Update deps, ticket edit updates
This commit is contained in:
parent
aa453954ed
commit
2d892779bf
19 changed files with 1753 additions and 7776 deletions
|
|
@ -42,31 +42,31 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
|
|||
useEffect(() => {
|
||||
const fetchAgents = async () => {
|
||||
const result = await getAgentsAction();
|
||||
console.log({ result });
|
||||
console.log({ agents: result });
|
||||
setAgents(result);
|
||||
};
|
||||
|
||||
const fetchGroups = async () => {
|
||||
const result = await getGroupsAction();
|
||||
console.log({ result });
|
||||
console.log({ groups: result });
|
||||
setGroups(result);
|
||||
};
|
||||
|
||||
const fetchTicketStates = async () => {
|
||||
const result = await getTicketStatesAction();
|
||||
console.log({ result });
|
||||
console.log({ ticketStates: result });
|
||||
setTicketStates(result);
|
||||
};
|
||||
|
||||
const fetchTicketPriorities = async () => {
|
||||
const result = await getTicketPrioritiesAction();
|
||||
console.log({ result });
|
||||
console.log({ ticketPriorities: result });
|
||||
setTicketPriorities(result);
|
||||
};
|
||||
|
||||
const fetchTicketTags = async () => {
|
||||
const result = await getTicketTagsAction();
|
||||
console.log({ result });
|
||||
console.log({ tags: result });
|
||||
setTags(result);
|
||||
};
|
||||
|
||||
|
|
@ -127,10 +127,10 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
|
|||
errors: [],
|
||||
values: {
|
||||
customer: "",
|
||||
group: ticket.group.id?.split("/").pop(),
|
||||
owner: ticket.owner.id?.split("/").pop(),
|
||||
priority: ticket.priority.id?.split("/").pop(),
|
||||
state: ticket.state.id?.split("/").pop(),
|
||||
group: ticket?.group?.id?.split("/").pop(),
|
||||
owner: ticket?.owner?.id?.split("/").pop(),
|
||||
priority: ticket?.priority?.id?.split("/").pop(),
|
||||
state: ticket?.state?.id?.split("/").pop(),
|
||||
tags: [],
|
||||
title: "",
|
||||
article: {
|
||||
|
|
@ -157,21 +157,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
|
|||
name="group"
|
||||
label="Group"
|
||||
formState={formState}
|
||||
getOptions={() =>
|
||||
groups?.map((group: any) => ({
|
||||
value: group.id,
|
||||
label: group.name,
|
||||
})) ?? []
|
||||
}
|
||||
/*
|
||||
onChange={(e: any) => {
|
||||
const newGroup = e.target.value;
|
||||
setSelectedGroup(newGroup);
|
||||
updateTicket({
|
||||
groupId: `gid://zammad/Group/${newGroup}`,
|
||||
});
|
||||
}}
|
||||
*/
|
||||
getOptions={() => groups}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item>
|
||||
|
|
@ -180,19 +166,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
|
|||
name="owner"
|
||||
label="Owner"
|
||||
formState={formState}
|
||||
getOptions={() =>
|
||||
agents?.map((user: any) => ({
|
||||
value: user.id,
|
||||
label: `${user.firstname} ${user.lastname}`,
|
||||
})) ?? []
|
||||
}
|
||||
/*
|
||||
onChange={(e: any) => {
|
||||
const newOwner = e.target.value;
|
||||
setSelectedOwner(newOwner);
|
||||
updateTicket({ ownerId: `gid://zammad/User/${newOwner}` });
|
||||
}}
|
||||
*/
|
||||
getOptions={() => agents}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
|
|
@ -249,12 +223,7 @@ export const TicketEdit: FC<TicketEditProps> = ({ id }) => {
|
|||
name="priority"
|
||||
label="Priority"
|
||||
formState={formState}
|
||||
getOptions={() =>
|
||||
ticketPriorities?.map((priority: any) => ({
|
||||
value: priority.id,
|
||||
label: priority.name,
|
||||
})) ?? []
|
||||
}
|
||||
getOptions={() => ticketPriorities}
|
||||
/*
|
||||
onChange={(e: any) => {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use server";
|
||||
|
||||
import { executeGraphQL } from "app/_lib/zammad";
|
||||
import { executeGraphQL, executeREST } from "app/_lib/zammad";
|
||||
import { getTicketOverviewCountsQuery } from "app/_graphql/getTicketOverviewCountsQuery";
|
||||
import { getTicketsByOverviewQuery } from "app/_graphql/getTicketsByOverviewQuery";
|
||||
|
||||
|
|
@ -22,17 +22,12 @@ export const getOverviewTicketsAction = async (name: string) => {
|
|||
let error = null;
|
||||
|
||||
if (name === "Recent") {
|
||||
const response = await fetch(
|
||||
`${process.env.ZAMMAD_URL}/api/v1/recent_view`,
|
||||
);
|
||||
const recent = await response.json();
|
||||
console.log({ recent });
|
||||
const recent = await executeREST({ path: "/api/v1/recent_view" });
|
||||
|
||||
for (const rec of recent) {
|
||||
const res = await fetch(
|
||||
`${process.env.ZAMMAD_URL}/api/v1/tickets/${rec.o_id}`,
|
||||
);
|
||||
const tkt = await res.json();
|
||||
const tkt = await executeREST({
|
||||
path: `/api/v1/tickets/${rec.o_id}`,
|
||||
});
|
||||
tickets.push({
|
||||
...tkt,
|
||||
internalId: tkt.id,
|
||||
|
|
|
|||
|
|
@ -170,7 +170,13 @@ export const getTicketTagsAction = async () => {
|
|||
path: "/api/v1/tags",
|
||||
});
|
||||
|
||||
return states;
|
||||
const formattedStates =
|
||||
states?.map((state: any) => ({
|
||||
value: state.id,
|
||||
label: state.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedStates;
|
||||
};
|
||||
|
||||
export const getTicketPrioritiesAction = async () => {
|
||||
|
|
@ -178,5 +184,11 @@ export const getTicketPrioritiesAction = async () => {
|
|||
path: "/api/v1/ticket_priorities",
|
||||
});
|
||||
|
||||
return priorities;
|
||||
const formattedPriorities =
|
||||
priorities?.map((priority: any) => ({
|
||||
value: priority.id,
|
||||
label: priority.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedPriorities;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export const getAgentsAction = async () => {
|
|||
const agents = users?.filter((user: any) => user.role_ids.includes(2)) ?? [];
|
||||
const formattedAgents = agents
|
||||
.map((agent: any) => ({
|
||||
label: agent.login,
|
||||
label: `${agent.firstname} ${agent.lastname}`,
|
||||
value: `gid://zammad/User/${agent.id}`,
|
||||
}))
|
||||
.sort((a: any, b: any) => a.label.localeCompare(b.label));
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ export default withAuth(checkRewrites, {
|
|||
},
|
||||
callbacks: {
|
||||
authorized: ({ token, req }) => {
|
||||
console.log({ p: req.nextUrl.pathname });
|
||||
if (req.nextUrl.pathname.startsWith("/api/v1/")) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@
|
|||
"dependencies": {
|
||||
"@chatscope/chat-ui-kit-react": "^2.0.3",
|
||||
"@chatscope/chat-ui-kit-styles": "^1.4.0",
|
||||
"@emotion/cache": "^11.11.0",
|
||||
"@emotion/react": "^11.11.4",
|
||||
"@emotion/cache": "^11.13.1",
|
||||
"@emotion/react": "^11.13.0",
|
||||
"@emotion/server": "^11.11.0",
|
||||
"@emotion/styled": "^11.11.5",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
"@mui/icons-material": "^5",
|
||||
"@mui/lab": "^5.0.0-alpha.172",
|
||||
"@mui/lab": "^5.0.0-alpha.173",
|
||||
"@mui/material": "^5",
|
||||
"@mui/x-data-grid-pro": "^7.10.0",
|
||||
"@mui/x-date-pickers-pro": "^7.10.0",
|
||||
"@mui/x-data-grid-pro": "^7.12.0",
|
||||
"@mui/x-date-pickers-pro": "^7.12.0",
|
||||
"@link-stack/bridge-common": "*",
|
||||
"@link-stack/bridge-ui": "*",
|
||||
"date-fns": "^3.6.0",
|
||||
|
|
@ -33,19 +33,19 @@
|
|||
"next-auth": "^4.24.7",
|
||||
"@link-stack/opensearch-common": "*",
|
||||
"react": "18.3.1",
|
||||
"react-cookie": "^7.1.4",
|
||||
"react-cookie": "^7.2.0",
|
||||
"react-dom": "18.3.1",
|
||||
"react-iframe": "^1.8.5",
|
||||
"react-polyglot": "^0.7.2",
|
||||
"sharp": "^0.33.4",
|
||||
"swr": "^2.2.5",
|
||||
"tss-react": "^4.9.10",
|
||||
"tss-react": "^4.9.12",
|
||||
"twilio-client": "^1.15.1",
|
||||
"@link-stack/ui": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.9",
|
||||
"@types/node": "^20.14.11",
|
||||
"@babel/core": "^7.25.2",
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
|
|
@ -54,8 +54,8 @@
|
|||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jsx-a11y": "^6.9.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-react": "^7.34.4",
|
||||
"typescript": "5.5.3"
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react": "^7.35.0",
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue