Browse Source

wip

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

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

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

Loading…
Cancel
Save