UI updates continued

This commit is contained in:
Darren Clarke 2022-12-14 13:24:50 +01:00
parent 2b9672fedf
commit 6a0cc58f60
No known key found for this signature in database
GPG key ID: E2483E6F82907488
24 changed files with 1209 additions and 306 deletions

54
pages/tickets/[...id].tsx Normal file
View file

@ -0,0 +1,54 @@
import Head from "next/head";
import { NextPage, GetServerSideProps, GetServerSidePropsContext } from "next";
import { Grid, Box } from "@mui/material";
import { Layout } from "components/Layout";
import { TicketDetail } from "components/TicketDetail";
import { TicketEdit } from "components/TicketEdit";
const Link: NextPage = ({ ticket, articles }: any) => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid container spacing={0} sx={{ height: "100vh" }} direction="row">
<Grid item sx={{ height: "100vh" }} xs={10}>
<TicketDetail ticket={ticket} articles={articles} />
</Grid>
<Grid item xs={2} sx={{ height: "100vh" }}>
<TicketEdit ticket={ticket} />
</Grid>
</Grid>
</Layout>
);
export const getServerSideProps: GetServerSideProps = async (
context: GetServerSidePropsContext
) => {
const {
params: { id },
} = context;
const baseURL = "https://help.cdr.link/api/v1";
const token = process.env.ZAMMAD_TOKEN;
const headers = { Authorization: `Token ${token}` };
const rawTicket = await fetch(`${baseURL}/tickets/${id}`, {
headers,
});
const ticket = await rawTicket.json();
const rawArticles = await fetch(
`${baseURL}/ticket_articles/by_ticket/${id}`,
{
headers,
}
);
const articles = await rawArticles.json();
console.log({ ticket, articles });
return {
props: {
ticket,
articles,
},
};
};
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/my_tickets" />
</Grid>
</Grid>
</Layout>
);
export default Link;

30
pages/tickets/pending.tsx Normal file
View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/my_pending_reached" />
</Grid>
</Grid>
</Layout>
);
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/all_unassigned" />
</Grid>
</Grid>
</Layout>
);
export default Link;

30
pages/tickets/urgent.tsx Normal file
View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/all_escalated" />
</Grid>
</Grid>
</Layout>
);
export default Link;