Merged in hotfix/2020-05-26 (pull request #69)
Hotfix/2020 05 26 to Testing Env.
This commit is contained in:
@@ -7,7 +7,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
|||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import PaymentExportButton from "../payment-export-button/payment-export-button.component";
|
import PaymentExportButton from "../payment-export-button/payment-export-button.component";
|
||||||
import { PaymentsExportAllButton } from "../payments-export-all-button/payments-export-all-button.component";
|
import PaymentsExportAllButton from "../payments-export-all-button/payments-export-all-button.component";
|
||||||
|
|
||||||
export default function AccountingPayablesTableComponent({
|
export default function AccountingPayablesTableComponent({
|
||||||
loading,
|
loading,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
} from "../../../../redux/user/user.selectors";
|
} from "../../../../redux/user/user.selectors";
|
||||||
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
|
||||||
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
|
||||||
|
import moment from "moment-business-days";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -133,7 +134,14 @@ export function JobChecklistForm({
|
|||||||
initialValues={{
|
initialValues={{
|
||||||
...(type === "intake" && {
|
...(type === "intake" && {
|
||||||
addToProduction: true,
|
addToProduction: true,
|
||||||
scheduled_completion: job && job.scheduled_completion,
|
scheduled_completion:
|
||||||
|
(job && job.scheduled_completion) ||
|
||||||
|
moment().businessAdd(
|
||||||
|
(job.labhrs.aggregate.sum.mod_lb_hrs +
|
||||||
|
job.larhrs.aggregate.sum.mod_lb_hrs) /
|
||||||
|
bodyshop.target_touchtime,
|
||||||
|
"days"
|
||||||
|
),
|
||||||
scheduled_delivery: job && job.scheduled_delivery,
|
scheduled_delivery: job && job.scheduled_delivery,
|
||||||
}),
|
}),
|
||||||
...(type === "deliver" && {
|
...(type === "deliver" && {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
// }),
|
// }),
|
||||||
// ]}
|
// ]}
|
||||||
>
|
>
|
||||||
<InputCurrency />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
|
|||||||
@@ -51,7 +51,13 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
<FormDatePicker />
|
<FormDatePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
||||||
<Input />
|
<Select>
|
||||||
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
|
<Select.Option key={s.name} value={s.name}>
|
||||||
|
{s.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.ins_addr1")} name="ins_addr1">
|
<Form.Item label={t("jobs.fields.ins_addr1")} name="ins_addr1">
|
||||||
<Input />
|
<Input />
|
||||||
|
|||||||
@@ -54,7 +54,13 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
||||||
<Input disabled={jobRO} />
|
<Select disabled={jobRO}>
|
||||||
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
|
<Select.Option key={s.name} value={s.name}>
|
||||||
|
{s.name}
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.ins_addr1")} name="ins_addr1">
|
<Form.Item label={t("jobs.fields.ins_addr1")} name="ins_addr1">
|
||||||
<Input disabled={jobRO} />
|
<Input disabled={jobRO} />
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import { Button } from "antd";
|
import { Button, Space } from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import React from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import cleanAxios from "../../utils/CleanAxios";
|
||||||
|
import formatBytes from "../../utils/formatbytes";
|
||||||
|
|
||||||
export default function JobsDocumentsDownloadButton({ galleryImages }) {
|
export default function JobsDocumentsDownloadButton({
|
||||||
|
galleryImages,
|
||||||
|
identifier,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [download, setDownload] = useState(null);
|
||||||
const imagesToDownload = [
|
const imagesToDownload = [
|
||||||
...galleryImages.images.filter((image) => image.isSelected),
|
...galleryImages.images.filter((image) => image.isSelected),
|
||||||
...galleryImages.other.filter((image) => image.isSelected),
|
...galleryImages.other.filter((image) => image.isSelected),
|
||||||
@@ -18,13 +24,68 @@ export default function JobsDocumentsDownloadButton({ galleryImages }) {
|
|||||||
ids: imagesToDownload.map((_) => _.key),
|
ids: imagesToDownload.map((_) => _.key),
|
||||||
})
|
})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
window.open(r.data);
|
// window.open(r.data);
|
||||||
|
downloadAs(
|
||||||
|
r.data,
|
||||||
|
`${identifier || "images"}.zip`,
|
||||||
|
(progressEvent) => {
|
||||||
|
const percentage = Math.round(
|
||||||
|
(progressEvent.loaded * 100) / progressEvent.total
|
||||||
|
);
|
||||||
|
console.log(progressEvent, percentage);
|
||||||
|
setDownload((currentDownloadState) => {
|
||||||
|
return {
|
||||||
|
downloaded: progressEvent.loaded || 0,
|
||||||
|
speed:
|
||||||
|
(progressEvent.loaded || 0) -
|
||||||
|
((currentDownloadState && currentDownloadState.downloaded) ||
|
||||||
|
0),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
() => setDownload(null)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button disabled={imagesToDownload.length < 1} onClick={handleDownload}>
|
<>
|
||||||
{t("documents.actions.download")}
|
<Button
|
||||||
</Button>
|
loading={!!download}
|
||||||
|
disabled={imagesToDownload.length < 1}
|
||||||
|
onClick={handleDownload}
|
||||||
|
>
|
||||||
|
<Space>
|
||||||
|
<span>{t("documents.actions.download")}</span>
|
||||||
|
{download && (
|
||||||
|
<span>{`(${formatBytes(download.downloaded)} @ ${formatBytes(
|
||||||
|
download.speed
|
||||||
|
)} / second)`}</span>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const downloadAs = (url, name, onDownloadProgress, onCompleted) => {
|
||||||
|
cleanAxios
|
||||||
|
.get(url, {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/octet-stream",
|
||||||
|
},
|
||||||
|
responseType: "blob",
|
||||||
|
onDownloadProgress: onDownloadProgress,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
onCompleted && onCompleted();
|
||||||
|
const a = document.createElement("a");
|
||||||
|
const url = window.URL.createObjectURL(response.data);
|
||||||
|
a.href = url;
|
||||||
|
a.download = name;
|
||||||
|
a.click();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("error", err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function JobsDocumentsComponent({
|
|||||||
billId,
|
billId,
|
||||||
billsCallback,
|
billsCallback,
|
||||||
totalSize,
|
totalSize,
|
||||||
bodyshop,
|
downloadIdentifier,
|
||||||
ignoreSizeLimit,
|
ignoreSizeLimit,
|
||||||
}) {
|
}) {
|
||||||
const [galleryImages, setgalleryImages] = useState({ images: [], other: [] });
|
const [galleryImages, setgalleryImages] = useState({ images: [], other: [] });
|
||||||
@@ -117,7 +117,10 @@ function JobsDocumentsComponent({
|
|||||||
galleryImages={galleryImages}
|
galleryImages={galleryImages}
|
||||||
setGalleryImages={setgalleryImages}
|
setGalleryImages={setgalleryImages}
|
||||||
/>
|
/>
|
||||||
<JobsDocumentsDownloadButton galleryImages={galleryImages} />
|
<JobsDocumentsDownloadButton
|
||||||
|
galleryImages={galleryImages}
|
||||||
|
identifier={downloadIdentifier}
|
||||||
|
/>
|
||||||
<JobsDocumentsDeleteButton
|
<JobsDocumentsDeleteButton
|
||||||
galleryImages={galleryImages}
|
galleryImages={galleryImages}
|
||||||
deletionCallback={billsCallback || refetch}
|
deletionCallback={billsCallback || refetch}
|
||||||
@@ -173,6 +176,7 @@ function JobsDocumentsComponent({
|
|||||||
backgroundImage: <FileExcelFilled />,
|
backgroundImage: <FileExcelFilled />,
|
||||||
height: "100%",
|
height: "100%",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
cursor: "pointer",
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
onClickThumbnail={(index) => {
|
onClickThumbnail={(index) => {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default function JobsDocumentsContainer({
|
|||||||
return (
|
return (
|
||||||
<JobDocuments
|
<JobDocuments
|
||||||
data={(data && data.documents) || documentsList || []}
|
data={(data && data.documents) || documentsList || []}
|
||||||
|
downloadIdentifier={data && data.jobs_by_pk.ro_number}
|
||||||
totalSize={data && data.documents_aggregate.aggregate.sum.size}
|
totalSize={data && data.documents_aggregate.aggregate.sum.size}
|
||||||
billId={billId}
|
billId={billId}
|
||||||
jobId={jobId}
|
jobId={jobId}
|
||||||
|
|||||||
@@ -31,55 +31,19 @@ export default function OwnerDetailFormComponent({ form, loading }) {
|
|||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow header={t("owners.forms.address")}>
|
<LayoutFormRow header={t("owners.forms.address")}>
|
||||||
<Form.Item
|
<Form.Item label={t("owners.fields.ownr_addr1")} name="ownr_addr1">
|
||||||
label={t("owners.fields.ownr_addr1")}
|
|
||||||
name="ownr_addr1"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("owners.fields.ownr_addr2")} name="ownr_addr2">
|
<Form.Item label={t("owners.fields.ownr_addr2")} name="ownr_addr2">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("owners.fields.ownr_city")} name="ownr_city">
|
||||||
label={t("owners.fields.ownr_city")}
|
|
||||||
name="ownr_city"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("owners.fields.ownr_st")} name="ownr_st">
|
||||||
label={t("owners.fields.ownr_st")}
|
|
||||||
name="ownr_st"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("owners.fields.ownr_zip")} name="ownr_zip">
|
||||||
label={t("owners.fields.ownr_zip")}
|
|
||||||
name="ownr_zip"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("owners.fields.ownr_ctry")} name="ownr_ctry">
|
<Form.Item label={t("owners.fields.ownr_ctry")} name="ownr_ctry">
|
||||||
|
|||||||
@@ -76,28 +76,10 @@ export default function VehicleDetailFormComponent({ form, loading }) {
|
|||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|
||||||
<LayoutFormRow header={t("vehicles.forms.registration")}>
|
<LayoutFormRow header={t("vehicles.forms.registration")}>
|
||||||
<Form.Item
|
<Form.Item label={t("vehicles.fields.plate_st")} name="plate_st">
|
||||||
label={t("vehicles.fields.plate_st")}
|
|
||||||
name="plate_st"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("vehicles.fields.plate_no")} name="plate_no">
|
||||||
label={t("vehicles.fields.plate_no")}
|
|
||||||
name="plate_no"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export const INSERT_APPOINTMENT = gql`
|
|||||||
title
|
title
|
||||||
isintake
|
isintake
|
||||||
block
|
block
|
||||||
|
color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_jobs(
|
update_jobs(
|
||||||
@@ -110,6 +111,7 @@ export const QUERY_APPOINTMENT_BY_DATE = gql`
|
|||||||
title
|
title
|
||||||
isintake
|
isintake
|
||||||
block
|
block
|
||||||
|
color
|
||||||
job {
|
job {
|
||||||
alt_transport
|
alt_transport
|
||||||
ro_number
|
ro_number
|
||||||
|
|||||||
@@ -197,6 +197,28 @@ export const QUERY_INTAKE_CHECKLIST = gql`
|
|||||||
scheduled_delivery
|
scheduled_delivery
|
||||||
intakechecklist
|
intakechecklist
|
||||||
status
|
status
|
||||||
|
labhrs: joblines_aggregate(
|
||||||
|
where: {
|
||||||
|
_and: [{ mod_lbr_ty: { _neq: "LAR" } }, { removed: { _eq: false } }]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
larhrs: joblines_aggregate(
|
||||||
|
where: {
|
||||||
|
_and: [{ mod_lbr_ty: { _eq: "LAR" } }, { removed: { _eq: false } }]
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
aggregate {
|
||||||
|
sum {
|
||||||
|
mod_lb_hrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import { gql } from "@apollo/client";
|
|||||||
|
|
||||||
export const GET_DOCUMENTS_BY_JOB = gql`
|
export const GET_DOCUMENTS_BY_JOB = gql`
|
||||||
query GET_DOCUMENTS_BY_JOB($jobId: uuid!) {
|
query GET_DOCUMENTS_BY_JOB($jobId: uuid!) {
|
||||||
|
jobs_by_pk(id: $jobId) {
|
||||||
|
id
|
||||||
|
ro_number
|
||||||
|
}
|
||||||
documents_aggregate(where: { jobid: { _eq: $jobId } }) {
|
documents_aggregate(where: { jobid: { _eq: $jobId } }) {
|
||||||
aggregate {
|
aggregate {
|
||||||
sum {
|
sum {
|
||||||
|
|||||||
Reference in New Issue
Block a user