diff --git a/build.zip b/build.zip index 68dad35..abd27ea 100644 Binary files a/build.zip and b/build.zip differ diff --git a/src/API/LayoutApi/tasks.ts b/src/API/LayoutApi/tasks.ts index 6894236..d5f023c 100644 --- a/src/API/LayoutApi/tasks.ts +++ b/src/API/LayoutApi/tasks.ts @@ -116,10 +116,19 @@ export const taskController = { }, async addTaskController(obj: TTasksPostParams) { - const { data } = await instance.post("task/", obj).then((u) => { - return u; - }); - return data; + try { + const { data, status } = await instance.post( + "task/", + obj + ); + if (status === 201) { + const datas = data as TMessageResponse; + message.success({ content: datas.message }); + } + return data; + } catch (error) { + message.error({ content: "something went wrong" }); + } }, async addTaskFile(formData: TTaskPostFileParams) { diff --git a/src/Components/Tasks/AddTask.tsx b/src/Components/Tasks/AddTask.tsx index 965b8ae..5fa254b 100644 --- a/src/Components/Tasks/AddTask.tsx +++ b/src/Components/Tasks/AddTask.tsx @@ -97,7 +97,7 @@ const AddTask = ({ setCustomerData(data.data); }); } - }, [companyId]); + }, [companyId, customerName]); // service select const serviceOptions = ServiceData?.data?.map((item) => ({ diff --git a/src/Components/Tasks/TaskTable.tsx b/src/Components/Tasks/TaskTable.tsx index 8e84bcb..d83fc07 100644 --- a/src/Components/Tasks/TaskTable.tsx +++ b/src/Components/Tasks/TaskTable.tsx @@ -46,13 +46,11 @@ const TaskTable = ({ const value = { status: "Checking", }; - taskController - .taskPatch(value, record?.id) - .then((response: { data: TTask; status: number }) => { - if (response?.status == 403) { - showErrorModal(response); - } - }); + taskController.taskPatch(value, record?.id).then((response: any) => { + if (response?.status == 403) { + showErrorModal(response); + } + }); }, }); } @@ -228,6 +226,7 @@ const TaskTable = ({ title: "Service", dataIndex: "service", width: isMobile ? "5%" : "7%", + align: "center", key: "5", ellipsis: { showTitle: false, @@ -246,6 +245,7 @@ const TaskTable = ({ title: "Status", dataIndex: "status", width: isMobile ? "5%" : "8%", + align: "center", key: "6", ellipsis: { showTitle: false, @@ -400,20 +400,27 @@ const TaskTable = ({ return columns; }, [role]); + const dataSource = data?.characters?.map((u, i) => { + const createdMoment = moment(u?.created_at, "YYYY-MM-DD HH:mm:ss"); + const isToday = createdMoment.isSame(moment(), "day"); + + return { + ...u, + no: i + 1, + created: isToday + ? `Today at ${createdMoment.format("HH:mm")}` + : createdMoment.format("DD.MM.YYYY HH:mm"), + key: u?.id, + }; + }); + return (
({ onClick: (event) => handleRowClick(record, event), })} - dataSource={data?.characters?.map((u, i) => ({ - ...u, - no: i + 1, - created: moment(u?.created_at, "YYYY-MM-DD HH:mm:ss").format( - "DD.MM.YYYY HH:mm" - ), - key: u?.id, - }))} + dataSource={dataSource} size="small" columns={columns as any} pagination={false}