WIP CA_BC_ETFTable decoder
This commit is contained in:
@@ -26454,6 +26454,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>ca_bc_etf_table</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>customer</name>
|
<name>customer</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
import { useLazyQuery } from "@apollo/client";
|
||||||
|
import { Button, Form, Modal } from "antd";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { FIND_JOBS_BY_CLAIM } from "../../graphql/jobs.queries";
|
||||||
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectCaBcEtfTableConvert } from "../../redux/modals/modals.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import CaBcEtfTableModalComponent from "./ca-bc-etf-table.modal.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
caBcEtfTableModal: selectCaBcEtfTableConvert,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
toggleModalVisible: () =>
|
||||||
|
dispatch(toggleModalVisible("ca_bc_eftTableConvert")),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ContractsFindModalContainer({
|
||||||
|
caBcEtfTableModal,
|
||||||
|
toggleModalVisible,
|
||||||
|
|
||||||
|
bodyshop,
|
||||||
|
}) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const { visible } = caBcEtfTableModal;
|
||||||
|
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
// const [updateJobLines] = useMutation(UPDATE_JOB_LINE);
|
||||||
|
const [callSearch, { loading,// error,
|
||||||
|
data }] = useLazyQuery(
|
||||||
|
FIND_JOBS_BY_CLAIM
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleFinish = async (values) => {
|
||||||
|
logImEXEvent("ca_bc_etf_table_parse");
|
||||||
|
|
||||||
|
const claimNumbers = [];
|
||||||
|
values.table.split("\n").forEach((row, idx, arr) => {
|
||||||
|
if (idx !== 0 && idx !== arr.length - 1) {
|
||||||
|
//Skip first row as it is header. Skip last row as it is totals.
|
||||||
|
const { 1: claim, 2: shortclaim } = row.split("\t");
|
||||||
|
if (!claim || !shortclaim) return;
|
||||||
|
const trimmedShortClaim = shortclaim.trim();
|
||||||
|
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);
|
||||||
|
|
||||||
|
callSearch({ variables: { claimNumbers } });
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (visible) {
|
||||||
|
form.resetFields();
|
||||||
|
}
|
||||||
|
}, [visible, form]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
visible={visible}
|
||||||
|
width="70%"
|
||||||
|
title={t("labels.labels.findermodal")}
|
||||||
|
onCancel={() => toggleModalVisible()}
|
||||||
|
onOk={() => toggleModalVisible()}
|
||||||
|
destroyOnClose
|
||||||
|
forceRender
|
||||||
|
>
|
||||||
|
<Form
|
||||||
|
form={form}
|
||||||
|
layout="vertical"
|
||||||
|
autoComplete="no"
|
||||||
|
onFinish={handleFinish}
|
||||||
|
>
|
||||||
|
<CaBcEtfTableModalComponent form={form} />
|
||||||
|
<Button onClick={() => form.submit()} type="primary" loading={loading}>
|
||||||
|
{t("general.labels.search")}
|
||||||
|
</Button>
|
||||||
|
{JSON.stringify(data)}
|
||||||
|
</Form>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ContractsFindModalContainer);
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { Form, Input } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, null)(PartsReceiveModalComponent);
|
||||||
|
|
||||||
|
export function PartsReceiveModalComponent({ bodyshop, form }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Form.Item
|
||||||
|
name="table"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input.TextArea rows={8} />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,31 +3,39 @@ import { Button, Card, Input, Space, Table, Typography } from "antd";
|
|||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
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 { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
|
||||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
|
||||||
|
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPaymentContext: (context) =>
|
setPaymentContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||||
|
setCaBcEtfTableContext: (context) =>
|
||||||
|
dispatch(
|
||||||
|
setModalContext({ context: context, modal: "ca_bc_eftTableConvert" })
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function PaymentsListPaginated({
|
export function PaymentsListPaginated({
|
||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
|
setCaBcEtfTableContext,
|
||||||
refetch,
|
refetch,
|
||||||
loading,
|
loading,
|
||||||
payments,
|
payments,
|
||||||
total,
|
total,
|
||||||
|
bodyshop,
|
||||||
}) {
|
}) {
|
||||||
const search = queryString.parse(useLocation().search);
|
const search = queryString.parse(useLocation().search);
|
||||||
const { page, sortcolumn, sortorder } = search;
|
const { page, sortcolumn, sortorder } = search;
|
||||||
@@ -193,6 +201,14 @@ export function PaymentsListPaginated({
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{bodyshop.region_config === "CA_BC" && (
|
||||||
|
<>
|
||||||
|
<CaBcEtfTableModalContainer />
|
||||||
|
<Button onClick={() => setCaBcEtfTableContext()}>
|
||||||
|
{t("payments.labels.ca_bc_etf_table")}
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1524,3 +1524,16 @@ export const QUERY_JOB_CHECKLISTS = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const FIND_JOBS_BY_CLAIM = gql`
|
||||||
|
query FIND_JOBS_BY_CLAIM($claimNumbers: [String!]!) {
|
||||||
|
jobs(where: { clm_no: { _in: $claimNumbers } }) {
|
||||||
|
id
|
||||||
|
ro_number
|
||||||
|
actual_completion
|
||||||
|
ownr_fn
|
||||||
|
ownr_ln
|
||||||
|
ownr_co_nm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const INITIAL_STATE = {
|
|||||||
reportCenter: { ...baseModal },
|
reportCenter: { ...baseModal },
|
||||||
partsReceive: { ...baseModal },
|
partsReceive: { ...baseModal },
|
||||||
contractFinder: { ...baseModal },
|
contractFinder: { ...baseModal },
|
||||||
|
ca_bc_eftTableConvert: { ...baseModal },
|
||||||
};
|
};
|
||||||
|
|
||||||
const modalsReducer = (state = INITIAL_STATE, action) => {
|
const modalsReducer = (state = INITIAL_STATE, action) => {
|
||||||
|
|||||||
@@ -70,3 +70,8 @@ export const selectContractFinder = createSelector(
|
|||||||
[selectModals],
|
[selectModals],
|
||||||
(modals) => modals.contractFinder
|
(modals) => modals.contractFinder
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const selectCaBcEtfTableConvert = createSelector(
|
||||||
|
[selectModals],
|
||||||
|
(modals) => modals.ca_bc_eftTableConvert
|
||||||
|
);
|
||||||
|
|||||||
@@ -1583,6 +1583,7 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"balance": "Balance",
|
"balance": "Balance",
|
||||||
|
"ca_bc_etf_table": "ICBC ETF Table Converter",
|
||||||
"customer": "Customer",
|
"customer": "Customer",
|
||||||
"edit": "Edit Payment",
|
"edit": "Edit Payment",
|
||||||
"electronicpayment": "Use Electronic Payment Processing?",
|
"electronicpayment": "Use Electronic Payment Processing?",
|
||||||
|
|||||||
@@ -1583,6 +1583,7 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"balance": "",
|
"balance": "",
|
||||||
|
"ca_bc_etf_table": "",
|
||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
|||||||
@@ -1583,6 +1583,7 @@
|
|||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"balance": "",
|
"balance": "",
|
||||||
|
"ca_bc_etf_table": "",
|
||||||
"customer": "",
|
"customer": "",
|
||||||
"edit": "",
|
"edit": "",
|
||||||
"electronicpayment": "",
|
"electronicpayment": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user