+
{filteredTickets.length === 0 ? (
@@ -60,6 +48,7 @@ export const ProjectList: FC = ({ projects }) => {
key={t.id}
title={t.title}
remainingDays={t.endingDate}
+ link={`/projects/${t.id}`}
validateTicket={async (e: MouseEvent) => {
e.preventDefault();
await put>(
@@ -67,7 +56,6 @@ export const ProjectList: FC = ({ projects }) => {
{}
);
}}
- // archiveTicket={archiveTicket}
/>
))
)}
diff --git a/client/src/components/TicketList.tsx b/client/src/components/TicketList.tsx
index 677af17..a2a5ad0 100644
--- a/client/src/components/TicketList.tsx
+++ b/client/src/components/TicketList.tsx
@@ -12,9 +12,14 @@ import { Project } from "../types/Project";
type TicketListProps = {
tickets: Ticket[];
allProjects: Project[];
+ addButton?: Boolean;
};
-export const TicketList: FC = ({ tickets, allProjects }) => {
+export const TicketList: FC = ({
+ tickets,
+ allProjects,
+ addButton = true
+}) => {
const [filterText, setFilterText] = useState("");
const clearFilterText: (e: MouseEvent) => void = (e: MouseEvent) => {
setFilterText("");
@@ -47,11 +52,13 @@ export const TicketList: FC = ({ tickets, allProjects }) => {
allProjects={allProjects}
/>
Tickets
-
+ {addButton && (
+
+ )}
= ({ tickets, tabNames, projects }) => {
-
+
>
diff --git a/client/src/controllers/ProjectController.tsx b/client/src/controllers/ProjectController.tsx
index 3d30d04..427bd8f 100644
--- a/client/src/controllers/ProjectController.tsx
+++ b/client/src/controllers/ProjectController.tsx
@@ -77,6 +77,7 @@ export const ProjectController: FC = () => {
if (hasError) {
return
;
}
+
const viewModel = new ProjectVM(project, allUsers, allProjects);
return isLoading ?
:
;
};
diff --git a/client/src/controllers/UserController.tsx b/client/src/controllers/UserController.tsx
index afc337b..4fa23c9 100644
--- a/client/src/controllers/UserController.tsx
+++ b/client/src/controllers/UserController.tsx
@@ -1,90 +1,126 @@
import React, { FC, useState, useEffect } from "react";
+import { useParams } from "react-router-dom";
import { UserPage } from "../pages/UserPage";
import { UserVM } from "../VM/UserVM";
import { User } from "../types/User";
-import { AppFile } from "../types/AppFile";
-import { Activity } from "../types/Activity";
-import { Ticket } from "../types/Ticket";
+import { HttpResponse } from "../types/HttpResponse";
import { Preloader } from "../components/Preloader";
+import { get } from "../utils/http";
+import { Constants } from "../utils/Constants";
+import { ErrorController } from "./ErrorController";
+// import { AppFile } from "../types/AppFile";
+// import { Activity } from "../types/Activity";
+// import { Ticket } from "../types/Ticket";
export const UserController: FC = () => {
const [isLoading, setIsLoading] = useState(true);
+ const [user, setUser] = useState
({} as User);
+ const [hasError, setHasError] = useState(false);
+ const [error, setError] = useState("");
+ const { id } = useParams();
- const user: User = {
- id: "resldsm,dgd",
- firstName: "David",
- lastName: "Whittaker",
- fullName: "David Whittaker",
- presentation: "Interface designer and front-end developer",
- creationDate: new Date().toDateString(),
- email: "dw@mail.au",
- phone: "0998765432",
- picture: require("../images/user_1.jpg"),
- projects: [
- {
- id: 1,
- title: "Project Title",
- description: "What is it about",
- progression: 25,
- creationDate: new Date().toDateString(),
- endingDate: "2020-02-17 15:51:02.787373",
- status: "Todo",
- manager: {} as User,
- users: [] as User[],
- tickets: [] as Ticket[],
- files: [] as AppFile[],
- activities: [] as Activity[]
+ async function httpGetUser(id: string): Promise {
+ try {
+ const response: HttpResponse = await get(
+ `${Constants.usersURI}/${id}`
+ );
+ if (response.parsedBody !== undefined) {
+ setUser(response.parsedBody);
+ setIsLoading(false);
}
- ],
- tickets: [
- {
- id: 1,
- title: "Client objective meeting",
- description: "Client objective meeting",
- endingDate: "2020-02-17 15:51:02.787373",
- status: "Done",
- project: {
- id: 1,
- title: "Project Title",
- description: "What is it about",
- progression: 25,
- creationDate: new Date().toDateString(),
- endingDate: "2020-02-17 15:51:02.787373",
- status: "Todo",
- manager: {} as User,
- users: [] as User[],
- tickets: [] as Ticket[],
- files: [] as AppFile[],
- activities: [] as Activity[]
- }
- },
- {
- id: 2,
- title: "Assemble Outcomes Report for client",
- description: "Assemble Outcomes Report for client",
- endingDate: "2020-02-27 15:51:02.787373",
- status: "To Do",
- project: {
- id: 1,
- title: "Project Title",
- description: "What is it about",
- progression: 25,
- creationDate: new Date().toDateString(),
- endingDate: "2020-02-17 15:51:02.787373",
- status: "Todo",
- manager: {} as User,
- users: [] as User[],
- tickets: [] as Ticket[],
- files: [] as AppFile[],
- activities: [] as Activity[]
- }
- }
- ],
- activities: []
- };
+ } catch (ex) {
+ console.error(ex);
+ setHasError(true);
+ setError(ex);
+ }
+ }
+
+ // const user: User = {
+ // id: "resldsm,dgd",
+ // firstName: "Ti",
+ // lastName: "Nyny",
+ // fullName: "Nilka Netty Nemo",
+ // presentation: "Woman of my life ❤️❤️❤️",
+ // creationDate: new Date().toDateString(),
+ // email: "dw@mail.au",
+ // phone: "0998765432",
+ // picture: require("../images/user_1.jpg"),
+ // projects: [
+ // {
+ // id: 1,
+ // title: "OP Baby",
+ // description: "What is it about",
+ // progression: 25,
+ // creationDate: new Date().toDateString(),
+ // endingDate: "2020-02-17 15:51:02.787373",
+ // status: "Todo",
+ // manager: {} as User,
+ // users: [] as User[],
+ // tickets: [] as Ticket[],
+ // files: [] as AppFile[],
+ // activities: [] as Activity[]
+ // }
+ // ],
+ // tickets: [
+ // {
+ // id: 1,
+ // title: "Client objective meeting",
+ // description: "Client objective meeting",
+ // endingDate: "2020-02-17 15:51:02.787373",
+ // status: "Done",
+ // project: {
+ // id: 1,
+ // title: "Project Title",
+ // description: "What is it about",
+ // progression: 25,
+ // creationDate: new Date().toDateString(),
+ // endingDate: "2020-02-17 15:51:02.787373",
+ // status: "Todo",
+ // manager: {} as User,
+ // users: [] as User[],
+ // tickets: [] as Ticket[],
+ // files: [] as AppFile[],
+ // activities: [] as Activity[]
+ // }
+ // },
+ // {
+ // id: 2,
+ // title: "Assemble Outcomes Report for client",
+ // description: "Assemble Outcomes Report for client",
+ // endingDate: "2020-02-27 15:51:02.787373",
+ // status: "To Do",
+ // project: {
+ // id: 1,
+ // title: "Project Title",
+ // description: "What is it about",
+ // progression: 25,
+ // creationDate: new Date().toDateString(),
+ // endingDate: "2020-02-17 15:51:02.787373",
+ // status: "Todo",
+ // manager: {} as User,
+ // users: [] as User[],
+ // tickets: [] as Ticket[],
+ // files: [] as AppFile[],
+ // activities: [] as Activity[]
+ // }
+ // }
+ // ],
+ // activities: []
+ // };
+
useEffect(() => {
- setTimeout(() => setIsLoading(false), 1000);
- });
+ if (id !== undefined) {
+ httpGetUser(id);
+ } else {
+ setHasError(true);
+ setError("Bad Request");
+ }
+ }, [id]);
+
+ if (hasError) {
+ return ;
+ }
+
const viewModel = new UserVM(user);
return isLoading ? : ;
};
diff --git a/client/src/utils/http.ts b/client/src/utils/http.ts
index d8f02fc..e73965e 100644
--- a/client/src/utils/http.ts
+++ b/client/src/utils/http.ts
@@ -58,5 +58,5 @@ const headers: Headers = new Headers({
Accept: "application/json",
"Content-Type": "application/json",
Authorization:
- "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UWkNSRFEzUkRnd1FUQXlNRFExTmtOQ09UQXlSamhGTURaRU1Ea3pNRGxHUkRrelFqZENSZyJ9.eyJpc3MiOiJodHRwczovL2Rldi1meWpydm9oeC5hdXRoMC5jb20vIiwic3ViIjoiR3dlZTlGUnN3ejNWNE5vZFVRTjJIcjJyQjJTMDI1UmZAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vbG9jYWxob3N0OjUwMDEvYXBpL1YxLyIsImlhdCI6MTU4MzI0ODU1NSwiZXhwIjoxNTgzMzM0OTU1LCJhenAiOiJHd2VlOUZSc3d6M1Y0Tm9kVVFOMkhyMnJCMlMwMjVSZiIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.lfgZAwqq3VHNAM1Y33Vj7Jtal6IdN92qWJHwu5T8l-56kBXNC2g1pm6TshRhYDKmedoJmSddjKXClA9eLu1Ve1X8wLj7CbrhZtGNsOcIEStF9icahCy8y2OdP2U6UXJJt9HehwqvwT3JltH_MqyYeJsyMsah3a3rlu6LoEAHNqF4jk8RUxZKjlVJz_iW-tbJ_GoGYrTp_bgvw6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