Browse Source

improve ui&ux

pull/2/head
Muhammad Sulaiman Yusuf 3 years ago
parent
commit
b5e5da20ae
  1. 45
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  2. 79
      src/views/SimproV2/CreatedProyek/FormAsignHr.js
  3. 2
      src/views/SimproV2/CreatedProyek/index.js

45
src/views/SimproV2/CreatedProyek/DialogFormProyek.js

@ -54,7 +54,6 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
const handleGetdataIdproyek = async (id) => {
const result = await axios.get(`${PROYEK_GET_ID(id)}`, HEADER).then(res => res).catch(err => err.response)
console.log("proyek by id", result)
if (result && result.data && result.data.code === 200) {
const val = result.data.data
setName(val.nama)
@ -84,29 +83,27 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
const handleGetDataApproval = async (id) => {
const result = await axios.get(`${PROJECT_APPROVAL_WHERE_CUSTOM('proyek_id', id)}`, HEADER).then(res => res).catch(err => err.response)
console.log("handleGetDataApproval by id", result)
setApproval(result.data.data)
}
const handleGetDataMileStone = async (id) => {
const result = await axios.get(`${PROJECT_MILESTONE_WHERE_CUSTOM('proyek_id', id)}`, HEADER).then(res => res).catch(err => err.response)
console.log("handleGetDataMileStone by id", result)
setMilestones(result.data.data)
}
const handleGetDataParticipants = async (id) => {
const result = await axios.get(`${PROJECT_PARTICIPANT_WHERE_CUSTOM('proyek_id', id)}`, HEADER).then(res => res).catch(err => err.response)
console.log("handleGetDataParticipants by id", result)
setParticipants(result.data.data)
}
const handleGetDataCurrency = async () => {
const result = await axios.get(CURRENCY_LIST, HEADER).then(res => res).catch(err => err.response)
console.log("handleGetDataCurrency", result)
const defaultVal = result.data.data.find(val => val.cc == "IDR")
setCurrencyList(result.data.data)
setCurrencySymbol(`${defaultVal.cc}|${defaultVal.symbol}|${defaultVal.name}`)
}
const handleClearData = () => {
@ -146,7 +143,6 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
}
if (idTask && idTask > 0) {
console.log("cel data Edit")
handleGetdataIdproyek(idTask)
handleGetDataParticipants(idTask)
handleGetDataMileStone(idTask)
@ -206,7 +202,6 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
currency_name: currencyName
}
data.projectCharter = { participants, milestones, approval}
console.log(data)
closeDialog('add', data);
}
handleClearData()
@ -223,14 +218,11 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
const onChangePm = (val) => {
console.log("chnage pm", val)
setPic(val)
}
const onChangeCurrency = (val) => {
console.log("onchange currency", val);
let curr = val.split("|"); // code|symbol|name
console.log('curr', curr);
setCurrencyCode(curr[0]);
setCurrencySymbol(curr[1]);
setCurrencyName(curr[2]);
@ -281,7 +273,6 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
setParticipants(participants);
setLastIdxParticipants(lastIdxParticipants + 1);
console.log('participants', participants);
}
const handleInputChangeParticipants = (e, index) => {
@ -376,13 +367,13 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<Col md={6}>
<FormGroup>
<Label className="capitalize">Project Name<span style={{ color: "red" }}>*</span></Label>
<Input type="text" value={name} onChange={(e) => setName(e.target.value)} placeholder={`Input project name...`} />
<Input type="text" value={name} onChange={(e) => setName(e.target.value)} />
</FormGroup>
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Code / Short Name</Label>
<Input type="text" value={shortName} onChange={(e) => setShortName(e.target.value)} placeholder={`Input code / short name...`} />
<Input type="text" value={shortName} onChange={(e) => setShortName(e.target.value)} />
</FormGroup>
</Col>
</Row>
@ -390,7 +381,11 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<Col md={6}>
<FormGroup>
<Label className="capitalize">Project Type<span style={{ color: "red" }}>*</span></Label>
<Select showSearch value={typeProject} defaultValue={typeProject} onChange={onChangeTypeProject} placeholder="Select project type" style={{ width: '100%' }}>
<Select showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={typeProject} defaultValue={typeProject} onChange={onChangeTypeProject} placeholder="Select project type" style={{ width: '100%' }}>
{dataTypeProyek.map(res => (
<Option key={res.id} value={res.id}>{res.name}</Option>
))}
@ -400,7 +395,11 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<Col md={6}>
<FormGroup>
<Label className="capitalize">PM</Label>
<Select showSearch value={pic} defaultValue={pic} onChange={onChangePm} placeholder="Select PM" style={{ width: '100%' }}>
<Select showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={pic} defaultValue={pic} onChange={onChangePm} placeholder="Select PM" style={{ width: '100%' }}>
{dataPM.map(res => (
<Option key={res.id} value={res.id}>{res.name}</Option>
))}
@ -426,13 +425,13 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<Col md={6}>
<FormGroup>
<Label className="capitalize">Work Area</Label>
<Input type="text" value={workArea} onChange={(e) => setWorkArea(e.target.value)} placeholder={`Input work area...`} />
<Input type="text" value={workArea} onChange={(e) => setWorkArea(e.target.value)} />
</FormGroup>
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Company</Label>
<Input type="text" value={company} onChange={(e) => setCompany(e.target.value)} placeholder={`Input company...`} />
<Input type="text" value={company} onChange={(e) => setCompany(e.target.value)} />
</FormGroup>
</Col>
</Row>
@ -441,15 +440,15 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<FormGroup>
<Label className="capitalize">Budget<span style={{ color: "red" }}>*</span></Label>
<Row>
<Col md={6}>
<Select showSearch value={currencySymbol} onChange={onChangeCurrency} placeholder="Select Currency" style={{ width: '100%' }}>
<Col md={4}>
<Select value={currencySymbol} defaultValue="IDR|Rp|Indonesian rupiah" onChange={onChangeCurrency} placeholder="Select Currency" style={{ width: '100%' }}>
{currencyList && currencyList.map(res => (
<Option key={res.id} value={`${res.cc}|${res.symbol}|${res.name}`}>{`${res.name}`}</Option>
<Option key={res.id} value={`${res.cc}|${res.symbol}|${res.name}`}>{`${res.cc}`}</Option>
))}
</Select>
</Col>
<Col md={6}>
<Input type="text" value={biaya} onChange={(e) => setBiaya(formatNumber(e.target.value))} placeholder={`Input planning cost...`} />
<Col md={8}>
<Input type="text" value={biaya} onChange={(e) => setBiaya(formatNumber(e.target.value))} placeholder={`Amount`} />
</Col>
</Row>
</FormGroup>
@ -457,7 +456,7 @@ const DialogFormProyek = ({ openDialog, closeDialog, toggleDialog, idTask, dataT
<Col md={6}>
<FormGroup>
<Label className="capitalize">Description</Label>
<Input type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={`Input description...`} />
<Input type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} />
</FormGroup>
</Col>
</Row>

79
src/views/SimproV2/CreatedProyek/FormAsignHr.js

@ -10,17 +10,17 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
const [id, setId] = useState(null)
const [typeForm, setTypeForm] = useState('add')
const [user, setUser] = useState(null)
const [rbs, setRbs] = useState("") //rbs ""
const [projectRole, setProjectRole] = useState(null) // id
const [groupR, setGroupR] = useState("") //group_r ""
const [maxUsed, setMaxUsed] = useState("") // max_used int
const [standartRate, setStandartRate] = useState("") //standart_rate int
const [uomStandartRate, setUomStandartRate] = useState(null) // uom_standart_rate ""
const [overTimeRate, setOverTimeRate] = useState("") //overtime_rate int
const [overTimeRateUom, setOverTimeRateUom] = useState(null) //uom_over_time_rate ""
const [costPerUsed, setCostPerUsed] = useState("") // cost_per_used int
const [accrue, setAccrue] = useState("") // accrue_at ""
const [baseCalender, setBaseCalender] = useState("") //base_calender ""
const [rbs, setRbs] = useState("")
const [projectRole, setProjectRole] = useState(null)
const [groupR, setGroupR] = useState("")
const [maxUsed, setMaxUsed] = useState("")
const [standartRate, setStandartRate] = useState("")
const [uomStandartRate, setUomStandartRate] = useState(null)
const [overTimeRate, setOverTimeRate] = useState("")
const [overTimeRateUom, setOverTimeRateUom] = useState(null)
const [costPerUsed, setCostPerUsed] = useState("")
const [accrue, setAccrue] = useState("")
const [baseCalender, setBaseCalender] = useState("")
const [listHr, setListHr] = useState([])
const handleClearData = () => {
@ -41,7 +41,6 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
useEffect(() => {
let data = dataHr || []
let availableHr = []
console.log("dataCurrentHr", dataCurrentHr)
data.map((val, index) => {
if(dataEdit && dataEdit.user_id){
if(parseInt(val.id)===parseInt(dataEdit.user_id)){
@ -60,7 +59,6 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
useEffect(() => {
if (idTask && idTask > 0) {
console.log("data edit", dataEdit)
if(dataEdit && dataEdit!=""){
setTypeForm('edit')
setId(dataEdit.id)
@ -152,46 +150,10 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
<Col>
<FormGroup>
<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>
</Col>
</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"}}>
<FormGroup style={{flexBasis:"49%"}}>
<Label>Standart Rate</Label>
@ -206,7 +168,6 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
<Option value={"Day"}>Day</Option>
<Option value={"Hour"}>Hour</Option>
</Select>
{/* <Input type='text' onChange={(e) => setUomStandartRate(e.target.value)} value={uomStandartRate} placeholder='hari..' /> */}
</FormGroup>
</div>
@ -224,28 +185,12 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
<Option value={"Day"}>Day</Option>
<Option value={"Hour"}>Hour</Option>
</Select>
{/* <Input type='text' onChange={(e) => setOverTimeRateUom(e.target.value)} value={overTimeRateUom} placeholder='hari..' /> */}
</FormGroup>
</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>
)
}
return (
<>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>

2
src/views/SimproV2/CreatedProyek/index.js

@ -130,7 +130,6 @@ const CreatedProyek = ({ params, ...props }) => {
const getDataProyek = async () => {
let start = 0;
if (currentPage !== 1 && currentPage > 1) {
@ -960,7 +959,6 @@ const CreatedProyek = ({ params, ...props }) => {
{ViewProyek}
{RenderDialogForm}
{RenderDialogFormProyek}
{/* {RenderDialogFormResources} */}
{RenderDialogFormMaterial}
{RenderDialogTableTools}
{RenderDialogDoc}

Loading…
Cancel
Save