70 lines
2.3 KiB
JavaScript
70 lines
2.3 KiB
JavaScript
import { Modal, Form, Input, InputNumber } from "antd";
|
|
import React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import ResetForm from "../form-items-formatted/reset-form-item.component";
|
|
|
|
export default function JobLinesUpsertModalComponent({
|
|
visible,
|
|
jobLine,
|
|
handleOk,
|
|
handleCancel,
|
|
handleSubmit,
|
|
form
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const { getFieldDecorator, isFieldsTouched, resetFields } = form;
|
|
|
|
return (
|
|
<Modal
|
|
title={
|
|
jobLine && jobLine.id
|
|
? t("joblines.labels.edit")
|
|
: t("joblines.labels.new")
|
|
}
|
|
visible={visible}
|
|
okText={t("general.labels.save")}
|
|
onOk={handleSubmit}
|
|
onCancel={handleCancel}
|
|
>
|
|
{isFieldsTouched() ? <ResetForm resetFields={resetFields} /> : null}
|
|
<Form onSubmit={handleSubmit} autoComplete={"off"}>
|
|
<Form.Item label={t("joblines.fields.line_desc")}>
|
|
{getFieldDecorator("line_desc", {
|
|
initialValue: jobLine.line_desc
|
|
})(<Input name="line_desc" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.oem_partno")}>
|
|
{getFieldDecorator("oem_partno", {
|
|
initialValue: jobLine.oem_partno
|
|
})(<Input name="oem_partno" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.part_type")}>
|
|
{getFieldDecorator("part_type", {
|
|
initialValue: jobLine.part_type
|
|
})(<Input name="part_type" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.mod_lbr_ty")}>
|
|
{getFieldDecorator("mod_lbr_ty", {
|
|
initialValue: jobLine.mod_lbr_ty
|
|
})(<Input name="mod_lbr_ty" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.op_code_desc")}>
|
|
{getFieldDecorator("op_code_desc", {
|
|
initialValue: jobLine.op_code_desc
|
|
})(<Input name="op_code_desc" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.mod_lb_hrs")}>
|
|
{getFieldDecorator("mod_lb_hrs", {
|
|
initialValue: jobLine.mod_lb_hrs
|
|
})(<InputNumber name="mod_lb_hrs" />)}
|
|
</Form.Item>
|
|
<Form.Item label={t("joblines.fields.act_price")}>
|
|
{getFieldDecorator("act_price", {
|
|
initialValue: jobLine.act_price
|
|
})(<InputNumber name="act_price" />)}
|
|
</Form.Item>
|
|
</Form>
|
|
</Modal>
|
|
);
|
|
}
|