Add claimed task name to tickets.

This commit is contained in:
Patrick Fic
2023-07-28 08:22:38 -07:00
parent ab2cf8c8c7
commit fe16329443
10 changed files with 126 additions and 22 deletions

View File

@@ -18,6 +18,8 @@ import RbacWrapper, {
HasRbacAccess,
} from "../rbac-wrapper/rbac-wrapper.component";
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
import { useTreatments } from "@splitsoftware/splitio-react";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
authLevel: selectAuthLevel,
@@ -46,7 +48,11 @@ export function TimeTicketList({
});
const { t } = useTranslation();
const { Enhanced_Payroll } = useTreatments(
["Enhanced_Payroll"],
{},
bodyshop.imexshopid
);
const totals = useMemo(() => {
if (timetickets)
return timetickets.reduce(
@@ -168,6 +174,19 @@ export function TimeTicketList({
render: (text, record) =>
record.clockon || record.clockoff ? t(record.memo) : record.memo,
},
...(Enhanced_Payroll.treatment === "on"
? [
{
title: t("timetickets.fields.parent_task"),
dataIndex: "parent_task",
key: "parent_task",
sorter: (a, b) => alphaSort(a.parent_task, b.parent_task),
sortOrder:
state.sortedInfo.columnKey === "parent_task" &&
state.sortedInfo.order,
},
]
: []),
{
title: t("timetickets.fields.clockon"),
dataIndex: "clockon",
@@ -274,17 +293,11 @@ export function TimeTicketList({
title={t("timetickets.labels.timetickets")}
extra={
<Space wrap>
{
// <TimeTicketListTeamPay
// actions={{ refetch }}
// context={{ jobId: jobId }}
// />
}
{bodyshop.md_tasks_presets.enable_tasks && (
{jobId && bodyshop.md_tasks_presets.enable_tasks && (
<Button
onClick={() => {
setTimeTicketTaskContext({
actions: {},
actions: { refetch: refetch },
context: { jobid: jobId },
});
}}

View File

@@ -36,10 +36,6 @@ export function TimeTicketTaskModalComponent({
completedTasks,
unassignedHours,
}) {
console.log(
"🚀 ~ file: time-ticket-task-modal.component.jsx:39 ~ unassignedHours:",
unassignedHours
);
const { t } = useTranslation();
return (

View File

@@ -31,7 +31,7 @@ export function TimeTickeTaskModalContainer({
toggleModalVisible,
}) {
const [form] = Form.useForm();
const { context, visible } = timeTicketTasksModal;
const { context, visible, actions } = timeTicketTasksModal;
const [completedTasks, setCompletedTasks] = useState([]);
const [unassignedHours, setUnassignedHours] = useState(0);
const { t } = useTranslation();
@@ -83,6 +83,7 @@ export function TimeTickeTaskModalContainer({
});
if (response.status === 200 && handleFinish) {
//Close the modal
if (actions?.refetch) actions.refetch();
toggleModalVisible();
} else if (handleFinish === false) {
form.setFieldsValue({ timetickets: data.ticketsToInsert });