Added shift clock framework + login on tech console BOD-97 BOD-188

This commit is contained in:
Patrick Fic
2020-07-16 10:17:23 -07:00
parent bf74d9a042
commit 6a8b59c7e6
67 changed files with 1791 additions and 217 deletions

View File

@@ -1,4 +1,4 @@
<babeledit_project version="1.2" be_version="2.6.1">
<babeledit_project be_version="2.6.1" version="1.2">
<!--
BabelEdit project file
@@ -17556,6 +17556,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>memo</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>productivehrs</name>
<definition_loaded>false</definition_loaded>
@@ -17624,6 +17645,48 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>ambreak</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>amshift</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>
@@ -17708,6 +17771,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>lunch</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>new</name>
<definition_loaded>false</definition_loaded>
@@ -17729,6 +17813,90 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>pmbreak</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>pmshift</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>shift</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>shiftalreadyclockedon</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>straight_time</name>
<definition_loaded>false</definition_loaded>

View File

@@ -55,7 +55,8 @@
}
::-webkit-scrollbar {
width: .25rem;
width: 0.25rem;
max-height: 0.25rem;
background-color: #f5f5f5;
}

View File

@@ -155,6 +155,9 @@ export function ShopEmployeesFormComponent({
]}>
<InputNumber />
</Form.Item>
<Form.Item label={t("employees.fields.user_email")} name='user_email'>
<Input />
</Form.Item>
</Form>
);
}

View File

@@ -8,14 +8,14 @@ import {
DELETE_EMPLOYEE,
INSERT_EMPLOYEES,
QUERY_EMPLOYEES,
UPDATE_EMPLOYEE
UPDATE_EMPLOYEE,
} from "../../graphql/employees.queries";
import { selectBodyshop } from "../../redux/user/user.selectors";
import AlertComponent from "../alert/alert.component";
import ShopEmployeeComponent from "./shop-employees.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
bodyshop: selectBodyshop,
});
function ShopEmployeesContainer({ bodyshop }) {
@@ -23,69 +23,75 @@ function ShopEmployeesContainer({ bodyshop }) {
const { t } = useTranslation();
const employeeState = useState(null);
const { loading, error, data, refetch } = useQuery(QUERY_EMPLOYEES, {
fetchPolicy: "network-only"
fetchPolicy: "network-only",
});
const [updateEmployee] = useMutation(UPDATE_EMPLOYEE);
const [insertEmployees] = useMutation(INSERT_EMPLOYEES);
const [deleteEmployee] = useMutation(DELETE_EMPLOYEE);
const handleDelete = id => {
const handleDelete = (id) => {
deleteEmployee({ variables: { id: id } })
.then(r => {
.then((r) => {
notification["success"]({
message: t("employees.successes.delete")
message: t("employees.successes.delete"),
});
//TODO Better way to reset the field decorators?
employeeState[1](null);
refetch().then(r => form.resetFields());
refetch().then((r) => form.resetFields());
})
.catch(error => {
.catch((error) => {
notification["error"]({
message: t("employees.errors.delete")
message: t("employees.errors.delete", {
message: JSON.stringify(error),
}),
});
});
};
const handleFinish = values => {
const handleFinish = (values) => {
console.log("values", values);
if (employeeState[0].id) {
//Update a record.
updateEmployee({
variables: { id: employeeState[0].id, employee: values }
variables: { id: employeeState[0].id, employee: values },
})
.then(r => {
.then((r) => {
notification["success"]({
message: t("employees.successes.save")
message: t("employees.successes.save"),
});
//TODO Better way to reset the field decorators?
employeeState[1](null);
refetch().then(r => form.resetFields());
refetch().then((r) => form.resetFields());
})
.catch(error => {
.catch((error) => {
notification["error"]({
message: t("employees.errors.save")
message: t("employees.errors.save", {
message: JSON.stringify(error),
}),
});
});
} else {
//New record, insert it.
insertEmployees({
variables: { employees: [{ ...values, shopid: bodyshop.id }] }
}).then(r => {
variables: { employees: [{ ...values, shopid: bodyshop.id }] },
}).then((r) => {
notification["success"]({
message: t("employees.successes.save")
message: t("employees.successes.save"),
});
//TODO Better way to reset the field decorators?
employeeState[1](null);
refetch().catch(error => {
refetch().catch((error) => {
notification["error"]({
message: t("employees.errors.save")
message: t("employees.errors.save", {
message: JSON.stringify(error),
}),
});
});
});
}
};
if (error) return <AlertComponent message={error.message} type="error" />;
if (error) return <AlertComponent message={error.message} type='error' />;
return (
<ShopEmployeeComponent

View File

@@ -1,5 +1,6 @@
import { Button, Form, notification, Card } from "antd";
import React from "react";
import { Button, Card, Form, notification } from "antd";
import axios from "axios";
import React, { useState } from "react";
import { useMutation } from "react-apollo";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -16,29 +17,35 @@ const mapStateToProps = createStructuredSelector({
export function TechClockInContainer({ technician, bodyshop }) {
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET, {
refetchQueries: ["QUERY_ACTIVE_TIME_TICKETS"],
});
const { t } = useTranslation();
const handleFinish = async (values) => {
setLoading(true);
const theTime = (await axios.post("/utils/time")).data;
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) => {
return (
bodyshop.md_responsibility_centers.defaults.costs[key] ===
values.cost_center
);
}),
},
timeTicketInput: [
{
bodyshopid: bodyshop.id,
employeeid: technician.id,
date: theTime,
clockon: theTime,
jobid: values.jobid,
cost_center: technician.cost_center,
ciecacode: Object.keys(
bodyshop.md_responsibility_centers.defaults.costs
).find((key) => {
return (
bodyshop.md_responsibility_centers.defaults.costs[key] ===
values.cost_center
);
}),
},
],
},
});
@@ -53,13 +60,14 @@ export function TechClockInContainer({ technician, bodyshop }) {
message: t("timetickets.successes.clockedin"),
});
}
setLoading(false);
};
return (
<div>
<Card title={t("timetickets.labels.clockintojob")}>
<Form form={form} layout="vertical" onFinish={handleFinish}>
<Button type="primary" htmlType="submit">
<Form form={form} layout='vertical' onFinish={handleFinish}>
<Button type='primary' htmlType='submit' loading={loading}>
{t("timetickets.actions.clockin")}
</Button>
<TechClockInComponent form={form} />

View File

@@ -11,7 +11,7 @@ import {
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { UPDATE_TIME_TICKET } from "../../graphql/timetickets.queries";
import axios from "axios";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
@@ -27,6 +27,7 @@ export function TechClockOffButton({
technician,
timeTicketId,
completedCallback,
isShiftTicket,
otherBtnProps,
}) {
const [loading, setLoading] = useState(false);
@@ -40,7 +41,10 @@ export function TechClockOffButton({
const result = await updateTimeticket({
variables: {
timeticketId: timeTicketId,
timeticket: { clockoff: new Date(), ...values },
timeticket: {
clockoff: (await axios.post("/utils/time")).data,
...values,
},
},
});
@@ -64,65 +68,76 @@ export function TechClockOffButton({
<div>
<Form
form={form}
layout="vertical"
layout='vertical'
onFinish={handleFinish}
initialValues={{
cost_center: technician ? technician.cost_center : null,
}}
>
cost_center: isShiftTicket
? "timetickets.labels.shift"
: technician
? technician.cost_center
: null,
}}>
{!isShiftTicket ? (
<div>
<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>
</div>
) : 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"
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 disabled={isShiftTicket}>
{isShiftTicket ? (
<Select.Option value='timetickets.labels.shift'>
{t("timetickets.labels.shift")}
</Select.Option>
))}
) : (
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">
<Button type='primary' htmlType='submit' loading={loading}>
{t("general.actions.save")}
</Button>
<TechJobClockoutDelete timeTicketId={timeTicketId} />
<TechJobClockoutDelete completedCallback={completedCallback} timeTicketId={timeTicketId} />
</Form>
</div>
</Card>
);
return (
<Popover content={overlay} trigger="click">
<Popover content={overlay} trigger='click'>
<Button loading={loading} {...otherBtnProps}>
{t("timetickets.actions.clockout")}
</Button>

View File

@@ -5,7 +5,10 @@ import { DELETE_TIME_TICKET } from "../../graphql/timetickets.queries";
import { useTranslation } from "react-i18next";
import { useMutation } from "@apollo/react-hooks";
export default function TechJobClockoutDelete({ timeTicketId }) {
export default function TechJobClockoutDelete({
timeTicketId,
completedCallback,
}) {
const [deleteTimeTicket] = useMutation(DELETE_TIME_TICKET);
const { t } = useTranslation();
const handleDelete = async () => {
@@ -25,6 +28,7 @@ export default function TechJobClockoutDelete({ timeTicketId }) {
message: t("timetickets.successes.deleted"),
});
}
if (completedCallback) completedCallback();
};
return (
@@ -32,8 +36,7 @@ export default function TechJobClockoutDelete({ timeTicketId }) {
title={t("timetickets.labels.deleteconfirm")}
okButtonProps={{ type: "danger" }}
okText={t("general.actions.delete")}
onConfirm={handleDelete}
>
onConfirm={handleDelete}>
<DeleteFilled style={{ margin: "1rem", color: "red" }} />
</Popconfirm>
);

View File

@@ -2,17 +2,17 @@ import { Card, List, Typography } from "antd";
import React from "react";
import { useQuery } from "react-apollo";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { QUERY_ACTIVE_TIME_TICKETS } from "../../graphql/timetickets.queries";
import { selectTechnician } from "../../redux/tech/tech.selectors";
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,
});

View File

@@ -2,6 +2,7 @@ import Icon, { SearchOutlined } from "@ant-design/icons";
import { Layout, Menu } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { FaBusinessTime } from "react-icons/fa";
import { FiLogIn, FiLogOut } from "react-icons/fi";
import { MdTimer } from "react-icons/md";
import { connect } from "react-redux";
@@ -9,6 +10,7 @@ import { Link } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { techLogout } from "../../redux/tech/tech.actions";
import { selectTechnician } from "../../redux/tech/tech.selectors";
const { Sider } = Layout;
const mapStateToProps = createStructuredSelector({
@@ -27,36 +29,39 @@ export function TechSider({ technician, techLogout }) {
return (
<Sider collapsible collapsed={collapsed} onCollapse={onCollapse}>
<Menu theme="dark" defaultSelectedKeys={["1"]} mode="inline">
<Menu theme='dark' defaultSelectedKeys={["1"]} mode='inline'>
<Menu.Item
key="1"
key='1'
disabled={!!technician}
icon={<Icon component={FiLogIn} />}
>
icon={<Icon component={FiLogIn} />}>
<Link to={`/tech/login`}>{t("menus.tech.login")}</Link>
</Menu.Item>
<Menu.Item key="2" disabled={!!!technician} icon={<SearchOutlined />}>
<Menu.Item key='2' disabled={!!!technician} icon={<SearchOutlined />}>
<Link to={`/tech/joblookup`}>{t("menus.tech.joblookup")}</Link>
</Menu.Item>
<Menu.Item
key="3"
key='3'
disabled={!!!technician}
icon={<Icon component={MdTimer} />}
>
<Link to={`/tech/jobclockin`}>{t("menus.tech.jobclockin")}</Link>
icon={<Icon component={FaBusinessTime} />}>
<Link to={`/tech/jobclock`}>{t("menus.tech.jobclockin")}</Link>
</Menu.Item>
<Menu.Item key="5" disabled={!!!technician} icon={<SearchOutlined />}>
<Menu.Item
key='4'
disabled={!!!technician}
icon={<Icon component={MdTimer} />}>
<Link to={`/tech/shiftclock`}>{t("menus.tech.shiftclockin")}</Link>
</Menu.Item>
<Menu.Item key='5' disabled={!!!technician} icon={<SearchOutlined />}>
<Link to={`/tech/list`}>{t("menus.tech.productionlist")}</Link>
</Menu.Item>
<Menu.Item key="6" disabled={!!!technician} icon={<SearchOutlined />}>
<Menu.Item key='6' disabled={!!!technician} icon={<SearchOutlined />}>
<Link to={`/tech/board`}> {t("menus.tech.productionboard")}</Link>
</Menu.Item>
<Menu.Item
key="7"
key='7'
disabled={!!!technician}
onClick={() => techLogout()}
icon={<Icon component={FiLogOut} />}
>
icon={<Icon component={FiLogOut} />}>
{t("menus.tech.logout")}
</Menu.Item>
</Menu>

View File

@@ -19,15 +19,14 @@ export default function TimeTicketModalComponent({
<div>
<div style={{ display: "flex" }}>
<Form.Item
name="jobid"
name='jobid'
label={t("timetickets.fields.ro_number")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<JobSearchSelect
options={roAutoCompleteOptions}
onBlur={() => {
@@ -40,15 +39,14 @@ export default function TimeTicketModalComponent({
/>
</Form.Item>
<Form.Item
name="employeeid"
name='employeeid'
label={t("timetickets.fields.employee")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<EmployeeSearchSelect options={employeeAutoCompleteOptions} />
</Form.Item>
</div>
@@ -56,71 +54,65 @@ export default function TimeTicketModalComponent({
<div style={{ display: "flex" }}>
<Form.Item
label={t("timetickets.fields.date")}
name="date"
name='date'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<DatePicker />
</Form.Item>
<Form.Item
label={t("timetickets.fields.productivehrs")}
name="productivehrs"
name='productivehrs'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber />
]}>
<InputNumber min={0} precision={1} />
</Form.Item>
<Form.Item
label={t("timetickets.fields.actualhrs")}
name="actualhrs"
name='actualhrs'
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber />
]}>
<InputNumber min={0} precision={1} />
</Form.Item>
<Form.Item
name="cost_center"
name='cost_center'
label={t("timetickets.fields.cost_center")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<Select
style={{ width: "150px" }}
onChange={() => {
console.log("Changed.");
}}
>
}}>
{responsibilityCenters.costs.map((item) => (
<Select.Option key={item.name}>{item.name}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item
name="ciecacode"
name='ciecacode'
label={t("timetickets.fields.ciecacode")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
]}>
<Input disabled />
</Form.Item>
</div>

View File

@@ -59,7 +59,7 @@ export function TimeTicketModalContainer({
} else {
insertTicket({
variables: {
timeTicketInput: [values],
timeTicketInput: [{ ...values, bodyshop: bodyshop.id }],
},
})
.then(handleMutationSuccess)
@@ -108,22 +108,21 @@ export function TimeTicketModalContainer({
);
form.setFieldsValue({
cost_center: emps.length > 0 ? emps[0].cost_center : "",
ciecacode: Object.keys(
bodyshop.md_responsibility_centers.defaults
).find(
(key) =>
bodyshop.md_responsibility_centers.defaults[key] ===
emps[0].cost_center
),
ciecacode:
Object.keys(bodyshop.md_responsibility_centers.defaults.costs).find(
(key) =>
bodyshop.md_responsibility_centers.defaults.costs[key] ===
emps[0].cost_center
) || "LAB",
});
}
if (!!changedFields.cost_center && !!EmployeeAutoCompleteData) {
form.setFieldsValue({
ciecacode: Object.keys(
bodyshop.md_responsibility_centers.defaults
bodyshop.md_responsibility_centers.defaults.costs
).find(
(key) =>
bodyshop.md_responsibility_centers.defaults[key] ===
bodyshop.md_responsibility_centers.defaults.costs[key] ===
changedFields.cost_center
),
});
@@ -152,18 +151,16 @@ export function TimeTicketModalContainer({
</Button>
{timeTicketModal.context && timeTicketModal.context.id ? null : (
<Button
type="primary"
type='primary'
onClick={() => {
setEnterAgain(true);
}}
>
}}>
{t("general.actions.saveandnew")}
</Button>
)}
</span>
}
destroyOnClose
>
destroyOnClose>
<Form
onFinish={handleFinish}
autoComplete={"off"}
@@ -178,8 +175,7 @@ export function TimeTicketModalContainer({
}
: { jobid: timeTicketModal.context.jobId || null }
}
onValuesChange={handleFieldsChange}
>
onValuesChange={handleFieldsChange}>
<TimeTicketModalComponent
form={form}
roAutoCompleteOptions={RoAutoCompleteData && RoAutoCompleteData.jobs}

View File

@@ -0,0 +1,50 @@
import { Card, List, Typography } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import DataLabel from "../data-label/data-label.component";
import TechClockOffButton from "../tech-job-clock-out-button/tech-job-clock-out-button.component";
export default function TimeTicketShiftActive({ timetickets, refetch }) {
const { t } = useTranslation();
return (
<div>
{timetickets.length > 0 ? (
<div>
<Typography.Title level={2}>
{t("timetickets.labels.shiftalreadyclockedon")}
</Typography.Title>
<List
grid={{
gutter: 32,
xs: 1,
sm: 2,
md: 3,
lg: 4,
xl: 5,
xxl: 6,
}}
dataSource={timetickets || []}
renderItem={(ticket) => (
<List.Item>
<Card
title={t(ticket.memo)}
actions={[
<TechClockOffButton
timeTicketId={ticket.id}
completedCallback={refetch}
isShiftTicket
/>,
]}>
<DataLabel label={t("timetickets.fields.clockon")}>
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
</DataLabel>
</Card>
</List.Item>
)}></List>
</div>
) : null}
</div>
);
}

View File

@@ -0,0 +1,53 @@
import { Form, InputNumber, Select } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function TimeTicketShiftFormComponent({ bodyshop, form }) {
const { t } = useTranslation();
return (
<div>
<Form.Item
name='memo'
label={t("timetickets.fields.memo")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}>
<Select>
<Select.Option value='timetickets.labels.amshift'>
{t("timetickets.labels.amshift")}
</Select.Option>
<Select.Option value='timetickets.labels.ambreak'>
{t("timetickets.labels.ambreak")}
</Select.Option>
<Select.Option value='timetickets.labels.lunch'>
{t("timetickets.labels.lunch")}
</Select.Option>
<Select.Option value='timetickets.labels.pmshift'>
{t("timetickets.labels.pmshift")}
</Select.Option>
<Select.Option value='timetickets.labels.pmbreak'>
{t("timetickets.labels.pmbreak")}
</Select.Option>
</Select>
</Form.Item>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(TimeTicketShiftFormComponent);

View File

@@ -0,0 +1,90 @@
import { useMutation } from "@apollo/react-hooks";
import { Button, Form, notification } from "antd";
import React, { useState } from "react";
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 TimeTicektShiftComponent from "./time-ticket-shift-form.component";
import axios from "axios";
import moment from "moment";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function TimeTicektShiftContainer({
bodyshop,
technician,
isTechConsole,
}) {
const [form] = Form.useForm();
const [insertTimeTicket] = useMutation(INSERT_NEW_TIME_TICKET);
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const handleFinish = async (values) => {
setLoading(true);
console.log(values);
const theTime = moment((await axios.post("/utils/time")).data);
const result = await insertTimeTicket({
variables: {
timeTicketInput: [
{
bodyshopid: bodyshop.id,
employeeid: isTechConsole
? technician.id
: bodyshop.associations[0].user.employee.id,
cost_center: "timetickets.labels.shift",
clockon: theTime,
date: theTime,
memo: values.memo,
},
],
},
awaitRefetchQueries: true,
refetchQueries: ["QUERY_ACTIVE_SHIFT_TIME_TICKETS"],
});
if (!!result.errors) {
notification["error"]({
message: t("timetickets.errors.clockingin", {
message: JSON.stringify(result.errors),
}),
});
} else {
notification["success"]({
message: t("timetickets.successes.clockedin"),
});
}
setLoading(false);
};
return (
<div>
The form TimeTicektShiftContainer
<Form
form={form}
layout='vertical'
autoComplete='no'
onFinish={handleFinish}
initialValues={{ cost_center: t("timetickets.labels.shift") }}>
<TimeTicektShiftComponent form={form} />
<Button htmlType='submit' loading={loading}>
{t("timetickets.actions.clockin")}
</Button>
</Form>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(TimeTicektShiftContainer);

View File

@@ -0,0 +1,57 @@
import React from "react";
import { useQuery } from "react-apollo";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { QUERY_ACTIVE_SHIFT_TIME_TICKETS } from "../../graphql/timetickets.queries";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import AlertComponent from "../alert/alert.component";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
import TimeTicketShiftActive from "../time-ticket-shift-active/time-ticket-shift-active.component";
import TimeTicketShiftFormContainer from "../time-ticket-shift-form/time-ticket-shift-form.container";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function TimeTicketShiftContainer({
bodyshop,
technician,
isTechConsole,
}) {
const { loading, error, data, refetch } = useQuery(
QUERY_ACTIVE_SHIFT_TIME_TICKETS,
{
variables: {
employeeId: isTechConsole
? technician.id
: bodyshop.associations[0].user.employee.id,
},
}
);
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type='error' />;
return (
<div>
{data.timetickets.length > 0 ? (
<TimeTicketShiftActive
timetickets={data ? data.timetickets : []}
refetch={refetch}
/>
) : (
<TimeTicketShiftFormContainer isTechConsole={isTechConsole} />
)}
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(TimeTicketShiftContainer);

View File

@@ -8,6 +8,9 @@ export const QUERY_BODYSHOP = gql`
authid
email
dashboardlayout
employee {
id
}
}
}
address1

View File

@@ -14,6 +14,7 @@ export const QUERY_EMPLOYEES = gql`
cost_center
base_rate
pin
user_email
}
}
`;
@@ -43,6 +44,7 @@ export const UPDATE_EMPLOYEE = gql`
cost_center
base_rate
pin
user_email
}
}
}

View File

@@ -72,11 +72,13 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
clockoff: { _is_null: true }
employeeid: { _eq: $employeeId }
clockon: { _is_null: false }
jobid: {_is_null: false}
}
}
) {
id
clockon
memo
job {
id
est_number
@@ -91,6 +93,37 @@ export const QUERY_ACTIVE_TIME_TICKETS = gql`
}
}
`;
export const QUERY_ACTIVE_SHIFT_TIME_TICKETS = gql`
query QUERY_ACTIVE_SHIFT_TIME_TICKETS($employeeId: uuid) {
timetickets(
where: {
_and: {
clockoff: { _is_null: true }
employeeid: { _eq: $employeeId }
clockon: { _is_null: false }
jobid: {_is_null: true}
}
}
) {
id
clockon
memo
job {
id
est_number
ownr_fn
ownr_ln
ownr_co_nm
v_model_desc
v_make_desc
v_model_yr
ro_number
}
}
}
`;
export const DELETE_TIME_TICKET = gql`
mutation DELETE_TIME_TICKET($id: uuid!) {
delete_timetickets_by_pk(id: $id) {

View File

@@ -0,0 +1,10 @@
import React from "react";
import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shift.container";
export default function TechShiftClock() {
return (
<div>
<TimeTicketShift isTechConsole />
</div>
);
}

View File

@@ -27,9 +27,12 @@ const ProductionListPage = lazy(() =>
const ProductionBoardPage = lazy(() =>
import("../production-board/production-board.container")
);
const TechJobClockIn = lazy(() =>
const TechJobClock = lazy(() =>
import("../tech-job-clock/tech-job-clock.component")
);
const TechShiftClock = lazy(() =>
import("../tech-shift-clock/tech-shift-clock.component")
);
const { Content } = Layout;
@@ -48,19 +51,18 @@ export function TechPage({ technician, match }) {
}, [t]);
return (
<Layout className="tech-layout-container">
<Layout className='tech-layout-container'>
<TechSider />
<Layout>
{technician ? null : <Redirect to={`${match.path}/login`} />}
<TechHeader />
<Content className="tech-content-container">
<Content className='tech-content-container'>
<FcmNotification />
<ErrorBoundary>
<Suspense
fallback={
<LoadingSpinner message={t("general.labels.loadingapp")} />
}
>
}>
<TimeTicketModalContainer />
<PrintCenterModalContainer />
<Switch>
@@ -78,11 +80,16 @@ export function TechPage({ technician, match }) {
exact
path={`${match.path}/list`}
component={ProductionListPage}
/>{" "}
/>
<Route
exact
path={`${match.path}/jobclockin`}
component={TechJobClockIn}
path={`${match.path}/jobclock`}
component={TechJobClock}
/>
<Route
exact
path={`${match.path}/shiftclock`}
component={TechShiftClock}
/>
<Route
exact

View File

@@ -27,6 +27,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
...state,
technician: action.payload,
loginLoading: false,
loginError: false,
};
case TechActionTypes.TECH_LOGIN_FAILURE:
return {

View File

@@ -351,8 +351,8 @@
"new": "New Employee"
},
"errors": {
"delete": "Error encountered while deleting employee.",
"save": "Error encountered saving employee.",
"delete": "Error encountered while deleting employee. {{message}}",
"save": "Error encountered saving employee. {{message}}",
"validation": "Please check all fields.",
"validationtitle": "Unable to save employee."
},
@@ -1117,16 +1117,24 @@
"cost_center": "Cost Center",
"date": "Ticket Date",
"employee": "Employee",
"memo": "Memo",
"productivehrs": "Productive Hours",
"ro_number": "Job to Post Against"
},
"labels": {
"alreadyclockedon": "You are already clocked in to the following job(s):",
"ambreak": "AM Break",
"amshift": "AM Shift",
"clockintojob": "Clock In to Job",
"deleteconfirm": "Are you sure you want to delete this time ticket? This cannot be undone.",
"edit": "Edit Time Ticket",
"flat_rate": "Flat Rate",
"lunch": "Lunch",
"new": "New Time Ticket",
"pmbreak": "PM Break",
"pmshift": "PM Shift",
"shift": "Shift",
"shiftalreadyclockedon": "Active Shift Time Tickets",
"straight_time": "Straight Time"
},
"successes": {

View File

@@ -351,8 +351,8 @@
"new": "Nuevo empleado"
},
"errors": {
"delete": "Se encontró un error al eliminar al empleado.",
"save": "Se encontró un error al salvar al empleado.",
"delete": "Se encontró un error al eliminar al empleado. {{message}}",
"save": "Se encontró un error al salvar al empleado. {{message}}",
"validation": "Por favor verifique todos los campos.",
"validationtitle": "No se puede salvar al empleado."
},
@@ -1117,16 +1117,24 @@
"cost_center": "",
"date": "",
"employee": "",
"memo": "",
"productivehrs": "",
"ro_number": ""
},
"labels": {
"alreadyclockedon": "",
"ambreak": "",
"amshift": "",
"clockintojob": "",
"deleteconfirm": "",
"edit": "",
"flat_rate": "",
"lunch": "",
"new": "",
"pmbreak": "",
"pmshift": "",
"shift": "",
"shiftalreadyclockedon": "",
"straight_time": ""
},
"successes": {

View File

@@ -351,8 +351,8 @@
"new": "Nouvel employé"
},
"errors": {
"delete": "Erreur rencontrée lors de la suppression de l'employé.",
"save": "Une erreur s'est produite lors de l'enregistrement de l'employé.",
"delete": "Erreur rencontrée lors de la suppression de l'employé. {{message}}",
"save": "Une erreur s'est produite lors de l'enregistrement de l'employé. {{message}}",
"validation": "Veuillez cocher tous les champs.",
"validationtitle": "Impossible d'enregistrer l'employé."
},
@@ -1117,16 +1117,24 @@
"cost_center": "",
"date": "",
"employee": "",
"memo": "",
"productivehrs": "",
"ro_number": ""
},
"labels": {
"alreadyclockedon": "",
"ambreak": "",
"amshift": "",
"clockintojob": "",
"deleteconfirm": "",
"edit": "",
"flat_rate": "",
"lunch": "",
"new": "",
"pmbreak": "",
"pmshift": "",
"shift": "",
"shiftalreadyclockedon": "",
"straight_time": ""
},
"successes": {

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."employees" DROP COLUMN "user_email";
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."employees" ADD COLUMN "user_email" text NULL UNIQUE;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."employees" drop constraint "employees_user_email_fkey";
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."employees"
add constraint "employees_user_email_fkey"
foreign key ("user_email")
references "public"."users"
("email") on update restrict on delete restrict;
type: run_sql

View File

@@ -0,0 +1,12 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."employees" drop constraint "employees_user_email_fkey",
add constraint "employees_user_email_fkey"
foreign key ("shopid")
references "public"."bodyshops"
("id")
on update cascade
on delete cascade;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."employees" drop constraint "employees_user_email_fkey",
add constraint "employees_user_email_fkey"
foreign key ("user_email")
references "public"."users"
("email") on update set null on delete set null;
type: run_sql

View File

@@ -0,0 +1,6 @@
- args:
relationship: employee
table:
name: users
schema: public
type: drop_relationship

View File

@@ -0,0 +1,13 @@
- args:
name: employee
table:
name: users
schema: public
using:
manual_configuration:
column_mapping:
email: user_email
remote_table:
name: employees
schema: public
type: create_object_relationship

View File

@@ -0,0 +1,6 @@
- args:
relationship: user
table:
name: employees
schema: public
type: drop_relationship

View File

@@ -0,0 +1,8 @@
- args:
name: user
table:
name: employees
schema: public
using:
foreign_key_constraint_on: user_email
type: create_object_relationship

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
set: {}
role: user
table:
name: employees
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
- user_email
set: {}
role: user
table:
name: employees
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: employees
schema: public
type: create_select_permission

View File

@@ -0,0 +1,40 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
- user_email
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: employees
schema: public
type: create_select_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_update_permission
- args:
permission:
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: employees
schema: public
type: create_update_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: employees
schema: public
type: drop_update_permission
- args:
permission:
columns:
- active
- base_rate
- cost_center
- created_at
- employee_number
- first_name
- flat_rate
- hire_date
- id
- last_name
- pin
- shopid
- termination_date
- updated_at
- user_email
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: employees
schema: public
type: create_update_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- ciecacode
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,29 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- ciecacode
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."timetickets" drop constraint "timetickets_bodyshopid_fkey";
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."timetickets"
add constraint "timetickets_bodyshopid_fkey"
foreign key ("bodyshopid")
references "public"."bodyshops"
("id") on update restrict on delete restrict;
type: run_sql

View File

@@ -0,0 +1,12 @@
- args:
relationship: timetickets
table:
name: bodyshops
schema: public
type: drop_relationship
- args:
relationship: bodyshop
table:
name: timetickets
schema: public
type: drop_relationship

View File

@@ -0,0 +1,20 @@
- args:
name: timetickets
table:
name: bodyshops
schema: public
using:
foreign_key_constraint_on:
column: bodyshopid
table:
name: timetickets
schema: public
type: create_array_relationship
- args:
name: bodyshop
table:
name: timetickets
schema: public
using:
foreign_key_constraint_on: bodyshopid
type: create_object_relationship

View File

@@ -0,0 +1,29 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check: {}
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- ciecacode
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- ciecacode
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- date
- actualhrs
- productivehrs
- rate
- ciecacode
- cost_center
- clockoff
- clockon
- created_at
- updated_at
- employeeid
- id
- jobid
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_select_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_select_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- ciecacode
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_update_permission
- args:
permission:
columns:
- date
- actualhrs
- productivehrs
- rate
- ciecacode
- cost_center
- clockoff
- clockon
- created_at
- updated_at
- employeeid
- id
- jobid
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: timetickets
schema: public
type: create_update_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_update_permission
- args:
permission:
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: timetickets
schema: public
type: create_update_permission

View File

@@ -0,0 +1,23 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_delete_permission
- args:
permission:
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_delete_permission

View File

@@ -0,0 +1,22 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_delete_permission
- args:
permission:
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_delete_permission

View File

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

View File

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

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_insert_permission
- args:
permission:
check:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
set: {}
role: user
table:
name: timetickets
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_select_permission

View File

@@ -0,0 +1,40 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: timetickets
schema: public
type: create_select_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_update_permission
- args:
permission:
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- productivehrs
- rate
- updated_at
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: timetickets
schema: public
type: create_update_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: timetickets
schema: public
type: drop_update_permission
- args:
permission:
columns:
- actualhrs
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: timetickets
schema: public
type: create_update_permission

View File

@@ -433,6 +433,13 @@ tables:
table:
schema: public
name: templates
- name: timetickets
using:
foreign_key_constraint_on:
column: bodyshopid
table:
schema: public
name: timetickets
- name: vehicles
using:
foreign_key_constraint_on:
@@ -1175,6 +1182,9 @@ tables:
- name: bodyshop
using:
foreign_key_constraint_on: shopid
- name: user
using:
foreign_key_constraint_on: user_email
array_relationships:
- name: allocations
using:
@@ -1217,6 +1227,7 @@ tables:
- shopid
- termination_date
- updated_at
- user_email
select_permissions:
- role: user
permission:
@@ -1235,6 +1246,7 @@ tables:
- shopid
- termination_date
- updated_at
- user_email
filter:
bodyshop:
associations:
@@ -1262,6 +1274,7 @@ tables:
- shopid
- termination_date
- updated_at
- user_email
filter:
bodyshop:
associations:
@@ -3538,6 +3551,9 @@ tables:
schema: public
name: timetickets
object_relationships:
- name: bodyshop
using:
foreign_key_constraint_on: bodyshopid
- name: employee
using:
foreign_key_constraint_on: employeeid
@@ -3548,100 +3564,111 @@ tables:
- role: user
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- id
- created_at
- updated_at
- date
- cost_center
- employeeid
- jobid
- rate
- productivehrs
- actualhrs
- clockon
- clockoff
- bodyshopid
- ciecacode
- clockoff
- clockon
- cost_center
- created_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
select_permissions:
- role: user
permission:
columns:
- date
- actualhrs
- productivehrs
- rate
- bodyshopid
- ciecacode
- cost_center
- clockoff
- clockon
- cost_center
- created_at
- updated_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
update_permissions:
- role: user
permission:
columns:
- date
- actualhrs
- productivehrs
- rate
- bodyshopid
- ciecacode
- cost_center
- clockoff
- clockon
- cost_center
- created_at
- updated_at
- date
- employeeid
- id
- jobid
- memo
- productivehrs
- rate
- updated_at
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
check: null
delete_permissions:
- role: user
permission:
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
- table:
schema: public
name: users
object_relationships:
- name: employee
using:
manual_configuration:
remote_table:
schema: public
name: employees
column_mapping:
email: user_email
array_relationships:
- name: associations
using: