|
|
|
@ -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> |
|
|
|
|