nurkomalasari
2 years ago
4 changed files with 710 additions and 469 deletions
@ -1,427 +1,443 @@ |
|||||||
import React, { useEffect, useState } from 'react' |
import React, { useEffect, useState } from 'react' |
||||||
import {
|
import { |
||||||
Modal, ModalHeader, ModalBody, ModalFooter, |
Modal, ModalHeader, ModalBody, ModalFooter, |
||||||
Button, Form, FormGroup, Label, Input, Col, Row |
Button, Form, FormGroup, Label, Input, Col, Row |
||||||
} from 'reactstrap'; |
} from 'reactstrap'; |
||||||
import { DatePicker, Tooltip, Select } from 'antd'; |
import { DatePicker, Tooltip, Select } from 'antd'; |
||||||
import { formatRupiah, formatNumber } from '../../../const/CustomFunc' |
import { formatRupiah, formatNumber } from '../../../const/CustomFunc' |
||||||
import moment from 'moment'; |
import moment from 'moment'; |
||||||
import 'antd/dist/antd.css'; |
import 'antd/dist/antd.css'; |
||||||
const { Option } = Select |
const { Option } = Select |
||||||
|
|
||||||
const DialogForm = ({openDialog, closeDialog, toggleDialog, typeDialog, dataEdit}) => { |
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataUom }) => { |
||||||
const [id, setId] = useState(0)
|
const [id, setId] = useState(0) |
||||||
const [materialName, setMaterialName] = useState('') |
const [materialName, setMaterialName] = useState('') |
||||||
const [uom, setUom] = useState('') |
const [uom, setUom] = useState('') |
||||||
const [description, setDescription] = useState('') |
const [description, setDescription] = useState('') |
||||||
const [unitPrice, setUnitPrice] = useState('') |
const [unitPrice, setUnitPrice] = useState('') |
||||||
const [priceReq, setPriceReq] = useState('') |
const [priceReq, setPriceReq] = useState('') |
||||||
const [status, setStatus] = useState('') |
const [status, setStatus] = useState('') |
||||||
|
|
||||||
const [requiredDate, setRequiredDate] = useState(null) |
const [requiredDate, setRequiredDate] = useState(null) |
||||||
const [qty, setQty] = useState('') |
const [qty, setQty] = useState('') |
||||||
const [qtyReceived, setQtyReceived] = useState('') |
const [qtyReceived, setQtyReceived] = useState('') |
||||||
const [fomDate, setFomDate] = useState(null) |
const [fomDate, setFomDate] = useState(null) |
||||||
const [prDate, setPrDate] = useState(null) |
const [prDate, setPrDate] = useState(null) |
||||||
const [poDate, setPoDate] = useState(null) |
const [poDate, setPoDate] = useState(null) |
||||||
const [receivedDate, setReceivedDate] = useState(null) |
const [receivedDate, setReceivedDate] = useState(null) |
||||||
const [deliveryDate, setDeliveryDate] = useState(null) |
const [deliveryDate, setDeliveryDate] = useState(null) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(()=> { |
useEffect(() => { |
||||||
if(typeDialog==="Edit"){ |
if (typeDialog === "Edit") { |
||||||
console.log("cel data Edit", dataEdit) |
console.log("cel data Edit", dataEdit) |
||||||
setId(dataEdit.id) |
setId(dataEdit.id) |
||||||
setQty(dataEdit.qty) |
setQty(dataEdit.qty) |
||||||
setDescription(dataEdit.description) |
setDescription(dataEdit.description) |
||||||
setUnitPrice(dataEdit.unit_price) |
setUnitPrice(dataEdit.unit_price) |
||||||
setUom(dataEdit.uom) |
setUom(dataEdit.uom) |
||||||
setMaterialName(dataEdit.name) |
setMaterialName(dataEdit.name) |
||||||
setStatus(dataEdit.status)
|
setStatus(dataEdit.status) |
||||||
} |
} |
||||||
else if (typeDialog === 'EditMatReq') { |
else if (typeDialog === 'EditMatReq') { |
||||||
console.log("cel data EditMatReq", dataEdit) |
console.log("cel data EditMatReq", dataEdit) |
||||||
setId(dataEdit.id) |
setId(dataEdit.id) |
||||||
setDescription(dataEdit.description) |
setDescription(dataEdit.description) |
||||||
setUnitPrice(dataEdit.unit_price) |
setUnitPrice(dataEdit.unit_price) |
||||||
setUom(dataEdit.uom) |
setUom(dataEdit.uom) |
||||||
setStatus(dataEdit.status) |
setStatus(dataEdit.status) |
||||||
setRequiredDate(dataEdit.required_date ? moment(dataEdit.required_date) : null) |
setRequiredDate(dataEdit.required_date ? moment(dataEdit.required_date) : null) |
||||||
setQty(dataEdit.qty) |
setQty(dataEdit.qty) |
||||||
setQtyReceived(dataEdit.qty_received) |
setQtyReceived(dataEdit.qty_received) |
||||||
setFomDate(dataEdit.fom_date ? moment(dataEdit.fom_date) : null) |
setFomDate(dataEdit.fom_date ? moment(dataEdit.fom_date) : null) |
||||||
setPrDate(dataEdit.pr_date ? moment(dataEdit.pr_date) : null) |
setPrDate(dataEdit.pr_date ? moment(dataEdit.pr_date) : null) |
||||||
setPoDate(dataEdit.po_date ? moment(dataEdit.po_date) : null) |
setPoDate(dataEdit.po_date ? moment(dataEdit.po_date) : null) |
||||||
setReceivedDate(dataEdit.received_date ? moment(dataEdit.received_date) : null) |
setReceivedDate(dataEdit.received_date ? moment(dataEdit.received_date) : null) |
||||||
setDeliveryDate(dataEdit.delivery_date ? moment(dataEdit.delivery_date) : null) |
setDeliveryDate(dataEdit.delivery_date ? moment(dataEdit.delivery_date) : null) |
||||||
} |
} |
||||||
else if (typeDialog === 'EditMatDelv') { |
else if (typeDialog === 'EditMatDelv') { |
||||||
console.log("cel data EditMatDelv", dataEdit) |
console.log("cel data EditMatDelv", dataEdit) |
||||||
setId(dataEdit.id) |
setId(dataEdit.id) |
||||||
setDescription(dataEdit.description) |
setDescription(dataEdit.description) |
||||||
setUnitPrice(dataEdit.unit_price) |
setUnitPrice(dataEdit.unit_price) |
||||||
setUom(dataEdit.uom) |
setUom(dataEdit.uom) |
||||||
setStatus(dataEdit.status) |
setStatus(dataEdit.status) |
||||||
setRequiredDate(dataEdit.required_date ? moment(dataEdit.required_date) : null) |
setRequiredDate(dataEdit.required_date ? moment(dataEdit.required_date) : null) |
||||||
setQty(dataEdit.qty) |
setQty(dataEdit.qty) |
||||||
setQtyReceived(dataEdit.qty_received) |
setQtyReceived(dataEdit.qty_received) |
||||||
setFomDate(dataEdit.fom_date ? moment(dataEdit.fom_date) : null) |
setFomDate(dataEdit.fom_date ? moment(dataEdit.fom_date) : null) |
||||||
setPrDate(dataEdit.pr_date ? moment(dataEdit.pr_date) : null) |
setPrDate(dataEdit.pr_date ? moment(dataEdit.pr_date) : null) |
||||||
setPoDate(dataEdit.po_date ? moment(dataEdit.po_date) : null) |
setPoDate(dataEdit.po_date ? moment(dataEdit.po_date) : null) |
||||||
setReceivedDate(dataEdit.received_date ? moment(dataEdit.received_date) : null) |
setReceivedDate(dataEdit.received_date ? moment(dataEdit.received_date) : null) |
||||||
setDeliveryDate(dataEdit.delivery_date ? moment(dataEdit.delivery_date) : null) |
setDeliveryDate(dataEdit.delivery_date ? moment(dataEdit.delivery_date) : null) |
||||||
} |
} |
||||||
else if (typeDialog === 'Save'){ |
else if (typeDialog === 'Save') { |
||||||
setId(0) |
setId(0) |
||||||
} |
} |
||||||
},[dataEdit,openDialog]) |
}, [dataEdit, openDialog]) |
||||||
|
|
||||||
const handleSave = () => { |
const handleSave = () => { |
||||||
let data = ''; |
let data = ''; |
||||||
if(typeDialog==="Save"){ |
if (typeDialog === "Save") { |
||||||
data = { |
data = { |
||||||
name: materialName, |
name: materialName, |
||||||
qty, |
qty, |
||||||
uom, |
uom, |
||||||
description, |
description, |
||||||
unit_price: typeof(unitPrice) === 'string' && unitPrice !== '' && unitPrice.includes('.') ? parseInt(unitPrice.replace(/\./g,'')) : unitPrice, |
unit_price: typeof (unitPrice) === 'string' && unitPrice !== '' && unitPrice.includes('.') ? parseInt(unitPrice.replace(/\./g, '')) : unitPrice, |
||||||
status |
status |
||||||
} |
} |
||||||
|
|
||||||
closeDialog('save', data); |
closeDialog('save', data); |
||||||
} |
} |
||||||
else if (typeDialog === 'Edit') { |
else if (typeDialog === 'Edit') { |
||||||
console.log('typeof', typeof(unitPrice)); |
console.log('typeof', typeof (unitPrice)); |
||||||
data = { |
data = { |
||||||
id, |
id, |
||||||
name: materialName, |
name: materialName, |
||||||
qty, |
qty, |
||||||
uom, |
uom, |
||||||
description, |
description, |
||||||
unit_price: typeof(unitPrice) === 'string' && unitPrice !== '' && unitPrice.includes('.') ? parseInt(unitPrice.replace(/\./g,'')) : unitPrice, |
unit_price: typeof (unitPrice) === 'string' && unitPrice !== '' && unitPrice.includes('.') ? parseInt(unitPrice.replace(/\./g, '')) : unitPrice, |
||||||
status |
status |
||||||
} |
} |
||||||
closeDialog('edit', data); |
closeDialog('edit', data); |
||||||
} |
} |
||||||
else if (typeDialog === 'EditMatReq') { |
else if (typeDialog === 'EditMatReq') { |
||||||
data = { |
data = { |
||||||
id, |
id, |
||||||
uom, |
uom, |
||||||
description, |
description, |
||||||
status, |
status, |
||||||
required_date: requiredDate, |
required_date: requiredDate, |
||||||
qty, |
qty, |
||||||
qty_received: qtyReceived, |
qty_received: qtyReceived, |
||||||
fom_date: fomDate, |
fom_date: fomDate, |
||||||
pr_date: prDate, |
pr_date: prDate, |
||||||
po_date: poDate, |
po_date: poDate, |
||||||
received_date: receivedDate, |
received_date: receivedDate, |
||||||
delivery_date: deliveryDate, |
delivery_date: deliveryDate, |
||||||
price: typeof(priceReq) === 'string' && priceReq !== '' && priceReq.includes('.') ? parseInt(priceReq.replace(/\./g,'')) : priceReq, |
price: typeof (priceReq) === 'string' && priceReq !== '' && priceReq.includes('.') ? parseInt(priceReq.replace(/\./g, '')) : priceReq, |
||||||
} |
} |
||||||
closeDialog('EditMatReq', data); |
closeDialog('EditMatReq', data); |
||||||
} |
} |
||||||
else if (typeDialog === 'EditMatDelv') { |
else if (typeDialog === 'EditMatDelv') { |
||||||
data = { |
data = { |
||||||
id, |
id, |
||||||
uom, |
uom, |
||||||
description, |
description, |
||||||
status, |
status, |
||||||
required_date: requiredDate, |
required_date: requiredDate, |
||||||
qty, |
qty, |
||||||
qty_received: qtyReceived, |
qty_received: qtyReceived, |
||||||
fom_date: fomDate, |
fom_date: fomDate, |
||||||
pr_date: prDate, |
pr_date: prDate, |
||||||
po_date: poDate, |
po_date: poDate, |
||||||
received_date: receivedDate, |
received_date: receivedDate, |
||||||
delivery_date: deliveryDate |
delivery_date: deliveryDate |
||||||
} |
} |
||||||
closeDialog('EditMatDelv', data); |
closeDialog('EditMatDelv', data); |
||||||
} |
} |
||||||
setId(0) |
setId(0) |
||||||
setDescription('') |
setDescription('') |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
const handleCancel = () => { |
const handleCancel = () => { |
||||||
closeDialog('cancel', 'none') |
closeDialog('cancel', 'none') |
||||||
setId(0) |
setId(0) |
||||||
setDescription('') |
setDescription('') |
||||||
} |
} |
||||||
|
|
||||||
|
const setupSelectUom = () => { |
||||||
|
return ( |
||||||
|
<> |
||||||
|
{dataUom.map((val, index) => { |
||||||
|
return ( |
||||||
const renderForm = () => { |
<Option key={index} value={val.id}>{val.name}</Option> |
||||||
if (typeDialog === 'Save' || typeDialog === 'Edit') { |
) |
||||||
return( |
})} |
||||||
<Form> |
</> |
||||||
<Row> |
) |
||||||
<Col md={12}> |
} |
||||||
<FormGroup> |
|
||||||
<Label className="capitalize">Material Name</Label> |
|
||||||
<Input type="text" value={materialName} onChange={(e)=> setMaterialName(e.target.value)} placeholder={`Input material name...`}/> |
|
||||||
</FormGroup> |
|
||||||
</Col> |
const renderForm = () => { |
||||||
</Row> |
if (typeDialog === 'Save' || typeDialog === 'Edit') { |
||||||
<Row> |
return ( |
||||||
<Col md={6}> |
<Form> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">QTY</Label> |
<Col md={12}> |
||||||
<Input type="text" value={qty} onChange={(e)=> setQty(e.target.value)} placeholder={`Input qty...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Material Name</Label> |
||||||
</Col> |
<Input type="text" value={materialName} onChange={(e) => setMaterialName(e.target.value)} placeholder={`Input material name...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">UOM</Label> |
</Row> |
||||||
<Input type="text" value={uom} onChange={(e)=> setUom(e.target.value)} placeholder={`Input uom...`} /> |
<Row> |
||||||
</FormGroup> |
<Col md={6}> |
||||||
</Col> |
<FormGroup> |
||||||
</Row> |
<Label className="capitalize">QTY</Label> |
||||||
<Row> |
<Input type="number" value={qty} onChange={(e) => setQty(e.target.value)} placeholder={`Input qty...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">Unit Price</Label> |
<Col md={6}> |
||||||
<Input type="text" value={unitPrice} onChange={(e)=> setUnitPrice(formatNumber(e.target.value))} placeholder={`Unit Price...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">UOM</Label> |
||||||
</Col> |
|
||||||
<Col md={6}> |
<Select showSearch defaultValue={uom} onChange={(val) => setUom(val)} placeholder="Select Uom" style={{ width: '100%' }}> |
||||||
<FormGroup> |
{setupSelectUom()} |
||||||
<Label className="capitalize">Status</Label> |
</Select> |
||||||
<Input type="text" value={status} onChange={(e)=> setStatus(e.target.value)} placeholder={`Status ...`} /> |
</FormGroup> |
||||||
</FormGroup> |
<Col md={6}> |
||||||
</Col> |
|
||||||
</Row> |
</Col> |
||||||
<Row> |
</Col> |
||||||
<Col md={12}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">Description</Label> |
<Col md={6}> |
||||||
<Input row="2" type="textarea" value={description} onChange={(e)=> setDescription(e.target.value)} placeholder={`Description ...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Unit Price</Label> |
||||||
</Col> |
<Input type="text" value={unitPrice} onChange={(e) => setUnitPrice(formatNumber(e.target.value))} placeholder={`Unit Price...`} /> |
||||||
</Row> |
</FormGroup> |
||||||
</Form> |
</Col> |
||||||
) |
<Col md={6}> |
||||||
} |
<FormGroup> |
||||||
else if (typeDialog === 'EditMatReq') { |
<Label className="capitalize">Status</Label> |
||||||
return ( |
<Input type="text" value={status} onChange={(e) => setStatus(e.target.value)} placeholder={`Status ...`} /> |
||||||
<Form> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">Status</Label> |
<Col md={12}> |
||||||
<Select showSearch value={status} defaultValue={status} onChange={(val) => setStatus(val)} placeholder="Select status" style={{ width: '100%' }}> |
<FormGroup> |
||||||
<Option value="fom">FOM (Form Order Material)</Option> |
<Label className="capitalize">Description</Label> |
||||||
<Option value="PO">PO (Pre Order)</Option> |
<Input row="2" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={`Description ...`} /> |
||||||
<Option value="PO approve">PO approve</Option> |
</FormGroup> |
||||||
<Option value="PO supplier">PO supplier</Option> |
</Col> |
||||||
<Option value="material deliver to warehouse">Material Deliver to Warehouse</Option> |
</Row> |
||||||
<Option value="receipt to warehouse">Receipt to Warehouse</Option> |
</Form> |
||||||
<Option value="receipt to site">Receipt to Site</Option> |
) |
||||||
</Select> |
} |
||||||
</FormGroup> |
else if (typeDialog === 'EditMatReq') { |
||||||
</Col> |
return ( |
||||||
<Col md={6}> |
<Form> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">Price</Label> |
<Col md={6}> |
||||||
<Input type="text" value={priceReq} onChange={(e) => setPriceReq(formatNumber(e.target.value))} placeholder={`Input Price ...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Status</Label> |
||||||
</Col> |
<Select showSearch value={status} defaultValue={status} onChange={(val) => setStatus(val)} placeholder="Select status" style={{ width: '100%' }}> |
||||||
</Row> |
<Option value="fom">FOM (Form Order Material)</Option> |
||||||
<Row> |
<Option value="PO">PO (Pre Order)</Option> |
||||||
<Col md={6}> |
<Option value="PO approve">PO approve</Option> |
||||||
<FormGroup> |
<Option value="PO supplier">PO supplier</Option> |
||||||
<Label className="capitalize">Description</Label> |
<Option value="material deliver to warehouse">Material Deliver to Warehouse</Option> |
||||||
<Input row="2" type="textarea" value={description} onChange={(e)=> setDescription(e.target.value)} placeholder={`Description ...`} /> |
<Option value="receipt to warehouse">Receipt to Warehouse</Option> |
||||||
</FormGroup> |
<Option value="receipt to site">Receipt to Site</Option> |
||||||
</Col> |
</Select> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">Required Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={requiredDate} onChange={(date, dateString) => setRequiredDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Price</Label> |
||||||
</Col> |
<Input type="text" value={priceReq} onChange={(e) => setPriceReq(formatNumber(e.target.value))} placeholder={`Input Price ...`} /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">QTY</Label> |
<Col md={6}> |
||||||
<Input type="number" value={qty} onChange={(e) => setQty(e.target.value)} placeholder={`Input QTY...`} disabled /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Description</Label> |
||||||
</Col> |
<Input row="2" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={`Description ...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">UOM</Label> |
<Col md={6}> |
||||||
<Input type="text" value={uom} onChange={(e) => setUom(e.target.value)} placeholder={`Input UOM...`} disabled /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Required Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={requiredDate} onChange={(date, dateString) => setRequiredDate(date)} /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">QTY Received</Label> |
<Col md={6}> |
||||||
<Input type="number" min="0" max={qty} value={qtyReceived} onChange={(e) => setQtyReceived(e.target.value)} placeholder={`Input QTY Received...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">QTY</Label> |
||||||
</Col> |
<Input type="number" min="0" value={qty} onChange={(e) => setQty(e.target.value)} placeholder={`Input QTY...`} disabled /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">FOM Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={fomDate} onChange={(date, dateString) => setFomDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">UOM</Label> |
||||||
</Col> |
<Input type="text" value={uom} onChange={(e) => setUom(e.target.value)} placeholder={`Input UOM...`} disabled /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">PR Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={prDate} onChange={(date, dateString) => setPrDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">QTY Received</Label> |
||||||
</Col> |
<Input type="number" min="0" max={qty} value={qtyReceived} onChange={(e) => setQtyReceived(e.target.value)} placeholder={`Input QTY Received...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">PO Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={poDate} onChange={(date, dateString) => setPoDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">FOM Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={fomDate} onChange={(date, dateString) => setFomDate(date)} /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">Received to Warehouse Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={receivedDate} onChange={(date, dateString) => setReceivedDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">PR Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={prDate} onChange={(date, dateString) => setPrDate(date)} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">Delivery to Site Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={deliveryDate} onChange={(date, dateString) => setDeliveryDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">PO Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={poDate} onChange={(date, dateString) => setPoDate(date)} /> |
||||||
|
</FormGroup> |
||||||
</Row> |
</Col> |
||||||
</Form> |
</Row> |
||||||
) |
<Row> |
||||||
} |
<Col md={6}> |
||||||
else if (typeDialog === 'EditMatDelv') { |
<FormGroup> |
||||||
return ( |
<Label className="capitalize">Received to Warehouse Date</Label> |
||||||
<Form> |
<DatePicker style={{ width: "100%" }} value={receivedDate} onChange={(date, dateString) => setReceivedDate(date)} /> |
||||||
<Row> |
</FormGroup> |
||||||
<Col md={12}> |
</Col> |
||||||
<FormGroup> |
<Col md={6}> |
||||||
<Label className="capitalize">Status</Label> |
<FormGroup> |
||||||
<Select showSearch value={status} defaultValue={status} onChange={(val) => setStatus(val)} placeholder="Select status" style={{ width: '100%' }}> |
<Label className="capitalize">Delivery to Site Date</Label> |
||||||
<Option value="receipt to warehouse">Receipt to Warehouse</Option> |
<DatePicker style={{ width: "100%" }} value={deliveryDate} onChange={(date, dateString) => setDeliveryDate(date)} /> |
||||||
<Option value="receipt to site">Receipt to Site</Option> |
</FormGroup> |
||||||
</Select> |
</Col> |
||||||
</FormGroup> |
|
||||||
</Col> |
</Row> |
||||||
</Row> |
</Form> |
||||||
<Row> |
) |
||||||
<Col md={6}> |
} |
||||||
<FormGroup> |
else if (typeDialog === 'EditMatDelv') { |
||||||
<Label className="capitalize">Description</Label> |
return ( |
||||||
<Input row="2" type="textarea" value={description} onChange={(e)=> setDescription(e.target.value)} placeholder={`Description ...`} /> |
<Form> |
||||||
</FormGroup> |
<Row> |
||||||
</Col> |
<Col md={12}> |
||||||
<Col md={6}> |
<FormGroup> |
||||||
<FormGroup> |
<Label className="capitalize">Status</Label> |
||||||
<Label className="capitalize">Required Date</Label> |
<Select showSearch value={status} defaultValue={status} onChange={(val) => setStatus(val)} placeholder="Select status" style={{ width: '100%' }}> |
||||||
<DatePicker style={{ width: "100%" }} value={requiredDate} onChange={(date, dateString) => setRequiredDate(date)} /> |
<Option value="receipt to warehouse">Receipt to Warehouse</Option> |
||||||
</FormGroup> |
<Option value="receipt to site">Receipt to Site</Option> |
||||||
</Col> |
</Select> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">QTY</Label> |
<Col md={6}> |
||||||
<Input type="number" value={qty} onChange={(e) => setQty(e.target.value)} placeholder={`Input QTY...`} disabled /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Description</Label> |
||||||
</Col> |
<Input row="2" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={`Description ...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">UOM</Label> |
<Col md={6}> |
||||||
<Input type="text" value={uom} onChange={(e) => setUom(e.target.value)} placeholder={`Input UOM...`} disabled /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">Required Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={requiredDate} onChange={(date, dateString) => setRequiredDate(date)} /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">QTY Received</Label> |
<Col md={6}> |
||||||
<Input type="number" min="0" max={qty} value={qtyReceived} onChange={(e) => setQtyReceived(e.target.value)} placeholder={`Input QTY Received...`} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">QTY</Label> |
||||||
</Col> |
<Input type="number" value={qty} onChange={(e) => setQty(e.target.value)} placeholder={`Input QTY...`} disabled /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">FOM Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={fomDate} onChange={(date, dateString) => setFomDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">UOM</Label> |
||||||
</Col> |
<Input type="text" value={uom} onChange={(e) => setUom(e.target.value)} placeholder={`Input UOM...`} disabled /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">PR Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={prDate} onChange={(date, dateString) => setPrDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">QTY Received</Label> |
||||||
</Col> |
<Input type="number" min="0" max={qty} value={qtyReceived} onChange={(e) => setQtyReceived(e.target.value)} placeholder={`Input QTY Received...`} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">PO Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={poDate} onChange={(date, dateString) => setPoDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">FOM Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={fomDate} onChange={(date, dateString) => setFomDate(date)} /> |
||||||
</Row> |
</FormGroup> |
||||||
<Row> |
</Col> |
||||||
<Col md={6}> |
</Row> |
||||||
<FormGroup> |
<Row> |
||||||
<Label className="capitalize">Received Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={receivedDate} onChange={(date, dateString) => setReceivedDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">PR Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={prDate} onChange={(date, dateString) => setPrDate(date)} /> |
||||||
<Col md={6}> |
</FormGroup> |
||||||
<FormGroup> |
</Col> |
||||||
<Label className="capitalize">Delivery Date</Label> |
<Col md={6}> |
||||||
<DatePicker style={{ width: "100%" }} value={deliveryDate} onChange={(date, dateString) => setDeliveryDate(date)} /> |
<FormGroup> |
||||||
</FormGroup> |
<Label className="capitalize">PO Date</Label> |
||||||
</Col> |
<DatePicker style={{ width: "100%" }} value={poDate} onChange={(date, dateString) => setPoDate(date)} /> |
||||||
</Row> |
</FormGroup> |
||||||
</Form> |
</Col> |
||||||
) |
</Row> |
||||||
} |
<Row> |
||||||
} |
<Col md={6}> |
||||||
|
<FormGroup> |
||||||
|
<Label className="capitalize">Received Date</Label> |
||||||
return ( |
<DatePicker style={{ width: "100%" }} value={receivedDate} onChange={(date, dateString) => setReceivedDate(date)} /> |
||||||
<> |
</FormGroup> |
||||||
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> |
</Col> |
||||||
<ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog=="Save" ? `Add` : "Edit"} Resource</ModalHeader> |
<Col md={6}> |
||||||
<ModalBody> |
<FormGroup> |
||||||
{renderForm()} |
<Label className="capitalize">Delivery Date</Label> |
||||||
</ModalBody> |
<DatePicker style={{ width: "100%" }} value={deliveryDate} onChange={(date, dateString) => setDeliveryDate(date)} /> |
||||||
<ModalFooter> |
</FormGroup> |
||||||
<Button color="primary" onClick={() => handleSave()}>{typeDialog === 'Save' ? 'Save' : 'Edit'}</Button>{' '} |
</Col> |
||||||
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button> |
</Row> |
||||||
</ModalFooter> |
</Form> |
||||||
</Modal> |
) |
||||||
|
} |
||||||
{/* <DialogMap |
} |
||||||
openDialog={openDialogMap} |
|
||||||
closeDialog={handleCloseDialogMap} |
|
||||||
toggleDialog={() => toggleMapDialog} |
return ( |
||||||
dataEdit={dataEdit} |
<> |
||||||
workArea_={workArea} |
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> |
||||||
lat_={lat} |
<ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Save" ? `Add` : "Edit"} Resource</ModalHeader> |
||||||
lon_={lon} |
<ModalBody> |
||||||
radius_={radius} |
{renderForm()} |
||||||
/> */} |
</ModalBody> |
||||||
</> |
<ModalFooter> |
||||||
) |
<Button color="primary" onClick={() => handleSave()}>{typeDialog === 'Save' ? 'Save' : 'Edit'}</Button>{' '} |
||||||
|
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Batal</Button> |
||||||
} |
</ModalFooter> |
||||||
|
</Modal> |
||||||
export default DialogForm; |
|
||||||
|
{/* <DialogMap |
||||||
|
openDialog={openDialogMap} |
||||||
|
closeDialog={handleCloseDialogMap} |
||||||
|
toggleDialog={() => toggleMapDialog} |
||||||
|
dataEdit={dataEdit} |
||||||
|
workArea_={workArea} |
||||||
|
lat_={lat} |
||||||
|
lon_={lon} |
||||||
|
radius_={radius} |
||||||
|
/> */} |
||||||
|
</> |
||||||
|
) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
export default DialogForm; |
||||||
|
Loading…
Reference in new issue