Browse Source

wip

pull/2/head
Yusuf 2 years ago
parent
commit
678a51f39f
  1. 61
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js

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

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from "react";
import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap";
import { Button, Form, FormGroup, Label, Input, Col, Row } from "reactstrap";
import { DatePicker, Tooltip, Select } from "antd";
import { DatePicker, Tooltip, Select, Divider } from "antd";
// import { Language } from 'src/const/LanguageConst';
import axios from "../../../const/interceptorApi";
import moment from "moment";
@ -45,6 +45,7 @@ const DialogFormProyek = ({
const [biaya, setBiaya] = useState("");
const [typeProject, setTypeproject] = useState(null);
const [phaseProject, setPhaseProject] = useState(null);
const [budgetHealth, setHealthBudget] = useState(null);
const [sdm, setSdm] = useState(0);
const [pic, setPic] = useState(null);
const [startDate, setStartDate] = useState(moment());
@ -61,8 +62,7 @@ const DialogFormProyek = ({
const [currencyName, setCurrencyName] = useState("");
// project charter
const [objectives, setObjectives] = useState("");
const [projectIsConsideredSuccessful, setProjectIsConsideredSuccessful] =
useState("");
const [projectIsConsideredSuccessful, setProjectIsConsideredSuccessful] = useState("");
const [participants, setParticipants] = useState([]);
const [availableResources, setAvailableResources] = useState("");
const [milestones, setMilestones] = useState([]);
@ -89,6 +89,7 @@ const DialogFormProyek = ({
setBiaya(val.rencana_biaya ? formatNumber(val.rencana_biaya) : "");
setTypeproject(val.type_proyek_id);
setPhaseProject(val.phase_id);
setHealthBudget(val.budget_health);
setPic(val.pm_id);
setStartDate(moment(val.mulai_proyek));
setEndDate(moment(val.akhir_proyek));
@ -219,6 +220,7 @@ const DialogFormProyek = ({
setBiaya("");
setTypeproject(null);
setPhaseProject(null);
setHealthBudget(null);
setPic(null);
setStartDate(moment());
setEndDate(moment());
@ -275,6 +277,8 @@ const DialogFormProyek = ({
mulai_proyek: startDate,
akhir_proyek: endDate,
type_proyek_id: parseInt(typeProject),
phase_id: parseInt(phaseProject),
budget_health: budgetHealth,
pm_id: pic,
investor,
finance,
@ -300,6 +304,8 @@ const DialogFormProyek = ({
mulai_proyek: startDate,
akhir_proyek: endDate,
type_proyek_id: parseInt(typeProject),
phase_id: parseInt(phaseProject),
budget_health: budgetHealth,
pm_id: pic,
investor,
finance,
@ -335,6 +341,9 @@ const DialogFormProyek = ({
setPhaseProject(val);
};
const onChangeBudgetHealth = (val) => {
setHealthBudget(val);
};
const onChangePm = (val) => {
let data = [...dataPM];
@ -519,6 +528,11 @@ const DialogFormProyek = ({
const renderForm = () => {
return (
<Form>
<Row>
<Col md={12}>
<span style={{ color: "red" }}>*</span> Wajib diisi.
</Col>
</Row>
<Row>
<Col md={6}>
<FormGroup>
@ -691,14 +705,17 @@ const DialogFormProyek = ({
</FormGroup>
</Col>
</Row>
<Divider orientation="left" plain>
Info Dashboard
</Divider>
<Row>
<Col md={6}>
<FormGroup>
<Label>Phase</Label>
<Select
showSearch
value={pic}
defaultValue={pic}
value={phaseProject}
defaultValue={phaseProject}
onChange={onChangePhaseProject}
style={{ width: "100%" }}
>
@ -715,30 +732,24 @@ const DialogFormProyek = ({
<Label>Cost Health</Label>
<Select
showSearch
value={pic}
defaultValue={pic}
onChange={onChangePm}
value={budgetHealth}
defaultValue={budgetHealth}
onChange={onChangeBudgetHealth}
style={{ width: "100%" }}
>
<Option key="on-budget" value="on-budget">
On budget
</Option>
</Option>
<Option key="warning" value="warning">
Warning
</Option>
</Option>
<Option key="danger" value="danger">
Danger
</Option>
</Option>
</Select>
</FormGroup>
</Col>
</Row>
<Row>
<Col md={12}>
<div>Notes:</div>
<span style={{ color: "red" }}>*</span> means required fields
</Col>
</Row>
</Form>
);
};
@ -1113,15 +1124,15 @@ const DialogFormProyek = ({
</Button>
</>
) : (
<>
<Button color="primary" onClick={() => previousStep()}>
<i className="fa fa-chevron-left"></i> Previous
<>
<Button color="primary" onClick={() => previousStep()}>
<i className="fa fa-chevron-left"></i> Previous
</Button>{" "}
<Button color="success" onClick={() => handleSave()}>
{idTask ? `Save` : "Add"}
</Button>
</>
)}
<Button color="success" onClick={() => handleSave()}>
{idTask ? `Save` : "Add"}
</Button>
</>
)}
</ModalFooter>
</Modal>
</>

Loading…
Cancel
Save