Merged in hotfix/2020-05-26 (pull request #69)

Hotfix/2020 05 26 to Testing Env.
This commit is contained in:
Patrick Fic
2021-05-25 23:33:23 +00:00
13 changed files with 134 additions and 74 deletions

View File

@@ -7,7 +7,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
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({
loading,

View File

@@ -15,6 +15,7 @@ import {
} from "../../../../redux/user/user.selectors";
import ConfigFormComponents from "../../../config-form-components/config-form-components.component";
import DateTimePicker from "../../../form-date-time-picker/form-date-time-picker.component";
import moment from "moment-business-days";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
@@ -133,7 +134,14 @@ export function JobChecklistForm({
initialValues={{
...(type === "intake" && {
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,
}),
...(type === "deliver" && {

View File

@@ -123,7 +123,7 @@ export default function JobLinesUpsertModalComponent({
// }),
// ]}
>
<InputCurrency />
<InputNumber precision={1} />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow>

View File

@@ -51,7 +51,13 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
<FormDatePicker />
</Form.Item>
<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 label={t("jobs.fields.ins_addr1")} name="ins_addr1">
<Input />

View File

@@ -54,7 +54,13 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
</Form.Item>
<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 label={t("jobs.fields.ins_addr1")} name="ins_addr1">
<Input disabled={jobRO} />

View File

@@ -1,11 +1,17 @@
import { Button } from "antd";
import { Button, Space } from "antd";
import axios from "axios";
import React from "react";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
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 [download, setDownload] = useState(null);
const imagesToDownload = [
...galleryImages.images.filter((image) => image.isSelected),
...galleryImages.other.filter((image) => image.isSelected),
@@ -18,13 +24,68 @@ export default function JobsDocumentsDownloadButton({ galleryImages }) {
ids: imagesToDownload.map((_) => _.key),
})
.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 (
<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);
});
};

View File

@@ -17,7 +17,7 @@ function JobsDocumentsComponent({
billId,
billsCallback,
totalSize,
bodyshop,
downloadIdentifier,
ignoreSizeLimit,
}) {
const [galleryImages, setgalleryImages] = useState({ images: [], other: [] });
@@ -117,7 +117,10 @@ function JobsDocumentsComponent({
galleryImages={galleryImages}
setGalleryImages={setgalleryImages}
/>
<JobsDocumentsDownloadButton galleryImages={galleryImages} />
<JobsDocumentsDownloadButton
galleryImages={galleryImages}
identifier={downloadIdentifier}
/>
<JobsDocumentsDeleteButton
galleryImages={galleryImages}
deletionCallback={billsCallback || refetch}
@@ -173,6 +176,7 @@ function JobsDocumentsComponent({
backgroundImage: <FileExcelFilled />,
height: "100%",
width: "100%",
cursor: "pointer",
};
}}
onClickThumbnail={(index) => {

View File

@@ -23,6 +23,7 @@ export default function JobsDocumentsContainer({
return (
<JobDocuments
data={(data && data.documents) || documentsList || []}
downloadIdentifier={data && data.jobs_by_pk.ro_number}
totalSize={data && data.documents_aggregate.aggregate.sum.size}
billId={billId}
jobId={jobId}

View File

@@ -31,55 +31,19 @@ export default function OwnerDetailFormComponent({ form, loading }) {
</LayoutFormRow>
<LayoutFormRow header={t("owners.forms.address")}>
<Form.Item
label={t("owners.fields.ownr_addr1")}
name="ownr_addr1"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("owners.fields.ownr_addr1")} name="ownr_addr1">
<Input />
</Form.Item>
<Form.Item label={t("owners.fields.ownr_addr2")} name="ownr_addr2">
<Input />
</Form.Item>
<Form.Item
label={t("owners.fields.ownr_city")}
name="ownr_city"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("owners.fields.ownr_city")} name="ownr_city">
<Input />
</Form.Item>
<Form.Item
label={t("owners.fields.ownr_st")}
name="ownr_st"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("owners.fields.ownr_st")} name="ownr_st">
<Input />
</Form.Item>
<Form.Item
label={t("owners.fields.ownr_zip")}
name="ownr_zip"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("owners.fields.ownr_zip")} name="ownr_zip">
<Input />
</Form.Item>
<Form.Item label={t("owners.fields.ownr_ctry")} name="ownr_ctry">

View File

@@ -76,28 +76,10 @@ export default function VehicleDetailFormComponent({ form, loading }) {
</LayoutFormRow>
<LayoutFormRow header={t("vehicles.forms.registration")}>
<Form.Item
label={t("vehicles.fields.plate_st")}
name="plate_st"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("vehicles.fields.plate_st")} name="plate_st">
<Input />
</Form.Item>
<Form.Item
label={t("vehicles.fields.plate_no")}
name="plate_no"
rules={[
{
required: true,
//message: t("general.validation.required"),
},
]}
>
<Form.Item label={t("vehicles.fields.plate_no")} name="plate_no">
<Input />
</Form.Item>
</LayoutFormRow>

View File

@@ -85,6 +85,7 @@ export const INSERT_APPOINTMENT = gql`
title
isintake
block
color
}
}
update_jobs(
@@ -110,6 +111,7 @@ export const QUERY_APPOINTMENT_BY_DATE = gql`
title
isintake
block
color
job {
alt_transport
ro_number

View File

@@ -197,6 +197,28 @@ export const QUERY_INTAKE_CHECKLIST = gql`
scheduled_delivery
intakechecklist
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
}
}
}
}
}
`;

View File

@@ -2,6 +2,10 @@ import { gql } from "@apollo/client";
export const GET_DOCUMENTS_BY_JOB = gql`
query GET_DOCUMENTS_BY_JOB($jobId: uuid!) {
jobs_by_pk(id: $jobId) {
id
ro_number
}
documents_aggregate(where: { jobid: { _eq: $jobId } }) {
aggregate {
sum {