mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 00:36:39 +00:00
NewTicketSubmit in progress
This commit is contained in:
parent
369de39dc4
commit
299aa37bb1
9 changed files with 126 additions and 16 deletions
|
|
@ -92,7 +92,7 @@ namespace TicketManager.Controllers
|
|||
{
|
||||
if (!ModelState.IsValid)
|
||||
{
|
||||
return BadRequest();
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
|
||||
var ticket = new Ticket()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
### v1
|
||||
|
||||
- [Internal Link. Don't forget to update](https://localhost:5001/swagger)
|
||||
- [Internal Link. Don't forget to update](https://localhost:5001/api/v1/)
|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ namespace TicketManager
|
|||
app.UseSwagger();
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.RoutePrefix = "api/v1";
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Ticket Manager API v1");
|
||||
c.DefaultModelsExpandDepth(-1);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,14 +1,36 @@
|
|||
import React, { FC } from "react";
|
||||
|
||||
interface IProps {}
|
||||
interface IProps {
|
||||
title: string;
|
||||
setTitle: React.Dispatch<React.SetStateAction<string>>;
|
||||
description: string;
|
||||
setDescription: React.Dispatch<React.SetStateAction<string>>;
|
||||
endingDate: string;
|
||||
setEndingDate: React.Dispatch<React.SetStateAction<string>>;
|
||||
}
|
||||
|
||||
export const NewTicketForm: FC<IProps> = () => {
|
||||
export const NewTicketForm: FC<IProps> = ({
|
||||
title,
|
||||
setTitle,
|
||||
description,
|
||||
setDescription,
|
||||
endingDate,
|
||||
setEndingDate
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<div className="row">
|
||||
<div className="input-field">
|
||||
<i className="material-icons prefix">note_add</i>
|
||||
<input id="title" type="text" className="validate" />
|
||||
<input
|
||||
id="title"
|
||||
type="text"
|
||||
className="validate"
|
||||
value={title}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setTitle(e.target.value)
|
||||
}
|
||||
/>
|
||||
<label htmlFor="title">Title</label>
|
||||
</div>
|
||||
|
||||
|
|
@ -17,13 +39,25 @@ export const NewTicketForm: FC<IProps> = () => {
|
|||
<textarea
|
||||
id="description"
|
||||
className="materialize-textarea validate"
|
||||
value={description}
|
||||
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||
setDescription(e.target.value)
|
||||
}
|
||||
></textarea>
|
||||
<label htmlFor="description">Description</label>
|
||||
</div>
|
||||
|
||||
<div className="input-field">
|
||||
<i className="material-icons prefix">date_range</i>
|
||||
<input id="Due Date" type="text" className="datepicker" />
|
||||
<input
|
||||
id="Due Date"
|
||||
type="text"
|
||||
className="datepicker"
|
||||
value={endingDate}
|
||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
||||
setEndingDate(e.target.value)
|
||||
}
|
||||
/>
|
||||
<label htmlFor="Due Date">Due Date</label>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ import { useParams } from "react-router-dom";
|
|||
import { Modal } from "./Modal";
|
||||
import { NewTicketTabRouter } from "./NewTicketTabRouter";
|
||||
import { User } from "../types/User";
|
||||
import { patch } from "../utils/http";
|
||||
import { Ticket } from "../types/Ticket";
|
||||
import { patch, post } from "../utils/http";
|
||||
import { Constants } from "../utils/Constants";
|
||||
import { Project } from "../types/Project";
|
||||
import { HttpResponse } from "../types/HttpResponse";
|
||||
|
||||
interface IProps {
|
||||
show: boolean;
|
||||
|
|
@ -15,6 +18,9 @@ interface IProps {
|
|||
export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
||||
const [filterText, setFilterText] = useState<string>("");
|
||||
const { id } = useParams();
|
||||
const [title, setTitle] = useState("");
|
||||
const [description, setDescription] = useState("");
|
||||
const [endingDate, setEndingDate] = useState("");
|
||||
|
||||
const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = (
|
||||
e: ChangeEvent<HTMLInputElement>
|
||||
|
|
@ -26,11 +32,20 @@ export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
|||
e: FormEvent
|
||||
) => {
|
||||
e.preventDefault();
|
||||
await patch<User[]>(
|
||||
`${Constants.projectsURI}/${id}/members`,
|
||||
{}
|
||||
// members.map(m => m.id)
|
||||
let newTicket: Ticket = {
|
||||
title: title,
|
||||
description: description,
|
||||
endingDate: endingDate,
|
||||
id: 0,
|
||||
status: "",
|
||||
project: {} as Project
|
||||
};
|
||||
console.log(newTicket);
|
||||
const response: HttpResponse<Ticket> = await post<Ticket>(
|
||||
`${Constants.ticketsURI}`,
|
||||
newTicket
|
||||
);
|
||||
console.log(response.parsedBody);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
|
|
@ -57,6 +72,12 @@ export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
|||
<NewTicketTabRouter
|
||||
tabNames={["Details", "Members"]}
|
||||
users={allUsers}
|
||||
title={title}
|
||||
setTitle={setTitle}
|
||||
description={description}
|
||||
setDescription={setDescription}
|
||||
endingDate={endingDate}
|
||||
setEndingDate={setEndingDate}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,29 @@ import { TabRouterHeader } from "./TabRouterHeader";
|
|||
import { NewTicketForm } from "./NewTicketForm";
|
||||
import { MemberList } from "./MemberList";
|
||||
import { User } from "../types/User";
|
||||
import { Ticket } from "../types/Ticket";
|
||||
|
||||
interface IProps {
|
||||
tabNames: string[];
|
||||
users: User[];
|
||||
description: string;
|
||||
setDescription: React.Dispatch<React.SetStateAction<string>>;
|
||||
title: string;
|
||||
setTitle: React.Dispatch<React.SetStateAction<string>>;
|
||||
endingDate: string;
|
||||
setEndingDate: React.Dispatch<React.SetStateAction<string>>;
|
||||
}
|
||||
|
||||
export const NewTicketTabRouter: FC<IProps> = ({ tabNames, users }) => {
|
||||
export const NewTicketTabRouter: FC<IProps> = ({
|
||||
tabNames,
|
||||
users,
|
||||
description,
|
||||
setDescription,
|
||||
title,
|
||||
setTitle,
|
||||
endingDate,
|
||||
setEndingDate
|
||||
}) => {
|
||||
const { url } = useRouteMatch();
|
||||
return (
|
||||
<>
|
||||
|
|
@ -20,7 +36,14 @@ export const NewTicketTabRouter: FC<IProps> = ({ tabNames, users }) => {
|
|||
<Redirect from={url} to={`${url}/details`} />
|
||||
|
||||
<Route path={`${url}/details`}>
|
||||
<NewTicketForm />
|
||||
<NewTicketForm
|
||||
title={title}
|
||||
setTitle={setTitle}
|
||||
description={description}
|
||||
setDescription={setDescription}
|
||||
endingDate={endingDate}
|
||||
setEndingDate={setEndingDate}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
<Route path={`${url}/members`}>
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ export const ProjectList: FC<IProps> = ({ projects }) => {
|
|||
{filteredTickets.length === 0 ? (
|
||||
<HorizontalCard />
|
||||
) : (
|
||||
filteredTickets.map((t: Ticket) => (
|
||||
filteredTickets.map((t: Project) => (
|
||||
<HorizontalCard
|
||||
key={t.id}
|
||||
title={t.title}
|
||||
|
|
|
|||
|
|
@ -42,14 +42,42 @@ export const UserController: FC = () => {
|
|||
title: "Client objective meeting",
|
||||
description: "Client objective meeting",
|
||||
endingDate: "2020-02-17 15:51:02.787373",
|
||||
status: "Done"
|
||||
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"
|
||||
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: []
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
import { Project } from "./Project";
|
||||
|
||||
export interface Ticket {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
status: string;
|
||||
endingDate: string;
|
||||
project: Project;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue