IO-902 ICBC ETf Translator
This commit is contained in:
@@ -26538,6 +26538,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>findermodal</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>insurance</name>
|
<name>insurance</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
import { useLazyQuery } from "@apollo/client";
|
|
||||||
import { Button, Form, Modal } from "antd";
|
import { Button, Form, Modal } from "antd";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { FIND_JOBS_BY_CLAIM } from "../../graphql/jobs.queries";
|
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectCaBcEtfTableConvert } from "../../redux/modals/modals.selectors";
|
import { selectCaBcEtfTableConvert } from "../../redux/modals/modals.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import CaBcEtfTableModalComponent from "./ca-bc-etf-table.modal.component";
|
import CaBcEtfTableModalComponent from "./ca-bc-etf-table.modal.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
|
||||||
caBcEtfTableModal: selectCaBcEtfTableConvert,
|
caBcEtfTableModal: selectCaBcEtfTableConvert,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -24,45 +22,37 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
export function ContractsFindModalContainer({
|
export function ContractsFindModalContainer({
|
||||||
caBcEtfTableModal,
|
caBcEtfTableModal,
|
||||||
toggleModalVisible,
|
toggleModalVisible,
|
||||||
|
|
||||||
bodyshop,
|
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { visible } = caBcEtfTableModal;
|
const { visible } = caBcEtfTableModal;
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
const EtfTemplate = TemplateList("special").ca_bc_etf_table;
|
||||||
// const [updateJobLines] = useMutation(UPDATE_JOB_LINE);
|
|
||||||
const [callSearch, { loading,// error,
|
|
||||||
data }] = useLazyQuery(
|
|
||||||
FIND_JOBS_BY_CLAIM
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("ca_bc_etf_table_parse");
|
logImEXEvent("ca_bc_etf_table_parse");
|
||||||
|
setLoading(true);
|
||||||
const claimNumbers = [];
|
const claimNumbers = [];
|
||||||
values.table.split("\n").forEach((row, idx, arr) => {
|
values.table.split("\n").forEach((row, idx, arr) => {
|
||||||
if (idx !== 0 && idx !== arr.length - 1) {
|
const { 1: claim, 2: shortclaim } = row.split("\t");
|
||||||
//Skip first row as it is header. Skip last row as it is totals.
|
if (!claim || !shortclaim) return;
|
||||||
const { 1: claim, 2: shortclaim } = row.split("\t");
|
const trimmedShortClaim = shortclaim.trim();
|
||||||
if (!claim || !shortclaim) return;
|
// const trimmedClaim = claim.trim();
|
||||||
const trimmedShortClaim = shortclaim.trim();
|
claimNumbers.push(trimmedShortClaim);
|
||||||
const trimmedClaim = claim.trim();
|
|
||||||
|
|
||||||
const beginning = trimmedShortClaim?.slice(0, -1); //Get everything except the last char
|
|
||||||
const last = trimmedShortClaim?.slice(-1); //Get the last digit
|
|
||||||
const alpha = trimmedClaim?.slice(-1);
|
|
||||||
|
|
||||||
const fullClaim = `${beginning}-${last}-${alpha}`;
|
|
||||||
if (fullClaim.length > 5) claimNumbers.push(fullClaim);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`claimNumbers`, claimNumbers);
|
await GenerateDocument(
|
||||||
|
{
|
||||||
callSearch({ variables: { claimNumbers } });
|
name: EtfTemplate.key,
|
||||||
|
variables: {
|
||||||
|
claimNumbers,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
"p"
|
||||||
|
);
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -75,7 +65,7 @@ export function ContractsFindModalContainer({
|
|||||||
<Modal
|
<Modal
|
||||||
visible={visible}
|
visible={visible}
|
||||||
width="70%"
|
width="70%"
|
||||||
title={t("labels.labels.findermodal")}
|
title={t("payments.labels.findermodal")}
|
||||||
onCancel={() => toggleModalVisible()}
|
onCancel={() => toggleModalVisible()}
|
||||||
onOk={() => toggleModalVisible()}
|
onOk={() => toggleModalVisible()}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
@@ -91,7 +81,6 @@ export function ContractsFindModalContainer({
|
|||||||
<Button onClick={() => form.submit()} type="primary" loading={loading}>
|
<Button onClick={() => form.submit()} type="primary" loading={loading}>
|
||||||
{t("general.labels.search")}
|
{t("general.labels.search")}
|
||||||
</Button>
|
</Button>
|
||||||
{JSON.stringify(data)}
|
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1526,9 +1526,10 @@ export const QUERY_JOB_CHECKLISTS = gql`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const FIND_JOBS_BY_CLAIM = gql`
|
export const FIND_JOBS_BY_CLAIM = gql`
|
||||||
query FIND_JOBS_BY_CLAIM($claimNumbers: [String!]!) {
|
query FIND_JOBS_BY_CLAIM($claimNumbers: String!) {
|
||||||
jobs(where: { clm_no: { _in: $claimNumbers } }) {
|
jobs(where: { clm_no: { _similar: $claimNumbers } }) {
|
||||||
id
|
id
|
||||||
|
clm_no
|
||||||
ro_number
|
ro_number
|
||||||
actual_completion
|
actual_completion
|
||||||
ownr_fn
|
ownr_fn
|
||||||
|
|||||||
@@ -1587,6 +1587,7 @@
|
|||||||
"customer": "Customer",
|
"customer": "Customer",
|
||||||
"edit": "Edit Payment",
|
"edit": "Edit Payment",
|
||||||
"electronicpayment": "Use Electronic Payment Processing?",
|
"electronicpayment": "Use Electronic Payment Processing?",
|
||||||
|
"findermodal": "ICBC Payment Finder",
|
||||||
"insurance": "Insurance",
|
"insurance": "Insurance",
|
||||||
"new": "New Payment",
|
"new": "New Payment",
|
||||||
"signup": "Please contact support to sign up for electronic payments.",
|
"signup": "Please contact support to sign up for electronic payments.",
|
||||||
|
|||||||
@@ -1587,6 +1587,7 @@
|
|||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
"findermodal": "",
|
||||||
"insurance": "",
|
"insurance": "",
|
||||||
"new": "",
|
"new": "",
|
||||||
"signup": "",
|
"signup": "",
|
||||||
|
|||||||
@@ -1587,6 +1587,7 @@
|
|||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
"findermodal": "",
|
||||||
"insurance": "",
|
"insurance": "",
|
||||||
"new": "",
|
"new": "",
|
||||||
"signup": "",
|
"signup": "",
|
||||||
|
|||||||
@@ -686,5 +686,17 @@ export const TemplateList = (type, context) => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
|
...(!type || type === "special"
|
||||||
|
? {
|
||||||
|
ca_bc_etf_table: {
|
||||||
|
title: i18n.t("printcenter.payments.ca_bc_etf_table"),
|
||||||
|
description: "Est Detail",
|
||||||
|
subject: i18n.t("printcenter.payments.ca_bc_etf_table"),
|
||||||
|
key: "ca_bc_etf_table",
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user