IO-1044 Dynamic fields on time ticket modal

This commit is contained in:
Patrick Fic
2021-05-07 15:14:23 -07:00
parent cc541293eb
commit 49c3a512c0
2 changed files with 33 additions and 24 deletions

View File

@@ -34,6 +34,7 @@ export function TimeTicketModalComponent({
bodyshop,
authLevel,
employeeAutoCompleteOptions,
isEdit,
}) {
const { t } = useTranslation();
@@ -158,28 +159,33 @@ export function TimeTicketModalComponent({
<Form.Item label={t("timetickets.fields.actualhrs")} name="actualhrs">
<InputNumber min={0} precision={1} />
</Form.Item>
<Form.Item label={t("timetickets.fields.clockon")} name="clockon">
<FormDateTimePicker
disabled={
!HasRbacAccess({
bodyshop,
authLevel,
action: "timetickets:shiftedit",
})
}
/>
</Form.Item>
<Form.Item label={t("timetickets.fields.clockoff")} name="clockoff">
<FormDateTimePicker
disabled={
!HasRbacAccess({
bodyshop,
authLevel,
action: "timetickets:shiftedit",
})
}
/>
</Form.Item>
{isEdit && (
<>
<Form.Item label={t("timetickets.fields.clockon")} name="clockon">
<FormDateTimePicker
disabled={
!HasRbacAccess({
bodyshop,
authLevel,
action: "timetickets:shiftedit",
})
}
/>
</Form.Item>
<Form.Item label={t("timetickets.fields.clockoff")} name="clockoff">
<FormDateTimePicker
disabled={
!HasRbacAccess({
bodyshop,
authLevel,
action: "timetickets:shiftedit",
})
}
/>
</Form.Item>
</>
)}
<Form.Item label={t("timetickets.fields.memo")} name="memo">
<MemoInput />
</Form.Item>

View File

@@ -168,12 +168,13 @@ export function TimeTicketModalContainer({
footer={
<span>
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
<Button onClick={() => form.submit()}>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
{timeTicketModal.context && timeTicketModal.context.id ? null : (
<Button
type="primary"
loading={loading}
onClick={() => {
setEnterAgain(true);
}}
@@ -214,12 +215,13 @@ export function TimeTicketModalContainer({
<Button onClick={handleCancel}>
{t("general.actions.cancel")}
</Button>
<Button onClick={() => form.submit()}>
<Button loading={loading} onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
{timeTicketModal.context && timeTicketModal.context.id ? null : (
<Button
type="primary"
loading={loading}
onClick={() => {
setEnterAgain(true);
}}
@@ -231,6 +233,7 @@ export function TimeTicketModalContainer({
}
/>
<TimeTicketModalComponent
isEdit={timeTicketModal.context.id}
form={form}
employeeAutoCompleteOptions={
EmployeeAutoCompleteData && EmployeeAutoCompleteData.employees