Added job login and log off functionality. BOD-183

This commit is contained in:
Patrick Fic
2020-07-03 16:35:18 -07:00
parent 1ff3cd0f55
commit 88c29490ca
24 changed files with 740 additions and 125 deletions

View File

@@ -13691,48 +13691,6 @@
<folder_node> <folder_node>
<name>tech</name> <name>tech</name>
<children> <children>
<concept_node>
<name>clockin</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>
<name>clockout</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>home</name> <name>home</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -13754,6 +13712,48 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>jobclockin</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>
<name>jobclockout</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>joblookup</name> <name>joblookup</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -16860,6 +16860,48 @@
<folder_node> <folder_node>
<name>actions</name> <name>actions</name>
<children> <children>
<concept_node>
<name>clockin</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>
<name>clockout</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>enter</name> <name>enter</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -16883,6 +16925,53 @@
</concept_node> </concept_node>
</children> </children>
</folder_node> </folder_node>
<folder_node>
<name>errors</name>
<children>
<concept_node>
<name>clockingin</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>
<name>clockingout</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>
</children>
</folder_node>
<folder_node> <folder_node>
<name>fields</name> <name>fields</name>
<children> <children>
@@ -16928,6 +17017,48 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>clockoff</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>
<name>clockon</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>cost_center</name> <name>cost_center</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -17038,6 +17169,48 @@
<folder_node> <folder_node>
<name>labels</name> <name>labels</name>
<children> <children>
<concept_node>
<name>alreadyclockedon</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>
<name>clockintojob</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>edit</name> <name>edit</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -17124,6 +17297,53 @@
</concept_node> </concept_node>
</children> </children>
</folder_node> </folder_node>
<folder_node>
<name>successes</name>
<children>
<concept_node>
<name>clockedin</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>
<name>clockedout</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>
</children>
</folder_node>
</children> </children>
</folder_node> </folder_node>
<folder_node> <folder_node>

View File

@@ -3,19 +3,23 @@ import LaborAllocationsTableComponent from "../labor-allocations-table/labor-all
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 TimeTicketList from "../time-ticket-list/time-ticket-list.component"; import TimeTicketList from "../time-ticket-list/time-ticket-list.component";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export default function JobsDetailLaborContainer({ export default function JobsDetailLaborContainer({
jobId, jobId,
joblines, joblines,
timetickets, timetickets,
refetch, refetch,
loading, loading,
techConsole,
}) { }) {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<div> <div>
<TimeTicketEnterButton actions={{ refetch }} context={{ jobId: jobId }}> {techConsole ? null : (
{t("timetickets.actions.enter")} <TimeTicketEnterButton actions={{ refetch }} context={{ jobId: jobId }}>
</TimeTicketEnterButton> {t("timetickets.actions.enter")}
</TimeTicketEnterButton>
)}
<LaborAllocationsTableComponent <LaborAllocationsTableComponent
joblines={joblines} joblines={joblines}
timetickets={timetickets} timetickets={timetickets}
@@ -24,6 +28,7 @@ export default function JobsDetailLaborContainer({
loading={loading} loading={loading}
timetickets={timetickets} timetickets={timetickets}
refetch={refetch} refetch={refetch}
techConsole={techConsole}
/> />
</div> </div>
); );

View File

@@ -4,7 +4,7 @@ import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs-lines.queries";
import AlertComponent from "../alert/alert.component"; import AlertComponent from "../alert/alert.component";
import JobsDetailLaborComponent from "./jobs-detail-labor.component"; import JobsDetailLaborComponent from "./jobs-detail-labor.component";
export default function JobsDetailLaborContainer({ jobId }) { export default function JobsDetailLaborContainer({ jobId, techConsole }) {
const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, { const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, {
variables: { id: jobId }, variables: { id: jobId },
skip: !!!jobId, skip: !!!jobId,
@@ -19,6 +19,7 @@ export default function JobsDetailLaborContainer({ jobId }) {
timetickets={data ? data.timetickets : []} timetickets={data ? data.timetickets : []}
joblines={data ? data.joblines : []} joblines={data ? data.joblines : []}
refetch={refetch} refetch={refetch}
techConsole={techConsole}
/> />
); );
} }

View File

@@ -1,44 +0,0 @@
import { Form, Button } from "antd";
import React from "react";
import { useQuery } from "react-apollo";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_ACTIVE_TIME_TICKETS } from "../../graphql/timetickets.queries";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import AlertComponent from "../alert/alert.component";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import TechClockInComponent from "./tech-clock-in.component";
import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
technician: selectTechnician,
});
export function TechClockInContainer({ technician }) {
const { loading, error, data } = useQuery(QUERY_ACTIVE_TIME_TICKETS);
const [form] = Form.useForm();
const { t } = useTranslation();
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
console.log("data", data);
if (data.timetickets.length > 0) {
return <div>already clock into a job.</div>;
}
const handleFinish = (values) => {
console.log("values", values);
};
return (
<div>
<Form form={form} layout="vertical" onFinish={handleFinish}>
<TechClockInComponent form={form} />
<Button type="primary" htmlType="submit">
{t("timetickets.actions.clockon")}
</Button>
</Form>
</div>
);
}
export default connect(mapStateToProps, null)(TechClockInContainer);

View File

@@ -1,17 +1,17 @@
import { useQuery } from "@apollo/react-hooks"; import { useQuery } from "@apollo/react-hooks";
import { Form } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createStructuredSelector } from "reselect"; import { createStructuredSelector } from "reselect";
import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries"; import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries";
import { selectBodyshop } from "../../redux/user/user.selectors"; import { selectBodyshop } from "../../redux/user/user.selectors";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import JobSearchSelect from "../job-search-select/job-search-select.component"; import JobSearchSelect from "../job-search-select/job-search-select.component";
import { useTranslation } from "react-i18next"; import JobsDetailLaborContainer from "../jobs-detail-labor/jobs-detail-labor.container";
import { Form } from "antd";
const mapStateToProps = createStructuredSelector({ const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop, bodyshop: selectBodyshop,
});
});
export function TechClockInComponent({ form, bodyshop }) { export function TechClockInComponent({ form, bodyshop }) {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -35,6 +35,22 @@ export function TechClockInComponent({ form, bodyshop }) {
> >
<JobSearchSelect loading={loading} options={data ? data.jobs : []} /> <JobSearchSelect loading={loading} options={data ? data.jobs : []} />
</Form.Item> </Form.Item>
<Form.Item
shouldUpdate={(prevValues, curValues) =>
prevValues.jobid !== curValues.jobid
}
>
{() => {
if (!form.getFieldValue("jobid")) return null;
return (
<JobsDetailLaborContainer
jobId={form.getFieldValue("jobid")}
techConsole
/>
);
}}
</Form.Item>
</div> </div>
); );
} }

View File

@@ -0,0 +1,76 @@
import { Button, Form, notification, Card } from "antd";
import React from "react";
import { useMutation } from "react-apollo";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { INSERT_NEW_TIME_TICKET } from "../../graphql/timetickets.queries";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import TechClockInComponent from "./tech-job-clock-in-form.component";
const mapStateToProps = createStructuredSelector({
technician: selectTechnician,
bodyshop: selectBodyshop,
});
export function TechClockInContainer({ technician, bodyshop }) {
const [form] = Form.useForm();
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET, {
refetchQueries: ["QUERY_ACTIVE_TIME_TICKETS"],
});
const { t } = useTranslation();
const handleFinish = async (values) => {
const result = await insertTimeTicket({
variables: {
timeTicketInput: {
employeeid: technician.id,
date: new Date(),
clockon: new Date(),
jobid: values.jobid,
cost_center: technician.cost_center,
ciecacode: Object.keys(
bodyshop.md_responsibility_centers.defaults.costs
).find((key) => {
console.log(
"key",
key,
bodyshop.md_responsibility_centers.defaults.costs[key]
);
return (
bodyshop.md_responsibility_centers.defaults.costs[key] ===
values.cost_center
);
}),
},
},
});
if (!!result.errors) {
notification["error"]({
message: t("timetickets.errors.clockingin", {
message: JSON.stringify(result.errors),
}),
});
} else {
notification["success"]({
message: t("timetickets.successes.clockedin"),
});
}
};
return (
<div>
<Card title={t("timetickets.labels.clockintojob")}>
<Form form={form} layout="vertical" onFinish={handleFinish}>
<Button type="primary" htmlType="submit">
{t("timetickets.actions.clockin")}
</Button>
<TechClockInComponent form={form} />
</Form>
</Card>
</div>
);
}
export default connect(mapStateToProps, null)(TechClockInContainer);

View File

@@ -0,0 +1,130 @@
import { useMutation } from "@apollo/react-hooks";
import {
Button,
Card,
Form,
InputNumber,
notification,
Popover,
Select,
} from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { UPDATE_TIME_TICKET } from "../../graphql/timetickets.queries";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { selectTechnician } from "../../redux/tech/tech.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
});
export function TechClockOffButton({
bodyshop,
technician,
timeTicketId,
completedCallback,
otherBtnProps,
}) {
const [loading, setLoading] = useState(false);
const [updateTimeticket] = useMutation(UPDATE_TIME_TICKET);
const [form] = Form.useForm();
const { t } = useTranslation();
const handleFinish = async (values) => {
setLoading(true);
const result = await updateTimeticket({
variables: {
timeticketId: timeTicketId,
timeticket: { clockoff: new Date(), ...values },
},
});
if (!!result.errors) {
notification["error"]({
message: t("timetickets.errors.clockingout", {
message: JSON.stringify(result.errors),
}),
});
} else {
notification["success"]({
message: t("timetickets.successes.clockedout"),
});
}
setLoading(false);
if (completedCallback) completedCallback();
};
const overlay = (
<Card>
<div>
<Form
form={form}
layout="vertical"
onFinish={handleFinish}
initialValues={{
cost_center: technician ? technician.cost_center : null,
}}
>
<Form.Item
label={t("timetickets.fields.actualhrs")}
name="actualhrs"
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber precision={1} />
</Form.Item>
<Form.Item
label={t("timetickets.fields.productivehrs")}
name="productivehrs"
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber precision={1} />
</Form.Item>
<Form.Item
name="cost_center"
label={t("timetickets.fields.cost_center")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Select>
{bodyshop.md_responsibility_centers.costs.map((i, idx) => (
<Select.Option key={idx} value={i.name}>
{i.name}
</Select.Option>
))}
</Select>
</Form.Item>
<Button type="primary" htmlType="submit">
{t("general.actions.save")}
</Button>
</Form>
</div>
</Card>
);
return (
<Popover content={overlay} trigger="click">
<Button loading={loading} {...otherBtnProps}>
{t("timetickets.actions.clockout")}
</Button>
</Popover>
);
}
export default connect(mapStateToProps, null)(TechClockOffButton);

View File

@@ -0,0 +1,93 @@
import { Card, List, Typography } from "antd";
import React from "react";
import { useQuery } from "react-apollo";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { QUERY_ACTIVE_TIME_TICKETS } from "../../graphql/timetickets.queries";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import AlertComponent from "../alert/alert.component";
import DataLabel from "../data-label/data-label.component";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import TechClockOffButton from "../tech-job-clock-out-button/tech-job-clock-out-button.component";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
const mapStateToProps = createStructuredSelector({
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function TechClockedInList({ technician }) {
const { loading, error, data, refetch } = useQuery(
QUERY_ACTIVE_TIME_TICKETS,
{
variables: {
employeeId: technician.id,
},
}
);
const { t } = useTranslation();
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
return (
<div>
{data.timetickets.length > 0 ? (
<div>
<Typography.Title level={2}>
{t("timetickets.labels.alreadyclockedon")}
</Typography.Title>
<List
grid={{
gutter: 32,
xs: 1,
sm: 2,
md: 3,
lg: 4,
xl: 5,
xxl: 6,
}}
dataSource={data.timetickets || []}
renderItem={(ticket) => (
<List.Item>
<Card
title={
<Link to={`/tech/joblookup?selected=${ticket.job.id}`}>
{`${ticket.job.ro_number || ticket.job.est_number} ${
ticket.job.ownr_fn || ""
} ${ticket.job.ownr_ln || ""} ${
ticket.job.ownr_co_nm || ""
}`}
</Link>
}
actions={[
<TechClockOffButton
timeTicketId={ticket.id}
completedCallback={refetch}
/>,
]}
>
<div>
{`
${ticket.job.v_model_yr || ""} ${
ticket.job.v_make_desc || ""
} ${ticket.job.v_model_desc || ""}`}
</div>
<DataLabel label={t("timetickets.fields.clockon")}>
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
</DataLabel>
</Card>
</List.Item>
)}
></List>
</div>
) : null}
</div>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(TechClockedInList);

View File

@@ -43,7 +43,7 @@ export function TechSider({ technician, techLogout }) {
disabled={!!!technician} disabled={!!!technician}
icon={<Icon component={MdTimer} />} icon={<Icon component={MdTimer} />}
> >
<Link to={`/tech/clockin`}>{t("menus.tech.clockin")}</Link> <Link to={`/tech/jobclockin`}>{t("menus.tech.jobclockin")}</Link>
</Menu.Item> </Menu.Item>
<Menu.Item <Menu.Item
key="4" key="4"

View File

@@ -6,7 +6,12 @@ import { alphaSort } from "../../utils/sorters";
import { DateFormatter } from "../../utils/DateFormatter"; import { DateFormatter } from "../../utils/DateFormatter";
import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component"; import TimeTicketEnterButton from "../time-ticket-enter-button/time-ticket-enter-button.component";
export default function TimeTicketList({ loading, timetickets, refetch }) { export default function TimeTicketList({
loading,
timetickets,
refetch,
techConsole,
}) {
const [state, setState] = useState({ const [state, setState] = useState({
sortedInfo: {}, sortedInfo: {},
filteredInfo: { text: "" }, filteredInfo: { text: "" },
@@ -65,14 +70,17 @@ export default function TimeTicketList({ loading, timetickets, refetch }) {
title: t("general.labels.actions"), title: t("general.labels.actions"),
dataIndex: "actions", dataIndex: "actions",
key: "actions", key: "actions",
render: (text, record) => ( render: (text, record) => {
<TimeTicketEnterButton if (techConsole) return null;
actions={{ refetch }} return (
context={{ id: record.id, timeticket: record }} <TimeTicketEnterButton
> actions={{ refetch }}
{t("general.actions.edit")} context={{ id: record.id, timeticket: record }}
</TimeTicketEnterButton> >
), {t("general.actions.edit")}
</TimeTicketEnterButton>
);
},
}, },
]; ];

View File

@@ -26,6 +26,13 @@ export const INSERT_NEW_TIME_TICKET = gql`
insert_timetickets(objects: $timeTicketInput) { insert_timetickets(objects: $timeTicketInput) {
returning { returning {
id id
clockon
clockoff
employeeid
productivehrs
actualhrs
ciecacode
date
} }
} }
} }
@@ -42,6 +49,16 @@ export const UPDATE_TIME_TICKET = gql`
) { ) {
returning { returning {
id id
clockon
clockoff
employeeid
productivehrs
actualhrs
ciecacode
created_at
updated_at
jobid
date
} }
} }
} }
@@ -51,11 +68,24 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
query QUERY_ACTIVE_TIME_TICKETS($employeeId: uuid) { query QUERY_ACTIVE_TIME_TICKETS($employeeId: uuid) {
timetickets( timetickets(
where: { where: {
_and: { clockoff: { _is_null: true }, employeeid: { _eq: $employeeId } } _and: {
clockoff: { _is_null: true }
employeeid: { _eq: $employeeId }
clockon: { _is_null: false }
}
} }
) { ) {
id id
clockon
job { job {
id
est_number
ownr_fn
ownr_ln
ownr_co_nm
v_model_desc
v_make_desc
v_model_yr
ro_number ro_number
} }
} }

View File

@@ -0,0 +1,12 @@
import React from "react";
import TechClockInFormContainer from "../../components/tech-job-clock-in-form/tech-job-clock-in-form.container";
import TechClockedInList from "../../components/tech-job-clocked-in-list/tech-job-clocked-in-list.component";
export default function TechClockComponent() {
return (
<div>
<TechClockInFormContainer />
<TechClockedInList />
</div>
);
}

View File

@@ -27,8 +27,8 @@ const ProductionListPage = lazy(() =>
const ProductionBoardPage = lazy(() => const ProductionBoardPage = lazy(() =>
import("../production-board/production-board.container") import("../production-board/production-board.container")
); );
const TechClockIn = lazy(() => const TechJobClockIn = lazy(() =>
import("../../components/tech-clock-in/tech-clock-in.container") import("../tech-job-clock/tech-job-clock.component")
); );
const { Content } = Layout; const { Content } = Layout;
@@ -81,8 +81,8 @@ export function TechPage({ technician, match }) {
/>{" "} />{" "}
<Route <Route
exact exact
path={`${match.path}/clockin`} path={`${match.path}/jobclockin`}
component={TechClockIn} component={TechJobClockIn}
/> />
<Route <Route
exact exact

View File

@@ -11,8 +11,8 @@ import techReducer from "./tech/tech.reducer";
const persistConfig = { const persistConfig = {
key: "root", key: "root",
storage, storage,
whitelist: ["messaging"], whitelist: ["messaging", "tech"],
blacklist: ["user", "email", "modals", "tech"], blacklist: ["user", "email", "modals"],
}; };
const rootReducer = combineReducers({ const rootReducer = combineReducers({

View File

@@ -1,11 +1,11 @@
import TechActionTypes from "./tech.types"; import TechActionTypes from "./tech.types";
const INITIAL_STATE = { const INITIAL_STATE = {
//technician: null, technician: null,
technician: { // technician: {
employee_number: "101", // employee_number: "101",
first_name: "***HARDCODED", // first_name: "***HARDCODED",
last_name: "IN REDUCER***", // last_name: "IN REDUCER***",
}, // },
loginLoading: false, loginLoading: false,
loginError: null, loginError: null,
}; };

View File

@@ -829,9 +829,9 @@
"shops": "My Shops" "shops": "My Shops"
}, },
"tech": { "tech": {
"clockin": "Clock In",
"clockout": "Clock Out",
"home": "Home", "home": "Home",
"jobclockin": "Job Clock In",
"jobclockout": "Job Clock Out",
"joblookup": "Job Lookup", "joblookup": "Job Lookup",
"login": "Login", "login": "Login",
"logout": "Logout", "logout": "Logout",
@@ -1068,11 +1068,19 @@
}, },
"timetickets": { "timetickets": {
"actions": { "actions": {
"clockin": "Clock In",
"clockout": "Clock Out",
"enter": "Enter New Time Ticket" "enter": "Enter New Time Ticket"
}, },
"errors": {
"clockingin": "Error while clocking in. {{message}}",
"clockingout": "Error while clocking out. {{message}}"
},
"fields": { "fields": {
"actualhrs": "Actual Hours", "actualhrs": "Actual Hours",
"ciecacode": "CIECA Code", "ciecacode": "CIECA Code",
"clockoff": "Clock Off",
"clockon": "Clocked In",
"cost_center": "Cost Center", "cost_center": "Cost Center",
"date": "Ticket Date", "date": "Ticket Date",
"employee": "Employee", "employee": "Employee",
@@ -1080,10 +1088,16 @@
"ro_number": "Job to Post Against" "ro_number": "Job to Post Against"
}, },
"labels": { "labels": {
"alreadyclockedon": "You are already clocked in to the following job(s):",
"clockintojob": "Clock In to Job",
"edit": "Edit Time Ticket", "edit": "Edit Time Ticket",
"flat_rate": "Flat Rate", "flat_rate": "Flat Rate",
"new": "New Time Ticket", "new": "New Time Ticket",
"straight_time": "Straight Time" "straight_time": "Straight Time"
},
"successes": {
"clockedin": "Clocked in successfully.",
"clockedout": "Clocked out successfully."
} }
}, },
"titles": { "titles": {

View File

@@ -829,9 +829,9 @@
"shops": "Mis tiendas" "shops": "Mis tiendas"
}, },
"tech": { "tech": {
"clockin": "",
"clockout": "",
"home": "", "home": "",
"jobclockin": "",
"jobclockout": "",
"joblookup": "", "joblookup": "",
"login": "", "login": "",
"logout": "", "logout": "",
@@ -1068,11 +1068,19 @@
}, },
"timetickets": { "timetickets": {
"actions": { "actions": {
"clockin": "",
"clockout": "",
"enter": "" "enter": ""
}, },
"errors": {
"clockingin": "",
"clockingout": ""
},
"fields": { "fields": {
"actualhrs": "", "actualhrs": "",
"ciecacode": "", "ciecacode": "",
"clockoff": "",
"clockon": "",
"cost_center": "", "cost_center": "",
"date": "", "date": "",
"employee": "", "employee": "",
@@ -1080,10 +1088,16 @@
"ro_number": "" "ro_number": ""
}, },
"labels": { "labels": {
"alreadyclockedon": "",
"clockintojob": "",
"edit": "", "edit": "",
"flat_rate": "", "flat_rate": "",
"new": "", "new": "",
"straight_time": "" "straight_time": ""
},
"successes": {
"clockedin": "",
"clockedout": ""
} }
}, },
"titles": { "titles": {

View File

@@ -829,9 +829,9 @@
"shops": "Mes boutiques" "shops": "Mes boutiques"
}, },
"tech": { "tech": {
"clockin": "",
"clockout": "",
"home": "", "home": "",
"jobclockin": "",
"jobclockout": "",
"joblookup": "", "joblookup": "",
"login": "", "login": "",
"logout": "", "logout": "",
@@ -1068,11 +1068,19 @@
}, },
"timetickets": { "timetickets": {
"actions": { "actions": {
"clockin": "",
"clockout": "",
"enter": "" "enter": ""
}, },
"errors": {
"clockingin": "",
"clockingout": ""
},
"fields": { "fields": {
"actualhrs": "", "actualhrs": "",
"ciecacode": "", "ciecacode": "",
"clockoff": "",
"clockon": "",
"cost_center": "", "cost_center": "",
"date": "", "date": "",
"employee": "", "employee": "",
@@ -1080,10 +1088,16 @@
"ro_number": "" "ro_number": ""
}, },
"labels": { "labels": {
"alreadyclockedon": "",
"clockintojob": "",
"edit": "", "edit": "",
"flat_rate": "", "flat_rate": "",
"new": "", "new": "",
"straight_time": "" "straight_time": ""
},
"successes": {
"clockedin": "",
"clockedout": ""
} }
}, },
"titles": { "titles": {

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."timetickets" ALTER COLUMN "ciecacode" SET NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."timetickets" ALTER COLUMN "ciecacode" DROP NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."timetickets" ALTER COLUMN "jobid" SET NOT NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."timetickets" ALTER COLUMN "jobid" DROP NOT NULL;
type: run_sql

View File

@@ -89,6 +89,9 @@ app.post("/stripe/payment", stripe.payment);
var tech = require("./server/tech/tech"); var tech = require("./server/tech/tech");
app.post("/tech/login", tech.techLogin); app.post("/tech/login", tech.techLogin);
var utils = require("./server/utils/utils");
app.post("/utils/time", utils.servertime);
//Serve React App if in Production //Serve React App if in Production
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
app.use(express.static(path.join(__dirname, "client/build"))); app.use(express.static(path.join(__dirname, "client/build")));

3
server/utils/utils.js Normal file
View File

@@ -0,0 +1,3 @@
exports.servertime = (req, res) => {
res.status(200).send(new Date());
};