From 0930702da839867527788591109abaddbfd84016 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 8 Mar 2021 15:46:39 -0800 Subject: [PATCH] IO-745 Add ins co and class to ccc conversion. --- .../contract-convert-to-ro.component.jsx | 65 +++++++++++++++---- .../contract-form/contract-form.component.jsx | 22 ++++--- client/src/index.js | 4 +- server/job/job-totals.js | 6 +- 4 files changed, 69 insertions(+), 28 deletions(-) diff --git a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx index 5782323d4..65c296858 100644 --- a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx +++ b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx @@ -1,25 +1,26 @@ -import React, { useState } from "react"; +import { useMutation } from "@apollo/client"; import { Button, + Form, + InputNumber, notification, Popover, Radio, - Form, - InputNumber, + Select, Space, } from "antd"; -import { useTranslation } from "react-i18next"; -import { useMutation } from "@apollo/client"; -import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; +import axios from "axios"; import moment from "moment"; +import React, { useState } from "react"; +import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; +import { useHistory } from "react-router-dom"; import { createStructuredSelector } from "reselect"; +import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; import { selectBodyshop, selectCurrentUser, } from "../../redux/user/user.selectors"; -import { useHistory } from "react-router-dom"; -import axios from "axios"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser @@ -49,8 +50,9 @@ export function ContractConvertToRo({ moment(contract.start), "days" ); - const billingLines = [ - { + const billingLines = []; + if (contractLength > 0) + billingLines.push({ unq_seq: 1, line_no: 1, line_ref: 1, @@ -63,9 +65,7 @@ export function ContractConvertToRo({ mod_lb_hrs: 0, db_ref: "io-ccdr", // mod_lbr_ty: "PAL", - }, - ]; - + }); const mileageDiff = contract.kmend - contract.kmstart - contract.dailyfreekm * contractLength; if (mileageDiff > 0) { @@ -139,7 +139,8 @@ export function ContractConvertToRo({ federal_tax_rate: bodyshop.bill_tax_rates.federal_tax_rate / 100, state_tax_rate: bodyshop.bill_tax_rates.state_tax_rate / 100, local_tax_rate: bodyshop.bill_tax_rates.local_tax_rate / 100, - ins_co_nm: "CC", + ins_co_nm: values.ins_co_nm, + class: values.class, converted: true, clm_no: contract.job.clm_no ? `${contract.job.clm_no}-CC` : null, ownr_fn: contract.job.owner.ownr_fn, @@ -307,6 +308,42 @@ export function ContractConvertToRo({ const popContent = (