IO-2381 Disabled Cancel Appt Button
This commit is contained in:
@@ -29,11 +29,11 @@ import { GenerateDocument } from "../../utils/RenderTemplate";
|
|||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import DataLabel from "../data-label/data-label.component";
|
import DataLabel from "../data-label/data-label.component";
|
||||||
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component";
|
import ScheduleManualEvent from "../schedule-manual-event/schedule-manual-event.component";
|
||||||
import ScheduleAtChange from "./job-at-change.component";
|
import ScheduleAtChange from "./job-at-change.component";
|
||||||
import ScheduleEventColor from "./schedule-event.color.component";
|
import ScheduleEventColor from "./schedule-event.color.component";
|
||||||
import ScheduleEventNote from "./schedule-event.note.component";
|
import ScheduleEventNote from "./schedule-event.note.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -208,46 +208,56 @@ export function ScheduleEventComponent({
|
|||||||
<Button>{t("appointments.actions.sendreminder")}</Button>
|
<Button>{t("appointments.actions.sendreminder")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
) : null}
|
) : null}
|
||||||
<Popover
|
{event.arrived ? (
|
||||||
trigger="click"
|
|
||||||
disabled={event.arrived}
|
|
||||||
content={
|
|
||||||
<Form
|
|
||||||
layout="vertical"
|
|
||||||
onFinish={({ lost_sale_reason }) => {
|
|
||||||
handleCancel({ id: event.id, lost_sale_reason });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
name="lost_sale_reason"
|
|
||||||
label={t("jobs.fields.lost_sale_reason")}
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Select
|
|
||||||
options={bodyshop.md_lost_sale_reasons.map((lsr) => ({
|
|
||||||
label: lsr,
|
|
||||||
value: lsr,
|
|
||||||
}))}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<Button htmlType="submit">
|
|
||||||
{t("appointments.actions.cancel")}
|
|
||||||
</Button>
|
|
||||||
</Form>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
// onClick={() => handleCancel(event.id)}
|
// onClick={() => handleCancel(event.id)}
|
||||||
disabled={event.arrived}
|
disabled={event.arrived}
|
||||||
>
|
>
|
||||||
{t("appointments.actions.cancel")}
|
{t("appointments.actions.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
</Popover>
|
) : (
|
||||||
|
<Popover
|
||||||
|
trigger="click"
|
||||||
|
disabled={event.arrived}
|
||||||
|
content={
|
||||||
|
<Form
|
||||||
|
layout="vertical"
|
||||||
|
onFinish={({ lost_sale_reason }) => {
|
||||||
|
handleCancel({ id: event.id, lost_sale_reason });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Form.Item
|
||||||
|
name="lost_sale_reason"
|
||||||
|
label={t("jobs.fields.lost_sale_reason")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
options={bodyshop.md_lost_sale_reasons.map((lsr) => ({
|
||||||
|
label: lsr,
|
||||||
|
value: lsr,
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Button htmlType="submit">
|
||||||
|
{t("appointments.actions.cancel")}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
// onClick={() => handleCancel(event.id)}
|
||||||
|
disabled={event.arrived}
|
||||||
|
>
|
||||||
|
{t("appointments.actions.cancel")}
|
||||||
|
</Button>
|
||||||
|
</Popover>
|
||||||
|
)}
|
||||||
|
|
||||||
{event.isintake ? (
|
{event.isintake ? (
|
||||||
<Button
|
<Button
|
||||||
disabled={event.arrived}
|
disabled={event.arrived}
|
||||||
|
|||||||
@@ -137,63 +137,67 @@ export function JobsDetailHeaderActions({
|
|||||||
<Menu.Item
|
<Menu.Item
|
||||||
disabled={job.status !== bodyshop.md_ro_statuses.default_scheduled}
|
disabled={job.status !== bodyshop.md_ro_statuses.default_scheduled}
|
||||||
>
|
>
|
||||||
<Popover
|
{job.status !== bodyshop.md_ro_statuses.default_scheduled ? (
|
||||||
trigger="click"
|
t("menus.jobsactions.cancelallappointments")
|
||||||
disabled={job.status !== bodyshop.md_ro_statuses.default_scheduled}
|
) : (
|
||||||
content={
|
<Popover
|
||||||
<Form
|
trigger="click"
|
||||||
layout="vertical"
|
disabled={job.status !== bodyshop.md_ro_statuses.default_scheduled}
|
||||||
onFinish={async ({ lost_sale_reason }) => {
|
content={
|
||||||
const jobUpdate = await cancelAllAppointments({
|
<Form
|
||||||
variables: {
|
layout="vertical"
|
||||||
jobid: job.id,
|
onFinish={async ({ lost_sale_reason }) => {
|
||||||
job: {
|
const jobUpdate = await cancelAllAppointments({
|
||||||
date_scheduled: null,
|
variables: {
|
||||||
scheduled_in: null,
|
jobid: job.id,
|
||||||
scheduled_completion: null,
|
job: {
|
||||||
lost_sale_reason,
|
date_scheduled: null,
|
||||||
status: bodyshop.md_ro_statuses.default_imported,
|
scheduled_in: null,
|
||||||
|
scheduled_completion: null,
|
||||||
|
lost_sale_reason,
|
||||||
|
status: bodyshop.md_ro_statuses.default_imported,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
});
|
|
||||||
if (!jobUpdate.errors) {
|
|
||||||
notification["success"]({
|
|
||||||
message: t("appointments.successes.canceled"),
|
|
||||||
});
|
});
|
||||||
return;
|
if (!jobUpdate.errors) {
|
||||||
}
|
notification["success"]({
|
||||||
}}
|
message: t("appointments.successes.canceled"),
|
||||||
>
|
});
|
||||||
<Form.Item
|
return;
|
||||||
name="lost_sale_reason"
|
}
|
||||||
label={t("jobs.fields.lost_sale_reason")}
|
}}
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Select
|
<Form.Item
|
||||||
options={bodyshop.md_lost_sale_reasons.map((lsr) => ({
|
name="lost_sale_reason"
|
||||||
label: lsr,
|
label={t("jobs.fields.lost_sale_reason")}
|
||||||
value: lsr,
|
rules={[
|
||||||
}))}
|
{
|
||||||
/>
|
required: true,
|
||||||
</Form.Item>
|
//message: t("general.validation.required"),
|
||||||
<Button
|
},
|
||||||
htmlType="submit"
|
]}
|
||||||
disabled={
|
>
|
||||||
job.status !== bodyshop.md_ro_statuses.default_scheduled
|
<Select
|
||||||
}
|
options={bodyshop.md_lost_sale_reasons.map((lsr) => ({
|
||||||
>
|
label: lsr,
|
||||||
{t("appointments.actions.cancel")}
|
value: lsr,
|
||||||
</Button>
|
}))}
|
||||||
</Form>
|
/>
|
||||||
}
|
</Form.Item>
|
||||||
>
|
<Button
|
||||||
{t("menus.jobsactions.cancelallappointments")}
|
htmlType="submit"
|
||||||
</Popover>
|
disabled={
|
||||||
|
job.status !== bodyshop.md_ro_statuses.default_scheduled
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{t("appointments.actions.cancel")}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{t("menus.jobsactions.cancelallappointments")}
|
||||||
|
</Popover>
|
||||||
|
)}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
disabled={
|
disabled={
|
||||||
|
|||||||
Reference in New Issue
Block a user