some changes to fix customer search

main
abujamol jamilov 2 months ago
parent a6fd4e318a
commit 25154f52af

Binary file not shown.

@ -116,10 +116,19 @@ export const taskController = {
}, },
async addTaskController(obj: TTasksPostParams) { async addTaskController(obj: TTasksPostParams) {
const { data } = await instance.post<TTask>("task/", obj).then((u) => { try {
return u; const { data, status } = await instance.post<TTask | TMessageResponse>(
}); "task/",
obj
);
if (status === 201) {
const datas = data as TMessageResponse;
message.success({ content: datas.message });
}
return data; return data;
} catch (error) {
message.error({ content: "something went wrong" });
}
}, },
async addTaskFile(formData: TTaskPostFileParams) { async addTaskFile(formData: TTaskPostFileParams) {

@ -97,7 +97,7 @@ const AddTask = ({
setCustomerData(data.data); setCustomerData(data.data);
}); });
} }
}, [companyId]); }, [companyId, customerName]);
// service select // service select
const serviceOptions = ServiceData?.data?.map((item) => ({ const serviceOptions = ServiceData?.data?.map((item) => ({

@ -46,9 +46,7 @@ const TaskTable = ({
const value = { const value = {
status: "Checking", status: "Checking",
}; };
taskController taskController.taskPatch(value, record?.id).then((response: any) => {
.taskPatch(value, record?.id)
.then((response: { data: TTask; status: number }) => {
if (response?.status == 403) { if (response?.status == 403) {
showErrorModal(response); showErrorModal(response);
} }
@ -228,6 +226,7 @@ const TaskTable = ({
title: "Service", title: "Service",
dataIndex: "service", dataIndex: "service",
width: isMobile ? "5%" : "7%", width: isMobile ? "5%" : "7%",
align: "center",
key: "5", key: "5",
ellipsis: { ellipsis: {
showTitle: false, showTitle: false,
@ -246,6 +245,7 @@ const TaskTable = ({
title: "Status", title: "Status",
dataIndex: "status", dataIndex: "status",
width: isMobile ? "5%" : "8%", width: isMobile ? "5%" : "8%",
align: "center",
key: "6", key: "6",
ellipsis: { ellipsis: {
showTitle: false, showTitle: false,
@ -400,20 +400,27 @@ const TaskTable = ({
return columns; return columns;
}, [role]); }, [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 ( return (
<div> <div>
<Table <Table
onRow={(record: any) => ({ onRow={(record: any) => ({
onClick: (event) => handleRowClick(record, event), onClick: (event) => handleRowClick(record, event),
})} })}
dataSource={data?.characters?.map((u, i) => ({ dataSource={dataSource}
...u,
no: i + 1,
created: moment(u?.created_at, "YYYY-MM-DD HH:mm:ss").format(
"DD.MM.YYYY HH:mm"
),
key: u?.id,
}))}
size="small" size="small"
columns={columns as any} columns={columns as any}
pagination={false} pagination={false}

Loading…
Cancel
Save