Further WIP in invoice enter screen.
This commit is contained in:
@@ -18,15 +18,14 @@ export default function InvoiceEnterModalComponent({
|
||||
invoice,
|
||||
handleCancel,
|
||||
handleFinish,
|
||||
|
||||
handleRoSelect,
|
||||
roAutoCompleteOptions,
|
||||
|
||||
handleVendorSelect,
|
||||
vendorAutoCompleteOptions,
|
||||
lineData,
|
||||
vendor,
|
||||
job
|
||||
job,
|
||||
responsibilityCenters
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
@@ -165,6 +164,7 @@ export default function InvoiceEnterModalComponent({
|
||||
lineData={lineData}
|
||||
discount={vendor && vendor.discount}
|
||||
form={form}
|
||||
responsibilityCenters={responsibilityCenters}
|
||||
/>
|
||||
|
||||
<Button onClick={() => console.log(form.getFieldsValue())}>
|
||||
|
||||
@@ -142,6 +142,7 @@ function InvoiceEnterModalContainer({
|
||||
: null
|
||||
}
|
||||
job={invoiceEnterModal.context.job || null}
|
||||
responsibilityCenters={bodyshop.md_responsibility_centers || null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@ import CurrencyInput from "../form-items-formatted/currency-form-item.component"
|
||||
export default function InvoiceEnterModalLinesComponent({
|
||||
lineData,
|
||||
discount,
|
||||
form
|
||||
form,
|
||||
responsibilityCenters
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { setFieldsValue, getFieldsValue } = form;
|
||||
|
||||
const [amounts, setAmounts] = useState({ invoiceTotal: 0, enteredAmount: 0 });
|
||||
|
||||
console.log("costCenters", responsibilityCenters);
|
||||
return (
|
||||
<div>
|
||||
<Form.List name="invoicelines">
|
||||
@@ -38,7 +40,7 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
<Select
|
||||
autoFocus
|
||||
name={`le${index}`}
|
||||
style={{ width: "300px" }}
|
||||
style={{ width: "450px" }}
|
||||
onSelect={(value, opt) => {
|
||||
setFieldsValue({
|
||||
invoicelines: getFieldsValue([
|
||||
@@ -54,7 +56,12 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
line_desc: opt.key.includes("noline")
|
||||
? ""
|
||||
: opt.value,
|
||||
actual_price: opt.cost ? opt.cost : 0
|
||||
actual_price: opt.cost ? opt.cost : 0,
|
||||
cost_center: opt.mod_lbr_ty
|
||||
? responsibilityCenters.defaults[
|
||||
opt.mod_lbr_ty
|
||||
] || null
|
||||
: null
|
||||
};
|
||||
}
|
||||
return item;
|
||||
@@ -76,8 +83,21 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
key={item.id}
|
||||
value={item.line_desc}
|
||||
cost={item.act_price ? item.act_price : 0}
|
||||
mod_lbr_ty={item.mod_lbr_ty}
|
||||
>
|
||||
{item.line_desc}
|
||||
<Row justify="center" align="middle">
|
||||
<Col span={12}> {item.line_desc}</Col>
|
||||
<Col span={8}>
|
||||
<Tag color="blue">{item.oem_partno}</Tag>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<Tag color="green">
|
||||
<CurrencyFormatter>
|
||||
{item.act_price}
|
||||
</CurrencyFormatter>
|
||||
</Tag>
|
||||
</Col>
|
||||
</Row>
|
||||
</Select.Option>
|
||||
))
|
||||
: null}
|
||||
@@ -170,7 +190,11 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
<Select style={{ width: "150px" }}>
|
||||
{responsibilityCenters.costs.map(item => (
|
||||
<Select.Option key={item}>{item}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<DeleteFilled
|
||||
@@ -187,7 +211,7 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
onClick={() => {
|
||||
add();
|
||||
}}
|
||||
style={{ width: "60%" }}
|
||||
style={{ width: "100%" }}
|
||||
>
|
||||
{t("invoicelines.actions.newline")}
|
||||
</Button>
|
||||
@@ -199,22 +223,20 @@ export default function InvoiceEnterModalLinesComponent({
|
||||
<Row>
|
||||
<Col span={4}>
|
||||
{t("invoicelines.labels.entered")}
|
||||
<CurrencyFormatter>{amounts.enteredTotal}</CurrencyFormatter>
|
||||
<CurrencyFormatter>{amounts.enteredTotal || 0}</CurrencyFormatter>
|
||||
</Col>
|
||||
|
||||
<Col span={4}>
|
||||
<Tag
|
||||
color={
|
||||
amounts.invoiceTotal - amounts.enteredTotal === 0
|
||||
? "green"
|
||||
: "red"
|
||||
}
|
||||
>
|
||||
{t("invoicelines.labels.unreconciled")}:
|
||||
<CurrencyFormatter>
|
||||
{amounts.invoiceTotal - amounts.enteredTotal}
|
||||
</CurrencyFormatter>
|
||||
</Tag>
|
||||
{amounts.invoiceTotal - amounts.enteredTotal === 0 ? (
|
||||
<Tag color="green">{t("invoicelines.labels.reconciled")}</Tag>
|
||||
) : (
|
||||
<Tag color="red">
|
||||
{t("invoicelines.labels.unreconciled")}:
|
||||
<CurrencyFormatter>
|
||||
{amounts.invoiceTotal - amounts.enteredTotal}
|
||||
</CurrencyFormatter>
|
||||
</Tag>
|
||||
)}
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user