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