15
client/package-lock.json
generated
15
client/package-lock.json
generated
@@ -10464,6 +10464,8 @@
|
||||
},
|
||||
"node_modules/eventemitter2": {
|
||||
"version": "6.4.7",
|
||||
"resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz",
|
||||
"integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@@ -22110,19 +22112,6 @@
|
||||
"is-typedarray": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-compare": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz",
|
||||
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
} from "../redux/user/user.selectors";
|
||||
import PrivateRoute from "../utils/private-route";
|
||||
import "./App.styles.scss";
|
||||
import handleBeta from "../utils/handleBeta";
|
||||
|
||||
const ResetPassword = lazy(() =>
|
||||
import("../pages/reset-password/reset-password.component")
|
||||
@@ -57,7 +58,6 @@ export function App({
|
||||
if (!navigator.onLine) {
|
||||
setOnline(false);
|
||||
}
|
||||
|
||||
checkUserSession();
|
||||
}, [checkUserSession, setOnline]);
|
||||
|
||||
@@ -73,6 +73,7 @@ export function App({
|
||||
window.addEventListener("online", function (e) {
|
||||
setOnline(true);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (currentUser.authorized && bodyshop) {
|
||||
client.setAttribute("imexshopid", bodyshop.imexshopid);
|
||||
@@ -107,6 +108,8 @@ export function App({
|
||||
/>
|
||||
);
|
||||
|
||||
handleBeta();
|
||||
|
||||
return (
|
||||
<Switch>
|
||||
<Suspense fallback={<LoadingSpinner />}>
|
||||
|
||||
@@ -13,7 +13,7 @@ import Icon, {
|
||||
FileFilled,
|
||||
//GlobalOutlined,
|
||||
HomeFilled,
|
||||
ImportOutlined,
|
||||
ImportOutlined, InfoCircleOutlined,
|
||||
LineChartOutlined,
|
||||
PaperClipOutlined,
|
||||
PhoneOutlined,
|
||||
@@ -26,8 +26,8 @@ import Icon, {
|
||||
UserOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||
import { Layout, Menu } from "antd";
|
||||
import React from "react";
|
||||
import {Layout, Menu, Switch, Tooltip} from "antd";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { BsKanban } from "react-icons/bs";
|
||||
import {
|
||||
@@ -52,6 +52,7 @@ import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import {handleBeta, setBeta, checkBeta} from "../../utils/handleBeta";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -102,9 +103,21 @@ function Header({
|
||||
{},
|
||||
bodyshop && bodyshop.imexshopid
|
||||
);
|
||||
const [betaSwitch, setBetaSwitch] = useState(false);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
const isBeta = checkBeta();
|
||||
setBetaSwitch(isBeta);
|
||||
}, []);
|
||||
|
||||
const betaSwitchChange = (checked) => {
|
||||
setBeta(checked);
|
||||
setBetaSwitch(checked);
|
||||
handleBeta();
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout.Header>
|
||||
<Menu
|
||||
@@ -430,6 +443,17 @@ function Header({
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu.SubMenu>
|
||||
<Menu.Item style={{marginLeft: 'auto'}} key="profile">
|
||||
<Tooltip title="A more modern ImEX Online is ready for you to try! You can switch back at any time.">
|
||||
<InfoCircleOutlined/>
|
||||
<span style={{marginRight: 8}}>Try the new ImEX Online</span>
|
||||
<Switch
|
||||
checked={betaSwitch}
|
||||
onChange={betaSwitchChange}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Menu.Item>
|
||||
|
||||
</Menu>
|
||||
</Layout.Header>
|
||||
);
|
||||
|
||||
@@ -7,21 +7,31 @@ import { connect } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UPDATE_JOB_LINES_IOU } from "../../graphql/jobs-lines.queries";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import {
|
||||
selectBodyshop,
|
||||
selectCurrentUser,
|
||||
} from "../../redux/user/user.selectors";
|
||||
import { CreateIouForJob } from "../jobs-detail-header-actions/jobs-detail-header-actions.duplicate.util";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
technician: selectTechnician,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobCreateIOU);
|
||||
|
||||
export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
||||
export function JobCreateIOU({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
job,
|
||||
selectedJobLines,
|
||||
technician,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const client = useApolloClient();
|
||||
@@ -79,13 +89,19 @@ export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) {
|
||||
title={t("jobs.labels.createiouwarning")}
|
||||
onConfirm={handleCreateIou}
|
||||
disabled={
|
||||
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||
!selectedJobLines ||
|
||||
selectedJobLines.length === 0 ||
|
||||
!job.converted ||
|
||||
technician
|
||||
}
|
||||
>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={
|
||||
!selectedJobLines || selectedJobLines.length === 0 || !job.converted
|
||||
!selectedJobLines ||
|
||||
selectedJobLines.length === 0 ||
|
||||
!job.converted ||
|
||||
technician
|
||||
}
|
||||
>
|
||||
{t("jobs.actions.createiou")}
|
||||
|
||||
@@ -1,15 +1,37 @@
|
||||
import React from "react";
|
||||
import { Card } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
|
||||
export default function JobDetailCardTemplate({
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
technician: selectTechnician,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(JobDetailCardTemplate);
|
||||
|
||||
export function JobDetailCardTemplate({
|
||||
loading,
|
||||
title,
|
||||
extraLink,
|
||||
technician,
|
||||
...otherProps
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
let extra;
|
||||
if (extraLink) extra = { extra: <Link to={extraLink}>More</Link> };
|
||||
if (extraLink && !technician)
|
||||
extra = {
|
||||
extra: <Link to={extraLink}>{t("jobs.labels.cards.more")}</Link>,
|
||||
};
|
||||
return (
|
||||
<Card
|
||||
size="small"
|
||||
|
||||
246
client/src/components/job-lifecycle/job-lifecycle.component.jsx
Normal file
246
client/src/components/job-lifecycle/job-lifecycle.component.jsx
Normal file
@@ -0,0 +1,246 @@
|
||||
import React, {useCallback, useEffect, useState} from 'react';
|
||||
import moment from "moment";
|
||||
import axios from 'axios';
|
||||
import {Badge, Card, Space, Table, Tag} from 'antd';
|
||||
import {gql, useQuery} from "@apollo/client";
|
||||
import {DateTimeFormatterFunction} from "../../utils/DateFormatter";
|
||||
import {isEmpty} from "lodash";
|
||||
import {useTranslation} from "react-i18next";
|
||||
|
||||
require('./job-lifecycle.styles.scss');
|
||||
|
||||
// show text on bar if text can fit
|
||||
export function JobLifecycleComponent({job, statuses, ...rest}) {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [lifecycleData, setLifecycleData] = useState(null);
|
||||
const {t} = useTranslation(); // Used for tracking external state changes.
|
||||
|
||||
const {data} = useQuery(gql`
|
||||
query get_job_test($id: uuid!){
|
||||
jobs_by_pk(id:$id){
|
||||
id
|
||||
status
|
||||
}
|
||||
}
|
||||
`, {
|
||||
variables: {
|
||||
id: job.id
|
||||
},
|
||||
fetchPolicy: 'cache-only'
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets the lifecycle data for the job.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
const getLifecycleData = useCallback(async () => {
|
||||
if (job && job.id && statuses && statuses.statuses) {
|
||||
try {
|
||||
setLoading(true);
|
||||
const response = await axios.post("/job/lifecycle", {
|
||||
jobids: job.id,
|
||||
statuses: statuses.statuses
|
||||
});
|
||||
const data = response.data.transition[job.id];
|
||||
setLifecycleData(data);
|
||||
} catch (err) {
|
||||
console.error(`${t('job_lifecycle.errors.fetch')}: ${err.message}`);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
}, [job, statuses, t]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) return;
|
||||
setTimeout(() => {
|
||||
getLifecycleData().catch(err => console.error(`${t('job_lifecycle.errors.fetch')}: ${err.message}`));
|
||||
}, 500);
|
||||
}, [data, getLifecycleData, t]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t('job_lifecycle.columns.value'),
|
||||
dataIndex: 'value',
|
||||
key: 'value',
|
||||
},
|
||||
{
|
||||
title: t('job_lifecycle.columns.start'),
|
||||
dataIndex: 'start',
|
||||
key: 'start',
|
||||
render: (text) => DateTimeFormatterFunction(text),
|
||||
sorter: (a, b) => moment(a.start).unix() - moment(b.start).unix(),
|
||||
},
|
||||
{
|
||||
title: t('job_lifecycle.columns.relative_start'),
|
||||
dataIndex: 'start_readable',
|
||||
key: 'start_readable',
|
||||
},
|
||||
{
|
||||
title: t('job_lifecycle.columns.end'),
|
||||
dataIndex: 'end',
|
||||
key: 'end',
|
||||
sorter: (a, b) => {
|
||||
if (isEmpty(a.end) || isEmpty(b.end)) {
|
||||
if (isEmpty(a.end) && isEmpty(b.end)) {
|
||||
return 0;
|
||||
}
|
||||
return isEmpty(a.end) ? 1 : -1;
|
||||
}
|
||||
return moment(a.end).unix() - moment(b.end).unix();
|
||||
},
|
||||
render: (text) => isEmpty(text) ? t('job_lifecycle.content.not_available') : DateTimeFormatterFunction(text)
|
||||
},
|
||||
{
|
||||
title: t('job_lifecycle.columns.relative_end'),
|
||||
dataIndex: 'end_readable',
|
||||
key: 'end_readable',
|
||||
},
|
||||
{
|
||||
title: t('job_lifecycle.columns.duration'),
|
||||
dataIndex: 'duration_readable',
|
||||
key: 'duration_readable',
|
||||
sorter: (a, b) => a.duration - b.duration,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Card loading={loading} title={t('job_lifecycle.content.title')}>
|
||||
{!loading ? (
|
||||
lifecycleData && lifecycleData.lifecycle && lifecycleData.durations ? (
|
||||
<Space direction='vertical' style={{width: '100%'}}>
|
||||
<Card
|
||||
type='inner'
|
||||
title={(
|
||||
<Space direction='horizontal' size='small'>
|
||||
<Badge status='processing' count={lifecycleData.durations.totalStatuses}/>
|
||||
{t('job_lifecycle.content.title_durations')}
|
||||
</Space>
|
||||
|
||||
)}
|
||||
style={{width: '100%'}}
|
||||
>
|
||||
<div id="bar-container" style={{
|
||||
display: 'flex',
|
||||
width: '100%',
|
||||
height: '100px',
|
||||
textAlign: 'center',
|
||||
borderRadius: '5px',
|
||||
borderWidth: '5px',
|
||||
borderStyle: 'solid',
|
||||
borderColor: '#f0f2f5',
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}}>
|
||||
{lifecycleData.durations.summations.map((key, index, array) => {
|
||||
const isFirst = index === 0;
|
||||
const isLast = index === array.length - 1;
|
||||
return (
|
||||
<div key={key.status} style={{
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
|
||||
borderTop: '1px solid #f0f2f5',
|
||||
borderBottom: '1px solid #f0f2f5',
|
||||
borderLeft: isFirst ? '1px solid #f0f2f5' : undefined,
|
||||
borderRight: isLast ? '1px solid #f0f2f5' : undefined,
|
||||
|
||||
backgroundColor: key.color,
|
||||
width: `${key.percentage}%`
|
||||
}}
|
||||
aria-label={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||
title={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||
>
|
||||
|
||||
{key.percentage > 15 ?
|
||||
<>
|
||||
<div>{key.roundedPercentage}</div>
|
||||
<div style={{
|
||||
backgroundColor: '#f0f2f5',
|
||||
borderRadius: '5px',
|
||||
paddingRight: '2px',
|
||||
paddingLeft: '2px',
|
||||
fontSize: '0.8rem',
|
||||
}}>
|
||||
{key.status}
|
||||
</div>
|
||||
</>
|
||||
: null}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Card type='inner' title={t('job_lifecycle.content.legend_title')}
|
||||
style={{marginTop: '10px'}}>
|
||||
<div>
|
||||
{lifecycleData.durations.summations.map((key) => (
|
||||
<Tag color={key.color} style={{width: '13vh', padding: '4px', margin: '4px'}}>
|
||||
<div
|
||||
aria-label={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||
title={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||
style={{
|
||||
backgroundColor: '#f0f2f5',
|
||||
color: '#000',
|
||||
padding: '4px',
|
||||
textAlign: 'center'
|
||||
}}>
|
||||
{key.status} ({key.roundedPercentage})
|
||||
</div>
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
</Card>
|
||||
{(lifecycleData?.durations?.humanReadableTotal) ||
|
||||
(lifecycleData.lifecycle[0] && lifecycleData.lifecycle[0].value && lifecycleData?.durations?.totalCurrentStatusDuration?.humanReadable) ?
|
||||
<Card style={{marginTop: '10px'}}>
|
||||
<ul>
|
||||
{lifecycleData.durations && lifecycleData.durations.humanReadableTotal &&
|
||||
<li>
|
||||
<span
|
||||
style={{fontWeight: 'bold'}}>{t('job_lifecycle.content.previous_status_accumulated_time')}:</span> {lifecycleData.durations.humanReadableTotal}
|
||||
</li>
|
||||
}
|
||||
{lifecycleData.lifecycle[0] && lifecycleData.lifecycle[0].value && lifecycleData?.durations?.totalCurrentStatusDuration?.humanReadable &&
|
||||
<li>
|
||||
<span
|
||||
style={{fontWeight: 'bold'}}>{t('job_lifecycle.content.current_status_accumulated_time')} ({lifecycleData.lifecycle[0].value}):</span> {lifecycleData.durations.totalCurrentStatusDuration.humanReadable}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</Card>
|
||||
: null}
|
||||
</Card>
|
||||
<Card type='inner' title={(
|
||||
<>
|
||||
<Space direction="horizontal" size="small">
|
||||
<Badge status='processing' count={lifecycleData.lifecycle.length}/>
|
||||
{t('job_lifecycle.content.title_transitions')}
|
||||
</Space>
|
||||
</>
|
||||
)}>
|
||||
<Table style={{
|
||||
overflow: 'auto',
|
||||
width: '100%',
|
||||
}} columns={columns} dataSource={lifecycleData.lifecycle}/>
|
||||
</Card>
|
||||
</Space>
|
||||
) : (
|
||||
<Card type='inner' style={{textAlign: 'center'}}>
|
||||
{t('job_lifecycle.content.data_unavailable')}
|
||||
</Card>
|
||||
)
|
||||
) : (
|
||||
<Card type='inner' title={t('job_lifecycle.content.title_loading')}>
|
||||
{t('job_lifecycle.content.loading')}
|
||||
</Card>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
export default JobLifecycleComponent;
|
||||
@@ -53,12 +53,14 @@ export function JobsAdminStatus({ insertAuditTrail, bodyshop, job }) {
|
||||
);
|
||||
|
||||
return (
|
||||
<Dropdown overlay={statusmenu} trigger={["click"]} key="changestatus">
|
||||
<Button shape="round">
|
||||
<span>{job.status}</span>
|
||||
<>
|
||||
<Dropdown overlay={statusmenu} trigger={["click"]} key="changestatus">
|
||||
<Button shape="round">
|
||||
<span>{job.status}</span>
|
||||
|
||||
<DownCircleFilled />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
<DownCircleFilled />
|
||||
</Button>
|
||||
</Dropdown>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,34 +1,18 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, notification } from "antd";
|
||||
import { gql } from "@apollo/client";
|
||||
import { Button, Space, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
DELETE_DELIVERY_CHECKLIST,
|
||||
DELETE_INTAKE_CHECKLIST,
|
||||
} from "../../graphql/jobs.queries";
|
||||
|
||||
export default function JobAdminDeleteIntake({ job }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [deleteIntake] = useMutation(gql`
|
||||
mutation DELETE_INTAKE($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { intakechecklist: null }
|
||||
) {
|
||||
id
|
||||
intakechecklist
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
const [DELETE_DELIVERY] = useMutation(gql`
|
||||
mutation DELETE_DELIVERY($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { deliverchecklist: null }
|
||||
) {
|
||||
id
|
||||
deliverchecklist
|
||||
}
|
||||
}
|
||||
`);
|
||||
const [deleteIntake] = useMutation(DELETE_INTAKE_CHECKLIST);
|
||||
const [deleteDelivery] = useMutation(DELETE_DELIVERY_CHECKLIST);
|
||||
|
||||
const handleDelete = async (values) => {
|
||||
setLoading(true);
|
||||
@@ -50,7 +34,7 @@ export default function JobAdminDeleteIntake({ job }) {
|
||||
|
||||
const handleDeleteDelivery = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await DELETE_DELIVERY({
|
||||
const result = await deleteDelivery({
|
||||
variables: { jobId: job.id },
|
||||
});
|
||||
|
||||
@@ -68,12 +52,22 @@ export default function JobAdminDeleteIntake({ job }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button loading={loading} onClick={handleDelete}>
|
||||
{t("jobs.labels.deleteintake")}
|
||||
</Button>
|
||||
<Button loading={loading} onClick={handleDeleteDelivery}>
|
||||
{t("jobs.labels.deletedelivery")}
|
||||
</Button>
|
||||
<Space wrap>
|
||||
<Button
|
||||
loading={loading}
|
||||
onClick={handleDelete}
|
||||
disabled={!job.intakechecklist}
|
||||
>
|
||||
{t("jobs.labels.deleteintake")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
onClick={handleDeleteDelivery}
|
||||
disabled={!job.deliverychecklist}
|
||||
>
|
||||
{t("jobs.labels.deletedelivery")}
|
||||
</Button>
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { gql, useMutation } from "@apollo/client";
|
||||
import { Button, notification } from "antd";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Space, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -7,6 +7,11 @@ import moment from "moment";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||
import {
|
||||
MARK_JOB_AS_EXPORTED,
|
||||
MARK_JOB_AS_UNINVOICED,
|
||||
MARK_JOB_FOR_REEXPORT,
|
||||
} from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import {
|
||||
selectBodyshop,
|
||||
@@ -35,58 +40,18 @@ export function JobAdminMarkReexport({
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
|
||||
const [markJobForReexport] = useMutation(gql`
|
||||
mutation MARK_JOB_FOR_REEXPORT($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { date_exported: null
|
||||
status: "${bodyshop.md_ro_statuses.default_invoiced}"
|
||||
}
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
status
|
||||
date_invoiced
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
const [markJobExported] = useMutation(gql`
|
||||
mutation MARK_JOB_AS_EXPORTED($jobId: uuid!, $date_exported: timestamptz!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { date_exported: $date_exported
|
||||
status: "${bodyshop.md_ro_statuses.default_exported}"
|
||||
}
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
date_invoiced
|
||||
status
|
||||
}
|
||||
}
|
||||
`);
|
||||
const [markJobUninvoiced] = useMutation(gql`
|
||||
mutation MARK_JOB_AS_UNINVOICED($jobId: uuid!, ) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { date_exported: null
|
||||
date_invoiced: null
|
||||
status: "${bodyshop.md_ro_statuses.default_delivered}"
|
||||
}
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
date_invoiced
|
||||
status
|
||||
}
|
||||
}
|
||||
`);
|
||||
const [markJobForReexport] = useMutation(MARK_JOB_FOR_REEXPORT);
|
||||
const [markJobExported] = useMutation(MARK_JOB_AS_EXPORTED);
|
||||
const [markJobUninvoiced] = useMutation(MARK_JOB_AS_UNINVOICED);
|
||||
|
||||
const handleMarkForExport = async () => {
|
||||
setLoading(true);
|
||||
const result = await markJobForReexport({
|
||||
variables: { jobId: job.id },
|
||||
variables: {
|
||||
jobId: job.id,
|
||||
default_invoiced: bodyshop.md_ro_statuses.default_invoiced,
|
||||
},
|
||||
});
|
||||
|
||||
if (!result.errors) {
|
||||
@@ -108,7 +73,11 @@ export function JobAdminMarkReexport({
|
||||
const handleMarkExported = async () => {
|
||||
setLoading(true);
|
||||
const result = await markJobExported({
|
||||
variables: { jobId: job.id, date_exported: moment() },
|
||||
variables: {
|
||||
jobId: job.id,
|
||||
date_exported: moment(),
|
||||
default_exported: bodyshop.md_ro_statuses.default_exported,
|
||||
},
|
||||
});
|
||||
|
||||
await insertExportLog({
|
||||
@@ -144,7 +113,10 @@ export function JobAdminMarkReexport({
|
||||
const handleUninvoice = async () => {
|
||||
setLoading(true);
|
||||
const result = await markJobUninvoiced({
|
||||
variables: { jobId: job.id },
|
||||
variables: {
|
||||
jobId: job.id,
|
||||
default_delivered: bodyshop.md_ro_statuses.default_delivered,
|
||||
},
|
||||
});
|
||||
|
||||
if (!result.errors) {
|
||||
@@ -165,27 +137,29 @@ export function JobAdminMarkReexport({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!job.date_exported}
|
||||
onClick={handleMarkForExport}
|
||||
>
|
||||
{t("jobs.labels.markforreexport")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={job.date_exported}
|
||||
onClick={handleMarkExported}
|
||||
>
|
||||
{t("jobs.actions.markasexported")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!job.date_invoiced || job.date_exported}
|
||||
onClick={handleUninvoice}
|
||||
>
|
||||
{t("jobs.actions.uninvoice")}
|
||||
</Button>
|
||||
<Space wrap>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!job.date_exported}
|
||||
onClick={handleMarkForExport}
|
||||
>
|
||||
{t("jobs.labels.markforreexport")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={job.date_exported}
|
||||
onClick={handleMarkExported}
|
||||
>
|
||||
{t("jobs.actions.markasexported")}
|
||||
</Button>
|
||||
<Button
|
||||
loading={loading}
|
||||
disabled={!job.date_invoiced || job.date_exported}
|
||||
onClick={handleUninvoice}
|
||||
>
|
||||
{t("jobs.actions.uninvoice")}
|
||||
</Button>
|
||||
</Space>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Switch, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UPDATE_REMOVE_FROM_AR } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
insertAuditTrail: ({ jobid, operation }) =>
|
||||
dispatch(insertAuditTrail({ jobid, operation })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminRemoveAR);
|
||||
|
||||
export function JobsAdminRemoveAR({ insertAuditTrail, job }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [switchValue, setSwitchValue] = useState(job.remove_from_ar);
|
||||
|
||||
const [mutationUpdateRemoveFromAR] = useMutation(UPDATE_REMOVE_FROM_AR);
|
||||
|
||||
const handleChange = async (value) => {
|
||||
setLoading(true);
|
||||
const result = await mutationUpdateRemoveFromAR({
|
||||
variables: { jobId: job.id, remove_from_ar: value },
|
||||
});
|
||||
|
||||
if (!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.save") });
|
||||
insertAuditTrail({
|
||||
jobid: job.id,
|
||||
operation: AuditTrailMapping.admin_job_remove_from_ar(value),
|
||||
});
|
||||
setSwitchValue(value);
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.saving", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: "flex", alignItems: "center" }}>
|
||||
<div style={{ marginRight: "10px" }}>
|
||||
{t("jobs.labels.remove_from_ar")}:
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
checked={switchValue}
|
||||
loading={loading}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { gql, useMutation } from "@apollo/client";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { UNVOID_JOB } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||
import {
|
||||
selectBodyshop,
|
||||
@@ -29,66 +30,17 @@ export function JobsAdminUnvoid({
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updateJob] = useMutation(gql`
|
||||
mutation UNVOID_JOB($jobId: uuid!) {
|
||||
update_jobs_by_pk(pk_columns: {id: $jobId}, _set: {voided: false, status: "${
|
||||
bodyshop.md_ro_statuses.default_imported
|
||||
}", date_void: null}) {
|
||||
id
|
||||
date_void
|
||||
voided
|
||||
status
|
||||
}
|
||||
insert_notes(objects: {jobid: $jobId, audit: true, created_by: "${
|
||||
currentUser.email
|
||||
}", text: "${t("jobs.labels.unvoidnote")}"}) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
`);
|
||||
|
||||
// const result = await voidJob({
|
||||
// variables: {
|
||||
// jobId: job.id,
|
||||
// job: {
|
||||
// status: bodyshop.md_ro_statuses.default_void,
|
||||
// voided: true,
|
||||
// },
|
||||
// note: [
|
||||
// {
|
||||
// jobid: job.id,
|
||||
// created_by: currentUser.email,
|
||||
// audit: true,
|
||||
// text: t("jobs.labels.voidnote", {
|
||||
// date: moment().format("MM/DD/yyy"),
|
||||
// time: moment().format("hh:mm a"),
|
||||
// }),
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// });
|
||||
|
||||
// if (!!!result.errors) {
|
||||
// notification["success"]({
|
||||
// message: t("jobs.successes.voided"),
|
||||
// });
|
||||
// //go back to jobs list.
|
||||
// history.push(`/manage/`);
|
||||
// } else {
|
||||
// notification["error"]({
|
||||
// message: t("jobs.errors.voiding", {
|
||||
// error: JSON.stringify(result.errors),
|
||||
// }),
|
||||
// });
|
||||
// }
|
||||
const [mutationUnvoidJob] = useMutation(UNVOID_JOB);
|
||||
|
||||
const handleUpdate = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: job.id },
|
||||
const result = await mutationUnvoidJob({
|
||||
variables: {
|
||||
jobId: job.id,
|
||||
default_imported: bodyshop.md_ro_statuses.default_imported,
|
||||
currentUserEmail: currentUser.email,
|
||||
text: t("jobs.labels.unvoidnote"),
|
||||
},
|
||||
});
|
||||
|
||||
if (!result.errors) {
|
||||
@@ -110,8 +62,10 @@ mutation UNVOID_JOB($jobId: uuid!) {
|
||||
};
|
||||
|
||||
return (
|
||||
<Button loading={loading} disabled={!job.voided} onClick={handleUpdate}>
|
||||
{t("jobs.actions.unvoid")}
|
||||
</Button>
|
||||
<>
|
||||
<Button loading={loading} disabled={!job.voided} onClick={handleUpdate}>
|
||||
{t("jobs.actions.unvoid")}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,13 @@ export default function JobsCreateOwnerInfoNewComponent() {
|
||||
label={t("owners.fields.ownr_ln")}
|
||||
name={["owner", "data", "ownr_ln"]}
|
||||
rules={[
|
||||
{
|
||||
required: state.owner.new,
|
||||
({ getFieldValue }) => ({
|
||||
required:
|
||||
state.owner.new &&
|
||||
(!getFieldValue(["owner", "data", "ownr_co_nm"]) ||
|
||||
getFieldValue(["owner", "data", "ownr_co_nm"]) === ""),
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input disabled={!state.owner.new} />
|
||||
@@ -31,10 +34,13 @@ export default function JobsCreateOwnerInfoNewComponent() {
|
||||
label={t("owners.fields.ownr_fn")}
|
||||
name={["owner", "data", "ownr_fn"]}
|
||||
rules={[
|
||||
{
|
||||
required: state.owner.new,
|
||||
({ getFieldValue }) => ({
|
||||
required:
|
||||
state.owner.new &&
|
||||
(!getFieldValue(["owner", "data", "ownr_co_nm"]) ||
|
||||
getFieldValue(["owner", "data", "ownr_co_nm"]) === ""),
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input disabled={!state.owner.new} />
|
||||
@@ -51,6 +57,17 @@ export default function JobsCreateOwnerInfoNewComponent() {
|
||||
<Form.Item
|
||||
label={t("owners.fields.ownr_co_nm")}
|
||||
name={["owner", "data", "ownr_co_nm"]}
|
||||
rules={[
|
||||
({ getFieldValue }) => ({
|
||||
required:
|
||||
state.owner.new &&
|
||||
(!getFieldValue(["owner", "data", "ownr_ln"]) ||
|
||||
!getFieldValue(["owner", "data", "ownr_fn"]) ||
|
||||
getFieldValue(["owner", "data", "ownr_ln"]) === "" ||
|
||||
getFieldValue(["owner", "data", "ownr_fn"]) === ""),
|
||||
//message: t("general.validation.required"),
|
||||
}),
|
||||
]}
|
||||
>
|
||||
<Input disabled={!state.owner.new} />
|
||||
</Form.Item>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||
import DataLabel from "../data-label/data-label.component";
|
||||
import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
||||
@@ -160,19 +161,35 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||
<Card
|
||||
style={{ height: "100%" }}
|
||||
title={
|
||||
<Link to={disabled ? "#" : `/manage/owners/${job.owner.id}`}>
|
||||
{ownerTitle.length > 0
|
||||
? ownerTitle
|
||||
: t("owner.labels.noownerinfo")}
|
||||
</Link>
|
||||
disabled ? (
|
||||
<>
|
||||
{ownerTitle.length > 0
|
||||
? ownerTitle
|
||||
: t("owner.labels.noownerinfo")}
|
||||
</>
|
||||
) : (
|
||||
<Link to={`/manage/owners/${job.owner.id}`}>
|
||||
{ownerTitle.length > 0
|
||||
? ownerTitle
|
||||
: t("owner.labels.noownerinfo")}
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
>
|
||||
<div>
|
||||
<DataLabel key="2" label={t("jobs.fields.ownr_ph1")}>
|
||||
<ChatOpenButton phone={job.ownr_ph1} jobid={job.id} />
|
||||
{disabled ? (
|
||||
<PhoneNumberFormatter>{job.ownr_ph1}</PhoneNumberFormatter>
|
||||
) : (
|
||||
<ChatOpenButton phone={job.ownr_ph1} jobid={job.id} />
|
||||
)}
|
||||
</DataLabel>
|
||||
<DataLabel key="22" label={t("jobs.fields.ownr_ph2")}>
|
||||
<ChatOpenButton phone={job.ownr_ph2} jobid={job.id} />
|
||||
{disabled ? (
|
||||
<PhoneNumberFormatter>{job.ownr_ph2}</PhoneNumberFormatter>
|
||||
) : (
|
||||
<ChatOpenButton phone={job.ownr_ph2} jobid={job.id} />
|
||||
)}
|
||||
</DataLabel>
|
||||
<DataLabel key="3" label={t("owners.fields.address")}>
|
||||
{`${job.ownr_addr1 || ""} ${job.ownr_addr2 || ""} ${
|
||||
@@ -180,7 +197,11 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||
} ${job.ownr_st || ""} ${job.ownr_zip || ""}`}
|
||||
</DataLabel>
|
||||
<DataLabel key="4" label={t("owners.fields.ownr_ea")}>
|
||||
{job.ownr_ea || ""}
|
||||
{disabled ? (
|
||||
<>{job.ownr_ea || ""}</>
|
||||
) : job.ownr_ea ? (
|
||||
<a href={`mailto:${job.ownr_ea}`}>{job.ownr_ea}</a>
|
||||
) : null}
|
||||
</DataLabel>
|
||||
{job.owner?.tax_number && (
|
||||
<DataLabel key="5" label={t("owners.fields.tax_number")}>
|
||||
@@ -195,17 +216,19 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||
style={{ height: "100%" }}
|
||||
title={
|
||||
job.vehicle ? (
|
||||
<Link
|
||||
to={
|
||||
disabled
|
||||
? "#"
|
||||
: job.vehicle && `/manage/vehicles/${job.vehicle.id}`
|
||||
}
|
||||
>
|
||||
{vehicleTitle.length > 0
|
||||
? vehicleTitle
|
||||
: t("vehicles.labels.novehinfo")}
|
||||
</Link>
|
||||
disabled ? (
|
||||
<>
|
||||
{vehicleTitle.length > 0
|
||||
? vehicleTitle
|
||||
: t("vehicles.labels.novehinfo")}{" "}
|
||||
</>
|
||||
) : (
|
||||
<Link to={job.vehicle && `/manage/vehicles/${job.vehicle.id}`}>
|
||||
{vehicleTitle.length > 0
|
||||
? vehicleTitle
|
||||
: t("vehicles.labels.novehinfo")}
|
||||
</Link>
|
||||
)
|
||||
) : (
|
||||
<span></span>
|
||||
)
|
||||
@@ -222,8 +245,10 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||
{`${job.v_vin || t("general.labels.na")}`}
|
||||
</VehicleVinDisplay>
|
||||
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
|
||||
job.v_vin.length !== 17 ? (
|
||||
<WarningFilled style={{ color: "tomato", marginLeft: ".3rem" }} />
|
||||
job.v_vin?.length !== 17 ? (
|
||||
<WarningFilled
|
||||
style={{ color: "tomato", marginLeft: ".3rem" }}
|
||||
/>
|
||||
) : null
|
||||
) : null}
|
||||
</DataLabel>
|
||||
@@ -231,7 +256,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
||||
{job.regie_number || t("general.labels.na")}
|
||||
</DataLabel>
|
||||
<DataLabel label={t("jobs.labels.relatedros")}>
|
||||
<JobsRelatedRos jobid={job.id} job={job} />
|
||||
<JobsRelatedRos jobid={job.id} job={job} disabled={disabled} />
|
||||
</DataLabel>
|
||||
{job.vehicle && job.vehicle.notes && (
|
||||
<DataLabel
|
||||
|
||||
@@ -10,9 +10,10 @@ import { Link, useHistory, useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
import {pageLimit} from "../../utils/config";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -25,6 +26,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
||||
const search = queryString.parse(useLocation().search);
|
||||
const [openSearchResults, setOpenSearchResults] = useState([]);
|
||||
const [searchLoading, setSearchLoading] = useState(false);
|
||||
const [filter, setFilter] = useLocalStorage("filter_jobs_all", null);
|
||||
const { page, sortcolumn, sortorder } = search;
|
||||
const history = useHistory();
|
||||
|
||||
@@ -93,6 +95,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
||||
render: (text, record) => {
|
||||
return record.status || t("general.labels.na");
|
||||
},
|
||||
filteredValue: filter?.status || null,
|
||||
filters: bodyshop.md_ro_statuses.statuses.map((s) => {
|
||||
return { text: s, value: [s] };
|
||||
}),
|
||||
@@ -189,6 +192,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
||||
} else {
|
||||
delete search.statusFilters;
|
||||
}
|
||||
setFilter(filters);
|
||||
history.push({ search: queryString.stringify(search) });
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
SyncOutlined,
|
||||
BranchesOutlined,
|
||||
ExclamationCircleFilled,
|
||||
PauseCircleOutlined,
|
||||
BranchesOutlined,
|
||||
SyncOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Button, Card, Grid, Input, Space, Table, Tooltip } from "antd";
|
||||
@@ -14,382 +14,389 @@ import { Link, useHistory, useLocation } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
import { alphaSort, statusSort } from "../../utils/sorters";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export function JobsList({ bodyshop }) {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { selected } = searchParams;
|
||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||
.filter((screen) => !!screen[1])
|
||||
.slice(-1)[0];
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||
variables: {
|
||||
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
||||
},
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { selected } = searchParams;
|
||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||
.filter((screen) => !!screen[1])
|
||||
.slice(-1)[0];
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||
variables: {
|
||||
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
||||
},
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" },
|
||||
});
|
||||
const [state, setState] = useState({ sortedInfo: {} });
|
||||
const [filter, setFilter] = useLocalStorage("filter_jobs_list", null);
|
||||
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
const [searchText, setSearchText] = useState("");
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
const jobs = data
|
||||
? searchText === ""
|
||||
? data.jobs
|
||||
: data.jobs.filter(
|
||||
(j) =>
|
||||
(j.ro_number || "")
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.comments || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.plate_no || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_model_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.est_ct_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.est_ct_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_make_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase())
|
||||
)
|
||||
: [];
|
||||
const jobs = data
|
||||
? searchText === ""
|
||||
? data.jobs
|
||||
: data.jobs.filter(
|
||||
(j) =>
|
||||
(j.ro_number || "")
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_co_nm || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.comments || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.ownr_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(j.plate_no || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_model_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.est_ct_fn || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.est_ct_ln || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(j.v_make_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase())
|
||||
)
|
||||
: [];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
};
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, sortedInfo: sorter });
|
||||
setFilter(filters);
|
||||
};
|
||||
|
||||
const handleOnRowClick = (record) => {
|
||||
if (record) {
|
||||
if (record.id) {
|
||||
history.push({
|
||||
search: queryString.stringify({
|
||||
...searchParams,
|
||||
selected: record.id,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
const handleOnRowClick = (record) => {
|
||||
if (record) {
|
||||
if (record.id) {
|
||||
history.push({
|
||||
search: queryString.stringify({
|
||||
...searchParams,
|
||||
selected: record.id,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.ro_number"),
|
||||
dataIndex: "ro_number",
|
||||
key: "ro_number",
|
||||
sorter: (a, b) =>
|
||||
parseInt((a.ro_number || "0").replace(/\D/g, "")) -
|
||||
parseInt((b.ro_number || "0").replace(/\D/g, "")),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||
|
||||
render: (text, record) => (
|
||||
<Link
|
||||
to={"/manage/jobs/" + record.id}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Space>
|
||||
{record.ro_number || t("general.labels.na")}
|
||||
{record.production_vars && record.production_vars.alert ? (
|
||||
<ExclamationCircleFilled className="production-alert" />
|
||||
) : null}
|
||||
{record.suspended && (
|
||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
||||
)}
|
||||
{record.iouparent && (
|
||||
<Tooltip title={t("jobs.labels.iou")}>
|
||||
<BranchesOutlined style={{ color: "orangered" }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Space>
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.owner"),
|
||||
dataIndex: "owner",
|
||||
key: "owner",
|
||||
ellipsis: true,
|
||||
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||
render: (text, record) => {
|
||||
return record.ownerid ? (
|
||||
<Link
|
||||
to={"/manage/owners/" + record.ownerid}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</Link>
|
||||
) : (
|
||||
<span>
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.ro_number"),
|
||||
dataIndex: "ro_number",
|
||||
key: "ro_number",
|
||||
sorter: (a, b) =>
|
||||
parseInt((a.ro_number || "0").replace(/\D/g, "")) -
|
||||
parseInt((b.ro_number || "0").replace(/\D/g, "")),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<Link
|
||||
to={"/manage/jobs/" + record.id}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Space>
|
||||
{record.ro_number || t("general.labels.na")}
|
||||
{record.production_vars && record.production_vars.alert ? (
|
||||
<ExclamationCircleFilled className="production-alert" />
|
||||
) : null}
|
||||
{record.suspended && (
|
||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
||||
)}
|
||||
{record.iouparent && (
|
||||
<Tooltip title={t("jobs.labels.iou")}>
|
||||
<BranchesOutlined style={{ color: "orangered" }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</Space>
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.owner"),
|
||||
dataIndex: "owner",
|
||||
key: "owner",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||
render: (text, record) => {
|
||||
return record.ownerid ? (
|
||||
<Link
|
||||
to={"/manage/owners/" + record.ownerid}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</Link>
|
||||
) : (
|
||||
<span>
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</span>
|
||||
);
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ownr_ph1"),
|
||||
dataIndex: "ownr_ph1",
|
||||
key: "ownr_ph1",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
render: (text, record) => (
|
||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ownr_ph2"),
|
||||
dataIndex: "ownr_ph2",
|
||||
key: "ownr_ph2",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
render: (text, record) => (
|
||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.status"),
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
ellipsis: true,
|
||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
filteredValue: filter?.status || null,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => j.status)
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
value: [s],
|
||||
};
|
||||
})
|
||||
.sort((a, b) =>
|
||||
statusSort(
|
||||
a.text,
|
||||
b.text,
|
||||
bodyshop.md_ro_statuses.active_statuses
|
||||
)
|
||||
)) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.vehicle"),
|
||||
dataIndex: "vehicle",
|
||||
key: "vehicle",
|
||||
ellipsis: true,
|
||||
render: (text, record) => {
|
||||
return record.vehicleid ? (
|
||||
<Link
|
||||
to={"/manage/vehicles/" + record.vehicleid}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||
record.v_model_desc || ""
|
||||
}`}
|
||||
</Link>
|
||||
) : (
|
||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||
record.v_model_desc || ""
|
||||
}`}</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t("vehicles.fields.plate_no"),
|
||||
dataIndex: "plate_no",
|
||||
key: "plate_no",
|
||||
ellipsis: true,
|
||||
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.plate_no, b.plate_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "plate_no" && state.sortedInfo.order,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_no"),
|
||||
dataIndex: "clm_no",
|
||||
key: "clm_no",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
`${record.clm_no || ""}${
|
||||
record.po_number ? ` (PO: ${record.po_number})` : ""
|
||||
}`,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ins_co_nm"),
|
||||
dataIndex: "ins_co_nm",
|
||||
key: "ins_co_nm",
|
||||
ellipsis: true,
|
||||
filteredValue: filter?.ins_co_nm || null,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => j.ins_co_nm)
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Ins. Co.*",
|
||||
value: [s],
|
||||
};
|
||||
})
|
||||
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||
responsive: ["md"],
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
dataIndex: "clm_total",
|
||||
key: "clm_total",
|
||||
responsive: ["md"],
|
||||
ellipsis: true,
|
||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.labels.estimator"),
|
||||
dataIndex: "jobs.labels.estimator",
|
||||
key: "estimator",
|
||||
ellipsis: true,
|
||||
responsive: ["xl"],
|
||||
filterSearch: true,
|
||||
filteredValue: filter?.estimator || null,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Estimator*",
|
||||
value: [s],
|
||||
};
|
||||
})
|
||||
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||
[],
|
||||
onFilter: (value, record) =>
|
||||
value.includes(
|
||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
||||
),
|
||||
render: (text, record) =>
|
||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.comment"),
|
||||
dataIndex: "comment",
|
||||
key: "comment",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
},
|
||||
// {
|
||||
// title: t("jobs.fields.owner_owing"),
|
||||
// dataIndex: "owner_owing",
|
||||
// key: "owner_owing",
|
||||
// responsive: ["md"],
|
||||
// render: (text, record) => (
|
||||
// <CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
||||
// ),
|
||||
// },
|
||||
];
|
||||
|
||||
const scrollMapper = {
|
||||
xs: true,
|
||||
sm: true,
|
||||
md: true,
|
||||
lg: "100%",
|
||||
xl: "100%",
|
||||
xxl: "100%",
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={t("titles.bc.jobs-active")}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch()}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<Input.Search
|
||||
placeholder={t("general.labels.search")}
|
||||
onChange={(e) => {
|
||||
setSearchText(e.target.value);
|
||||
}}
|
||||
value={searchText}
|
||||
enterButton
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
loading={loading}
|
||||
pagination={{ defaultPageSize: 50 }}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={jobs}
|
||||
scroll={{
|
||||
x: selectedBreakpoint ? scrollMapper[selectedBreakpoint[0]] : "100%",
|
||||
}}
|
||||
rowSelection={{
|
||||
onSelect: (record) => {
|
||||
handleOnRowClick(record);
|
||||
},
|
||||
selectedRowKeys: [selected],
|
||||
type: "radio",
|
||||
}}
|
||||
onChange={handleTableChange}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
handleOnRowClick(record);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ownr_ph1"),
|
||||
dataIndex: "ownr_ph1",
|
||||
key: "ownr_ph1",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
render: (text, record) => (
|
||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id} />
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ownr_ph2"),
|
||||
dataIndex: "ownr_ph2",
|
||||
key: "ownr_ph2",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
render: (text, record) => (
|
||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.status"),
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
ellipsis: true,
|
||||
|
||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => j.status)
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "No Status*",
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.vehicle"),
|
||||
dataIndex: "vehicle",
|
||||
key: "vehicle",
|
||||
ellipsis: true,
|
||||
render: (text, record) => {
|
||||
return record.vehicleid ? (
|
||||
<Link
|
||||
to={"/manage/vehicles/" + record.vehicleid}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||
record.v_model_desc || ""
|
||||
}`}
|
||||
</Link>
|
||||
) : (
|
||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||
record.v_model_desc || ""
|
||||
}`}</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t("vehicles.fields.plate_no"),
|
||||
dataIndex: "plate_no",
|
||||
key: "plate_no",
|
||||
ellipsis: true,
|
||||
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.plate_no, b.plate_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "plate_no" && state.sortedInfo.order,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_no"),
|
||||
dataIndex: "clm_no",
|
||||
key: "clm_no",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
`${record.clm_no || ""}${
|
||||
record.po_number ? ` (PO: ${record.po_number})` : ""
|
||||
}`,
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ins_co_nm"),
|
||||
dataIndex: "ins_co_nm",
|
||||
key: "ins_co_nm",
|
||||
ellipsis: true,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => j.ins_co_nm)
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s,
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||
responsive: ["md"],
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
dataIndex: "clm_total",
|
||||
key: "clm_total",
|
||||
responsive: ["md"],
|
||||
ellipsis: true,
|
||||
|
||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t("jobs.labels.estimator"),
|
||||
dataIndex: "jobs.labels.estimator",
|
||||
key: "jobs.labels.estimator",
|
||||
ellipsis: true,
|
||||
responsive: ["xl"],
|
||||
filterSearch: true,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
.map((j) => `${j.est_ct_fn || ""} ${j.est_ct_ln || ""}`.trim())
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "N/A",
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
[],
|
||||
onFilter: (value, record) =>
|
||||
value.includes(
|
||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
||||
),
|
||||
render: (text, record) =>
|
||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.comment"),
|
||||
dataIndex: "comment",
|
||||
key: "comment",
|
||||
ellipsis: true,
|
||||
responsive: ["md"],
|
||||
},
|
||||
// {
|
||||
// title: t("jobs.fields.owner_owing"),
|
||||
// dataIndex: "owner_owing",
|
||||
// key: "owner_owing",
|
||||
// responsive: ["md"],
|
||||
// render: (text, record) => (
|
||||
// <CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
||||
// ),
|
||||
// },
|
||||
];
|
||||
|
||||
const scrollMapper = {
|
||||
xs: true,
|
||||
sm: true,
|
||||
md: true,
|
||||
lg: "100%",
|
||||
xl: "100%",
|
||||
xxl: "100%",
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={t("titles.bc.jobs-active")}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch()}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<Input.Search
|
||||
placeholder={t("general.labels.search")}
|
||||
onChange={(e) => {
|
||||
setSearchText(e.target.value);
|
||||
}}
|
||||
value={searchText}
|
||||
enterButton
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
loading={loading}
|
||||
pagination={{ defaultPageSize: 50 }}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={jobs}
|
||||
scroll={{
|
||||
x: selectedBreakpoint ? scrollMapper[selectedBreakpoint[0]] : "100%",
|
||||
}}
|
||||
rowSelection={{
|
||||
onSelect: (record) => {
|
||||
handleOnRowClick(record);
|
||||
},
|
||||
selectedRowKeys: [selected],
|
||||
type: "radio",
|
||||
}}
|
||||
onChange={handleTableChange}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
handleOnRowClick(record);
|
||||
},
|
||||
};
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(JobsList);
|
||||
|
||||
@@ -16,11 +16,12 @@ import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { pageLimit } from "../../utils/config";
|
||||
import { alphaSort, statusSort } from "../../utils/sorters";
|
||||
import useLocalStorage from "../../utils/useLocalStorage";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||
import {pageLimit} from "../../utils/config";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -53,10 +54,8 @@ export function JobsReadyList({ bodyshop }) {
|
||||
nextFetchPolicy: "network-only",
|
||||
});
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" },
|
||||
});
|
||||
const [state, setState] = useState({ sortedInfo: {} });
|
||||
const [filter, setFilter] = useLocalStorage("filter_jobs_ready", null);
|
||||
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
@@ -105,7 +104,8 @@ export function JobsReadyList({ bodyshop }) {
|
||||
: [];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
setState({ ...state, sortedInfo: sorter });
|
||||
setFilter(filters);
|
||||
};
|
||||
|
||||
const handleOnRowClick = (record) => {
|
||||
@@ -129,7 +129,6 @@ export function JobsReadyList({ bodyshop }) {
|
||||
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||
|
||||
render: (text, record) => (
|
||||
<Link
|
||||
to={"/manage/jobs/" + record.id}
|
||||
@@ -157,7 +156,6 @@ export function JobsReadyList({ bodyshop }) {
|
||||
dataIndex: "owner",
|
||||
key: "owner",
|
||||
ellipsis: true,
|
||||
|
||||
responsive: ["md"],
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
sortOrder:
|
||||
@@ -197,16 +195,15 @@ export function JobsReadyList({ bodyshop }) {
|
||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.status"),
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
ellipsis: true,
|
||||
|
||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
filteredValue: filter?.status || null,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
@@ -217,11 +214,17 @@ export function JobsReadyList({ bodyshop }) {
|
||||
text: s || "No Status*",
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
})
|
||||
.sort((a, b) =>
|
||||
statusSort(
|
||||
a.text,
|
||||
b.text,
|
||||
bodyshop.md_ro_statuses.active_statuses
|
||||
)
|
||||
)) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
},
|
||||
|
||||
{
|
||||
title: t("jobs.fields.vehicle"),
|
||||
dataIndex: "vehicle",
|
||||
@@ -274,6 +277,7 @@ export function JobsReadyList({ bodyshop }) {
|
||||
dataIndex: "ins_co_nm",
|
||||
key: "ins_co_nm",
|
||||
ellipsis: true,
|
||||
filteredValue: filter?.ins_co_nm || null,
|
||||
filters:
|
||||
(jobs &&
|
||||
jobs
|
||||
@@ -281,10 +285,11 @@ export function JobsReadyList({ bodyshop }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s,
|
||||
text: s || "No Ins Co.*",
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
})
|
||||
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||
responsive: ["md"],
|
||||
@@ -295,7 +300,6 @@ export function JobsReadyList({ bodyshop }) {
|
||||
key: "clm_total",
|
||||
responsive: ["md"],
|
||||
ellipsis: true,
|
||||
|
||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
||||
@@ -306,9 +310,10 @@ export function JobsReadyList({ bodyshop }) {
|
||||
{
|
||||
title: t("jobs.labels.estimator"),
|
||||
dataIndex: "jobs.labels.estimator",
|
||||
key: "jobs.labels.estimator",
|
||||
key: "estimator",
|
||||
ellipsis: true,
|
||||
responsive: ["xl"],
|
||||
filteredValue: filter?.estimator || null,
|
||||
filterSearch: true,
|
||||
filters:
|
||||
(jobs &&
|
||||
@@ -317,10 +322,11 @@ export function JobsReadyList({ bodyshop }) {
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || "N/A",
|
||||
text: s || "No Estimator*",
|
||||
value: [s],
|
||||
};
|
||||
})) ||
|
||||
})
|
||||
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||
[],
|
||||
onFilter: (value, record) =>
|
||||
value.includes(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Space, Tag } from "antd";
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
export default function JobsRelatedRos({ jobid, job }) {
|
||||
export default function JobsRelatedRos({ jobid, job, disabled }) {
|
||||
if (!(job && job.vehicle && job.vehicle.jobs)) return null;
|
||||
return (
|
||||
<Space wrap>
|
||||
@@ -10,9 +10,15 @@ export default function JobsRelatedRos({ jobid, job }) {
|
||||
.filter((j) => j.id !== job.id)
|
||||
.map((j) => (
|
||||
<Tag key={j.id}>
|
||||
<Link to={`/manage/jobs/${j?.id}`}>{`${j.ro_number || "N/A"}${
|
||||
j.clm_no ? ` | ${j.clm_no}` : ""
|
||||
}${j.status ? ` | ${j.status}` : ""}`}</Link>
|
||||
{disabled ? (
|
||||
<>{`${j.ro_number || "N/A"}${j.clm_no ? ` | ${j.clm_no}` : ""}${
|
||||
j.status ? ` | ${j.status}` : ""
|
||||
}`}</>
|
||||
) : (
|
||||
<Link to={`/manage/jobs/${j?.id}`}>{`${j.ro_number || "N/A"}${
|
||||
j.clm_no ? ` | ${j.clm_no}` : ""
|
||||
}${j.status ? ` | ${j.status}` : ""}`}</Link>
|
||||
)}
|
||||
</Tag>
|
||||
))}
|
||||
</Space>
|
||||
|
||||
@@ -101,7 +101,14 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
||||
dataIndex: "ownr",
|
||||
key: "ownr",
|
||||
ellipsis: true,
|
||||
render: (text, record) => <OwnerNameDisplay ownerObject={record} />,
|
||||
render: (text, record) =>
|
||||
technician ? (
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
) : (
|
||||
<Link to={`/manage/owners/${record.ownerid}`}>
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</Link>
|
||||
),
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ownr" && state.sortedInfo.order,
|
||||
@@ -118,13 +125,18 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
||||
),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<Link to={`/manage/vehicles/${record.vehicleid}`}>{`${
|
||||
record.v_model_yr || ""
|
||||
} ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${
|
||||
record.v_color || ""
|
||||
} ${record.plate_no || ""}`}</Link>
|
||||
),
|
||||
render: (text, record) =>
|
||||
technician ? (
|
||||
<>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||
record.v_model_desc || ""
|
||||
} ${record.v_color || ""} ${record.plate_no || ""}`}</>
|
||||
) : (
|
||||
<Link to={`/manage/vehicles/${record.vehicleid}`}>{`${
|
||||
record.v_model_yr || ""
|
||||
} ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${
|
||||
record.v_color || ""
|
||||
} ${record.plate_no || ""}`}</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: i18n.t("jobs.fields.actual_in"),
|
||||
|
||||
@@ -13,12 +13,14 @@ import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
||||
import JobAtChange from "../job-at-change/job-at-change.component";
|
||||
import JobDetailCardsDocumentsComponent from "../job-detail-cards/job-detail-cards.documents.component";
|
||||
import JobDetailCardsNotesComponent from "../job-detail-cards/job-detail-cards.notes.component";
|
||||
import JobDetailCardsPartsComponent from "../job-detail-cards/job-detail-cards.parts.component";
|
||||
import CardTemplate from "../job-detail-cards/job-detail-cards.template.component";
|
||||
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
|
||||
import ScoreboardAddButton from "../job-scoreboard-add-button/job-scoreboard-add-button.component";
|
||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||
@@ -103,7 +105,13 @@ export function ProductionListDetail({
|
||||
{error && <AlertComponent error={JSON.stringify(error)} />}
|
||||
{!loading && data && (
|
||||
<div>
|
||||
<JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
|
||||
<CardTemplate
|
||||
title={t("jobs.labels.employeeassignments")}
|
||||
loading={loading}
|
||||
>
|
||||
<JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
|
||||
</CardTemplate>
|
||||
<div style={{ height: "8px" }} />
|
||||
<Descriptions bordered column={1}>
|
||||
<Descriptions.Item label={t("jobs.fields.ro_number")}>
|
||||
{theJob.ro_number || ""}
|
||||
@@ -111,7 +119,7 @@ export function ProductionListDetail({
|
||||
<Descriptions.Item label={t("jobs.fields.alt_transport")}>
|
||||
<Space>
|
||||
{data.jobs_by_pk.alt_transport || ""}
|
||||
<JobAtChange event={{ job: data.jobs_by_pk }} />
|
||||
<JobAtChange job={data.jobs_by_pk} />
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t("jobs.fields.clm_no")}>
|
||||
@@ -121,15 +129,30 @@ export function ProductionListDetail({
|
||||
{theJob.ins_co_nm || ""}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t("jobs.fields.owner")}>
|
||||
<OwnerNameDisplay ownerObject={theJob} />
|
||||
<StartChatButton
|
||||
phone={data.jobs_by_pk.ownr_ph1}
|
||||
jobid={data.jobs_by_pk.id}
|
||||
/>
|
||||
<StartChatButton
|
||||
phone={data.jobs_by_pk.ownr_ph2}
|
||||
jobid={data.jobs_by_pk.id}
|
||||
/>
|
||||
<Space>
|
||||
<OwnerNameDisplay ownerObject={theJob} />
|
||||
{!technician ? (
|
||||
<>
|
||||
<StartChatButton
|
||||
phone={data.jobs_by_pk.ownr_ph1}
|
||||
jobid={data.jobs_by_pk.id}
|
||||
/>
|
||||
<StartChatButton
|
||||
phone={data.jobs_by_pk.ownr_ph2}
|
||||
jobid={data.jobs_by_pk.id}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<PhoneNumberFormatter>
|
||||
{data.jobs_by_pk.ownr_ph1}
|
||||
</PhoneNumberFormatter>
|
||||
<PhoneNumberFormatter>
|
||||
{data.jobs_by_pk.ownr_ph2}
|
||||
</PhoneNumberFormatter>
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t("jobs.fields.vehicle")}>
|
||||
{`${theJob.v_model_yr || ""} ${theJob.v_color || ""} ${
|
||||
@@ -146,21 +169,24 @@ export function ProductionListDetail({
|
||||
<DateFormatter>{theJob.scheduled_completion}</DateFormatter>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
<div style={{ height: "8px" }} />
|
||||
<JobDetailCardsPartsComponent
|
||||
loading={loading}
|
||||
data={data ? data.jobs_by_pk : null}
|
||||
/>
|
||||
|
||||
<div style={{ height: "8px" }} />
|
||||
<JobDetailCardsNotesComponent
|
||||
loading={loading}
|
||||
data={data ? data.jobs_by_pk : null}
|
||||
/>
|
||||
{!bodyshop.uselocalmediaserver && (
|
||||
<JobDetailCardsDocumentsComponent
|
||||
loading={loading}
|
||||
data={data ? data.jobs_by_pk : null}
|
||||
/>
|
||||
<>
|
||||
<div style={{ height: "8px" }} />
|
||||
<JobDetailCardsDocumentsComponent
|
||||
loading={loading}
|
||||
data={data ? data.jobs_by_pk : null}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -93,8 +93,8 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
setLoading(true);
|
||||
const start = values.dates[0];
|
||||
const end = values.dates[1];
|
||||
const start = values.dates ? values.dates[0] : null;
|
||||
const end = values.dates ? values.dates[1] : null;
|
||||
const { id } = values;
|
||||
|
||||
await GenerateDocument(
|
||||
@@ -264,20 +264,30 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
|
||||
else return null;
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="dates"
|
||||
label={t("reportcenter.labels.dates")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePIckerRanges}
|
||||
/>
|
||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
||||
{() => {
|
||||
const key = form.getFieldValue("key");
|
||||
const datedisable = Templates[key] && Templates[key].datedisable;
|
||||
if (datedisable !== true) {
|
||||
return (
|
||||
<Form.Item
|
||||
name="dates"
|
||||
label={t("reportcenter.labels.dates")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
//message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<DatePicker.RangePicker
|
||||
format="MM/DD/YYYY"
|
||||
ranges={DatePIckerRanges}
|
||||
/>
|
||||
</Form.Item>
|
||||
);
|
||||
} else return null;
|
||||
}}
|
||||
</Form.Item>
|
||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
||||
{() => {
|
||||
|
||||
@@ -216,6 +216,7 @@ export function ScheduleJobModalContainer({
|
||||
okButtonProps={{
|
||||
loading: loading,
|
||||
}}
|
||||
closable={false}
|
||||
>
|
||||
<Form
|
||||
form={form}
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
import { Button, Table } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useHistory, useLocation } from "react-router-dom";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
|
||||
export default function ShopEmployeesListComponent({ loading, employees }) {
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
const search = queryString.parse(useLocation().search);
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" },
|
||||
});
|
||||
|
||||
const handleOnRowClick = (record) => {
|
||||
if (record) {
|
||||
search.employeeId = record.id;
|
||||
@@ -18,32 +24,82 @@ export default function ShopEmployeesListComponent({ loading, employees }) {
|
||||
history.push({ search: queryString.stringify(search) });
|
||||
}
|
||||
};
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("employees.fields.employee_number"),
|
||||
dataIndex: "employee_number",
|
||||
key: "employee_number",
|
||||
sorter: (a, b) => alphaSort(a.employee_number, b.employee_number),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "employee_number" &&
|
||||
state.sortedInfo.order,
|
||||
},
|
||||
{
|
||||
title: t("employees.fields.first_name"),
|
||||
dataIndex: "first_name",
|
||||
key: "first_name",
|
||||
title: t("employees.labels.name"),
|
||||
dataIndex: "employee_name",
|
||||
key: "employee_name",
|
||||
sorter: (a, b) =>
|
||||
alphaSort(
|
||||
`${a.first_name || ""} ${a.last_name || ""}`.trim(),
|
||||
`${b.first_name || ""} ${b.last_name || ""}`.trim()
|
||||
),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "employee_name" &&
|
||||
state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
`${record.first_name || ""} ${record.last_name || ""}`.trim(),
|
||||
},
|
||||
{
|
||||
title: t("employees.fields.last_name"),
|
||||
dataIndex: "last_name",
|
||||
key: "last_name",
|
||||
},
|
||||
|
||||
{
|
||||
title: t("employees.labels.rate_type"),
|
||||
dataIndex: "rate_type",
|
||||
key: "rate_type",
|
||||
sorter: (a, b) => Number(a.flat_rate) - Number(b.flat_rate),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "rate_type" && state.sortedInfo.order,
|
||||
filters: [
|
||||
{
|
||||
text: t("employees.labels.flat_rate"),
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
text: t("employees.labels.straight_time"),
|
||||
value: false,
|
||||
},
|
||||
],
|
||||
onFilter: (value, record) => value === record.flate_rate,
|
||||
render: (text, record) =>
|
||||
record.flat_rate
|
||||
? t("employees.labels.flat_rate")
|
||||
: t("employees.labels.straight_time"),
|
||||
},
|
||||
{
|
||||
title: t("employees.labels.status"),
|
||||
dataIndex: "active",
|
||||
key: "active",
|
||||
sorter: (a, b) => Number(a.active) - Number(b.active),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "active" && state.sortedInfo.order,
|
||||
filters: [
|
||||
{
|
||||
text: t("employees.labels.active"),
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
text: t("employees.labels.inactive"),
|
||||
value: false,
|
||||
},
|
||||
],
|
||||
onFilter: (value, record) => value === record.active,
|
||||
render: (text, record) =>
|
||||
record.active
|
||||
? t("employees.labels.active")
|
||||
: t("employees.labels.inactive"),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<div>
|
||||
@@ -74,6 +130,7 @@ export default function ShopEmployeesListComponent({ loading, employees }) {
|
||||
type: "radio",
|
||||
selectedRowKeys: [search.employeeId],
|
||||
}}
|
||||
onChange={handleTableChange}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
onClick: (event) => {
|
||||
|
||||
@@ -175,9 +175,6 @@ export function TechClockOffButton({
|
||||
},
|
||||
({ getFieldValue }) => ({
|
||||
validator(rule, value) {
|
||||
console.log(
|
||||
bodyshop.tt_enforce_hours_for_tech_console
|
||||
);
|
||||
if (!bodyshop.tt_enforce_hours_for_tech_console) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Button, Form, Input } from "antd";
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Redirect } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { techLoginStart } from "../../redux/tech/tech.actions";
|
||||
import {
|
||||
@@ -11,7 +12,6 @@ import {
|
||||
} from "../../redux/tech/tech.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import "./tech-login.styles.scss";
|
||||
import { Redirect } from "react-router-dom";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
technician: selectTechnician,
|
||||
@@ -35,6 +35,10 @@ export function TechLogin({
|
||||
techLoginStart(values);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.techconsole");
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<div className="tech-login-container">
|
||||
{technician ? <Redirect to={`/tech/joblookup`} /> : null}
|
||||
|
||||
@@ -3,11 +3,12 @@ import { gql } from "@apollo/client";
|
||||
export const QUERY_EMPLOYEES = gql`
|
||||
query QUERY_EMPLOYEES {
|
||||
employees(order_by: { employee_number: asc }) {
|
||||
last_name
|
||||
id
|
||||
active
|
||||
employee_number
|
||||
first_name
|
||||
flat_rate
|
||||
employee_number
|
||||
id
|
||||
last_name
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -5,7 +5,7 @@ export const QUERY_ALL_ACTIVE_JOBS_PAGINATED = gql`
|
||||
$offset: Int
|
||||
$limit: Int
|
||||
$order: [jobs_order_by!]
|
||||
$statuses: [String!]!,
|
||||
$statuses: [String!]!
|
||||
$isConverted: Boolean
|
||||
) {
|
||||
jobs(
|
||||
@@ -120,7 +120,9 @@ export const QUERY_PARTS_QUEUE = gql`
|
||||
}
|
||||
}
|
||||
jobs(
|
||||
where: { _and: [{ status: { _in: $statuses }, converted: { _eq: true } }] }
|
||||
where: {
|
||||
_and: [{ status: { _in: $statuses }, converted: { _eq: true } }]
|
||||
}
|
||||
offset: $offset
|
||||
limit: $limit
|
||||
order_by: $order
|
||||
@@ -336,6 +338,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
||||
category
|
||||
iouparent
|
||||
ro_number
|
||||
ownerid
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
@@ -542,147 +545,166 @@ export const QUERY_JOB_COSTING_DETAILS = gql`
|
||||
export const GET_JOB_BY_PK = gql`
|
||||
query GET_JOB_BY_PK($id: uuid!) {
|
||||
jobs_by_pk(id: $id) {
|
||||
updated_at
|
||||
actual_completion
|
||||
actual_delivery
|
||||
actual_in
|
||||
adjustment_bottom_line
|
||||
area_of_damage
|
||||
auto_add_ats
|
||||
available_jobs {
|
||||
id
|
||||
}
|
||||
alt_transport
|
||||
ca_bc_pvrt
|
||||
ca_customer_gst
|
||||
ca_gst_registrant
|
||||
category
|
||||
cccontracts {
|
||||
agreementnumber
|
||||
courtesycar {
|
||||
fleetnumber
|
||||
id
|
||||
make
|
||||
model
|
||||
plate
|
||||
year
|
||||
}
|
||||
id
|
||||
scheduledreturn
|
||||
start
|
||||
status
|
||||
}
|
||||
cieca_ttl
|
||||
class
|
||||
clm_no
|
||||
clm_total
|
||||
comment
|
||||
converted
|
||||
csiinvites {
|
||||
completedon
|
||||
id
|
||||
}
|
||||
date_estimated
|
||||
date_exported
|
||||
date_invoiced
|
||||
date_last_contacted
|
||||
date_lost_sale
|
||||
date_next_contact
|
||||
date_open
|
||||
date_rentalresp
|
||||
date_repairstarted
|
||||
date_scheduled
|
||||
date_towin
|
||||
date_void
|
||||
ded_amt
|
||||
ded_note
|
||||
ded_status
|
||||
deliverchecklist
|
||||
depreciation_taxes
|
||||
driveable
|
||||
employee_body
|
||||
employee_body_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
employee_refinish_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
employee_prep_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
employee_csr
|
||||
employee_csr_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
employee_csr
|
||||
employee_prep
|
||||
employee_prep_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
employee_refinish
|
||||
employee_body
|
||||
alt_transport
|
||||
intakechecklist
|
||||
invoice_final_note
|
||||
comment
|
||||
loss_desc
|
||||
kmin
|
||||
kmout
|
||||
referral_source
|
||||
referral_source_extra
|
||||
unit_number
|
||||
po_number
|
||||
special_coverage_policy
|
||||
scheduled_delivery
|
||||
converted
|
||||
lbr_adjustments
|
||||
ro_number
|
||||
po_number
|
||||
clm_total
|
||||
employee_refinish_rel {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
}
|
||||
est_co_nm
|
||||
est_ct_fn
|
||||
est_ct_ln
|
||||
est_ea
|
||||
est_ph1
|
||||
federal_tax_rate
|
||||
id
|
||||
inproduction
|
||||
vehicleid
|
||||
plate_no
|
||||
plate_st
|
||||
v_vin
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_color
|
||||
vehicleid
|
||||
driveable
|
||||
towin
|
||||
loss_of_use
|
||||
lost_sale_reason
|
||||
vehicle {
|
||||
id
|
||||
plate_no
|
||||
plate_st
|
||||
v_vin
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_color
|
||||
notes
|
||||
v_paint_codes
|
||||
jobs {
|
||||
id
|
||||
ro_number
|
||||
status
|
||||
clm_no
|
||||
}
|
||||
}
|
||||
available_jobs {
|
||||
id
|
||||
}
|
||||
ins_co_id
|
||||
policy_no
|
||||
loss_date
|
||||
clm_no
|
||||
area_of_damage
|
||||
ins_co_nm
|
||||
ins_addr1
|
||||
ins_city
|
||||
ins_co_id
|
||||
ins_co_nm
|
||||
ins_ct_ln
|
||||
ins_ct_fn
|
||||
ins_ea
|
||||
ins_ph1
|
||||
est_co_nm
|
||||
est_ct_fn
|
||||
est_ct_ln
|
||||
est_ph1
|
||||
est_ea
|
||||
selling_dealer
|
||||
servicing_dealer
|
||||
selling_dealer_contact
|
||||
servicing_dealer_contact
|
||||
regie_number
|
||||
scheduled_completion
|
||||
id
|
||||
ded_amt
|
||||
ded_status
|
||||
depreciation_taxes
|
||||
other_amount_payable
|
||||
towing_payable
|
||||
storage_payable
|
||||
adjustment_bottom_line
|
||||
federal_tax_rate
|
||||
state_tax_rate
|
||||
local_tax_rate
|
||||
tax_tow_rt
|
||||
tax_str_rt
|
||||
tax_paint_mat_rt
|
||||
tax_shop_mat_rt
|
||||
tax_sub_rt
|
||||
tax_lbr_rt
|
||||
tax_levies_rt
|
||||
parts_tax_rates
|
||||
job_totals
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
ownr_ea
|
||||
ownr_addr1
|
||||
ownr_addr2
|
||||
ownr_city
|
||||
ownr_st
|
||||
ownr_zip
|
||||
ownr_ctry
|
||||
ownr_ph1
|
||||
ownr_ph2
|
||||
production_vars
|
||||
ca_gst_registrant
|
||||
ownerid
|
||||
ded_note
|
||||
materials
|
||||
auto_add_ats
|
||||
rate_ats
|
||||
intakechecklist
|
||||
invoice_final_note
|
||||
iouparent
|
||||
job_totals
|
||||
joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
|
||||
act_price
|
||||
ah_detail_line
|
||||
alt_partm
|
||||
alt_partno
|
||||
billlines(limit: 1, order_by: { bill: { date: desc } }) {
|
||||
actual_cost
|
||||
actual_price
|
||||
bill {
|
||||
id
|
||||
invoice_number
|
||||
vendor {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
joblineid
|
||||
id
|
||||
quantity
|
||||
}
|
||||
convertedtolbr
|
||||
critical
|
||||
db_hrs
|
||||
db_price
|
||||
db_ref
|
||||
id
|
||||
ioucreated
|
||||
lbr_amt
|
||||
lbr_op
|
||||
line_desc
|
||||
line_ind
|
||||
line_no
|
||||
line_ref
|
||||
location
|
||||
manual_line
|
||||
mod_lb_hrs
|
||||
mod_lbr_ty
|
||||
notes
|
||||
oem_partno
|
||||
op_code_desc
|
||||
part_qty
|
||||
part_type
|
||||
prt_dsmk_m
|
||||
prt_dsmk_p
|
||||
status
|
||||
tax_part
|
||||
unq_seq
|
||||
}
|
||||
kmin
|
||||
kmout
|
||||
labor_rate_desc
|
||||
lbr_adjustments
|
||||
local_tax_rate
|
||||
loss_date
|
||||
loss_desc
|
||||
loss_of_use
|
||||
lost_sale_reason
|
||||
materials
|
||||
other_amount_payable
|
||||
owner {
|
||||
id
|
||||
ownr_fn
|
||||
@@ -699,7 +721,40 @@ export const GET_JOB_BY_PK = gql`
|
||||
ownr_ph2
|
||||
tax_number
|
||||
}
|
||||
labor_rate_desc
|
||||
owner_owing
|
||||
ownerid
|
||||
ownr_addr1
|
||||
ownr_addr2
|
||||
ownr_ctry
|
||||
ownr_city
|
||||
ownr_co_nm
|
||||
ownr_ea
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
ownr_ph1
|
||||
ownr_ph2
|
||||
ownr_st
|
||||
ownr_zip
|
||||
parts_tax_rates
|
||||
payments {
|
||||
amount
|
||||
created_at
|
||||
date
|
||||
exportedat
|
||||
id
|
||||
jobid
|
||||
memo
|
||||
payer
|
||||
paymentnum
|
||||
transactionid
|
||||
type
|
||||
}
|
||||
plate_no
|
||||
plate_st
|
||||
po_number
|
||||
policy_no
|
||||
production_vars
|
||||
rate_ats
|
||||
rate_la1
|
||||
rate_la2
|
||||
rate_la3
|
||||
@@ -723,58 +778,49 @@ export const GET_JOB_BY_PK = gql`
|
||||
rate_mapa
|
||||
rate_mash
|
||||
rate_matd
|
||||
actual_in
|
||||
federal_tax_rate
|
||||
local_tax_rate
|
||||
state_tax_rate
|
||||
regie_number
|
||||
referral_source
|
||||
referral_source_extra
|
||||
remove_from_ar
|
||||
ro_number
|
||||
scheduled_completion
|
||||
scheduled_in
|
||||
actual_completion
|
||||
scheduled_delivery
|
||||
actual_delivery
|
||||
date_estimated
|
||||
date_open
|
||||
date_scheduled
|
||||
date_invoiced
|
||||
date_last_contacted
|
||||
date_lost_sale
|
||||
date_next_contact
|
||||
date_towin
|
||||
date_rentalresp
|
||||
date_exported
|
||||
date_repairstarted
|
||||
date_void
|
||||
scheduled_in
|
||||
selling_dealer
|
||||
servicing_dealer
|
||||
selling_dealer_contact
|
||||
servicing_dealer_contact
|
||||
special_coverage_policy
|
||||
state_tax_rate
|
||||
status
|
||||
owner_owing
|
||||
tax_registration_number
|
||||
class
|
||||
category
|
||||
deliverchecklist
|
||||
voided
|
||||
ca_bc_pvrt
|
||||
ca_customer_gst
|
||||
storage_payable
|
||||
suspended
|
||||
joblines(where: { removed: { _eq: false } }, order_by: { line_no: asc }) {
|
||||
tax_lbr_rt
|
||||
tax_levies_rt
|
||||
tax_paint_mat_rt
|
||||
tax_registration_number
|
||||
tax_shop_mat_rt
|
||||
tax_str_rt
|
||||
tax_sub_rt
|
||||
tax_tow_rt
|
||||
towin
|
||||
towing_payable
|
||||
unit_number
|
||||
updated_at
|
||||
v_vin
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
v_make_desc
|
||||
v_color
|
||||
vehicleid
|
||||
vehicle {
|
||||
id
|
||||
alt_partm
|
||||
line_no
|
||||
unq_seq
|
||||
line_ind
|
||||
line_desc
|
||||
line_ref
|
||||
part_type
|
||||
oem_partno
|
||||
alt_partno
|
||||
db_price
|
||||
act_price
|
||||
part_qty
|
||||
mod_lbr_ty
|
||||
db_hrs
|
||||
mod_lb_hrs
|
||||
lbr_op
|
||||
lbr_amt
|
||||
op_code_desc
|
||||
status
|
||||
jobs {
|
||||
clm_no
|
||||
id
|
||||
ro_number
|
||||
status
|
||||
}
|
||||
notes
|
||||
location
|
||||
tax_part
|
||||
@@ -811,6 +857,14 @@ export const GET_JOB_BY_PK = gql`
|
||||
}
|
||||
}
|
||||
}
|
||||
plate_no
|
||||
plate_st
|
||||
v_color
|
||||
v_make_desc
|
||||
v_model_desc
|
||||
v_model_yr
|
||||
v_paint_codes
|
||||
v_vin
|
||||
}
|
||||
payments {
|
||||
id
|
||||
@@ -849,9 +903,11 @@ export const GET_JOB_BY_PK = gql`
|
||||
id
|
||||
completedon
|
||||
}
|
||||
voided
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_JOB_RECONCILIATION_BY_PK = gql`
|
||||
query GET_JOB_RECONCILIATION_BY_PK($id: uuid!) {
|
||||
bills(where: { jobid: { _eq: $id } }) {
|
||||
@@ -917,6 +973,7 @@ export const GET_JOB_RECONCILIATION_BY_PK = gql`
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_JOB_CARD_DETAILS = gql`
|
||||
query QUERY_JOB_CARD_DETAILS($id: uuid!) {
|
||||
jobs_by_pk(id: $id) {
|
||||
@@ -2292,6 +2349,123 @@ export const GET_JOB_LINE_ORDERS = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_REMOVE_FROM_AR = gql`
|
||||
mutation UPDATE_REMOVE_FROM_AR($jobId: uuid!, $remove_from_ar: Boolean!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { remove_from_ar: $remove_from_ar }
|
||||
) {
|
||||
id
|
||||
remove_from_ar
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNVOID_JOB = gql`
|
||||
mutation UNVOID_JOB(
|
||||
$jobId: uuid!
|
||||
$default_imported: String!
|
||||
$currentUserEmail: String!
|
||||
$text: String!
|
||||
) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { voided: false, status: $default_imported, date_void: null }
|
||||
) {
|
||||
id
|
||||
date_void
|
||||
voided
|
||||
status
|
||||
}
|
||||
insert_notes(
|
||||
objects: {
|
||||
jobid: $jobId
|
||||
audit: true
|
||||
created_by: $currentUserEmail
|
||||
text: $text
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_INTAKE_CHECKLIST = gql`
|
||||
mutation DELETE_INTAKE($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { intakechecklist: null }
|
||||
) {
|
||||
id
|
||||
intakechecklist
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_DELIVERY_CHECKLIST = gql`
|
||||
mutation DELETE_DELIVERY($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { deliverchecklist: null }
|
||||
) {
|
||||
id
|
||||
deliverchecklist
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MARK_JOB_FOR_REEXPORT = gql`
|
||||
mutation MARK_JOB_FOR_REEXPORT($jobId: uuid!, $default_invoiced: String!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { date_exported: null, status: $default_invoiced }
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
status
|
||||
date_invoiced
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MARK_JOB_AS_EXPORTED = gql`
|
||||
mutation MARK_JOB_AS_EXPORTED(
|
||||
$jobId: uuid!
|
||||
$date_exported: timestamptz!
|
||||
$default_exported: String!
|
||||
) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { date_exported: $date_exported, status: $default_exported }
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
date_invoiced
|
||||
status
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MARK_JOB_AS_UNINVOICED = gql`
|
||||
mutation MARK_JOB_AS_UNINVOICED($jobId: uuid!, $default_delivered: String!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: {
|
||||
date_exported: null
|
||||
date_invoiced: null
|
||||
status: $default_delivered
|
||||
}
|
||||
) {
|
||||
id
|
||||
date_exported
|
||||
date_invoiced
|
||||
status
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_COMPLETED_TASKS = gql`
|
||||
query QUERY_COMPLETED_TASKS($jobid: uuid!) {
|
||||
jobs_by_pk(id: $jobid) {
|
||||
|
||||
@@ -7,16 +7,16 @@ import { useParams } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import JobCalculateTotals from "../../components/job-calculate-totals/job-calculate-totals.component";
|
||||
import ScoreboardAddButton from "../../components/job-scoreboard-add-button/job-scoreboard-add-button.component";
|
||||
import JobsAdminStatus from "../../components/jobs-admin-change-status/jobs-admin-change.status.component";
|
||||
import JobsAdminClass from "../../components/jobs-admin-class/jobs-admin-class.component";
|
||||
import JobsAdminDatesChange from "../../components/jobs-admin-dates/jobs-admin-dates.component";
|
||||
import JobsAdminDeleteIntake from "../../components/jobs-admin-delete-intake/jobs-admin-delete-intake.component";
|
||||
import JobsAdminMarkReexport from "../../components/jobs-admin-mark-reexport/jobs-admin-mark-reexport.component";
|
||||
import JobAdminOwnerReassociate from "../../components/jobs-admin-owner-reassociate/jobs-admin-owner-reassociate.component";
|
||||
import JobsAdminRemoveAR from "../../components/jobs-admin-remove-ar/jobs-admin-remove-ar.component";
|
||||
import JobsAdminUnvoid from "../../components/jobs-admin-unvoid/jobs-admin-unvoid.component";
|
||||
import JobAdminVehicleReassociate from "../../components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component";
|
||||
import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
|
||||
import JobsAdminStatus from "../../components/jobs-admin-change-status/jobs-admin-change.status.component";
|
||||
|
||||
import NotFound from "../../components/not-found/not-found.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import { GET_JOB_BY_PK } from "../../graphql/jobs.queries";
|
||||
@@ -104,6 +104,7 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
<JobsAdminMarkReexport job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminUnvoid job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminStatus job={data ? data.jobs_by_pk : {}} />
|
||||
<JobsAdminRemoveAR job={data ? data.jobs_by_pk : {}} />
|
||||
</Space>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
@@ -56,6 +56,7 @@ import UndefinedToNull from "../../utils/undefinedtonull";
|
||||
import _ from "lodash";
|
||||
import JobProfileDataWarning from "../../components/job-profile-data-warning/job-profile-data-warning.component";
|
||||
import { DateTimeFormat } from "./../../utils/DateFormatter";
|
||||
import JobLifecycleComponent from "../../components/job-lifecycle/job-lifecycle.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -371,7 +372,15 @@ export function JobsDetailPage({
|
||||
>
|
||||
<JobsDetailLaborContainer job={job} jobId={job.id} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane
|
||||
<Tabs.TabPane
|
||||
forceRender
|
||||
tab={<span><BarsOutlined />{t('menus.jobsdetail.lifecycle')}</span>}
|
||||
key="lifecycle"
|
||||
>
|
||||
<JobLifecycleComponent job={job} statuses={bodyshop.md_ro_statuses}/>
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane
|
||||
forceRender
|
||||
tab={
|
||||
<span>
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import { Divider } from "antd";
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
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";
|
||||
import TechJobStatistics from "../../components/tech-job-statistics/tech-job-statistics.component";
|
||||
|
||||
export default function TechClockComponent() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.techjobclock");
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<TechJobStatistics />
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import RbacWrapperComponent from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import TechLookupJobsList from "../../components/tech-lookup-jobs-list/tech-lookup-jobs-list.component";
|
||||
|
||||
export default function TechLookupContainer() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.techjoblookup");
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<RbacWrapperComponent action="jobs:list-active">
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shift.container";
|
||||
|
||||
export default function TechShiftClock() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.techshiftclock");
|
||||
}, [t]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<TimeTicketShift isTechConsole />
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
},
|
||||
"audit_trail": {
|
||||
"messages": {
|
||||
"admin_job_remove_from_ar": "ADMIN: Remove from AR updated to: {{status}}",
|
||||
"admin_jobmarkexported": "ADMIN: Job marked as exported.",
|
||||
"admin_jobmarkforreexport": "ADMIN: Job marked for re-export.",
|
||||
"admin_jobuninvoice": "ADMIN: Job has been uninvoiced.",
|
||||
@@ -114,11 +115,11 @@
|
||||
"jobassignmentchange": "Employee {{name}} assigned to {{operation}}",
|
||||
"jobassignmentremoved": "Employee assignment removed for {{operation}}",
|
||||
"jobchecklist": "Checklist type \"{{type}}\" completed. In production set to {{inproduction}}. Status set to {{status}}.",
|
||||
"jobinvoiced": "Job has been invoiced.",
|
||||
"jobconverted": "Job converted and assigned number {{ro_number}}.",
|
||||
"jobfieldchanged": "Job field $t(jobs.fields.{{field}}) changed to {{value}}.",
|
||||
"jobimported": "Job imported.",
|
||||
"jobinproductionchange": "Job production status set to {{inproduction}}",
|
||||
"jobinvoiced": "Job has been invoiced.",
|
||||
"jobioucreated": "IOU Created.",
|
||||
"jobmodifylbradj": "Labor adjustments modified {{mod_lbr_ty}} / {{hours}}.",
|
||||
"jobnoteadded": "Note added to Job.",
|
||||
@@ -258,7 +259,6 @@
|
||||
"saving": "Error encountered while saving. {{message}}"
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "QBO Receivable Custom Field {{number}}",
|
||||
"address1": "Address 1",
|
||||
"address2": "Address 2",
|
||||
"appt_alt_transport": "Appointment Alternative Transportation Options",
|
||||
@@ -335,6 +335,9 @@
|
||||
"md_ded_notes": "Deductible Notes",
|
||||
"md_email_cc": "Auto Email CC: $t(printcenter.subjects.jobs.{{template}})",
|
||||
"md_from_emails": "Additional From Emails",
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": "Auto Add Imported/Supplemented Jobs to Parts Queue"
|
||||
},
|
||||
"md_hour_split": {
|
||||
"paint": "Paint Hour Split",
|
||||
"prep": "Prep Hour Split"
|
||||
@@ -357,9 +360,6 @@
|
||||
},
|
||||
"md_payment_types": "Payment Types",
|
||||
"md_referral_sources": "Referral Sources",
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": "Auto Add Imported/Supplemented Jobs to Parts Queue"
|
||||
},
|
||||
"md_tasks_presets": {
|
||||
"enable_tasks": "Enable Hour Flagging",
|
||||
"hourstype": "Hour Types",
|
||||
@@ -480,6 +480,7 @@
|
||||
"editaccess": "Users -> Edit access"
|
||||
}
|
||||
},
|
||||
"ReceivableCustomField": "QBO Receivable Custom Field {{number}}",
|
||||
"responsibilitycenter": "Responsibility Center",
|
||||
"responsibilitycenter_accountdesc": "Account Description",
|
||||
"responsibilitycenter_accountitem": "Item",
|
||||
@@ -827,6 +828,10 @@
|
||||
"usage": "Usage",
|
||||
"vehicle": "Vehicle Description"
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "Not Ready",
|
||||
"ready": "Ready"
|
||||
},
|
||||
"status": {
|
||||
"in": "Available",
|
||||
"inservice": "In Service",
|
||||
@@ -836,10 +841,6 @@
|
||||
},
|
||||
"successes": {
|
||||
"saved": "Courtesy Car saved successfully."
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "Not Ready",
|
||||
"ready": "Ready"
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
@@ -1015,10 +1016,13 @@
|
||||
},
|
||||
"labels": {
|
||||
"actions": "Actions",
|
||||
"active": "Active",
|
||||
"endmustbeafterstart": "End date must be after start date.",
|
||||
"flat_rate": "Flat Rate",
|
||||
"inactive": "Inactive",
|
||||
"name": "Name",
|
||||
"rate_type": "Rate Type",
|
||||
"status": "Status",
|
||||
"straight_time": "Straight Time"
|
||||
},
|
||||
"successes": {
|
||||
@@ -1224,6 +1228,31 @@
|
||||
"updated": "Inventory line updated."
|
||||
}
|
||||
},
|
||||
"job_lifecycle": {
|
||||
"columns": {
|
||||
"duration": "Duration",
|
||||
"end": "End",
|
||||
"relative_end": "Relative End",
|
||||
"relative_start": "Relative Start",
|
||||
"start": "Start",
|
||||
"value": "Value"
|
||||
},
|
||||
"content": {
|
||||
"current_status_accumulated_time": "Current Status Accumulated Time",
|
||||
"data_unavailable": " There is currently no Lifecycle data for this Job.",
|
||||
"legend_title": "Legend",
|
||||
"loading": "Loading Job Timelines....",
|
||||
"not_available": "N/A",
|
||||
"previous_status_accumulated_time": "Previous Status Accumulated Time",
|
||||
"title": "Job Lifecycle Component",
|
||||
"title_durations": "Historical Status Durations",
|
||||
"title_loading": "Loading",
|
||||
"title_transitions": "Transitions"
|
||||
},
|
||||
"errors": {
|
||||
"fetch": "Error getting Job Lifecycle Data"
|
||||
}
|
||||
},
|
||||
"job_payments": {
|
||||
"buttons": {
|
||||
"goback": "Go Back",
|
||||
@@ -1762,6 +1791,7 @@
|
||||
"estimator": "Estimator",
|
||||
"filehandler": "Adjuster",
|
||||
"insurance": "Insurance Details",
|
||||
"more": "More",
|
||||
"notes": "Notes",
|
||||
"parts": "Parts",
|
||||
"totals": "Totals",
|
||||
@@ -1894,6 +1924,7 @@
|
||||
},
|
||||
"reconciliationheader": "Parts & Sublet Reconciliation",
|
||||
"relatedros": "Related ROs",
|
||||
"remove_from_ar": "Remove from AR",
|
||||
"returntotals": "Return Totals",
|
||||
"rosaletotal": "RO Parts Total",
|
||||
"sale_additional": "Sales - Additional",
|
||||
@@ -2074,6 +2105,7 @@
|
||||
"general": "General",
|
||||
"insurance": "Insurance Information",
|
||||
"labor": "Labor",
|
||||
"lifecycle": "Lifecycle",
|
||||
"partssublet": "Parts & Bills",
|
||||
"rates": "Rates",
|
||||
"repairdata": "Repair Data",
|
||||
@@ -2093,7 +2125,7 @@
|
||||
"joblookup": "Job Lookup",
|
||||
"login": "Login",
|
||||
"logout": "Logout",
|
||||
"productionboard": "Production Board - Visual",
|
||||
"productionboard": "Production Visual",
|
||||
"productionlist": "Production List",
|
||||
"shiftclockin": "Shift Clock"
|
||||
}
|
||||
@@ -2653,6 +2685,7 @@
|
||||
},
|
||||
"templates": {
|
||||
"anticipated_revenue": "Anticipated Revenue",
|
||||
"ar_aging": "AR Aging",
|
||||
"attendance_detail": "Attendance (All Employees)",
|
||||
"attendance_employee": "Employee Attendance",
|
||||
"attendance_summary": "Attendance Summary (All Employees)",
|
||||
@@ -2719,6 +2752,7 @@
|
||||
"open_orders": "Open Orders by Date",
|
||||
"open_orders_csr": "Open Orders by CSR",
|
||||
"open_orders_estimator": "Open Orders by Estimator",
|
||||
"open_orders_excel": "Open Orders - Excel",
|
||||
"open_orders_ins_co": "Open Orders by Insurance Company",
|
||||
"open_orders_referral": "Open Orders by Referral Source",
|
||||
"open_orders_specific_csr": "Open Orders filtered by CSR",
|
||||
@@ -3014,7 +3048,7 @@
|
||||
"parts-queue": "Parts Queue | $t(titles.app)",
|
||||
"payments-all": "Payments | $t(titles.app)",
|
||||
"phonebook": "Phonebook | $t(titles.app)",
|
||||
"productionboard": "Production - Board",
|
||||
"productionboard": "Production Board - Visual | $t(titles.app)",
|
||||
"productionlist": "Production Board - List | $t(titles.app)",
|
||||
"profile": "My Profile | $t(titles.app)",
|
||||
"readyjobs": "Ready Jobs | $t(titles.app)",
|
||||
@@ -3026,6 +3060,10 @@
|
||||
"shop-csi": "CSI Responses | $t(titles.app)",
|
||||
"shop-templates": "Shop Templates | $t(titles.app)",
|
||||
"shop_vendors": "Vendors | $t(titles.app)",
|
||||
"techconsole": "Technician Console | $t(titles.app)",
|
||||
"techjobclock": "Technician Job Clock | $t(titles.app)",
|
||||
"techjoblookup": "Technician Job Lookup | $t(titles.app)",
|
||||
"techshiftclock": "Technician Shift Clock | $t(titles.app)",
|
||||
"temporarydocs": "Temporary Documents | $t(titles.app)",
|
||||
"timetickets": "Time Tickets | $t(titles.app)",
|
||||
"ttapprovals": "Time Ticket Approvals | $t(titles.app)",
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
},
|
||||
"audit_trail": {
|
||||
"messages": {
|
||||
"admin_job_remove_from_ar": "",
|
||||
"admin_jobmarkexported": "",
|
||||
"admin_jobmarkforreexport": "",
|
||||
"admin_jobuninvoice": "",
|
||||
@@ -114,11 +115,11 @@
|
||||
"jobassignmentchange": "",
|
||||
"jobassignmentremoved": "",
|
||||
"jobchecklist": "",
|
||||
"jobinvoiced": "",
|
||||
"jobconverted": "",
|
||||
"jobfieldchanged": "",
|
||||
"jobimported": "",
|
||||
"jobinproductionchange": "",
|
||||
"jobinvoiced": "",
|
||||
"jobioucreated": "",
|
||||
"jobmodifylbradj": "",
|
||||
"jobnoteadded": "",
|
||||
@@ -258,13 +259,9 @@
|
||||
"saving": ""
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "",
|
||||
"address1": "",
|
||||
"address2": "",
|
||||
"appt_alt_transport": "",
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": ""
|
||||
},
|
||||
"appt_colors": {
|
||||
"color": "",
|
||||
"label": ""
|
||||
@@ -338,6 +335,9 @@
|
||||
"md_ded_notes": "",
|
||||
"md_email_cc": "",
|
||||
"md_from_emails": "",
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": ""
|
||||
},
|
||||
"md_hour_split": {
|
||||
"paint": "",
|
||||
"prep": ""
|
||||
@@ -480,6 +480,7 @@
|
||||
"editaccess": ""
|
||||
}
|
||||
},
|
||||
"ReceivableCustomField": "",
|
||||
"responsibilitycenter": "",
|
||||
"responsibilitycenter_accountdesc": "",
|
||||
"responsibilitycenter_accountitem": "",
|
||||
@@ -827,6 +828,10 @@
|
||||
"usage": "",
|
||||
"vehicle": ""
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "",
|
||||
"ready": ""
|
||||
},
|
||||
"status": {
|
||||
"in": "",
|
||||
"inservice": "",
|
||||
@@ -836,10 +841,6 @@
|
||||
},
|
||||
"successes": {
|
||||
"saved": ""
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "",
|
||||
"ready": ""
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
@@ -1015,10 +1016,13 @@
|
||||
},
|
||||
"labels": {
|
||||
"actions": "",
|
||||
"active": "",
|
||||
"endmustbeafterstart": "",
|
||||
"flat_rate": "",
|
||||
"inactive": "",
|
||||
"name": "",
|
||||
"rate_type": "",
|
||||
"status": "",
|
||||
"straight_time": ""
|
||||
},
|
||||
"successes": {
|
||||
@@ -1224,6 +1228,31 @@
|
||||
"updated": ""
|
||||
}
|
||||
},
|
||||
"job_lifecycle": {
|
||||
"columns": {
|
||||
"duration": "",
|
||||
"end": "",
|
||||
"relative_end": "",
|
||||
"relative_start": "",
|
||||
"start": "",
|
||||
"value": ""
|
||||
},
|
||||
"content": {
|
||||
"current_status_accumulated_time": "",
|
||||
"data_unavailable": "",
|
||||
"legend_title": "",
|
||||
"loading": "",
|
||||
"not_available": "",
|
||||
"previous_status_accumulated_time": "",
|
||||
"title": "",
|
||||
"title_durations": "",
|
||||
"title_loading": "",
|
||||
"title_transitions": ""
|
||||
},
|
||||
"errors": {
|
||||
"fetch": "Error al obtener los datos del ciclo de vida del trabajo"
|
||||
}
|
||||
},
|
||||
"job_payments": {
|
||||
"buttons": {
|
||||
"goback": "",
|
||||
@@ -1762,6 +1791,7 @@
|
||||
"estimator": "Estimador",
|
||||
"filehandler": "File Handler",
|
||||
"insurance": "detalles del seguro",
|
||||
"more": "Más",
|
||||
"notes": "Notas",
|
||||
"parts": "Partes",
|
||||
"totals": "Totales",
|
||||
@@ -1894,6 +1924,7 @@
|
||||
},
|
||||
"reconciliationheader": "",
|
||||
"relatedros": "",
|
||||
"remove_from_ar": "",
|
||||
"returntotals": "",
|
||||
"rosaletotal": "",
|
||||
"sale_additional": "",
|
||||
@@ -2074,6 +2105,7 @@
|
||||
"general": "",
|
||||
"insurance": "",
|
||||
"labor": "Labor",
|
||||
"lifecycle": "",
|
||||
"partssublet": "Piezas / Subarrendamiento",
|
||||
"rates": "",
|
||||
"repairdata": "Datos de reparación",
|
||||
@@ -2653,6 +2685,7 @@
|
||||
},
|
||||
"templates": {
|
||||
"anticipated_revenue": "",
|
||||
"ar_aging": "",
|
||||
"attendance_detail": "",
|
||||
"attendance_employee": "",
|
||||
"attendance_summary": "",
|
||||
@@ -2719,6 +2752,7 @@
|
||||
"open_orders": "",
|
||||
"open_orders_csr": "",
|
||||
"open_orders_estimator": "",
|
||||
"open_orders_excel": "",
|
||||
"open_orders_ins_co": "",
|
||||
"open_orders_referral": "",
|
||||
"open_orders_specific_csr": "",
|
||||
@@ -3007,7 +3041,7 @@
|
||||
"jobs-intake": "",
|
||||
"jobsavailable": "Empleos disponibles | $t(titles.app)",
|
||||
"jobsdetail": "Trabajo {{ro_number}} | $t(titles.app)",
|
||||
"jobsdocuments": "Documentos de trabajo {{ro_number}} | $ t (títulos.app)",
|
||||
"jobsdocuments": "Documentos de trabajo {{ro_number}} | $t(titles.app)",
|
||||
"manageroot": "Casa | $t(titles.app)",
|
||||
"owners": "Todos los propietarios | $t(titles.app)",
|
||||
"owners-detail": "",
|
||||
@@ -3026,6 +3060,10 @@
|
||||
"shop-csi": "",
|
||||
"shop-templates": "",
|
||||
"shop_vendors": "Vendedores | $t(titles.app)",
|
||||
"techconsole": "$t(titles.app)",
|
||||
"techjobclock": "$t(titles.app)",
|
||||
"techjoblookup": "$t(titles.app)",
|
||||
"techshiftclock": "$t(titles.app)",
|
||||
"temporarydocs": "",
|
||||
"timetickets": "",
|
||||
"ttapprovals": "",
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
},
|
||||
"audit_trail": {
|
||||
"messages": {
|
||||
"admin_job_remove_from_ar": "",
|
||||
"admin_jobmarkexported": "",
|
||||
"admin_jobmarkforreexport": "",
|
||||
"admin_jobuninvoice": "",
|
||||
@@ -114,11 +115,11 @@
|
||||
"jobassignmentchange": "",
|
||||
"jobassignmentremoved": "",
|
||||
"jobchecklist": "",
|
||||
"jobinvoiced": "",
|
||||
"jobconverted": "",
|
||||
"jobfieldchanged": "",
|
||||
"jobimported": "",
|
||||
"jobinproductionchange": "",
|
||||
"jobinvoiced": "",
|
||||
"jobioucreated": "",
|
||||
"jobmodifylbradj": "",
|
||||
"jobnoteadded": "",
|
||||
@@ -258,7 +259,6 @@
|
||||
"saving": ""
|
||||
},
|
||||
"fields": {
|
||||
"ReceivableCustomField": "",
|
||||
"address1": "",
|
||||
"address2": "",
|
||||
"appt_alt_transport": "",
|
||||
@@ -335,13 +335,13 @@
|
||||
"md_ded_notes": "",
|
||||
"md_email_cc": "",
|
||||
"md_from_emails": "",
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": ""
|
||||
},
|
||||
"md_hour_split": {
|
||||
"paint": "",
|
||||
"prep": ""
|
||||
},
|
||||
"md_functionality_toggles": {
|
||||
"parts_queue_toggle": ""
|
||||
},
|
||||
"md_ins_co": {
|
||||
"city": "",
|
||||
"name": "",
|
||||
@@ -480,6 +480,7 @@
|
||||
"editaccess": ""
|
||||
}
|
||||
},
|
||||
"ReceivableCustomField": "",
|
||||
"responsibilitycenter": "",
|
||||
"responsibilitycenter_accountdesc": "",
|
||||
"responsibilitycenter_accountitem": "",
|
||||
@@ -827,6 +828,10 @@
|
||||
"usage": "",
|
||||
"vehicle": ""
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "",
|
||||
"ready": ""
|
||||
},
|
||||
"status": {
|
||||
"in": "",
|
||||
"inservice": "",
|
||||
@@ -836,10 +841,6 @@
|
||||
},
|
||||
"successes": {
|
||||
"saved": ""
|
||||
},
|
||||
"readiness": {
|
||||
"notready": "",
|
||||
"ready": ""
|
||||
}
|
||||
},
|
||||
"csi": {
|
||||
@@ -1015,10 +1016,13 @@
|
||||
},
|
||||
"labels": {
|
||||
"actions": "",
|
||||
"active": "",
|
||||
"endmustbeafterstart": "",
|
||||
"flat_rate": "",
|
||||
"inactive": "",
|
||||
"name": "",
|
||||
"rate_type": "",
|
||||
"status": "",
|
||||
"straight_time": ""
|
||||
},
|
||||
"successes": {
|
||||
@@ -1224,6 +1228,31 @@
|
||||
"updated": ""
|
||||
}
|
||||
},
|
||||
"job_lifecycle": {
|
||||
"columns": {
|
||||
"duration": "",
|
||||
"end": "",
|
||||
"relative_end": "",
|
||||
"relative_start": "",
|
||||
"start": "",
|
||||
"value": ""
|
||||
},
|
||||
"content": {
|
||||
"current_status_accumulated_time": "",
|
||||
"data_unavailable": "",
|
||||
"legend_title": "",
|
||||
"loading": "",
|
||||
"not_available": "",
|
||||
"previous_status_accumulated_time": "",
|
||||
"title": "",
|
||||
"title_durations": "",
|
||||
"title_loading": "",
|
||||
"title_transitions": ""
|
||||
},
|
||||
"errors": {
|
||||
"fetch": "Erreur lors de l'obtention des données du cycle de vie des tâches"
|
||||
}
|
||||
},
|
||||
"job_payments": {
|
||||
"buttons": {
|
||||
"goback": "",
|
||||
@@ -1762,6 +1791,7 @@
|
||||
"estimator": "Estimateur",
|
||||
"filehandler": "Gestionnaire de fichiers",
|
||||
"insurance": "Détails de l'assurance",
|
||||
"more": "Plus",
|
||||
"notes": "Remarques",
|
||||
"parts": "les pièces",
|
||||
"totals": "Totaux",
|
||||
@@ -1894,6 +1924,7 @@
|
||||
},
|
||||
"reconciliationheader": "",
|
||||
"relatedros": "",
|
||||
"remove_from_ar": "",
|
||||
"returntotals": "",
|
||||
"rosaletotal": "",
|
||||
"sale_additional": "",
|
||||
@@ -2074,6 +2105,7 @@
|
||||
"general": "",
|
||||
"insurance": "",
|
||||
"labor": "La main d'oeuvre",
|
||||
"lifecycle": "",
|
||||
"partssublet": "Pièces / Sous-location",
|
||||
"rates": "",
|
||||
"repairdata": "Données de réparation",
|
||||
@@ -2653,6 +2685,7 @@
|
||||
},
|
||||
"templates": {
|
||||
"anticipated_revenue": "",
|
||||
"ar_aging": "",
|
||||
"attendance_detail": "",
|
||||
"attendance_employee": "",
|
||||
"attendance_summary": "",
|
||||
@@ -2719,6 +2752,7 @@
|
||||
"open_orders": "",
|
||||
"open_orders_csr": "",
|
||||
"open_orders_estimator": "",
|
||||
"open_orders_excel": "",
|
||||
"open_orders_ins_co": "",
|
||||
"open_orders_referral": "",
|
||||
"open_orders_specific_csr": "",
|
||||
@@ -3007,7 +3041,7 @@
|
||||
"jobs-intake": "",
|
||||
"jobsavailable": "Emplois disponibles | $t(titles.app)",
|
||||
"jobsdetail": "Travail {{ro_number}} | $t(titles.app)",
|
||||
"jobsdocuments": "Documents de travail {{ro_number}} | $ t (titres.app)",
|
||||
"jobsdocuments": "Documents de travail {{ro_number}} | $t(titles.app)",
|
||||
"manageroot": "Accueil | $t(titles.app)",
|
||||
"owners": "Tous les propriétaires | $t(titles.app)",
|
||||
"owners-detail": "",
|
||||
@@ -3026,6 +3060,10 @@
|
||||
"shop-csi": "",
|
||||
"shop-templates": "",
|
||||
"shop_vendors": "Vendeurs | $t(titles.app)",
|
||||
"techconsole": "$t(titles.app)",
|
||||
"techjobclock": "$t(titles.app)",
|
||||
"techjoblookup": "$t(titles.app)",
|
||||
"techshiftclock": "$t(titles.app)",
|
||||
"temporarydocs": "",
|
||||
"timetickets": "",
|
||||
"ttapprovals": "",
|
||||
|
||||
@@ -1,32 +1,19 @@
|
||||
import i18n from "i18next";
|
||||
|
||||
const AuditTrailMapping = {
|
||||
alertToggle: (status) => i18n.t("audit_trail.messages.alerttoggle", { status }),
|
||||
admin_job_remove_from_ar: (status) =>
|
||||
i18n.t("audit_trail.messages.admin_job_remove_from_ar", { status }),
|
||||
admin_jobfieldchange: (field, value) =>
|
||||
"ADMIN: " +
|
||||
i18n.t("audit_trail.messages.jobfieldchanged", { field, value }),
|
||||
admin_jobstatuschange: (status) =>
|
||||
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||
alertToggle: (status) =>
|
||||
i18n.t("audit_trail.messages.alerttoggle", { status }),
|
||||
appointmentcancel: (lost_sale_reason) =>
|
||||
i18n.t("audit_trail.messages.appointmentcancel", { lost_sale_reason }),
|
||||
appointmentinsert: (start) =>
|
||||
i18n.t("audit_trail.messages.appointmentinsert", { start }),
|
||||
jobstatuschange: (status) =>
|
||||
i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||
admin_jobstatuschange: (status) =>
|
||||
"ADMIN: " + i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
||||
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
||||
jobinvoiced: () =>
|
||||
i18n.t("audit_trail.messages.jobinvoiced"),
|
||||
jobconverted: (ro_number) =>
|
||||
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
||||
jobfieldchange: (field, value) =>
|
||||
i18n.t("audit_trail.messages.jobfieldchanged", { field, value }),
|
||||
admin_jobfieldchange: (field, value) =>
|
||||
"ADMIN: " +
|
||||
i18n.t("audit_trail.messages.jobfieldchanged", { field, value }),
|
||||
jobspartsorder: (order_number) =>
|
||||
i18n.t("audit_trail.messages.jobspartsorder", { order_number }),
|
||||
jobspartsreturn: (order_number) =>
|
||||
i18n.t("audit_trail.messages.jobspartsreturn", { order_number }),
|
||||
jobmodifylbradj: ({ mod_lbr_ty, hours }) =>
|
||||
i18n.t("audit_trail.messages.jobmodifylbradj", { mod_lbr_ty, hours }),
|
||||
billposted: (invoice_number) =>
|
||||
i18n.t("audit_trail.messages.billposted", { invoice_number }),
|
||||
billupdated: (invoice_number) =>
|
||||
@@ -35,10 +22,18 @@ const AuditTrailMapping = {
|
||||
i18n.t("audit_trail.messages.jobassignmentchange", { operation, name }),
|
||||
jobassignmentremoved: (operation) =>
|
||||
i18n.t("audit_trail.messages.jobassignmentremoved", { operation }),
|
||||
jobinproductionchange: (inproduction) =>
|
||||
i18n.t("audit_trail.messages.jobinproductionchange", { inproduction }),
|
||||
jobchecklist: (type, inproduction, status) =>
|
||||
i18n.t("audit_trail.messages.jobchecklist", { type, inproduction, status }),
|
||||
jobconverted: (ro_number) =>
|
||||
i18n.t("audit_trail.messages.jobconverted", { ro_number }),
|
||||
jobfieldchange: (field, value) =>
|
||||
i18n.t("audit_trail.messages.jobfieldchanged", { field, value }),
|
||||
jobimported: () => i18n.t("audit_trail.messages.jobimported"),
|
||||
jobinproductionchange: (inproduction) =>
|
||||
i18n.t("audit_trail.messages.jobinproductionchange", { inproduction }),
|
||||
jobinvoiced: () => i18n.t("audit_trail.messages.jobinvoiced"),
|
||||
jobmodifylbradj: ({ mod_lbr_ty, hours }) =>
|
||||
i18n.t("audit_trail.messages.jobmodifylbradj", { mod_lbr_ty, hours }),
|
||||
jobnoteadded: () => i18n.t("audit_trail.messages.jobnoteadded"),
|
||||
jobnoteupdated: () => i18n.t("audit_trail.messages.jobnoteupdated"),
|
||||
jobnotedeleted: () => i18n.t("audit_trail.messages.jobnotedeleted"),
|
||||
@@ -51,6 +46,13 @@ const AuditTrailMapping = {
|
||||
failedpayment: () => i18n.t("audit_trail.messages.failedpayment"),
|
||||
assignedlinehours: (team, hours) =>
|
||||
i18n.t("audit_trail.messages.assignedlinehours", { team, hours }),
|
||||
jobspartsorder: (order_number) =>
|
||||
i18n.t("audit_trail.messages.jobspartsorder", { order_number }),
|
||||
jobspartsreturn: (order_number) =>
|
||||
i18n.t("audit_trail.messages.jobspartsreturn", { order_number }),
|
||||
jobstatuschange: (status) =>
|
||||
i18n.t("audit_trail.messages.jobstatuschange", { status }),
|
||||
jobsupplement: () => i18n.t("audit_trail.messages.jobsupplement"),
|
||||
};
|
||||
|
||||
export default AuditTrailMapping;
|
||||
|
||||
@@ -17,6 +17,9 @@ export function DateTimeFormatter(props) {
|
||||
)
|
||||
: null;
|
||||
}
|
||||
export function DateTimeFormatterFunction(date) {
|
||||
return moment(date).format("MM/DD/YYYY hh:mm a");
|
||||
}
|
||||
export function TimeFormatter(props) {
|
||||
return props.children
|
||||
? moment(props.children).format(props.format ? props.format : "hh:mm a")
|
||||
|
||||
@@ -2193,6 +2193,28 @@ export const TemplateList = (type, context) => {
|
||||
group: "jobs",
|
||||
enhanced_payroll: true,
|
||||
},
|
||||
open_orders_excel: {
|
||||
title: i18n.t("reportcenter.templates.open_orders_excel"),
|
||||
subject: i18n.t("reportcenter.templates.open_orders_excel"),
|
||||
key: "open_orders_excel",
|
||||
//idtype: "vendor",
|
||||
reporttype: "excel",
|
||||
disabled: false,
|
||||
rangeFilter: {
|
||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||
field: i18n.t("jobs.fields.date_open"),
|
||||
},
|
||||
group: "jobs",
|
||||
},
|
||||
ar_aging: {
|
||||
title: i18n.t("reportcenter.templates.ar_aging"),
|
||||
subject: i18n.t("reportcenter.templates.ar_aging"),
|
||||
key: "ar_aging",
|
||||
//idtype: "vendor",
|
||||
disabled: false,
|
||||
datedisable: true,
|
||||
group: "customers",
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
...(!type || type === "courtesycarcontract"
|
||||
|
||||
37
client/src/utils/handleBeta.js
Normal file
37
client/src/utils/handleBeta.js
Normal file
@@ -0,0 +1,37 @@
|
||||
export const BETA_KEY = 'betaSwitchImex';
|
||||
|
||||
export const checkBeta = () => {
|
||||
const cookie = document.cookie.split('; ').find(row => row.startsWith(BETA_KEY));
|
||||
return cookie ? cookie.split('=')[1] === 'true' : false;
|
||||
}
|
||||
|
||||
|
||||
export const setBeta = (value) => {
|
||||
const domain = window.location.hostname.split('.').slice(-2).join('.');
|
||||
document.cookie = `${BETA_KEY}=${value}; path=/; domain=.${domain}`;
|
||||
}
|
||||
|
||||
export const handleBeta = () => {
|
||||
// If the current host name does not start with beta or test, then we don't need to do anything.
|
||||
if (window.location.hostname.startsWith('localhost')) {
|
||||
console.log('Not on beta or test, so no need to handle beta.');
|
||||
return;
|
||||
}
|
||||
|
||||
const isBeta = checkBeta();
|
||||
|
||||
const currentHostName = window.location.hostname;
|
||||
|
||||
// Beta is enabled, but the current host name does start with beta.
|
||||
if (isBeta && !currentHostName.startsWith('beta')) {
|
||||
const href= `${window.location.protocol}//beta.${currentHostName}${window.location.pathname}${window.location.search}${window.location.hash}`;
|
||||
window.location.replace(href);
|
||||
}
|
||||
|
||||
// Beta is not enabled, but the current host name does start with beta.
|
||||
else if (!isBeta && currentHostName.startsWith('beta')) {
|
||||
const href = `${window.location.protocol}//${currentHostName.replace('beta.', '')}${window.location.pathname}${window.location.search}${window.location.hash}`;
|
||||
window.location.replace(href);
|
||||
}
|
||||
}
|
||||
export default handleBeta;
|
||||
832
client/yarn.lock
832
client/yarn.lock
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,6 @@
|
||||
- function:
|
||||
name: jobs_ar_summary
|
||||
schema: public
|
||||
- function:
|
||||
name: search_bills
|
||||
schema: public
|
||||
|
||||
@@ -2423,6 +2423,73 @@
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
- table:
|
||||
name: eula_acceptances
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: eula
|
||||
using:
|
||||
foreign_key_constraint_on: eulaid
|
||||
- name: user
|
||||
using:
|
||||
foreign_key_constraint_on: useremail
|
||||
insert_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
check:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
columns:
|
||||
- address
|
||||
- business_name
|
||||
- date_accepted
|
||||
- eulaid
|
||||
- first_name
|
||||
- last_name
|
||||
- phone_number
|
||||
- useremail
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- address
|
||||
- business_name
|
||||
- first_name
|
||||
- last_name
|
||||
- phone_number
|
||||
- useremail
|
||||
- created_at
|
||||
- date_accepted
|
||||
- updated_at
|
||||
- eulaid
|
||||
- id
|
||||
filter:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- table:
|
||||
name: eulas
|
||||
schema: public
|
||||
array_relationships:
|
||||
- name: eula_acceptances
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: eulaid
|
||||
table:
|
||||
name: eula_acceptances
|
||||
schema: public
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- effective_date
|
||||
- end_date
|
||||
- content
|
||||
filter: {}
|
||||
- table:
|
||||
name: exportlog
|
||||
schema: public
|
||||
@@ -2606,6 +2673,34 @@
|
||||
- table:
|
||||
name: ioevents
|
||||
schema: public
|
||||
- table:
|
||||
name: job_ar_schema
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: job
|
||||
using:
|
||||
foreign_key_constraint_on: id
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- id
|
||||
- ro_number
|
||||
- clm_total
|
||||
- total_payments
|
||||
- balance
|
||||
- date_invoiced
|
||||
- shopid
|
||||
filter:
|
||||
job:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- active:
|
||||
_eq: true
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- table:
|
||||
name: job_conversations
|
||||
schema: public
|
||||
@@ -3745,6 +3840,7 @@
|
||||
- referral_source
|
||||
- referral_source_extra
|
||||
- regie_number
|
||||
- remove_from_ar
|
||||
- ro_number
|
||||
- scheduled_completion
|
||||
- scheduled_delivery
|
||||
@@ -4026,6 +4122,7 @@
|
||||
- referral_source
|
||||
- referral_source_extra
|
||||
- regie_number
|
||||
- remove_from_ar
|
||||
- ro_number
|
||||
- scheduled_completion
|
||||
- scheduled_delivery
|
||||
@@ -4092,6 +4189,11 @@
|
||||
- name: job_status_transition
|
||||
definition:
|
||||
enable_manual: true
|
||||
insert:
|
||||
columns: '*'
|
||||
update:
|
||||
columns:
|
||||
- status
|
||||
retry_conf:
|
||||
interval_sec: 10
|
||||
num_retries: 0
|
||||
@@ -5888,6 +5990,13 @@
|
||||
table:
|
||||
name: email_audit_trail
|
||||
schema: public
|
||||
- name: eula_acceptances
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: useremail
|
||||
table:
|
||||
name: eula_acceptances
|
||||
schema: public
|
||||
- name: exportlogs
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE "public"."eulas";
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE "public"."eulas" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "effective_date" timestamptz NOT NULL, "end_date" timestamptz, "content" text NOT NULL, PRIMARY KEY ("id") );
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_eulas_updated_at"
|
||||
BEFORE UPDATE ON "public"."eulas"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_eulas_updated_at" ON "public"."eulas"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE "public"."eula_acceptances";
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE "public"."eula_acceptances" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "eulaid" uuid NOT NULL, "date_accepted" timestamptz NOT NULL, "first_name" text NOT NULL, "last_name" text NOT NULL, "address" text NOT NULL, "phone_number" Text NOT NULL, "buisness_name" Text NOT NULL, "useremail" text NOT NULL, PRIMARY KEY ("id") , FOREIGN KEY ("eulaid") REFERENCES "public"."eulas"("id") ON UPDATE restrict ON DELETE restrict, FOREIGN KEY ("useremail") REFERENCES "public"."users"("email") ON UPDATE restrict ON DELETE restrict);
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_eula_acceptances_updated_at"
|
||||
BEFORE UPDATE ON "public"."eula_acceptances"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_eula_acceptances_updated_at" ON "public"."eula_acceptances"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
33
hasura/migrations/1705693552101_run_sql_migration/down.sql
Normal file
33
hasura/migrations/1705693552101_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF jobs
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.shopid,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- p.total_payments,
|
||||
-- j.clm_total - p.total_payments as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- sum(p.amount) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid ;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
31
hasura/migrations/1705693552101_run_sql_migration/up.sql
Normal file
31
hasura/migrations/1705693552101_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF jobs
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.shopid,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
p.total_payments,
|
||||
j.clm_total - p.total_payments as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
sum(p.amount) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid ;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
@@ -0,0 +1 @@
|
||||
DROP TABLE "public"."job_ar_schema";
|
||||
@@ -0,0 +1 @@
|
||||
CREATE TABLE "public"."job_ar_schema" ("id" uuid NOT NULL, "ro_number" text, "clm_total" numeric NOT NULL, "total_payments" numeric NOT NULL DEFAULT 0, "balance" numeric NOT NULL DEFAULT 0, PRIMARY KEY ("id") );
|
||||
34
hasura/migrations/1705693896379_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705693896379_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- DROP FUNCTION public.jobs_ar_summary;
|
||||
--
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- p.total_payments,
|
||||
-- j.clm_total - p.total_payments as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- sum(p.amount) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid ;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
32
hasura/migrations/1705693896379_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705693896379_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
DROP FUNCTION public.jobs_ar_summary;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
p.total_payments,
|
||||
j.clm_total - p.total_payments as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
sum(p.amount) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid ;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
32
hasura/migrations/1705694146809_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705694146809_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- p.total_payments,
|
||||
-- j.clm_total - p.total_payments as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid ;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
30
hasura/migrations/1705694146809_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705694146809_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
p.total_payments,
|
||||
j.clm_total - p.total_payments as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid ;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
32
hasura/migrations/1705694176838_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705694176838_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- p.total_payments,
|
||||
-- j.clm_total - p.total_payments as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid ;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
30
hasura/migrations/1705694176838_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705694176838_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
p.total_payments,
|
||||
j.clm_total - p.total_payments as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid ;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
32
hasura/migrations/1705696451631_run_sql_migration/down.sql
Normal file
32
hasura/migrations/1705696451631_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid ;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
30
hasura/migrations/1705696451631_run_sql_migration/up.sql
Normal file
30
hasura/migrations/1705696451631_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid ;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."jobs" add column "remove_from_ar" boolean
|
||||
-- not null default 'false';
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."jobs" add column "remove_from_ar" boolean
|
||||
not null default 'false';
|
||||
33
hasura/migrations/1705698426997_run_sql_migration/down.sql
Normal file
33
hasura/migrations/1705698426997_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
31
hasura/migrations/1705698426997_run_sql_migration/up.sql
Normal file
31
hasura/migrations/1705698426997_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."job_ar_schema" add column "date_invoiced" timestamptz
|
||||
-- null;
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."job_ar_schema" add column "date_invoiced" timestamptz
|
||||
null;
|
||||
34
hasura/migrations/1705698534883_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698534883_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- j.date_invoiced,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
32
hasura/migrations/1705698534883_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698534883_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
j.date_invoiced,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
34
hasura/migrations/1705698593644_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698593644_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
32
hasura/migrations/1705698593644_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698593644_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
34
hasura/migrations/1705698876975_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705698876975_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null and balance > 0;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
32
hasura/migrations/1705698876975_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705698876975_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null and balance > 0;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
34
hasura/migrations/1705700945994_run_sql_migration/down.sql
Normal file
34
hasura/migrations/1705700945994_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
32
hasura/migrations/1705700945994_run_sql_migration/up.sql
Normal file
32
hasura/migrations/1705700945994_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" rename column "business_name" to "buisness_name";
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" rename column "buisness_name" to "business_name";
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" alter column "phone_number" set not null;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" alter column "phone_number" drop not null;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" alter column "address" set not null;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."eula_acceptances" alter column "address" drop not null;
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."job_ar_schema" add column "shopid" uuid
|
||||
-- null;
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."job_ar_schema" add column "shopid" uuid
|
||||
null;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."job_ar_schema" drop constraint "job_ar_schema_id_fkey";
|
||||
@@ -0,0 +1,5 @@
|
||||
alter table "public"."job_ar_schema"
|
||||
add constraint "job_ar_schema_id_fkey"
|
||||
foreign key ("id")
|
||||
references "public"."jobs"
|
||||
("id") on update restrict on delete restrict;
|
||||
35
hasura/migrations/1705952926623_run_sql_migration/down.sql
Normal file
35
hasura/migrations/1705952926623_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced,
|
||||
-- j.shopid
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
33
hasura/migrations/1705952926623_run_sql_migration/up.sql
Normal file
33
hasura/migrations/1705952926623_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced,
|
||||
j.shopid
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) > 0;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
35
hasura/migrations/1706207204357_run_sql_migration/down.sql
Normal file
35
hasura/migrations/1706207204357_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced,
|
||||
-- j.shopid
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) != 0;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
33
hasura/migrations/1706207204357_run_sql_migration/up.sql
Normal file
33
hasura/migrations/1706207204357_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced,
|
||||
j.shopid
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) != 0;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
35
hasura/migrations/1706207267558_run_sql_migration/down.sql
Normal file
35
hasura/migrations/1706207267558_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
-- RETURNS SETOF job_ar_schema
|
||||
-- LANGUAGE plpgsql
|
||||
-- STABLE
|
||||
-- AS $function$
|
||||
-- BEGIN
|
||||
--
|
||||
-- RETURN query
|
||||
-- select
|
||||
-- j.id,
|
||||
-- j.ro_number,
|
||||
-- j.clm_total,
|
||||
-- coalesce (p.total_payments,0) as total_payments,
|
||||
-- j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
-- j.date_invoiced,
|
||||
-- j.shopid
|
||||
-- from
|
||||
-- jobs j
|
||||
-- left join (
|
||||
-- select
|
||||
-- p.jobid,
|
||||
-- coalesce (sum(p.amount),0) as total_payments
|
||||
-- from
|
||||
-- payments p
|
||||
-- group by
|
||||
-- p.jobid
|
||||
-- ) p on
|
||||
-- j.id = p.jobid
|
||||
-- where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) != 0;
|
||||
--
|
||||
--
|
||||
-- END
|
||||
-- $function$;
|
||||
33
hasura/migrations/1706207267558_run_sql_migration/up.sql
Normal file
33
hasura/migrations/1706207267558_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
CREATE OR REPLACE FUNCTION public.jobs_ar_summary ()
|
||||
RETURNS SETOF job_ar_schema
|
||||
LANGUAGE plpgsql
|
||||
STABLE
|
||||
AS $function$
|
||||
BEGIN
|
||||
|
||||
RETURN query
|
||||
select
|
||||
j.id,
|
||||
j.ro_number,
|
||||
j.clm_total,
|
||||
coalesce (p.total_payments,0) as total_payments,
|
||||
j.clm_total - coalesce (p.total_payments,0) as balance,
|
||||
j.date_invoiced,
|
||||
j.shopid
|
||||
from
|
||||
jobs j
|
||||
left join (
|
||||
select
|
||||
p.jobid,
|
||||
coalesce (sum(p.amount),0) as total_payments
|
||||
from
|
||||
payments p
|
||||
group by
|
||||
p.jobid
|
||||
) p on
|
||||
j.id = p.jobid
|
||||
where j.remove_from_ar = false and j.date_invoiced is not null and j.clm_total - coalesce (p.total_payments,0) != 0;
|
||||
|
||||
|
||||
END
|
||||
$function$;
|
||||
47574
new_bodyshop_translations.babel
Normal file
47574
new_bodyshop_translations.babel
Normal file
File diff suppressed because it is too large
Load Diff
411
package-lock.json
generated
411
package-lock.json
generated
@@ -42,6 +42,7 @@
|
||||
"nodemailer": "^6.9.7",
|
||||
"phone": "^3.1.41",
|
||||
"recursive-diff": "^1.0.9",
|
||||
"rimraf": "^5.0.5",
|
||||
"soap": "^1.0.0",
|
||||
"socket.io": "^4.7.2",
|
||||
"ssh2-sftp-client": "^9.1.0",
|
||||
@@ -940,6 +941,95 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
|
||||
"dependencies": {
|
||||
"string-width": "^5.1.2",
|
||||
"string-width-cjs": "npm:string-width@^4.2.0",
|
||||
"strip-ansi": "^7.0.1",
|
||||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
|
||||
"wrap-ansi": "^8.1.0",
|
||||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/ansi-regex": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
|
||||
"integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/ansi-styles": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
||||
"dependencies": {
|
||||
"eastasianwidth": "^0.2.0",
|
||||
"emoji-regex": "^9.2.2",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/strip-ansi": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
||||
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
||||
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.1.0",
|
||||
"string-width": "^5.0.1",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@jonkemp/package-utils": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@jonkemp/package-utils/-/package-utils-1.0.8.tgz",
|
||||
@@ -1017,6 +1107,15 @@
|
||||
"yarn": "^1.22.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgjs/parseargs": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||
@@ -1898,7 +1997,6 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"devOptional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -1907,7 +2005,6 @@
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
@@ -2042,8 +2139,7 @@
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||
"devOptional": true
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
@@ -2149,7 +2245,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0"
|
||||
}
|
||||
@@ -2347,7 +2442,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
@@ -2651,6 +2745,19 @@
|
||||
"node-fetch": "^2.6.12"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
"which": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/csrf": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/csrf/-/csrf-3.1.0.tgz",
|
||||
@@ -2955,6 +3062,11 @@
|
||||
"stream-shift": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
||||
},
|
||||
"node_modules/ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
@@ -2995,8 +3107,7 @@
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"devOptional": true
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
|
||||
},
|
||||
"node_modules/enabled": {
|
||||
"version": "2.0.0",
|
||||
@@ -3508,6 +3619,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/foreground-child": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz",
|
||||
"integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"signal-exit": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
@@ -4211,7 +4337,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"devOptional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -4255,11 +4380,33 @@
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
|
||||
},
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
},
|
||||
"node_modules/isstream": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
|
||||
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g=="
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz",
|
||||
"integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==",
|
||||
"dependencies": {
|
||||
"@isaacs/cliui": "^8.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@pkgjs/parseargs": "^0.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jake": {
|
||||
"version": "10.8.7",
|
||||
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
|
||||
@@ -4843,6 +4990,14 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
|
||||
"integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
|
||||
@@ -5210,6 +5365,37 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-scurry": {
|
||||
"version": "1.10.1",
|
||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz",
|
||||
"integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^9.1.1 || ^10.0.0",
|
||||
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/path-scurry/node_modules/lru-cache": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz",
|
||||
"integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==",
|
||||
"engines": {
|
||||
"node": "14 || >=16.14"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
@@ -5676,57 +5862,55 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||
"dev": true,
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz",
|
||||
"integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
"glob": "^10.3.7"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
"rimraf": "dist/esm/bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dev": true,
|
||||
"version": "10.3.10",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz",
|
||||
"integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
"foreground-child": "^3.1.0",
|
||||
"jackspeak": "^2.3.5",
|
||||
"minimatch": "^9.0.1",
|
||||
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0",
|
||||
"path-scurry": "^1.10.1"
|
||||
},
|
||||
"bin": {
|
||||
"glob": "dist/esm/bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"version": "9.0.3",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
|
||||
"integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
"brace-expansion": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rndm": {
|
||||
@@ -5875,6 +6059,25 @@
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
|
||||
},
|
||||
"node_modules/shebang-command": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/shell-quote": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz",
|
||||
@@ -5897,6 +6100,17 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-swizzle": {
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
|
||||
@@ -6319,7 +6533,20 @@
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width-cjs": {
|
||||
"name": "string-width",
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
@@ -6341,7 +6568,18 @@
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"devOptional": true,
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi-cjs": {
|
||||
"name": "strip-ansi",
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
@@ -6529,6 +6767,60 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/temp/node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/temp/node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/temp/node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/temp/node_modules/rimraf": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
|
||||
"integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/text-decoding": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/text-decoding/-/text-decoding-1.0.0.tgz",
|
||||
@@ -6928,6 +7220,20 @@
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node-which": "bin/node-which"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/winston": {
|
||||
"version": "3.11.0",
|
||||
"resolved": "https://registry.npmjs.org/winston/-/winston-3.11.0.tgz",
|
||||
@@ -6987,6 +7293,23 @@
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs": {
|
||||
"name": "wrap-ansi",
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"setup": "rm -rf node_modules && npm i && cd client && rm -rf node_modules && npm i",
|
||||
"setup:win": "rimraf node_modules && npm i && cd client && rimraf node_modules && npm i",
|
||||
"admin": "cd admin && npm start",
|
||||
"client": "cd client && npm start",
|
||||
"server": "nodemon server.js",
|
||||
@@ -50,6 +51,7 @@
|
||||
"nodemailer": "^6.9.7",
|
||||
"phone": "^3.1.41",
|
||||
"recursive-diff": "^1.0.9",
|
||||
"rimraf": "^5.0.5",
|
||||
"soap": "^1.0.0",
|
||||
"socket.io": "^4.7.2",
|
||||
"ssh2-sftp-client": "^9.1.0",
|
||||
|
||||
352
server.js
352
server.js
@@ -1,309 +1,93 @@
|
||||
// Import core modules
|
||||
const express = require("express");
|
||||
const cors = require("cors");
|
||||
const bodyParser = require("body-parser");
|
||||
const path = require("path");
|
||||
const compression = require("compression");
|
||||
const twilio = require("twilio");
|
||||
const logger = require("./server/utils/logger");
|
||||
const fb = require("./server/firebase/firebase-handler");
|
||||
const cookieParser = require("cookie-parser");
|
||||
const multer = require("multer");
|
||||
const upload = multer();
|
||||
//var enforce = require("express-sslify");
|
||||
const http = require("http");
|
||||
const {Server} = require("socket.io");
|
||||
|
||||
// Load environment variables
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
`.env.${process.env.NODE_ENV || "development"}`
|
||||
),
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
// Import custom utilities and handlers
|
||||
const logger = require("./server/utils/logger");
|
||||
|
||||
// Express app and server setup
|
||||
const app = express();
|
||||
const port = process.env.PORT || 5000;
|
||||
//const port = 5000;
|
||||
|
||||
const http = require("http");
|
||||
const server = http.createServer(app);
|
||||
const { Server } = require("socket.io");
|
||||
const io = new Server(server, {
|
||||
path: "/ws",
|
||||
cors: {
|
||||
origin: [
|
||||
"https://test.imex.online",
|
||||
"https://www.test.imex.online",
|
||||
"http://localhost:3000",
|
||||
"https://imex.online",
|
||||
"https://www.imex.online",
|
||||
"https://romeonline.io",
|
||||
"https://www.romeonline.io",
|
||||
],
|
||||
methods: ["GET", "POST"],
|
||||
credentials: true,
|
||||
exposedHeaders: ["set-cookie"],
|
||||
},
|
||||
path: "/ws",
|
||||
cors: {
|
||||
origin: [
|
||||
"https://test.imex.online",
|
||||
"https://www.test.imex.online",
|
||||
"http://localhost:3000",
|
||||
"https://imex.online",
|
||||
"https://www.imex.online",
|
||||
"https://romeonline.io",
|
||||
"https://www.romeonline.io",
|
||||
],
|
||||
methods: ["GET", "POST"],
|
||||
credentials: true,
|
||||
exposedHeaders: ["set-cookie"],
|
||||
},
|
||||
});
|
||||
exports.io = io;
|
||||
|
||||
require("./server/web-sockets/web-socket");
|
||||
// app.set('trust proxy', true)
|
||||
// app.use(fb.validateFirebaseIdToken);
|
||||
|
||||
|
||||
// Middleware
|
||||
app.use(compression());
|
||||
app.use(cookieParser());
|
||||
app.use(bodyParser.json({ limit: "50mb" }));
|
||||
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
|
||||
// app.use(enforce.HTTPS({ trustProtoHeader: true }));
|
||||
app.use(
|
||||
cors({ credentials: true, exposedHeaders: ["set-cookie"] })
|
||||
// cors({
|
||||
// credentials: true,
|
||||
// origin: [
|
||||
// "https://test.imex.online",
|
||||
// "http://localhost:3000",
|
||||
// "https://imex.online",
|
||||
// ],
|
||||
// })
|
||||
);
|
||||
app.use(bodyParser.json({limit: "50mb"}));
|
||||
app.use(bodyParser.urlencoded({limit: "50mb", extended: true}));
|
||||
app.use(cors({credentials: true, exposedHeaders: ["set-cookie"]}));
|
||||
|
||||
//Email Based Paths.
|
||||
var sendEmail = require("./server/email/sendemail.js");
|
||||
app.post("/sendemail", fb.validateFirebaseIdToken, sendEmail.sendEmail);
|
||||
app.post("/emailbounce", bodyParser.text(), sendEmail.emailBounce);
|
||||
|
||||
//Test route to ensure Express is responding.
|
||||
app.get("/test", async function (req, res) {
|
||||
const commit = require("child_process").execSync(
|
||||
"git rev-parse --short HEAD"
|
||||
);
|
||||
// console.log(app.get('trust proxy'));
|
||||
// console.log("remoteAddress", req.socket.remoteAddress);
|
||||
// console.log("X-Forwarded-For", req.header('x-forwarded-for'));
|
||||
logger.log("test-api-status", "DEBUG", "api", { commit });
|
||||
// sendEmail.sendServerEmail({
|
||||
// subject: `API Check - ${process.env.NODE_ENV}`,
|
||||
// text: `Server API check has come in. Remote IP: ${req.socket.remoteAddress}, X-Forwarded-For: ${req.header('x-forwarded-for')}`,
|
||||
// });
|
||||
sendEmail.sendServerEmail({
|
||||
subject: `API Check - ${process.env.NODE_ENV}`,
|
||||
text: `Server API check has come in.`,
|
||||
});
|
||||
res.status(200).send(`OK - ${commit}`);
|
||||
// Helper middleware
|
||||
app.use((req, res, next) => {
|
||||
req.logger = logger;
|
||||
next();
|
||||
});
|
||||
|
||||
//Accounting Qbxml
|
||||
const accountQbxml = require("./server/accounting/qbxml/qbxml");
|
||||
app.post(
|
||||
"/accounting/qbxml/receivables",
|
||||
fb.validateFirebaseIdToken,
|
||||
accountQbxml.receivables
|
||||
);
|
||||
app.post(
|
||||
"/accounting/qbxml/payables",
|
||||
fb.validateFirebaseIdToken,
|
||||
accountQbxml.payables
|
||||
);
|
||||
app.post(
|
||||
"/accounting/qbxml/payments",
|
||||
fb.validateFirebaseIdToken,
|
||||
accountQbxml.payments
|
||||
);
|
||||
// Route groupings
|
||||
app.use('/', require("./server/routes/miscellaneousRoutes"));
|
||||
app.use("/notifications", require("./server/routes/notificationsRoutes"));
|
||||
app.use("/render", require("./server/routes/renderRoutes"));
|
||||
app.use('/mixdata', require("./server/routes/mixDataRoutes"));
|
||||
app.use('/accounting', require("./server/routes/accountingRoutes"));
|
||||
app.use('/qbo', require("./server/routes/qboRoutes"));
|
||||
app.use('/media', require("./server/routes/mediaRoutes"));
|
||||
app.use('/sms', require("./server/routes/smsRoutes"));
|
||||
app.use('/job', require("./server/routes/jobRoutes"));
|
||||
app.use('/scheduling', require("./server/routes/schedulingRoutes"));
|
||||
app.use('/utils', require("./server/routes/utilRoutes"));
|
||||
app.use('/data', require("./server/routes/dataRoutes"));
|
||||
app.use('/adm', require("./server/routes/adminRoutes"));
|
||||
app.use('/tech', require("./server/routes/techRoutes"));
|
||||
app.use('/intellipay', require("./server/routes/intellipayRoutes"));
|
||||
app.use('/cdk', require("./server/routes/cdkRoutes"));
|
||||
app.use('/payroll', require("./server/routes/payrollRoutes"));
|
||||
|
||||
//Cloudinary Media Paths
|
||||
var media = require("./server/media/media");
|
||||
app.post(
|
||||
"/media/sign",
|
||||
fb.validateFirebaseIdToken,
|
||||
media.createSignedUploadURL
|
||||
);
|
||||
app.post("/media/download", fb.validateFirebaseIdToken, media.downloadFiles);
|
||||
app.post("/media/rename", fb.validateFirebaseIdToken, media.renameKeys);
|
||||
app.post("/media/delete", fb.validateFirebaseIdToken, media.deleteFiles);
|
||||
|
||||
//SMS/Twilio Paths
|
||||
var smsReceive = require("./server/sms/receive");
|
||||
app.post(
|
||||
"/sms/receive",
|
||||
twilio.webhook({ validate: process.env.NODE_ENV === "PRODUCTION" }),
|
||||
smsReceive.receive
|
||||
);
|
||||
var smsSend = require("./server/sms/send");
|
||||
app.post("/sms/send", fb.validateFirebaseIdToken, smsSend.send);
|
||||
var smsStatus = require("./server/sms/status");
|
||||
app.post(
|
||||
"/sms/status",
|
||||
twilio.webhook({ validate: process.env.NODE_ENV === "PRODUCTION" }),
|
||||
smsStatus.status
|
||||
);
|
||||
app.post(
|
||||
"/sms/markConversationRead",
|
||||
fb.validateFirebaseIdToken,
|
||||
smsStatus.markConversationRead
|
||||
);
|
||||
|
||||
var job = require("./server/job/job");
|
||||
app.post("/job/totals", fb.validateFirebaseIdToken, job.totals);
|
||||
app.post(
|
||||
"/job/statustransition",
|
||||
// fb.validateFirebaseIdToken,
|
||||
job.statustransition
|
||||
);
|
||||
app.post("/job/totalsssu", fb.validateFirebaseIdToken, job.totalsSsu);
|
||||
app.post("/job/costing", fb.validateFirebaseIdToken, job.costing);
|
||||
app.post("/job/costingmulti", fb.validateFirebaseIdToken, job.costingmulti);
|
||||
|
||||
var ppc = require("./server/ccc/partspricechange");
|
||||
app.post("/job/ppc", fb.validateFirebaseIdToken, ppc.generatePpc);
|
||||
|
||||
var partsScan = require("./server/parts-scan/parts-scan");
|
||||
app.post("/job/partsscan", fb.validateFirebaseIdToken, partsScan.partsScan);
|
||||
//Scheduling
|
||||
var scheduling = require("./server/scheduling/scheduling-job");
|
||||
app.post("/scheduling/job", fb.validateFirebaseIdToken, scheduling.job);
|
||||
|
||||
//Handlebars Paths for Email/Report Rendering
|
||||
// var renderHandlebars = require("./server/render/renderHandlebars");
|
||||
// app.post("/render", fb.validateFirebaseIdToken, renderHandlebars.render);
|
||||
var inlineCss = require("./server/render/inlinecss");
|
||||
app.post("/render/inlinecss", fb.validateFirebaseIdToken, inlineCss.inlinecss);
|
||||
|
||||
// app.post(
|
||||
// "/notifications/send",
|
||||
|
||||
// fb.sendNotification
|
||||
// );
|
||||
app.post("/notifications/subscribe", fb.validateFirebaseIdToken, fb.subscribe);
|
||||
app.post(
|
||||
"/notifications/unsubscribe",
|
||||
fb.validateFirebaseIdToken,
|
||||
fb.unsubscribe
|
||||
);
|
||||
app.post("/adm/updateuser", fb.validateFirebaseIdToken, fb.updateUser);
|
||||
app.post("/adm/getuser", fb.validateFirebaseIdToken, fb.getUser);
|
||||
app.post("/adm/createuser", fb.validateFirebaseIdToken, fb.createUser);
|
||||
const adm = require("./server/admin/adminops");
|
||||
app.post(
|
||||
"/adm/createassociation",
|
||||
fb.validateFirebaseIdToken,
|
||||
fb.validateAdmin,
|
||||
adm.createAssociation
|
||||
);
|
||||
app.post(
|
||||
"/adm/createshop",
|
||||
fb.validateFirebaseIdToken,
|
||||
fb.validateAdmin,
|
||||
adm.createShop
|
||||
);
|
||||
app.post(
|
||||
"/adm/updateshop",
|
||||
fb.validateFirebaseIdToken,
|
||||
fb.validateAdmin,
|
||||
adm.updateShop
|
||||
);
|
||||
app.post(
|
||||
"/adm/updatecounter",
|
||||
fb.validateFirebaseIdToken,
|
||||
fb.validateAdmin,
|
||||
adm.updateCounter
|
||||
);
|
||||
|
||||
//Stripe Processing
|
||||
// var stripe = require("./server/stripe/payment");
|
||||
// app.post("/stripe/payment", fb.validateFirebaseIdToken, stripe.payment);
|
||||
// app.post(
|
||||
// "/stripe/mobilepayment",
|
||||
// fb.validateFirebaseIdToken,
|
||||
// stripe.mobile_payment
|
||||
// );
|
||||
|
||||
//Tech Console
|
||||
var tech = require("./server/tech/tech");
|
||||
app.post("/tech/login", fb.validateFirebaseIdToken, tech.techLogin);
|
||||
|
||||
var utils = require("./server/utils/utils");
|
||||
app.post("/utils/time", utils.servertime);
|
||||
app.post("/utils/jsr", fb.validateFirebaseIdToken, utils.jsrAuth);
|
||||
var qbo = require("./server/accounting/qbo/qbo");
|
||||
app.post("/qbo/authorize", fb.validateFirebaseIdToken, qbo.authorize);
|
||||
app.get("/qbo/callback", qbo.callback);
|
||||
app.post("/qbo/receivables", fb.validateFirebaseIdToken, qbo.receivables);
|
||||
app.post("/qbo/payables", fb.validateFirebaseIdToken, qbo.payables);
|
||||
app.post("/qbo/payments", fb.validateFirebaseIdToken, qbo.payments);
|
||||
|
||||
var data = require("./server/data/data");
|
||||
app.post("/data/ah", data.autohouse);
|
||||
app.post("/data/cc", data.claimscorp);
|
||||
app.post("/record-handler/arms", data.arms);
|
||||
|
||||
var taskHandler = require("./server/tasks/tasks");
|
||||
app.post("/taskHandler", fb.validateFirebaseIdToken, taskHandler.taskHandler);
|
||||
|
||||
var mixdataUpload = require("./server/mixdata/mixdata");
|
||||
|
||||
app.post(
|
||||
"/mixdata/upload",
|
||||
fb.validateFirebaseIdToken,
|
||||
upload.any(),
|
||||
mixdataUpload.mixdataUpload
|
||||
);
|
||||
|
||||
var intellipay = require("./server/intellipay/intellipay");
|
||||
app.post(
|
||||
"/intellipay/lightbox_credentials",
|
||||
fb.validateFirebaseIdToken,
|
||||
intellipay.lightbox_credentials
|
||||
);
|
||||
|
||||
app.post(
|
||||
"/intellipay/payment_refund",
|
||||
fb.validateFirebaseIdToken,
|
||||
intellipay.payment_refund
|
||||
);
|
||||
|
||||
app.post(
|
||||
"/intellipay/generate_payment_url",
|
||||
fb.validateFirebaseIdToken,
|
||||
intellipay.generate_payment_url
|
||||
);
|
||||
|
||||
app.post(
|
||||
"/intellipay/postback",
|
||||
// fb.validateFirebaseIdToken,
|
||||
intellipay.postback
|
||||
);
|
||||
|
||||
const payroll = require("./server/payroll/payroll");
|
||||
app.post(
|
||||
"/payroll/calculatelabor",
|
||||
fb.validateFirebaseIdToken,
|
||||
payroll.calculatelabor
|
||||
);
|
||||
app.post("/payroll/payall", fb.validateFirebaseIdToken, payroll.payall);
|
||||
app.post("/payroll/claimtask", fb.validateFirebaseIdToken, payroll.claimtask);
|
||||
|
||||
var ioevent = require("./server/ioevent/ioevent");
|
||||
app.post("/ioevent", ioevent.default);
|
||||
// app.post("/newlog", (req, res) => {
|
||||
// const { message, type, user, record, object } = req.body;
|
||||
// logger.log(message, type, user, record, object);
|
||||
// });
|
||||
|
||||
var os = require("./server/opensearch/os-handler");
|
||||
app.post(
|
||||
"/opensearch", //fb.validateFirebaseIdToken,
|
||||
os.handler
|
||||
);
|
||||
app.post("/search", fb.validateFirebaseIdToken, os.search);
|
||||
|
||||
var cdkGetMake = require("./server/cdk/cdk-get-makes");
|
||||
app.post("/cdk/getvehicles", fb.validateFirebaseIdToken, cdkGetMake.default);
|
||||
|
||||
app.get("/", async function (req, res) {
|
||||
res.status(200).send("Access Forbidden.");
|
||||
// Default route for forbidden access
|
||||
app.get("/", (req, res) => {
|
||||
res.status(200).send("Access Forbidden.");
|
||||
});
|
||||
|
||||
server.listen(port, (error) => {
|
||||
if (error) throw error;
|
||||
logger.log(
|
||||
`[${process.env.NODE_ENV || "DEVELOPMENT"}] Server running on port ${port}`,
|
||||
"INFO",
|
||||
"api"
|
||||
);
|
||||
});
|
||||
const main = async () => {
|
||||
await server.listen(port);
|
||||
}
|
||||
|
||||
// Start server
|
||||
main()
|
||||
.then(() => {
|
||||
logger.log(`[${process.env.NODE_ENV || "DEVELOPMENT"}] Server started on port ${port}`, "INFO", "api");
|
||||
})
|
||||
.catch((error) => {
|
||||
logger.log(`[${process.env.NODE_ENV || "DEVELOPMENT"}] Server failed to start on port ${port}`, "ERROR", "api", error);
|
||||
});
|
||||
@@ -166,7 +166,7 @@ async function CheckForErrors(socket, response) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`Succesful response from DMS. ${response.Message || ""}`
|
||||
`Successful response from DMS. ${response.Message || ""}`
|
||||
);
|
||||
} else {
|
||||
CdkBase.createLogEvent(
|
||||
|
||||
@@ -18,10 +18,10 @@ const {
|
||||
} = require("./qbo-callback");
|
||||
const OAuthClient = require("intuit-oauth");
|
||||
const moment = require("moment-timezone");
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
const findTaxCode = require("../qb-receivables-lines").findTaxCode;
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
|
||||
const oauthClient = new OAuthClient({
|
||||
clientId: process.env.QBO_CLIENT_ID,
|
||||
clientSecret: process.env.QBO_SECRET,
|
||||
@@ -30,29 +30,31 @@ exports.default = async (req, res) => {
|
||||
redirectUri: process.env.QBO_REDIRECT_URI,
|
||||
logging: true,
|
||||
});
|
||||
|
||||
try {
|
||||
//Fetch the API Access Tokens & Set them for the session.
|
||||
const response = await apiGqlClient.request(queries.GET_QBO_AUTH, {
|
||||
email: req.user.email,
|
||||
});
|
||||
|
||||
const { qbo_realmId } = response.associations[0];
|
||||
|
||||
oauthClient.setToken(response.associations[0].qbo_auth);
|
||||
|
||||
if (!qbo_realmId) {
|
||||
res.status(401).json({ error: "No company associated." });
|
||||
return;
|
||||
}
|
||||
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { bills: billsToQuery, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
logger.log("qbo-payable-create", "DEBUG", req.user.email, billsToQuery);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_BILLS_FOR_PAYABLES_EXPORT, {
|
||||
|
||||
@@ -51,15 +51,13 @@ exports.default = async (req, res) => {
|
||||
}
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { payments: paymentsToQuery, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
logger.log("qbo-payment-create", "DEBUG", req.user.email, paymentsToQuery);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_PAYMENTS_FOR_EXPORT, {
|
||||
|
||||
@@ -45,15 +45,14 @@ exports.default = async (req, res) => {
|
||||
|
||||
await refreshOauthToken(oauthClient, req);
|
||||
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { jobIds, elgen } = req.body;
|
||||
//Query Job Info
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
logger.log("qbo-receivable-create", "DEBUG", req.user.email, jobIds);
|
||||
|
||||
const result = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
.request(queries.QUERY_JOBS_FOR_RECEIVABLES_EXPORT, {
|
||||
|
||||
@@ -3,10 +3,11 @@ const path = require("path");
|
||||
const DineroQbFormat = require("../accounting-constants").DineroQbFormat;
|
||||
const queries = require("../../graphql-client/queries");
|
||||
const Dinero = require("dinero.js");
|
||||
var builder = require("xmlbuilder2");
|
||||
const builder = require("xmlbuilder2");
|
||||
const QbXmlUtils = require("./qbxml-utils");
|
||||
const moment = require("moment-timezone");
|
||||
const logger = require("../../utils/logger");
|
||||
const logger = require('../../utils/logger');
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
process.cwd(),
|
||||
@@ -15,14 +16,10 @@ require("dotenv").config({
|
||||
});
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { bills: billsToQuery } = req.body;
|
||||
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
const path = require("path");
|
||||
const DineroQbFormat = require("../accounting-constants").DineroQbFormat;
|
||||
const queries = require("../../graphql-client/queries");
|
||||
const Dinero = require("dinero.js");
|
||||
var builder = require("xmlbuilder2");
|
||||
const builder = require("xmlbuilder2");
|
||||
const moment = require("moment-timezone");
|
||||
const QbXmlUtils = require("./qbxml-utils");
|
||||
const QbxmlReceivables = require("./qbxml-receivables");
|
||||
const logger = require("../../utils/logger");
|
||||
const logger = require('../../utils/logger');
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
@@ -19,14 +18,10 @@ require("dotenv").config({
|
||||
const { generateJobTier, generateOwnerTier, generateSourceTier } = QbXmlUtils;
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { payments: paymentsToQuery } = req.body;
|
||||
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
const path = require("path");
|
||||
const DineroQbFormat = require("../accounting-constants").DineroQbFormat;
|
||||
const queries = require("../../graphql-client/queries");
|
||||
const Dinero = require("dinero.js");
|
||||
const moment = require("moment-timezone");
|
||||
var builder = require("xmlbuilder2");
|
||||
const builder = require("xmlbuilder2");
|
||||
const QbXmlUtils = require("./qbxml-utils");
|
||||
const logger = require("../../utils/logger");
|
||||
const CreateInvoiceLines = require("../qb-receivables-lines").default;
|
||||
const logger = require('../../utils/logger');
|
||||
|
||||
require("dotenv").config({
|
||||
path: path.resolve(
|
||||
@@ -20,14 +19,10 @@ Dinero.globalRoundingMode = "HALF_EVEN";
|
||||
const { generateJobTier, generateOwnerTier, generateSourceTier } = QbXmlUtils;
|
||||
|
||||
exports.default = async (req, res) => {
|
||||
const BearerToken = req.headers.authorization;
|
||||
const { jobIds } = req.body;
|
||||
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
try {
|
||||
logger.log(
|
||||
|
||||
@@ -5,7 +5,6 @@ require("dotenv").config({
|
||||
`.env.${process.env.NODE_ENV || "development"}`
|
||||
),
|
||||
});
|
||||
const GraphQLClient = require("graphql-request").GraphQLClient;
|
||||
const soap = require("soap");
|
||||
const queries = require("../graphql-client/queries");
|
||||
|
||||
@@ -34,16 +33,11 @@ const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
|
||||
exports.default = async function ReloadCdkMakes(req, res) {
|
||||
const { bodyshopid, cdk_dealerid } = req.body;
|
||||
try {
|
||||
const BearerToken = req.headers.authorization;
|
||||
//Query all CDK Models
|
||||
const newList = await GetCdkMakes(req, cdk_dealerid);
|
||||
|
||||
//Clear out the existing records
|
||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {
|
||||
headers: {
|
||||
Authorization: BearerToken,
|
||||
},
|
||||
});
|
||||
const BearerToken = req.BearerToken;
|
||||
const client = req.userGraphQLClient;
|
||||
|
||||
const deleteResult = await client
|
||||
.setHeaders({ Authorization: BearerToken })
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user