mirror of
https://github.com/rjNemo/ticket_manager
synced 2026-06-06 08:46: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)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
return BadRequest();
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ticket = new Ticket()
|
var ticket = new Ticket()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
### v1
|
### 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
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,7 @@ namespace TicketManager
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c =>
|
app.UseSwaggerUI(c =>
|
||||||
{
|
{
|
||||||
|
c.RoutePrefix = "api/v1";
|
||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Ticket Manager API v1");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Ticket Manager API v1");
|
||||||
c.DefaultModelsExpandDepth(-1);
|
c.DefaultModelsExpandDepth(-1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,36 @@
|
||||||
import React, { FC } from "react";
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="input-field">
|
<div className="input-field">
|
||||||
<i className="material-icons prefix">note_add</i>
|
<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>
|
<label htmlFor="title">Title</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -17,13 +39,25 @@ export const NewTicketForm: FC<IProps> = () => {
|
||||||
<textarea
|
<textarea
|
||||||
id="description"
|
id="description"
|
||||||
className="materialize-textarea validate"
|
className="materialize-textarea validate"
|
||||||
|
value={description}
|
||||||
|
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
|
||||||
|
setDescription(e.target.value)
|
||||||
|
}
|
||||||
></textarea>
|
></textarea>
|
||||||
<label htmlFor="description">Description</label>
|
<label htmlFor="description">Description</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="input-field">
|
<div className="input-field">
|
||||||
<i className="material-icons prefix">date_range</i>
|
<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>
|
<label htmlFor="Due Date">Due Date</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,11 @@ import { useParams } from "react-router-dom";
|
||||||
import { Modal } from "./Modal";
|
import { Modal } from "./Modal";
|
||||||
import { NewTicketTabRouter } from "./NewTicketTabRouter";
|
import { NewTicketTabRouter } from "./NewTicketTabRouter";
|
||||||
import { User } from "../types/User";
|
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 { Constants } from "../utils/Constants";
|
||||||
|
import { Project } from "../types/Project";
|
||||||
|
import { HttpResponse } from "../types/HttpResponse";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
show: boolean;
|
show: boolean;
|
||||||
|
|
@ -15,6 +18,9 @@ interface IProps {
|
||||||
export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
||||||
const [filterText, setFilterText] = useState<string>("");
|
const [filterText, setFilterText] = useState<string>("");
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
const [title, setTitle] = useState("");
|
||||||
|
const [description, setDescription] = useState("");
|
||||||
|
const [endingDate, setEndingDate] = useState("");
|
||||||
|
|
||||||
const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = (
|
const handleChange: (e: ChangeEvent<HTMLInputElement>) => void = (
|
||||||
e: ChangeEvent<HTMLInputElement>
|
e: ChangeEvent<HTMLInputElement>
|
||||||
|
|
@ -26,11 +32,20 @@ export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
||||||
e: FormEvent
|
e: FormEvent
|
||||||
) => {
|
) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await patch<User[]>(
|
let newTicket: Ticket = {
|
||||||
`${Constants.projectsURI}/${id}/members`,
|
title: title,
|
||||||
{}
|
description: description,
|
||||||
// members.map(m => m.id)
|
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();
|
handleClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,6 +72,12 @@ export const NewTicketModal: FC<IProps> = ({ show, handleClose, allUsers }) => {
|
||||||
<NewTicketTabRouter
|
<NewTicketTabRouter
|
||||||
tabNames={["Details", "Members"]}
|
tabNames={["Details", "Members"]}
|
||||||
users={allUsers}
|
users={allUsers}
|
||||||
|
title={title}
|
||||||
|
setTitle={setTitle}
|
||||||
|
description={description}
|
||||||
|
setDescription={setDescription}
|
||||||
|
endingDate={endingDate}
|
||||||
|
setEndingDate={setEndingDate}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,29 @@ import { TabRouterHeader } from "./TabRouterHeader";
|
||||||
import { NewTicketForm } from "./NewTicketForm";
|
import { NewTicketForm } from "./NewTicketForm";
|
||||||
import { MemberList } from "./MemberList";
|
import { MemberList } from "./MemberList";
|
||||||
import { User } from "../types/User";
|
import { User } from "../types/User";
|
||||||
|
import { Ticket } from "../types/Ticket";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
tabNames: string[];
|
tabNames: string[];
|
||||||
users: User[];
|
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();
|
const { url } = useRouteMatch();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -20,7 +36,14 @@ export const NewTicketTabRouter: FC<IProps> = ({ tabNames, users }) => {
|
||||||
<Redirect from={url} to={`${url}/details`} />
|
<Redirect from={url} to={`${url}/details`} />
|
||||||
|
|
||||||
<Route path={`${url}/details`}>
|
<Route path={`${url}/details`}>
|
||||||
<NewTicketForm />
|
<NewTicketForm
|
||||||
|
title={title}
|
||||||
|
setTitle={setTitle}
|
||||||
|
description={description}
|
||||||
|
setDescription={setDescription}
|
||||||
|
endingDate={endingDate}
|
||||||
|
setEndingDate={setEndingDate}
|
||||||
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route path={`${url}/members`}>
|
<Route path={`${url}/members`}>
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export const ProjectList: FC<IProps> = ({ projects }) => {
|
||||||
{filteredTickets.length === 0 ? (
|
{filteredTickets.length === 0 ? (
|
||||||
<HorizontalCard />
|
<HorizontalCard />
|
||||||
) : (
|
) : (
|
||||||
filteredTickets.map((t: Ticket) => (
|
filteredTickets.map((t: Project) => (
|
||||||
<HorizontalCard
|
<HorizontalCard
|
||||||
key={t.id}
|
key={t.id}
|
||||||
title={t.title}
|
title={t.title}
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,42 @@ export const UserController: FC = () => {
|
||||||
title: "Client objective meeting",
|
title: "Client objective meeting",
|
||||||
description: "Client objective meeting",
|
description: "Client objective meeting",
|
||||||
endingDate: "2020-02-17 15:51:02.787373",
|
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,
|
id: 2,
|
||||||
title: "Assemble Outcomes Report for client",
|
title: "Assemble Outcomes Report for client",
|
||||||
description: "Assemble Outcomes Report for client",
|
description: "Assemble Outcomes Report for client",
|
||||||
endingDate: "2020-02-27 15:51:02.787373",
|
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: []
|
activities: []
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
import { Project } from "./Project";
|
||||||
|
|
||||||
export interface Ticket {
|
export interface Ticket {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
status: string;
|
status: string;
|
||||||
endingDate: string;
|
endingDate: string;
|
||||||
|
project: Project;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue