Added driveable and tow in flags. IO-719
This commit is contained in:
@@ -1,18 +1,62 @@
|
||||
import { InputNumber } from "antd";
|
||||
import React, { forwardRef } from "react";
|
||||
function FormItemCurrency(props, ref) {
|
||||
import React from "react";
|
||||
|
||||
// const locale = "en-us";
|
||||
// const currencyFormatter = (value) => {
|
||||
// return new Intl.NumberFormat(locale, {
|
||||
// style: "currency",
|
||||
// currency: "CAD",
|
||||
// }).format(value);
|
||||
// };
|
||||
|
||||
// const currencyParser = (val) => {
|
||||
// try {
|
||||
// // for when the input gets clears
|
||||
// if (typeof val === "string" && !val.length) {
|
||||
// val = "0.0";
|
||||
// }
|
||||
|
||||
// // detecting and parsing between comma and dot
|
||||
// var group = new Intl.NumberFormat(locale).format(1111).replace(/1/g, "");
|
||||
// var decimal = new Intl.NumberFormat(locale).format(1.1).replace(/1/g, "");
|
||||
// var reversedVal = val.replace(new RegExp("\\" + group, "g"), "");
|
||||
// reversedVal = reversedVal.replace(new RegExp("\\" + decimal, "g"), ".");
|
||||
// // => 1232.21 €
|
||||
|
||||
// // removing everything except the digits and dot
|
||||
// reversedVal = reversedVal.replace(/[^0-9.]/g, "");
|
||||
// // => 1232.21
|
||||
|
||||
// // appending digits properly
|
||||
// const digitsAfterDecimalCount = (reversedVal.split(".")[1] || []).length;
|
||||
// const needsDigitsAppended = digitsAfterDecimalCount > 2;
|
||||
|
||||
// if (needsDigitsAppended) {
|
||||
// reversedVal = reversedVal * Math.pow(10, digitsAfterDecimalCount - 2);
|
||||
// }
|
||||
|
||||
// return Number.isNaN(reversedVal) ? 0 : reversedVal;
|
||||
// } catch (error) {
|
||||
// console.error(error);
|
||||
// }
|
||||
// };
|
||||
|
||||
export default function FormItemCurrency(props) {
|
||||
return (
|
||||
<InputNumber
|
||||
{...props}
|
||||
ref={ref}
|
||||
style={{ width: "initial" }}
|
||||
formatter={(value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}
|
||||
parser={(value) => value.replace(/\$\s?|(,*)/g, "")}
|
||||
precision={2}
|
||||
// formatter={currencyFormatter}
|
||||
// parser={currencyParser}
|
||||
// formatter={(value) =>
|
||||
// "$" +
|
||||
// parseFloat(value)
|
||||
// .toFixed(2)
|
||||
// .replace(/(\d)(?=(\d{3})+\.)/g, "$1,")
|
||||
// }
|
||||
// parser={(value) => value.replace(/\$\s?|(,*)/g, "")}
|
||||
// formatter={(value) => `$ ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",")}
|
||||
// parser={(value) => value.replace(/\$\s?|(,*)/g, "")}
|
||||
precision={2}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default forwardRef(FormItemCurrency);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Button, Form, notification, Popover, Select } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Form, notification, Popover, Select, Switch } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -38,7 +38,11 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
|
||||
|
||||
const popMenu = (
|
||||
<div>
|
||||
<Form layout="vertical" onFinish={handleConvert}>
|
||||
<Form
|
||||
layout="vertical"
|
||||
onFinish={handleConvert}
|
||||
initialValues={{ driveable: true, towin: false }}
|
||||
>
|
||||
<Form.Item
|
||||
name={["ins_co_nm"]}
|
||||
label={t("jobs.fields.ins_co_nm")}
|
||||
@@ -75,6 +79,27 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.ca_gst_registrant")}
|
||||
name="ca_gst_registrant"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.driveable")}
|
||||
name="driveable"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.towin")}
|
||||
name="towin"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
<Button type="danger" htmlType="submit">
|
||||
{t("jobs.actions.convert")}
|
||||
</Button>
|
||||
|
||||
@@ -140,6 +140,20 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
||||
>
|
||||
<Input disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.driveable")}
|
||||
name="driveable"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch disabled={jobRO} />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("jobs.fields.towin")}
|
||||
name="towin"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch disabled={jobRO} />
|
||||
</Form.Item>
|
||||
</FormRow>
|
||||
</Col>
|
||||
<Col {...lossColDamage}>
|
||||
|
||||
@@ -350,6 +350,8 @@ export const GET_JOB_BY_PK = gql`
|
||||
v_make_desc
|
||||
v_color
|
||||
vehicleid
|
||||
driveable
|
||||
towin
|
||||
vehicle {
|
||||
id
|
||||
plate_no
|
||||
@@ -735,10 +737,20 @@ export const CONVERT_JOB_TO_RO = gql`
|
||||
$jobId: uuid!
|
||||
$class: String
|
||||
$ins_co_nm: String!
|
||||
$ca_gst_registrant: Boolean
|
||||
$driveable: Boolean
|
||||
$towin: Boolean
|
||||
) {
|
||||
update_jobs(
|
||||
where: { id: { _eq: $jobId } }
|
||||
_set: { converted: true, ins_co_nm: $ins_co_nm, class: $class }
|
||||
_set: {
|
||||
converted: true
|
||||
ins_co_nm: $ins_co_nm
|
||||
class: $class
|
||||
ca_gst_registrant: $ca_gst_registrant
|
||||
towin: $towin
|
||||
driveable: $driveable
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
@@ -1092,6 +1104,8 @@ export const QUERY_ALL_JOB_FIELDS = gql`
|
||||
employee_body
|
||||
employee_refinish
|
||||
employee_prep
|
||||
driveable
|
||||
towin
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -969,6 +969,7 @@
|
||||
"ded_amt": "Deductible",
|
||||
"ded_status": "Deductible Status",
|
||||
"depreciation_taxes": "Depreciation/Taxes",
|
||||
"driveable": "Driveable",
|
||||
"employee_body": "Body",
|
||||
"employee_prep": "Prep",
|
||||
"employee_refinish": "Refinish",
|
||||
@@ -1099,6 +1100,7 @@
|
||||
"tax_str_rt": "Storage Tax Rate",
|
||||
"tax_sub_rt": "Sublet Tax Rate",
|
||||
"tax_tow_rt": "Towing Tax Rate",
|
||||
"towin": "Tow In",
|
||||
"towing_payable": "Towing Payable",
|
||||
"unitnumber": "Unit #",
|
||||
"updated_at": "Updated At",
|
||||
|
||||
@@ -969,6 +969,7 @@
|
||||
"ded_amt": "Deducible",
|
||||
"ded_status": "Estado deducible",
|
||||
"depreciation_taxes": "Depreciación / Impuestos",
|
||||
"driveable": "",
|
||||
"employee_body": "",
|
||||
"employee_prep": "",
|
||||
"employee_refinish": "",
|
||||
@@ -1099,6 +1100,7 @@
|
||||
"tax_str_rt": "",
|
||||
"tax_sub_rt": "",
|
||||
"tax_tow_rt": "",
|
||||
"towin": "",
|
||||
"towing_payable": "Remolque a pagar",
|
||||
"unitnumber": "Unidad #",
|
||||
"updated_at": "Actualizado en",
|
||||
|
||||
@@ -969,6 +969,7 @@
|
||||
"ded_amt": "Déductible",
|
||||
"ded_status": "Statut de franchise",
|
||||
"depreciation_taxes": "Amortissement / taxes",
|
||||
"driveable": "",
|
||||
"employee_body": "",
|
||||
"employee_prep": "",
|
||||
"employee_refinish": "",
|
||||
@@ -1099,6 +1100,7 @@
|
||||
"tax_str_rt": "",
|
||||
"tax_sub_rt": "",
|
||||
"tax_tow_rt": "",
|
||||
"towin": "",
|
||||
"towing_payable": "Remorquage à payer",
|
||||
"unitnumber": "Unité #",
|
||||
"updated_at": "Mis à jour à",
|
||||
|
||||
Reference in New Issue
Block a user