|
|
@ -10,17 +10,17 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
const [id, setId] = useState(null) |
|
|
|
const [id, setId] = useState(null) |
|
|
|
const [typeForm, setTypeForm] = useState('add') |
|
|
|
const [typeForm, setTypeForm] = useState('add') |
|
|
|
const [user, setUser] = useState(null) |
|
|
|
const [user, setUser] = useState(null) |
|
|
|
const [rbs, setRbs] = useState("") //rbs ""
|
|
|
|
const [rbs, setRbs] = useState("") |
|
|
|
const [projectRole, setProjectRole] = useState(null) // id
|
|
|
|
const [projectRole, setProjectRole] = useState(null) |
|
|
|
const [groupR, setGroupR] = useState("") //group_r ""
|
|
|
|
const [groupR, setGroupR] = useState("") |
|
|
|
const [maxUsed, setMaxUsed] = useState("") // max_used int
|
|
|
|
const [maxUsed, setMaxUsed] = useState("") |
|
|
|
const [standartRate, setStandartRate] = useState("") //standart_rate int
|
|
|
|
const [standartRate, setStandartRate] = useState("") |
|
|
|
const [uomStandartRate, setUomStandartRate] = useState(null) // uom_standart_rate ""
|
|
|
|
const [uomStandartRate, setUomStandartRate] = useState(null) |
|
|
|
const [overTimeRate, setOverTimeRate] = useState("") //overtime_rate int
|
|
|
|
const [overTimeRate, setOverTimeRate] = useState("") |
|
|
|
const [overTimeRateUom, setOverTimeRateUom] = useState(null) //uom_over_time_rate ""
|
|
|
|
const [overTimeRateUom, setOverTimeRateUom] = useState(null) |
|
|
|
const [costPerUsed, setCostPerUsed] = useState("") // cost_per_used int
|
|
|
|
const [costPerUsed, setCostPerUsed] = useState("") |
|
|
|
const [accrue, setAccrue] = useState("") // accrue_at ""
|
|
|
|
const [accrue, setAccrue] = useState("") |
|
|
|
const [baseCalender, setBaseCalender] = useState("") //base_calender ""
|
|
|
|
const [baseCalender, setBaseCalender] = useState("") |
|
|
|
const [listHr, setListHr] = useState([]) |
|
|
|
const [listHr, setListHr] = useState([]) |
|
|
|
|
|
|
|
|
|
|
|
const handleClearData = () => { |
|
|
|
const handleClearData = () => { |
|
|
@ -41,12 +41,11 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
let data = dataHr || [] |
|
|
|
let data = dataHr || [] |
|
|
|
let availableHr = [] |
|
|
|
let availableHr = [] |
|
|
|
console.log("dataCurrentHr", dataCurrentHr) |
|
|
|
|
|
|
|
data.map((val, index) => { |
|
|
|
data.map((val, index) => { |
|
|
|
if(dataEdit && dataEdit.user_id){ |
|
|
|
if(dataEdit && dataEdit.user_id){ |
|
|
|
if(parseInt(val.id)===parseInt(dataEdit.user_id)){ |
|
|
|
if(parseInt(val.id)===parseInt(dataEdit.user_id)){ |
|
|
|
availableHr.push(val); |
|
|
|
availableHr.push(val); |
|
|
|
}
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
let check = dataCurrentHr.some(function (x) { |
|
|
|
let check = dataCurrentHr.some(function (x) { |
|
|
|
return parseInt(val.id)==parseInt(x.user_id) |
|
|
|
return parseInt(val.id)==parseInt(x.user_id) |
|
|
@ -60,7 +59,6 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (idTask && idTask > 0) { |
|
|
|
if (idTask && idTask > 0) { |
|
|
|
console.log("data edit", dataEdit) |
|
|
|
|
|
|
|
if(dataEdit && dataEdit!=""){ |
|
|
|
if(dataEdit && dataEdit!=""){ |
|
|
|
setTypeForm('edit') |
|
|
|
setTypeForm('edit') |
|
|
|
setId(dataEdit.id) |
|
|
|
setId(dataEdit.id) |
|
|
@ -130,7 +128,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
<Col> |
|
|
|
<Col> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label>Human Resource</Label> |
|
|
|
<Label>Human Resource</Label> |
|
|
|
<Select showSearch value={user} onChange={(val) => setUser(val)} placeholder="Select Human Resource" filterOption={(input, option) =>
|
|
|
|
<Select showSearch value={user} onChange={(val) => setUser(val)} placeholder="Select Human Resource" filterOption={(input, option) => |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
} style={{ width: '100%' }}> |
|
|
|
} style={{ width: '100%' }}> |
|
|
|
{listHr && listHr.map(res => ( |
|
|
|
{listHr && listHr.map(res => ( |
|
|
@ -152,46 +150,10 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
<Col> |
|
|
|
<Col> |
|
|
|
<FormGroup> |
|
|
|
<FormGroup> |
|
|
|
<Label>Percentage Available User</Label> |
|
|
|
<Label>Percentage Available User</Label> |
|
|
|
<Input type="text" onChange={(e) => setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='100%' /> |
|
|
|
<Input type="text" onChange={(e) => setMaxUsed(formatNumber(e.target.value))} value={maxUsed} placeholder='' required/> |
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</Col> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
</Row> |
|
|
|
{/* <Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>RBS</Label> |
|
|
|
|
|
|
|
<Input type='text' onChange={(e) => setRbs(e.target.value)} value={rbs} placeholder='rbs..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>Group R</Label> |
|
|
|
|
|
|
|
<Input type='text' onChange={(e) => setGroupR(e.target.value)} value={groupR} placeholder='group r..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> */} |
|
|
|
|
|
|
|
{/* <Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>Max Used</Label> |
|
|
|
|
|
|
|
<Input type='number' onChange={(e) => setMaxUsed(e.target.value)} value={maxUsed} placeholder='10..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>Cost Per Used</Label> |
|
|
|
|
|
|
|
<Input type='number' onChange={(e) => setCostPerUsed(e.target.value)} value={costPerUsed} placeholder='2000..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> */} |
|
|
|
|
|
|
|
{/* <Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> */} |
|
|
|
|
|
|
|
<div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}> |
|
|
|
<div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}> |
|
|
|
<FormGroup style={{flexBasis:"49%"}}> |
|
|
|
<FormGroup style={{flexBasis:"49%"}}> |
|
|
|
<Label>Standart Rate</Label> |
|
|
|
<Label>Standart Rate</Label> |
|
|
@ -206,7 +168,6 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
<Option value={"Day"}>Day</Option> |
|
|
|
<Option value={"Day"}>Day</Option> |
|
|
|
<Option value={"Hour"}>Hour</Option> |
|
|
|
<Option value={"Hour"}>Hour</Option> |
|
|
|
</Select> |
|
|
|
</Select> |
|
|
|
{/* <Input type='text' onChange={(e) => setUomStandartRate(e.target.value)} value={uomStandartRate} placeholder='hari..' /> */} |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -224,28 +185,12 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
<Option value={"Day"}>Day</Option> |
|
|
|
<Option value={"Day"}>Day</Option> |
|
|
|
<Option value={"Hour"}>Hour</Option> |
|
|
|
<Option value={"Hour"}>Hour</Option> |
|
|
|
</Select> |
|
|
|
</Select> |
|
|
|
{/* <Input type='text' onChange={(e) => setOverTimeRateUom(e.target.value)} value={overTimeRateUom} placeholder='hari..' /> */} |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
</FormGroup> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{/* <Row> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>Accrue At</Label> |
|
|
|
|
|
|
|
<Input type='text' onChange={(e) => setAccrue(e.target.value)} value={accrue} placeholder='accrue..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
<Col> |
|
|
|
|
|
|
|
<FormGroup> |
|
|
|
|
|
|
|
<Label>Base Calendar</Label> |
|
|
|
|
|
|
|
<Input type='text' onChange={(e) => setBaseCalender(e.target.value)} value={baseCalender} placeholder='base calendar..' /> |
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
|
|
|
</Col> |
|
|
|
|
|
|
|
</Row> */} |
|
|
|
|
|
|
|
</Form> |
|
|
|
</Form> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> |
|
|
|
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> |
|
|
@ -263,4 +208,4 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit, |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default FormAsignHr; |
|
|
|
export default FormAsignHr; |
|
|
|