Browse Source

feat(project): add new field income yearly and value contract

pull/1/head
farhantock 4 months ago
parent
commit
978d8af20b
  1. 67
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  2. 28
      src/views/SimproV2/CreatedProyek/index.js

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

@ -50,6 +50,8 @@ const DialogFormProyek = ({
const [late, setLateConsequence] = useState(""); const [late, setLateConsequence] = useState("");
const [assumtion, setAssumtion] = useState(""); const [assumtion, setAssumtion] = useState("");
const [biaya, setBiaya] = useState(""); const [biaya, setBiaya] = useState("");
const [valueProyek, setValueProyek] = useState("");
const [incomeYearly, setIncomeYearly] = useState("");
const [typeProject, setTypeproject] = useState(null); const [typeProject, setTypeproject] = useState(null);
const [phaseProject, setPhaseProject] = useState(null); const [phaseProject, setPhaseProject] = useState(null);
const [divisiProject, setDivisiProject] = useState(null); const [divisiProject, setDivisiProject] = useState(null);
@ -67,10 +69,9 @@ const DialogFormProyek = ({
const [scompany_id, setCompanyId] = useState(null); const [scompany_id, setCompanyId] = useState(null);
const [step, setStep] = useState(1); const [step, setStep] = useState(1);
const [currencyList, setCurrencyList] = useState(null); const [currencyList, setCurrencyList] = useState(null);
const [currency, setCurrency] = useState(""); // merge of code | symbol | name const [currencyCode, setCurrencyCode] = useState("IDR");
const [currencyCode, setCurrencyCode] = useState(""); const [currencySymbol, setCurrencySymbol] = useState("Rp");
const [currencySymbol, setCurrencySymbol] = useState("IDR|Rp|Indonesian rupiah"); const [currencyName, setCurrencyName] = useState("Indonesian rupiah");
const [currencyName, setCurrencyName] = useState("");
const [objectives, setObjectives] = useState(""); const [objectives, setObjectives] = useState("");
const [projectIsConsideredSuccessful, setProjectIsConsideredSuccessful] = useState(""); const [projectIsConsideredSuccessful, setProjectIsConsideredSuccessful] = useState("");
const [participants, setParticipants] = useState([]); const [participants, setParticipants] = useState([]);
@ -104,6 +105,8 @@ const DialogFormProyek = ({
setLateConsequence(val.late_consequence ? val.late_consequence : ""); setLateConsequence(val.late_consequence ? val.late_consequence : "");
setAssumtion(val.assumtion ? val.assumtion : ""); setAssumtion(val.assumtion ? val.assumtion : "");
setBiaya(val.rencana_biaya ? formatNumber(val.rencana_biaya) : ""); setBiaya(val.rencana_biaya ? formatNumber(val.rencana_biaya) : "");
setValueProyek(val.value_proyek ? formatNumber(val.value_proyek) : "");
setIncomeYearly(val.income_year ? formatNumber(val.income_year) : "");
setTypeproject(val.type_proyek_id); setTypeproject(val.type_proyek_id);
setPhaseProject(val.phase_id); setPhaseProject(val.phase_id);
setDivisiProject(val.divisi_id); setDivisiProject(val.divisi_id);
@ -208,10 +211,9 @@ const DialogFormProyek = ({
setProjectStructureOrg(null); setProjectStructureOrg(null);
setCompany(""); setCompany("");
setCompanyId(null) setCompanyId(null)
setCurrency(""); setCurrencyCode("IDR");
setCurrencyCode(""); setCurrencySymbol("Rp");
setCurrencySymbol("IDR|Rp|Indonesian rupiah"); setCurrencyName("Indonesian rupiah");
setCurrencyName("");
setObjectives(""); setObjectives("");
setImage(""); setImage("");
setProjectIsConsideredSuccessful(""); setProjectIsConsideredSuccessful("");
@ -278,7 +280,9 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id),
value_proyek: valueProyek,
income_year: incomeYearly
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;
@ -309,7 +313,9 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id) company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id),
value_proyek: valueProyek,
income_year: incomeYearly
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;
@ -381,6 +387,8 @@ const DialogFormProyek = ({
setCurrencyName(curr[2]); setCurrencyName(curr[2]);
}; };
console.log(currencyCode, currencySymbol, currencyName);
const handleDatePickerStart = (date, dateString) => { const handleDatePickerStart = (date, dateString) => {
setStartDate(date); setStartDate(date);
}; };
@ -806,7 +814,7 @@ const DialogFormProyek = ({
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}> <Label className="capitalize" style={{ fontWeight: "bold" }}>
Budget<span style={{ color: "red" }}>*</span> Nilai Kontrak<span style={{ color: "red" }}>*</span>
</Label> </Label>
<Row> <Row>
<Col md={4}> <Col md={4}>
@ -824,13 +832,40 @@ const DialogFormProyek = ({
<Col md={8}> <Col md={8}>
<Input <Input
type="text" type="text"
value={biaya} value={valueProyek}
onChange={(e) => setBiaya(formatNumber(e.target.value))} onChange={(e) => setValueProyek(formatNumber(e.target.value))}
/> />
</Col> </Col>
</Row> </Row>
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Target Pendapatan/Tahun<span style={{ color: "red" }}>*</span>
</Label>
<Input
type="text"
value={incomeYearly}
onChange={(e) => setIncomeYearly(formatNumber(e.target.value))}
/>
</FormGroup>
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Anggaran Biaya<span style={{ color: "red" }}>*</span>
</Label>
<Input
type="text"
value={biaya}
onChange={(e) => setBiaya(formatNumber(e.target.value))}
/>
</FormGroup>
</Col>
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Work Area</Label> <Label className="capitalize" style={{ fontWeight: "bold" }}>Work Area</Label>
@ -844,7 +879,7 @@ const DialogFormProyek = ({
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}> <Label className="capitalize" style={{ fontWeight: "bold" }}>
Handled By Division<span style={{ color: "red" }}>*</span> Handled By MP<span style={{ color: "red" }}>*</span>
</Label> </Label>
<Select <Select
showSearch showSearch
@ -1241,7 +1276,7 @@ const DialogFormProyek = ({
</Row> </Row>
); );
}); });
} else if (checklist.length < 1) { } else if (checklist?.length == 0) {
return ( return (
<div <div
style={{ style={{
@ -1546,7 +1581,7 @@ const DialogFormProyek = ({
return ( return (
<> <>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> <Modal scrollable={true} size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}> <ModalHeader className="capitalize" toggle={closeDialog}>
{step === 1 {step === 1
? idTask ? idTask

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

@ -414,9 +414,10 @@ const CreatedProyek = ({ params, ...props }) => {
"currency_symbol", "currency_symbol",
"mulai_proyek", "mulai_proyek",
"akhir_proyek", "akhir_proyek",
"value_proyek",
"income_year",
"company_id", "company_id",
"deleted_at", "deleted_at",
"value_proyek",
"deleted_by_id" "deleted_by_id"
], ],
joins: [ joins: [
@ -1489,7 +1490,7 @@ const CreatedProyek = ({ params, ...props }) => {
const handleExportPdf = async () => { const handleExportPdf = async () => {
const doc = new jsPDF(); const doc = new jsPDF();
let headers = [ let headers = [
[role_name === 'Super Admin' ? "Company" : null, "Project Name", "Budget", "Project Type", "PM", "Time Project"], [role_name === 'Super Admin' ? "Company" : null, "Project Name", "Nilai Kontrak", "Pendapatan Pertahun", "Anggaran Biaya", "Project Type", "PM", "Time Project"],
]; ];
const payload = { const payload = {
@ -1621,7 +1622,7 @@ const CreatedProyek = ({ params, ...props }) => {
<span className="menu-icon"> <span className="menu-icon">
<i className="fa fa-eye"></i> <i className="fa fa-eye"></i>
</span> </span>
<span className="menu-text">Project Charter</span> <span className="menu-text">Indentitas Proyek</span>
</div> </div>
<div className="menu-list" onClick={() => handleOpenDokumen(text)}> <div className="menu-list" onClick={() => handleOpenDokumen(text)}>
<span className="menu-icon"> <span className="menu-icon">
@ -1762,6 +1763,7 @@ const CreatedProyek = ({ params, ...props }) => {
title: "Action", title: "Action",
dataIndex: "", dataIndex: "",
key: "x", key: "x",
width: 70,
render: (text, record) => render: (text, record) =>
parseInt(role_id) == 44 ? ( parseInt(role_id) == 44 ? (
<> <>
@ -1831,13 +1833,25 @@ const CreatedProyek = ({ params, ...props }) => {
<span>{record.join_third_company_name}</span> <span>{record.join_third_company_name}</span>
) )
}] : []), }] : []),
{ title: "Project Name", dataIndex: "nama", key: "nama" }, { title: "Project Name", dataIndex: "nama", key: "nama", width: 200 },
{
title: "Pendapatan Pertahun", dataIndex: "income_year",
key: "income_year",
render: (text, record) => {
const incomeYear = text ?? '-';
return record.currency_symbol
? `${record.currency_symbol} ${formatThousand(incomeYear)}`
: `${formatThousand(incomeYear)}`;
},
},
{ {
title: "Nilai Kontrak", title: "Nilai Kontrak", dataIndex: "value_proyek",
dataIndex: "value_proyek",
key: "value_proyek", key: "value_proyek",
render: (text, record) => { render: (text, record) => {
return "Rp " + (record.value_proyek == null ? 0 : record.value_proyek); const valueProyek = text ?? '-';
return record.currency_symbol
? `${record.currency_symbol} ${formatThousand(valueProyek)}`
: `${formatThousand(valueProyek)}`;
}, },
}, },
{ {

Loading…
Cancel
Save