Time Ticket Task Improvmenets.
This commit is contained in:
@@ -23,6 +23,7 @@ import JobSearchSelectComponent from "../job-search-select/job-search-select.com
|
||||
import { CalculateAllocationsTotals } from "../labor-allocations-table/labor-allocations-table.utility";
|
||||
import { LaborAllocationContainer } from "../time-ticket-modal/time-ticket-modal.component";
|
||||
import TimeTicketsTasksPresets from "../time-ticket-tasks-presets/time-ticket-tasks-presets.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
@@ -54,7 +55,12 @@ export function TimeTicketTaskModalComponent({
|
||||
calculateTimeTickets={calculateTimeTickets}
|
||||
/>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col lg={12} md={24}>
|
||||
{bodyshop?.md_tasks_presets?.use_approvals && (
|
||||
<Col span={24}>
|
||||
<Alert message={t(".tt_approvals.labels.approval_queue_in_use")} />
|
||||
</Col>
|
||||
)}
|
||||
<Col xl={12} lg={24}>
|
||||
<Form.Item
|
||||
name="jobid"
|
||||
label={t("timetickets.fields.ro_number")}
|
||||
@@ -77,37 +83,37 @@ export function TimeTicketTaskModalComponent({
|
||||
>
|
||||
<EmployeeTeamSearchSelectComponent />
|
||||
</Form.Item>
|
||||
<Space wrap>
|
||||
<Form.Item
|
||||
name="hourstype"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox.Group>
|
||||
<Space wrap>
|
||||
<Checkbox value="LAB" style={{ display: "flex" }}>
|
||||
Body
|
||||
</Checkbox>
|
||||
<Checkbox value="LAR" style={{ display: "flex" }}>
|
||||
Refinish
|
||||
</Checkbox>
|
||||
<Checkbox value="LAM" style={{ display: "flex" }}>
|
||||
Mechanical
|
||||
</Checkbox>
|
||||
<Checkbox value="LAF" style={{ display: "flex" }}>
|
||||
Frame
|
||||
</Checkbox>
|
||||
<Checkbox value="LAG" style={{ display: "flex" }}>
|
||||
Glass
|
||||
</Checkbox>
|
||||
</Space>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="hourstype"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox.Group>
|
||||
<Space wrap>
|
||||
<Checkbox value="LAB" style={{ display: "flex" }}>
|
||||
{t("jobs.fields.lab")}
|
||||
</Checkbox>
|
||||
<Checkbox value="LAR" style={{ display: "flex" }}>
|
||||
{t("jobs.fields.lar")}
|
||||
</Checkbox>
|
||||
<Checkbox value="LAM" style={{ display: "flex" }}>
|
||||
{t("jobs.fields.lam")}
|
||||
</Checkbox>
|
||||
<Checkbox value="LAF" style={{ display: "flex" }}>
|
||||
{t("jobs.fields.laf")}
|
||||
</Checkbox>
|
||||
<Checkbox value="LAG" style={{ display: "flex" }}>
|
||||
{t("jobs.fields.lag")}
|
||||
</Checkbox>
|
||||
</Space>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
<Space wrap align="start">
|
||||
<Form.Item
|
||||
name="percent"
|
||||
rules={[
|
||||
@@ -119,10 +125,13 @@ export function TimeTicketTaskModalComponent({
|
||||
>
|
||||
<InputNumber min={0} max={100} precision={1} addonAfter="%" />
|
||||
</Form.Item>
|
||||
|
||||
<Button onClick={calculateTimeTickets}>
|
||||
{t("tt_approvals.labels.calculate")}
|
||||
</Button>
|
||||
</Space>
|
||||
<Button onClick={calculateTimeTickets}>Calculate</Button>
|
||||
</Col>
|
||||
<Col lg={12} md={24}>
|
||||
<Col xl={12} lg={24}>
|
||||
<Form.Item shouldUpdate>
|
||||
{() => {
|
||||
const data = form.getFieldValue("timetickets");
|
||||
@@ -167,11 +176,11 @@ export function TimeTicketTaskModalComponent({
|
||||
dataIndex: "rate",
|
||||
key: "rate",
|
||||
},
|
||||
{
|
||||
title: "Pay",
|
||||
dataIndex: "pay",
|
||||
key: "pay",
|
||||
},
|
||||
// {
|
||||
// title: "Pay",
|
||||
// dataIndex: "pay",
|
||||
// key: "pay",
|
||||
// },
|
||||
]}
|
||||
/>
|
||||
);
|
||||
@@ -231,11 +240,9 @@ export function TimeTicketTaskModalComponent({
|
||||
<Alert key={idx} message={e} />
|
||||
))}
|
||||
<div
|
||||
style={
|
||||
{
|
||||
//display: "none"
|
||||
}
|
||||
}
|
||||
style={{
|
||||
display: "none",
|
||||
}}
|
||||
>
|
||||
{fields.map((field, index) => (
|
||||
<Form.Item
|
||||
|
||||
@@ -52,12 +52,8 @@ export function TimeTickeTaskModalContainer({
|
||||
});
|
||||
|
||||
async function handleFinish(values) {
|
||||
console.log(
|
||||
"🚀 ~ file: time-ticket-task-modal.container.jsx:55 ~ handleFinish ~ values:",
|
||||
values
|
||||
);
|
||||
try {
|
||||
if (true) {
|
||||
if (bodyshop.md_tasks_presets.use_approvals) {
|
||||
const result = await insertTimeTicketApproval({
|
||||
variables: {
|
||||
timeTicketInput: values.timetickets.map((ticket) => ({
|
||||
@@ -88,6 +84,7 @@ export function TimeTickeTaskModalContainer({
|
||||
_.omit(ticket, "pay")
|
||||
),
|
||||
},
|
||||
refetchQueries: ["GET_LINE_TICKET_BY_PK"]
|
||||
});
|
||||
if (result.errors) {
|
||||
notification.open({
|
||||
@@ -105,6 +102,13 @@ export function TimeTickeTaskModalContainer({
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("🚀 ~ file: time-ticket-task-modal.container.jsx:104 ~ handleFinish ~ error:", error)
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("timetickets.errors.creating", {
|
||||
message: JSON.stringify(error),
|
||||
}),
|
||||
});
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user