@@ -1,15 +1,17 @@
|
||||
import {Col, Form, Input, Row, Select, Switch} from "antd";
|
||||
import React, {useCallback} from "react";
|
||||
import React from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {FormDatePicker} from "../form-date-picker/form-date-picker.component.jsx";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors.js";
|
||||
import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors.js";
|
||||
import dayjs from '../../utils/day';
|
||||
|
||||
import {connect} from "react-redux";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component.jsx";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
@@ -23,6 +25,7 @@ export default connect(
|
||||
export function TaskUpsertModalComponent({
|
||||
form,
|
||||
bodyshop,
|
||||
currentUser,
|
||||
selectedJobId,
|
||||
setSelectedJobId,
|
||||
selectedJobDetails,
|
||||
@@ -32,14 +35,19 @@ export function TaskUpsertModalComponent({
|
||||
}) {
|
||||
const {t} = useTranslation();
|
||||
|
||||
console.dir(data)
|
||||
const datePickerPresets = [
|
||||
{label: t('tasks.date_presets.next_week'), value: dayjs().add(1, 'week')},
|
||||
{label: t('tasks.date_presets.two_weeks'), value: dayjs().add(2, 'weeks')},
|
||||
{label: t('tasks.date_presets.three_weeks'), value: dayjs().add(3, 'weeks')},
|
||||
{label: t('tasks.date_presets.one_month'), value: dayjs().add(1, 'month')},
|
||||
];
|
||||
|
||||
if (loading || error) return <LoadingSkeleton active/>;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={18}>
|
||||
<Col span={16}>
|
||||
<Form.Item
|
||||
label={t("tasks.fields.title")}
|
||||
name="title"
|
||||
@@ -49,7 +57,7 @@ export function TaskUpsertModalComponent({
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input placeholder={t("tasks.labels.titleplaceholder")}/>
|
||||
<Input placeholder={t("tasks.fields.title")}/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
@@ -60,14 +68,14 @@ export function TaskUpsertModalComponent({
|
||||
>
|
||||
<Select
|
||||
options={[
|
||||
{value: 3, label: t("tasks.fields.priority.low")},
|
||||
{value: 2, label: t("tasks.fields.priority.medium")},
|
||||
{value: 1, label: t("tasks.fields.priority.high")},
|
||||
{value: 3, label: t("tasks.fields.priorities.low")},
|
||||
{value: 2, label: t("tasks.fields.priorities.medium")},
|
||||
{value: 1, label: t("tasks.fields.priorities.high")},
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={2}>
|
||||
<Col span={4}>
|
||||
<Form.Item
|
||||
label={t("tasks.fields.completed")}
|
||||
name="completed"
|
||||
@@ -82,6 +90,7 @@ export function TaskUpsertModalComponent({
|
||||
<Form.Item
|
||||
label={t("tasks.fields.assigned_to")}
|
||||
name="assigned_to"
|
||||
initialValue={currentUser.email}
|
||||
>
|
||||
<Select placeholder={t("tasks.labels.selectemployee")}>
|
||||
{bodyshop.employees.map((employee) => (
|
||||
@@ -97,7 +106,7 @@ export function TaskUpsertModalComponent({
|
||||
label={t("tasks.fields.due_date")}
|
||||
name="due_date"
|
||||
>
|
||||
<FormDatePicker/>
|
||||
<FormDatePicker format="MM/DD/YYYY" presets={datePickerPresets}/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
@@ -105,7 +114,7 @@ export function TaskUpsertModalComponent({
|
||||
label={t("tasks.fields.remind_at")}
|
||||
name="remind_at"
|
||||
>
|
||||
<FormDatePicker/>
|
||||
<FormDatePicker format="MM/DD/YYYY" presets={datePickerPresets}/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -117,7 +126,7 @@ export function TaskUpsertModalComponent({
|
||||
>
|
||||
<Input.TextArea
|
||||
rows={8}
|
||||
placeholder={t("tasks.labels.descriptionplaceholder")}
|
||||
placeholder={t("tasks.fields.description")}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
@@ -126,16 +135,14 @@ export function TaskUpsertModalComponent({
|
||||
<Col span={24}>
|
||||
<Form.Item
|
||||
name="jobid"
|
||||
label="Job ID"
|
||||
|
||||
label={t("tasks.fields.jobid")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: 'Please select a Job ID',
|
||||
},
|
||||
},1
|
||||
]}
|
||||
>
|
||||
<Select placeholder="Select a Job ID" defaultValue={selectedJobId} onSelect={setSelectedJobId}>
|
||||
<Select placeholder={t('tasks.placeholders.jobid')} defaultValue={selectedJobId} onSelect={setSelectedJobId}>
|
||||
{data.jobs.map((job) => (
|
||||
<Select.Option key={job.id} value={job.id}>
|
||||
{job.ro_number}
|
||||
@@ -151,7 +158,7 @@ export function TaskUpsertModalComponent({
|
||||
label={t("tasks.fields.joblineid")}
|
||||
name="joblineid"
|
||||
>
|
||||
<Select placeholder={t("tasks.labels.joblineidplaceholder")} disabled={!selectedJobDetails}>
|
||||
<Select placeholder={t("tasks.placeholders.joblineid")} disabled={!selectedJobDetails}>
|
||||
{selectedJobDetails?.joblines?.map((jobline) => (
|
||||
<Select.Option key={jobline.id} value={jobline.id}>
|
||||
{jobline.line_desc}
|
||||
@@ -165,8 +172,12 @@ export function TaskUpsertModalComponent({
|
||||
label={t("tasks.fields.partsorderid")}
|
||||
name="partsorderid"
|
||||
>
|
||||
<Select placeholder={t("tasks.labels.partsorderidplaceholder")} disabled={!selectedJobDetails}>
|
||||
{/* Add your options here */}
|
||||
<Select placeholder={t("tasks.placeholders.partsorderid")} disabled={!selectedJobDetails}>
|
||||
{selectedJobDetails?.parts_orders?.map((partsOrder) => (
|
||||
<Select.Option key={partsOrder.id} value={partsOrder.id}>
|
||||
{partsOrder.order_number} - {partsOrder.vendor.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
@@ -175,8 +186,12 @@ export function TaskUpsertModalComponent({
|
||||
label={t("tasks.fields.billid")}
|
||||
name="billid"
|
||||
>
|
||||
<Select placeholder={t("tasks.labels.billidplaceholder")} disabled={!selectedJobDetails}>
|
||||
{/* Add your options here */}
|
||||
<Select placeholder={t("tasks.placeholders.billid")} disabled={!selectedJobDetails}>
|
||||
{selectedJobDetails?.bills?.map((bill) => (
|
||||
<Select.Option key={bill.id} value={bill.id}>
|
||||
{bill.invoice_number} - {bill.vendor.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
||||
Reference in New Issue
Block a user