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

@@ -1,4 +1,4 @@
<babeledit_project version="1.2" be_version="2.7.1"> <babeledit_project be_version="2.7.1" version="1.2">
<!-- <!--
BabelEdit project file BabelEdit project file
@@ -1474,6 +1474,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>admin_jobuninvoice</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>admin_jobunvoid</name> <name>admin_jobunvoid</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -23815,6 +23836,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>date_void</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>ded_amt</name> <name>ded_amt</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -40967,6 +41009,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>parts_return_slip</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>sublet_order</name> <name>sublet_order</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -46483,6 +46546,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>parent_task</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node> <concept_node>
<name>productivehrs</name> <name>productivehrs</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>

View File

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

View File

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

View File

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

View File

@@ -2432,7 +2432,7 @@
"jobs": { "jobs": {
"individual_job_note": "Job Note RO: {{ro_number}}", "individual_job_note": "Job Note RO: {{ro_number}}",
"parts_order": "Parts Order PO: {{ro_number}} - {{name}}", "parts_order": "Parts Order PO: {{ro_number}} - {{name}}",
"parts_return_slip":"Parts Return PO: {{ro_number}} - {{name}}", "parts_return_slip": "Parts Return PO: {{ro_number}} - {{name}}",
"sublet_order": "Sublet Order PO: {{ro_number}} - {{name}}" "sublet_order": "Sublet Order PO: {{ro_number}} - {{name}}"
} }
}, },
@@ -2760,6 +2760,7 @@
"employee_team": "Employee Team", "employee_team": "Employee Team",
"flat_rate": "Flat Rate?", "flat_rate": "Flat Rate?",
"memo": "Memo", "memo": "Memo",
"parent_task": "Task",
"productivehrs": "Productive Hours", "productivehrs": "Productive Hours",
"ro_number": "Job to Post Against" "ro_number": "Job to Post Against"
}, },

View File

@@ -2760,6 +2760,7 @@
"employee_team": "", "employee_team": "",
"flat_rate": "", "flat_rate": "",
"memo": "", "memo": "",
"parent_task": "",
"productivehrs": "", "productivehrs": "",
"ro_number": "" "ro_number": ""
}, },

View File

@@ -2760,6 +2760,7 @@
"employee_team": "", "employee_team": "",
"flat_rate": "", "flat_rate": "",
"memo": "", "memo": "",
"parent_task": "",
"productivehrs": "", "productivehrs": "",
"ro_number": "" "ro_number": ""
}, },

View File

@@ -14,7 +14,7 @@ Dinero.globalRoundingMode = "HALF_EVEN";
exports.calculatelabor = async function (req, res) { exports.calculatelabor = async function (req, res) {
const BearerToken = req.headers.authorization; const BearerToken = req.headers.authorization;
const { jobid, calculateOnly } = req.body; const { jobid, calculateOnly } = req.body;
logger.log("job-payroll-pay-all", "DEBUG", req.user.email, jobid, null); logger.log("job-payroll-calculate-labor", "DEBUG", req.user.email, jobid, null);
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, { const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
headers: { headers: {
Authorization: BearerToken, Authorization: BearerToken,

View File

@@ -31,6 +31,12 @@ exports.claimtask = async function (req, res) {
const theTaskPreset = job.bodyshop.md_tasks_presets.presets.find( const theTaskPreset = job.bodyshop.md_tasks_presets.presets.find(
(tp) => tp.name === task (tp) => tp.name === task
); );
if (!theTaskPreset) {
res
.status(400)
.json({ success: false, error: "Provided task preset not found." });
return;
}
//Get all of the assignments that are filtered. //Get all of the assignments that are filtered.
const { assignmentHash, employeeHash } = CalculateExpectedHoursForJob( const { assignmentHash, employeeHash } = CalculateExpectedHoursForJob(
@@ -52,6 +58,7 @@ exports.claimtask = async function (req, res) {
(theTaskPreset.percent / 100); (theTaskPreset.percent / 100);
ticketsToInsert.push({ ticketsToInsert.push({
task_name: task,
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: employeeIdKey, employeeid: employeeIdKey,

View File

@@ -53,6 +53,7 @@ exports.payall = async function (req, res) {
console.log("Hours", diff.val[key][Object.keys(diff.val[key])[0]]); console.log("Hours", diff.val[key][Object.keys(diff.val[key])[0]]);
console.log("Rate", Object.keys(diff.val[key])[0]); console.log("Rate", Object.keys(diff.val[key])[0]);
ticketsToInsert.push({ ticketsToInsert.push({
task_name: "Pay All",
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: path.employeeid, employeeid: path.employeeid,
@@ -68,6 +69,7 @@ exports.payall = async function (req, res) {
} else { } else {
//Only the 1 value to add. //Only the 1 value to add.
ticketsToInsert.push({ ticketsToInsert.push({
task_name: "Pay All",
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: path.employeeid, employeeid: path.employeeid,
@@ -86,6 +88,7 @@ exports.payall = async function (req, res) {
//An old ticket amount isn't sufficient //An old ticket amount isn't sufficient
//We can't modify the existing ticket, it might already be committed. So let's add a new one instead. //We can't modify the existing ticket, it might already be committed. So let's add a new one instead.
ticketsToInsert.push({ ticketsToInsert.push({
task_name: "Pay All",
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: path.employeeid, employeeid: path.employeeid,
@@ -107,12 +110,8 @@ exports.payall = async function (req, res) {
) { ) {
//Multiple oldValues to add. //Multiple oldValues to add.
Object.keys(diff.oldVal).forEach((key) => { Object.keys(diff.oldVal).forEach((key) => {
console.log(
"Hours",
diff.oldVal[key][Object.keys(diff.oldVal[key])[0]]
);
console.log("Rate", Object.keys(diff.oldVal[key])[0]);
ticketsToInsert.push({ ticketsToInsert.push({
task_name: "Pay All",
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: path.employeeid, employeeid: path.employeeid,
@@ -129,6 +128,7 @@ exports.payall = async function (req, res) {
} else { } else {
//Only the 1 value to add. //Only the 1 value to add.
ticketsToInsert.push({ ticketsToInsert.push({
task_name: "Pay All",
jobid: job.id, jobid: job.id,
bodyshopid: job.bodyshop.id, bodyshopid: job.bodyshop.id,
employeeid: path.employeeid, employeeid: path.employeeid,