Added ins co to 3rd party payer & expanded md_ins_co IO-546
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { Button, Form, Input, InputNumber, Modal, Radio } from "antd";
|
||||
import { Button, Form, Input, InputNumber, Modal, Radio, Select } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { SEARCH_VENDOR_AUTOCOMPLETE_WITH_ADDR } from "../../graphql/vendors.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||
|
||||
export default function Jobd3RdPartyModal({ jobId }) {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Jobd3RdPartyModal);
|
||||
|
||||
export function Jobd3RdPartyModal({ bodyshop, jobId }) {
|
||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
@@ -42,6 +53,18 @@ export default function Jobd3RdPartyModal({ jobId }) {
|
||||
);
|
||||
};
|
||||
|
||||
const handleInsSelect = (value, option) => {
|
||||
form.setFieldsValue({
|
||||
addr1: option.obj.name,
|
||||
addr2: option.obj.street1,
|
||||
addr3: option.obj.street2,
|
||||
city: option.obj.city,
|
||||
state: option.obj.state,
|
||||
zip: option.obj.zip,
|
||||
vendorid: null,
|
||||
});
|
||||
};
|
||||
|
||||
const handleVendorSelect = (vendorid, opt) => {
|
||||
const vendor = VendorAutoCompleteData.vendors.filter(
|
||||
(v) => v.id === vendorid
|
||||
@@ -54,6 +77,7 @@ export default function Jobd3RdPartyModal({ jobId }) {
|
||||
city: vendor.city,
|
||||
state: vendor.state,
|
||||
zip: vendor.zip,
|
||||
ins_co_id: null,
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -76,6 +100,18 @@ export default function Jobd3RdPartyModal({ jobId }) {
|
||||
onSelect={handleVendorSelect}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.md_ins_co.name")}
|
||||
name="ins_co_id"
|
||||
>
|
||||
<Select onSelect={handleInsSelect}>
|
||||
{bodyshop.md_ins_cos.map((s) => (
|
||||
<Select.Option key={s.name} obj={s} value={s.name}>
|
||||
{s.name}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<LayoutFormRow grow>
|
||||
<Form.Item
|
||||
label={t("printcenter.jobs.3rdpartyfields.addr1")}
|
||||
|
||||
Reference in New Issue
Block a user