IO-1912 Resolve date for tech clock in.
This commit is contained in:
@@ -10,6 +10,7 @@ import { selectTechnician } from "../../redux/tech/tech.selectors";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import TechClockInComponent from "./tech-job-clock-in-form.component";
|
import TechClockInComponent from "./tech-job-clock-in-form.component";
|
||||||
import TechJobPrintTickets from "../tech-job-print-tickets/tech-job-print-tickets.component";
|
import TechJobPrintTickets from "../tech-job-print-tickets/tech-job-print-tickets.component";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
technician: selectTechnician,
|
technician: selectTechnician,
|
||||||
@@ -23,18 +24,19 @@ export function TechClockInContainer({ technician, bodyshop }) {
|
|||||||
refetchQueries: ["QUERY_ACTIVE_TIME_TICKETS"],
|
refetchQueries: ["QUERY_ACTIVE_TIME_TICKETS"],
|
||||||
});
|
});
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
console.log(moment("2022-05-28T01:43:52.508Z").format("YYYY-MM-DD"));
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const theTime = (await axios.post("/utils/time")).data;
|
const theTime = (await axios.post("/utils/time")).data;
|
||||||
|
|
||||||
const result = await insertTimeTicket({
|
const result = await insertTimeTicket({
|
||||||
variables: {
|
variables: {
|
||||||
timeTicketInput: [
|
timeTicketInput: [
|
||||||
{
|
{
|
||||||
bodyshopid: bodyshop.id,
|
bodyshopid: bodyshop.id,
|
||||||
employeeid: technician.id,
|
employeeid: technician.id,
|
||||||
date: theTime,
|
date: moment(theTime).format("YYYY-MM-DD"),
|
||||||
clockon: theTime,
|
clockon: moment(theTime),
|
||||||
jobid: values.jobid,
|
jobid: values.jobid,
|
||||||
cost_center: values.cost_center,
|
cost_center: values.cost_center,
|
||||||
ciecacode:
|
ciecacode:
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function TechClockOffButton({
|
|||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("tech_clock_out_job");
|
logImEXEvent("tech_clock_out_job");
|
||||||
|
console.log(values);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await updateTimeticket({
|
const result = await updateTimeticket({
|
||||||
variables: {
|
variables: {
|
||||||
@@ -55,9 +55,10 @@ export function TechClockOffButton({
|
|||||||
timeticket: {
|
timeticket: {
|
||||||
clockoff: (await axios.post("/utils/time")).data,
|
clockoff: (await axios.post("/utils/time")).data,
|
||||||
...values,
|
...values,
|
||||||
rate: emps && emps.rates.filter(
|
rate:
|
||||||
(r) => r.cost_center === values.cost_center
|
emps &&
|
||||||
)[0]?.rate,
|
emps.rates.filter((r) => r.cost_center === values.cost_center)[0]
|
||||||
|
?.rate,
|
||||||
ciecacode:
|
ciecacode:
|
||||||
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber
|
||||||
? values.cost_center
|
? values.cost_center
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ const CreateCosts = (job) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const StatusMapping = (status, md_ro_statuses) => {
|
const StatusMapping = (status, md_ro_statuses) => {
|
||||||
//EST, SCH, ARR, IPR, RDY, DEL, CLO, CAN, UNDEFINED.
|
//Possible return statuses EST, SCH, ARR, IPR, RDY, DEL, CLO, CAN, UNDEFINED.
|
||||||
const {
|
const {
|
||||||
default_imported,
|
default_imported,
|
||||||
default_open,
|
default_open,
|
||||||
@@ -823,8 +823,6 @@ const StatusMapping = (status, md_ro_statuses) => {
|
|||||||
else if (status === default_void) return "VOID";
|
else if (status === default_void) return "VOID";
|
||||||
else if (md_ro_statuses.production_statuses.includes(status)) return "IPR";
|
else if (md_ro_statuses.production_statuses.includes(status)) return "IPR";
|
||||||
else return "UNDEFINED";
|
else return "UNDEFINED";
|
||||||
|
|
||||||
// default: return "UNDEFINED"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const GenerateDetailLines = (job, line, statuses) => {
|
const GenerateDetailLines = (job, line, statuses) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user