Files
bodyshop/client/src/components/inventory-bill-ro/inventory-bill-ro.component.jsx

63 lines
2.0 KiB
JavaScript

import { Button } from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { setModalContext } from "../../redux/modals/modals.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import dayjs from "../../utils/day";
import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop
});
const mapDispatchToProps = (dispatch) => ({
setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" }))
});
export default connect(mapStateToProps, mapDispatchToProps)(InventoryBillRo);
export function InventoryBillRo({ bodyshop, setBillEnterContext, inventoryline }) {
const { t } = useTranslation();
return (
<Button
onClick={() => {
setBillEnterContext({
actions: {
//refetch: refetch
},
context: {
disableInvNumber: true,
//job: { id: job.id },
consumeinventoryid: inventoryline.id,
bill: {
vendorid: bodyshop.inhousevendorid,
invoice_number: "ih",
isinhouse: true,
date: dayjs(),
total: 0,
billlines: [{}]
// billlines: selectedLines.map((p) => {
// return {
// joblineid: p.id,
// actual_price: p.act_price,
// actual_cost: 0, //p.act_price,
// line_desc: p.line_desc,
// line_remarks: p.line_remarks,
// part_type: p.part_type,
// quantity: p.quantity || 1,
// applicable_taxes: {
// local: false,
// state: false,
// federal: false,
// },
// };
// }),
}
}
});
}}
>
{t("inventory.actions.addtoro")}
</Button>
);
}