Compare commits

...

4 Commits

@ -743,12 +743,6 @@
cursor: pointer; cursor: pointer;
} }
.ant-upload-wrapper .ant-upload-drag {
border: 0.5px solid rgba(215, 216, 224, 1);
padding: 25px 0;
color: #333333;
}
.card_stat { .card_stat {
/* font-weight: 500; */ /* font-weight: 500; */
/* font-size: 20px; */ /* font-size: 20px; */
@ -814,8 +808,8 @@
} }
.ant-upload-list-text { .ant-upload-list-text {
overflow: scroll; /* overflow: scroll; */
height: 50px; height: 0;
} }
.ant-modal-mask { .ant-modal-mask {

@ -304,7 +304,7 @@ const App: React.FC = () => {
useEffect(() => { useEffect(() => {
const handleResize = () => { const handleResize = () => {
if (window.innerWidth <= 768) { if (window.innerWidth <= 1000) {
setCollapsed(true); setCollapsed(true);
} else { } else {
setCollapsed(false); setCollapsed(false);

@ -15,9 +15,14 @@ import {
Radio, Radio,
RadioChangeEvent, RadioChangeEvent,
Select, Select,
theme,
} from "antd"; } from "antd";
import { companyController } from "../../API/LayoutApi/companies"; import { companyController } from "../../API/LayoutApi/companies";
import { DashboardOutlined } from "@ant-design/icons"; import {
DashboardOutlined,
LeftOutlined,
RightOutlined,
} from "@ant-design/icons";
import Notfound from "../../Utils/Notfound"; import Notfound from "../../Utils/Notfound";
import Table from "antd/es/table"; import Table from "antd/es/table";
import AddDriver from "./AddDriver"; import AddDriver from "./AddDriver";
@ -53,6 +58,8 @@ const CompanyEdit = () => {
const customerData = useCustomerByComanyData({ page, page_size: 10 }, id); const customerData = useCustomerByComanyData({ page, page_size: 10 }, id);
const { data, refetch, status } = useCompanyOne(id); const { data, refetch, status } = useCompanyOne(id);
const { token } = theme.useToken();
const showModal = () => { const showModal = () => {
setOpen(true); setOpen(true);
}; };
@ -346,17 +353,40 @@ const CompanyEdit = () => {
direction="vertical" direction="vertical"
> >
<Space <Space
style={{ width: "100%", justifyContent: "flex-end" }} style={{
justifyContent: "end",
position: "fixed",
bottom: 0,
left: 0,
width: "100%",
// backgroundColor: token.colorBgContainer,
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.4)",
padding: "10px 0",
zIndex: 1000,
}}
wrap wrap
> >
<Button <Button
type="primary"
icon={<StepBackwardOutlined />}
onClick={Previos} onClick={Previos}
disabled={customerData.data?.previous ? false : true} disabled={customerData.data?.previous ? false : true}
></Button> style={{
backgroundColor: token.colorBgContainer,
color: token.colorText,
border: "none",
}}
>
<LeftOutlined />
</Button>
<Input <Input
style={{ width: 50, textAlign: "right" }} disabled
style={{
width: 40,
textAlign: "center",
background: token.colorBgContainer,
border: "1px solid",
borderColor: token.colorText,
color: token.colorText,
}}
value={page} value={page}
onChange={(e) => { onChange={(e) => {
let num = e.target.value; let num = e.target.value;
@ -366,11 +396,16 @@ const CompanyEdit = () => {
}} }}
/> />
<Button <Button
type="primary"
icon={<StepForwardOutlined />}
onClick={Next} onClick={Next}
disabled={customerData.data?.next ? false : true} disabled={customerData.data?.next ? false : true}
></Button> style={{
backgroundColor: token.colorBgContainer,
color: token.colorText,
border: "none",
}}
>
<RightOutlined />
</Button>
</Space> </Space>
</Space> </Space>
{open && ( {open && (

@ -30,6 +30,7 @@ import tt from "../../assets/tticon.svg";
import addicon from "../../assets/addiconpng.png"; import addicon from "../../assets/addiconpng.png";
//ts-ignore //ts-ignore
import fileUpload from "../../assets/upload-file.png"; import fileUpload from "../../assets/upload-file.png";
import closeIcon from "../../assets/closeIcon.png";
import AddCustomer from "../Customers/AddCustomer"; import AddCustomer from "../Customers/AddCustomer";
import AddDriver from "../Companies/AddDriver"; import AddDriver from "../Companies/AddDriver";
@ -183,10 +184,27 @@ const AddTask = ({
<AddDriver id={companyId} open={driverOpen} setOpen={setDriverOpen} /> <AddDriver id={companyId} open={driverOpen} setOpen={setDriverOpen} />
<Modal <Modal
open={open} open={open}
width={720} width={600}
title="Add task" title={
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<span>Add Task</span>
<Button type="text" onClick={handleCancel}>
<img src={closeIcon} />
</Button>
</div>
}
okText="Create" okText="Create"
cancelText="Cancel" cancelText="Cancel"
centered={false}
bodyStyle={{
height: 685,
}}
onCancel={handleCancel} onCancel={handleCancel}
onOk={() => { onOk={() => {
form.validateFields().then(async (values) => { form.validateFields().then(async (values) => {
@ -277,10 +295,8 @@ const AddTask = ({
onClick={(e) => setDriverOpen(true)} onClick={(e) => setDriverOpen(true)}
type="primary" type="primary"
style={{ style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
marginTop: 5, marginTop: 5,
marginLeft: 3,
}} }}
disabled={!companyId} disabled={!companyId}
> >
@ -290,7 +306,17 @@ const AddTask = ({
</div> </div>
</Col> </Col>
<Col span={12}> <Col span={24}>
<FormAnt.Item
label="Service"
name="service_id"
rules={[{ required: true, message: "Please select service!" }]}
>
<Select options={serviceOptions?.sort(sortByLabel)} />
</FormAnt.Item>
</Col>
<Col span={24}>
<FormAnt.Item <FormAnt.Item
label="Assigned to" label="Assigned to"
name="assigned_to_id" name="assigned_to_id"
@ -315,16 +341,6 @@ const AddTask = ({
</Col> </Col>
<Col span={12}> <Col span={12}>
<FormAnt.Item
label="Service"
name="service_id"
rules={[{ required: true, message: "Please select service!" }]}
>
<Select options={serviceOptions?.sort(sortByLabel)} />
</FormAnt.Item>
</Col>
<Col span={isMobile ? 12 : 12}>
<FormAnt.Item <FormAnt.Item
label="Status" label="Status"
name="status" name="status"
@ -343,7 +359,7 @@ const AddTask = ({
</FormAnt.Item> </FormAnt.Item>
</Col> </Col>
<Col span={isMobile ? 12 : 12}> <Col span={12}>
<FormAnt.Item <FormAnt.Item
label="PTI" label="PTI"
name="pti" name="pti"
@ -365,7 +381,7 @@ const AddTask = ({
> >
<TextArea <TextArea
style={{ padding: "7px 11px" }} style={{ padding: "7px 11px" }}
placeholder="note" placeholder="Note"
autoSize={{ minRows: isMobile ? 1 : 2, maxRows: 1 }} autoSize={{ minRows: isMobile ? 1 : 2, maxRows: 1 }}
onChange={changeText} onChange={changeText}
value={text} value={text}
@ -395,19 +411,18 @@ const AddTask = ({
/> />
</div> </div>
)} )}
<br />
</FormAnt.Item> </FormAnt.Item>
</Col> </Col>
</Row> </Row>
</FormAnt> </FormAnt>
<FormAnt> <FormAnt>
<Row gutter={[16, 16]}> <Row gutter={[16, 0]}>
<Col span={isMobile ? 6 : 24}> <Col span={isMobile ? 6 : 24}>
<FormAnt.Item name="attachment"> <FormAnt.Item name="attachment">
<div> <div>
<Upload.Dragger <Upload.Dragger
name="file" name="file"
height={174} height={100}
multiple={true} multiple={true}
customRequest={({ file, onSuccess }: any) => { customRequest={({ file, onSuccess }: any) => {
const formData = new FormData(); const formData = new FormData();
@ -425,7 +440,10 @@ const AddTask = ({
}} }}
> >
{!isMobile ? ( {!isMobile ? (
<p className={`ant-upload-drag-icon`}> <p
className={`ant-upload-drag-icon`}
style={{ margin: 0 }}
>
<img src={fileUpload} /> <img src={fileUpload} />
</p> </p>
) : ( ) : (
@ -441,9 +459,8 @@ const AddTask = ({
Click to select Click to select
</span> </span>
<br /> <br />
<span style={{ fontSize: 13 }}> <span style={{ fontSize: 12 }}>
Maximum file size is 10 MB <br /> Maximum file size is 10 MB
(only .jpeg .jpg .png .pdf)
</span> </span>
</p> </p>
)} )}

@ -1,13 +1,5 @@
import { TTask } from "../../types/Tasks/TTasks"; import { TTask } from "../../types/Tasks/TTasks";
import { import { Dropdown, MenuProps, Modal, Table, Tabs, Tooltip, theme } from "antd";
Dropdown,
MenuProps,
Modal,
Table,
Tabs,
Tooltip,
message,
} from "antd";
import TabPane from "antd/es/tabs/TabPane"; import TabPane from "antd/es/tabs/TabPane";
import { role, timeZone } from "../../App"; import { role, timeZone } from "../../App";
import { useTaskHistory } from "../../Hooks/Tasks"; import { useTaskHistory } from "../../Hooks/Tasks";
@ -16,7 +8,11 @@ import { useEffect, useState } from "react";
import { taskController } from "../../API/LayoutApi/tasks"; import { taskController } from "../../API/LayoutApi/tasks";
import { useTeamData } from "../../Hooks/Teams"; import { useTeamData } from "../../Hooks/Teams";
import { TTeam } from "../../types/Team/TTeam"; import { TTeam } from "../../types/Team/TTeam";
import { EditOutlined } from "@ant-design/icons"; import {
ArrowRightOutlined,
CaretRightOutlined,
EditOutlined,
} from "@ant-design/icons";
import { TSocket } from "../../types/common/TSocket"; import { TSocket } from "../../types/common/TSocket";
// @ts-ignore // @ts-ignore
import closeIcon from "../../assets/closeIcon.png"; import closeIcon from "../../assets/closeIcon.png";
@ -71,13 +67,15 @@ const TaskModal = ({
socketData: TSocket | undefined; socketData: TSocket | undefined;
}) => { }) => {
const moment = require("moment-timezone"); const moment = require("moment-timezone");
const theme = localStorage.getItem("theme") === "true" ? true : false; const themes = localStorage.getItem("theme") === "true" ? true : false;
const [text, setText] = useState<string | undefined>(recordTask?.note); const [text, setText] = useState<string | undefined>(recordTask?.note);
const [pti, setPti] = useState<boolean | undefined>(recordTask?.pti); const [pti, setPti] = useState<boolean | undefined>(recordTask?.pti);
const [status, setStatus] = useState(recordTask?.status); const [status, setStatus] = useState(recordTask?.status);
const [teamName, setTeamName] = useState(recordTask?.assigned_to?.name); const [teamName, setTeamName] = useState(recordTask?.assigned_to?.name);
const { data, isLoading } = useTaskHistory(recordTask?.id); const { data, isLoading } = useTaskHistory(recordTask?.id);
const { token } = theme.useToken();
const handleCancel = () => { const handleCancel = () => {
setModalOpen(!modalOpen); setModalOpen(!modalOpen);
}; };
@ -211,13 +209,13 @@ const TaskModal = ({
onCancel={handleCancel} onCancel={handleCancel}
footer={null} footer={null}
open={modalOpen} open={modalOpen}
width={800} width={700}
maskClosable={true} maskClosable={true}
// style={{ position: "fixed", right: 0, top: 0, bottom: 0, height: 1000 }} // style={{ position: "fixed", right: 0, top: 0, bottom: 0, height: 1000 }}
> >
<div className={!theme ? "TaskModal-header" : "TaskModal-header-dark"}> <div className={!themes ? "TaskModal-header" : "TaskModal-header-dark"}>
<div className={!theme ? "TaskModal-title" : "TaskModal-title-dark"}> <div className={!themes ? "TaskModal-title" : "TaskModal-title-dark"}>
<p className={!theme ? "p-driver" : "p-driver-dark"}> <p className={!themes ? "p-driver" : "p-driver-dark"}>
{recordTask?.customer?.name} {recordTask?.customer?.name}
</p> </p>
<Dropdown <Dropdown
@ -227,7 +225,11 @@ const TaskModal = ({
disabled={role === "Checker" && status === "Done"} disabled={role === "Checker" && status === "Done"}
> >
<button <button
style={{ marginLeft: 12, display: "flex", alignItems: "center" }} style={{
marginLeft: 12,
display: "flex",
alignItems: "center",
}}
className={`status-${status}`} className={`status-${status}`}
> >
{status} {status}
@ -247,16 +249,24 @@ const TaskModal = ({
> >
<button <button
disabled={recordTask?.status !== "New"} disabled={recordTask?.status !== "New"}
style={{ marginRight: 12 }} style={{
className={`btn-modal-action-${theme && "dark"}`} marginRight: 12,
color: token.colorText,
backgroundColor: token.colorBgContainer,
}}
className={`btn-modal-action-${themes && "dark"}`}
> >
<img src={forwardIcon} alt="" /> <img src={forwardIcon} alt="" />
Forward Forward
</button> </button>
</Dropdown> </Dropdown>
<button <button
style={{ marginLeft: 12 }} style={{
className={`btn-modal-action-${theme && "dark"}`} marginLeft: 12,
color: token.colorText,
backgroundColor: token.colorBgContainer,
}}
className={`btn-modal-action-${themes && "dark"}`}
onClick={showUploadModal} onClick={showUploadModal}
> >
<img src={uploadIcon} alt="" /> <img src={uploadIcon} alt="" />
@ -264,8 +274,12 @@ const TaskModal = ({
</button> </button>
<button <button
onClick={handleCancel} onClick={handleCancel}
style={{ marginLeft: 20 }} style={{
className={`btn-modal-action-${theme && "dark"}`} marginLeft: 20,
color: token.colorText,
backgroundColor: token.colorBgContainer,
}}
className={`btn-modal-action-${themes && "dark"}`}
> >
<img style={{ margin: 2 }} src={closeIcon} alt="" /> <img style={{ margin: 2 }} src={closeIcon} alt="" />
</button> </button>
@ -301,36 +315,36 @@ const TaskModal = ({
</p> </p>
<div className="info-body"> <div className="info-body">
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Comapany</p> <p className={!themes ? "sub" : "sub-dark"}>Comapany</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{recordTask?.company?.name} {recordTask?.company?.name}
</p> </p>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Driver</p> <p className={!themes ? "sub" : "sub-dark"}>Driver</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{recordTask?.customer?.name} {recordTask?.customer?.name}
</p> </p>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Service</p> <p className={!themes ? "sub" : "sub-dark"}>Service</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{recordTask?.service?.title} {recordTask?.service?.title}
</p> </p>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Team</p> <p className={!themes ? "sub" : "sub-dark"}>Team</p>
<p className={!theme ? "info" : "info-dark"}>{teamName}</p> <p className={!themes ? "info" : "info-dark"}>{teamName}</p>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Assignee</p> <p className={!themes ? "sub" : "sub-dark"}>Assignee</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{recordTask?.in_charge?.username} {recordTask?.in_charge?.username}
</p> </p>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>PTI</p> <p className={!themes ? "sub" : "sub-dark"}>PTI</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{pti === false ? "Do" : "No need"} {pti === false ? "Do" : "No need"}
</p> </p>
<button <button
@ -348,8 +362,8 @@ const TaskModal = ({
</button> </button>
</tr> </tr>
<tr> <tr>
<p className={!theme ? "sub" : "sub-dark"}>Created at</p> <p className={!themes ? "sub" : "sub-dark"}>Created at</p>
<p className={!theme ? "info" : "info-dark"}> <p className={!themes ? "info" : "info-dark"}>
{moment( {moment(
recordTask?.created_at, recordTask?.created_at,
"YYYY-MM-DD HH:mm:ss" "YYYY-MM-DD HH:mm:ss"
@ -358,7 +372,7 @@ const TaskModal = ({
</tr> </tr>
</div> </div>
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<label className={!theme ? "sub" : "sub-dark"}>Note:</label> <label className={!themes ? "sub" : "sub-dark"}>Note:</label>
<TextArea <TextArea
style={{ padding: "7px 11px", marginTop: 10 }} style={{ padding: "7px 11px", marginTop: 10 }}
placeholder="Description" placeholder="Description"
@ -368,8 +382,12 @@ const TaskModal = ({
/> />
</div> </div>
<button <button
style={{ marginTop: 20 }} style={{
className={`btn-modal-action-${theme && "dark"}`} marginTop: 20,
color: token.colorText,
backgroundColor: token.colorBgContainer,
}}
className={`btn-modal-action-${themes && "dark"}`}
onClick={(e) => patchTask()} onClick={(e) => patchTask()}
> >
<img src={editIcon} alt="" /> <img src={editIcon} alt="" />
@ -495,7 +513,7 @@ const TaskModal = ({
alignItems: "center", alignItems: "center",
justifyContent: "space-between", justifyContent: "space-between",
borderRadius: 8, borderRadius: 8,
color: !theme ? "rgba(15, 17, 28, 1)" : "#bbb", color: !themes ? "rgba(15, 17, 28, 1)" : "#bbb",
border: "1px solid rgba(215, 216, 224, 1)", border: "1px solid rgba(215, 216, 224, 1)",
boxShadow: "0px 1px 3px 0px rgba(20, 22, 41, 0.1)", boxShadow: "0px 1px 3px 0px rgba(20, 22, 41, 0.1)",
}} }}

@ -327,22 +327,38 @@ const TaskTable = ({
{ {
title: "Created at", title: "Created at",
dataIndex: "created", dataIndex: "created",
width: "12%", width: "15%",
key: "10", key: "10",
responsive: ["xxl"], // responsive: ["xxl"],
ellipsis: { ellipsis: {
showTitle: false, showTitle: false,
}, },
render: (note: string) => ( render: (note: string, record: TTask) => (
<Tooltip placement="topLeft" title={note}> <div
{note} style={{
</Tooltip> display: "flex",
alignItems: "center",
justifyContent: "start",
gap: 5,
}}
>
<Tooltip placement="topLeft" title={note}>
{note}
</Tooltip>
<div>
{record?.via_telegram && (
<Tooltip placement="topLeft" title={"Created via Telegram"}>
<img src={tgIcon} alt="" style={{ width: 20, height: 20 }} />
</Tooltip>
)}
</div>
</div>
), ),
}, },
{ {
title: "Actions", title: "Actions",
dataIndex: "action", dataIndex: "action",
width: isMobile ? "3%" : "10%", width: "10%",
key: "11", key: "11",
fixed: isMobile ? "right" : false, fixed: isMobile ? "right" : false,
render: (text: string, record: TTask) => { render: (text: string, record: TTask) => {
@ -429,7 +445,7 @@ const TaskTable = ({
columns={columns as any} columns={columns as any}
loading={isLoading} loading={isLoading}
rowClassName={rowClassName} rowClassName={rowClassName}
scroll={{ x: "768px" }} scroll={{ x: "800px" }}
bordered bordered
// pagination={{ // pagination={{
// pageSize: 10, // pageSize: 10,

Loading…
Cancel
Save