Add commit and uncommit functionality.
This commit is contained in:
@@ -37,6 +37,7 @@ export function TimeTicketModalComponent({
|
||||
authLevel,
|
||||
employeeAutoCompleteOptions,
|
||||
isEdit,
|
||||
disabled,
|
||||
employeeSelectDisabled,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
@@ -50,7 +51,7 @@ export function TimeTicketModalComponent({
|
||||
<Select
|
||||
value={value === "timetickets.labels.shift" ? t(value) : value}
|
||||
{...props}
|
||||
disabled={value === "timetickets.labels.shift"}
|
||||
disabled={value === "timetickets.labels.shift" || disabled}
|
||||
>
|
||||
{emps &&
|
||||
emps.rates.map((item) => (
|
||||
@@ -73,7 +74,7 @@ export function TimeTicketModalComponent({
|
||||
<Input
|
||||
value={value?.startsWith("timetickets.") ? t(value) : value}
|
||||
{...props}
|
||||
disabled={value?.startsWith("timetickets.")}
|
||||
disabled={value?.startsWith("timetickets.") || disabled}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -126,7 +127,7 @@ export function TimeTicketModalComponent({
|
||||
]}
|
||||
>
|
||||
<EmployeeSearchSelect
|
||||
disabled={employeeSelectDisabled}
|
||||
disabled={employeeSelectDisabled || disabled}
|
||||
options={employeeAutoCompleteOptions}
|
||||
onSelect={(value) => {
|
||||
const emps =
|
||||
@@ -278,6 +279,7 @@ export function TimeTicketModalComponent({
|
||||
<FormDateTimePicker
|
||||
minuteStep={5}
|
||||
disabled={
|
||||
disabled ||
|
||||
!HasRbacAccess({
|
||||
bodyshop,
|
||||
authLevel,
|
||||
@@ -316,6 +318,7 @@ export function TimeTicketModalComponent({
|
||||
<FormDateTimePicker
|
||||
minuteStep={5}
|
||||
disabled={
|
||||
disabled ||
|
||||
!HasRbacAccess({
|
||||
bodyshop,
|
||||
authLevel,
|
||||
|
||||
@@ -14,6 +14,7 @@ import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||
import { selectTimeTicket } from "../../redux/modals/modals.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import TimeTicketModalComponent from "./time-ticket-modal.component";
|
||||
import TimeTicketsCommitToggleComponent from "../time-tickets-commit-toggle/time-tickets-commit-toggle.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
timeTicketModal: selectTimeTicket,
|
||||
@@ -174,7 +175,11 @@ export function TimeTicketModalContainer({
|
||||
footer={
|
||||
<span>
|
||||
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
|
||||
<Button loading={loading} onClick={() => form.submit()}>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={timeTicketModal.context?.timeticket?.committed_at}
|
||||
onClick={() => form.submit()}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
{timeTicketModal.context && timeTicketModal.context.id ? null : (
|
||||
@@ -198,6 +203,7 @@ export function TimeTicketModalContainer({
|
||||
autoComplete={"off"}
|
||||
form={form}
|
||||
onFinishFailed={() => setEnterAgain(false)}
|
||||
disabled={timeTicketModal.context?.timeticket?.committed_at}
|
||||
initialValues={
|
||||
timeTicketModal.context.timeticket
|
||||
? {
|
||||
@@ -218,6 +224,9 @@ export function TimeTicketModalContainer({
|
||||
<PageHeader
|
||||
extra={
|
||||
<Space>
|
||||
<TimeTicketsCommitToggleComponent
|
||||
timeticket={timeTicketModal.context?.timeticket}
|
||||
/>
|
||||
<Button onClick={handleCancel}>
|
||||
{t("general.actions.cancel")}
|
||||
</Button>
|
||||
@@ -241,14 +250,16 @@ export function TimeTicketModalContainer({
|
||||
<TimeTicketModalComponent
|
||||
isEdit={timeTicketModal.context.id}
|
||||
form={form}
|
||||
disabled={timeTicketModal.context?.timeticket?.committed_at}
|
||||
employeeAutoCompleteOptions={
|
||||
EmployeeAutoCompleteData && EmployeeAutoCompleteData.employees
|
||||
}
|
||||
employeeSelectDisabled={
|
||||
timeTicketModal.context?.timeticket?.employeeid &&
|
||||
timeTicketModal.context?.timeticket?.committed_at ||
|
||||
(timeTicketModal.context?.timeticket?.employeeid &&
|
||||
!timeTicketModal.context.id
|
||||
? true
|
||||
: false
|
||||
: false)
|
||||
}
|
||||
/>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user