Browse Source

Merge pull request 'dev-wahyun' (#116) from dev-wahyun into staging

Reviewed-on: ordo/adw-frontend#116
pull/2/head
ibnu 1 year ago
parent
commit
5a03f94402
  1. 4
      src/views/Dashboard/DashboardBOD.js
  2. 148
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  3. 82
      src/views/SimproV2/CreatedProyek/ViewProject.js
  4. 5
      src/views/SimproV2/CreatedProyek/index.js
  5. 2
      src/views/SimproV2/Divisi/DialogForm.js

4
src/views/Dashboard/DashboardBOD.js

@ -245,7 +245,9 @@ const DashboardBOD = () => {
}
if (result.status == 200 && result.data.data) {
SET_PROJECT_PER_DIVISION(result.data.data);
let dataRes = result.data.data;
const filteredData = dataRes.filter(item => item.parent === null);
SET_PROJECT_PER_DIVISION(filteredData);
}
SET_READY_PROJECT_PER_DIVISION(true);
}

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

@ -200,6 +200,7 @@ const DialogFormProyek = ({
setFinance("");
setWorkArea("");
setProjectDuration("");
setDivisiProject(null);
setProjectStructureOrg(null);
setCompany("");
setCurrency("");
@ -611,7 +612,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Project Name<span style={{ color: "red" }}>*</span>
</Label>
<Input
@ -623,7 +624,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Code / Short Name<span style={{ color: "red" }}>*</span></Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Code / Short Name<span style={{ color: "red" }}>*</span></Label>
<Input
type="text"
value={shortName}
@ -635,7 +636,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Project Type<span style={{ color: "red" }}>*</span>
</Label>
<Select
@ -658,7 +659,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">PM</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>PM</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
@ -681,7 +682,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Start Date<span style={{ color: "red" }}>*</span>
</Label>
<DatePicker
@ -694,7 +695,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
<Label className="capitalize" style={{ fontWeight: "bold" }}>
End Date<span style={{ color: "red" }}>*</span>
</Label>
<DatePicker
@ -716,7 +717,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Work Area</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Work Area</Label>
<Input
type="text"
value={workArea}
@ -726,7 +727,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Company</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Company</Label>
<Input
type="text"
value={company}
@ -738,7 +739,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Budget<span style={{ color: "red" }}>*</span>
</Label>
<Row>
@ -768,8 +769,14 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label>Handled By Division</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Handled By Division<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={divisiProject}
defaultValue={divisiProject}
onChange={onChangeDivisiProject}
@ -785,7 +792,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Project Duration</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Project Duration</Label>
<Input
type="number"
min="1"
@ -798,7 +805,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Organizational Structure</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Organizational Structure</Label>
<Input
type="file"
accept="image/*"
@ -809,7 +816,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Description</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Description</Label>
<Input
type="textarea"
value={description}
@ -820,7 +827,7 @@ const DialogFormProyek = ({
</Row>
<Row>
<Col md={12}>
<Label className="capitalize">Late Consequence</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Late Consequence</Label>
<CKEditor
editor={ ClassicEditor }
data={ late }
@ -832,9 +839,9 @@ const DialogFormProyek = ({
/>
</Col>
</Row>
<Row>
<Row style={{ marginTop: "20px"}}>
<Col md={12}>
<Label className="capitalize">Assumtion</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Assumtion</Label>
<CKEditor
editor={ClassicEditor}
data={assumtion}
@ -846,18 +853,18 @@ const DialogFormProyek = ({
/>
</Col>
</Row>
<Row>
<Row style={{ marginTop: "20px"}}>
<Col md={12}>
<Label className="capitalize">Project Checklist</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Project Checklist</Label>
<Row>
<Col md={5}>
<b>Item</b>
<p>Item</p>
</Col>
<Col md={4}>
<b>Availability</b>
<p>Availability</p>
</Col>
<Col md={2}>
<b>Action</b>
<p>Action</p>
</Col>
<Col md={1}>
<Tooltip title="Add row">
@ -877,16 +884,16 @@ const DialogFormProyek = ({
<Divider orientation="left" plain></Divider>
<Row>
<Col md={12}>
<Label className="capitalize">Issues & Obstacles</Label>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Issues & Obstacles</Label>
<Row>
<Col md={5}>
<b>Issu Level</b>
<p>Issue Level</p>
</Col>
<Col md={4}>
<b>Description</b>
<p>Description</p>
</Col>
<Col md={2}>
<b>Action</b>
<p>Action</p>
</Col>
<Col md={1}>
<Tooltip title="Add row">
@ -909,7 +916,7 @@ const DialogFormProyek = ({
<Row>
<Col md={6}>
<FormGroup>
<Label>Phase</Label>
<Label style={{ fontWeight: "bold" }}>Phase</Label>
<Select
value={phaseProject}
defaultValue={phaseProject}
@ -926,7 +933,7 @@ const DialogFormProyek = ({
</Col>
<Col md={6}>
<FormGroup>
<Label>Cost Health</Label>
<Label style={{ fontWeight: "bold" }}>Cost Health</Label>
<Select
value={budgetHealth}
defaultValue={budgetHealth}
@ -954,47 +961,47 @@ const DialogFormProyek = ({
<b>Project Objectives</b>
</Col>
<Col md={9}>
<FormGroup>
<Input
type="textarea"
value={objectives}
onChange={(e) => setObjectives(e.target.value)}
<CKEditor
editor={ClassicEditor}
data={objectives}
config={editorConfig}
onChange={ ( event, editor ) => {
const data = editor.getData();
setObjectives(data);
} }
/>
</FormGroup>
</Col>
</Row>
<Row>
<Row style={{ marginTop: "20px" }}>
<Col md={3}>
<b>Project is considered successful when</b>
</Col>
<Col md={9}>
<FormGroup>
<Input
type="textarea"
value={projectIsConsideredSuccessful}
onChange={(e) =>
setProjectIsConsideredSuccessful(e.target.value)
}
placeholder={`List of indicators`}
rows={5}
<CKEditor
editor={ClassicEditor}
data={projectIsConsideredSuccessful}
config={editorConfig}
onChange={ ( event, editor ) => {
const data = editor.getData();
setProjectIsConsideredSuccessful(data);
} }
/>
</FormGroup>
</Col>
</Row>
<Row>
<Row style={{ marginTop:"20px" }}>
<Col md={3}>
<b>Project Participants</b>
</Col>
<Col md={9}>
<Row>
<Col md={5}>
<b>Title</b>
<p>Title</p>
</Col>
<Col md={4}>
<b>Name</b>
<p>Name</p>
</Col>
<Col md={2}>
<b>Action</b>
<p>Action</p>
</Col>
<Col md={1}>
<Tooltip title="Add row">
@ -1011,35 +1018,36 @@ const DialogFormProyek = ({
<div style={{ marginBottom: 50 }}>{RenderParticipants()}</div>
</Col>
</Row>
<Row>
<Row style={{ marginTop:"20px" }}>
<Col md={3}>
<b>Testing Environment</b>
</Col>
<Col md={9}>
<FormGroup>
<Input
type="textarea"
value={testingEnv}
onChange={(e) => setTestingEnv(e.target.value)}
rows={5}
<CKEditor
editor={ClassicEditor}
data={testingEnv}
config={editorConfig}
onChange={ ( event, editor ) => {
const data = editor.getData();
setTestingEnv(data);
} }
/>
</FormGroup>
</Col>
</Row>
<Row>
<Row style={{ marginTop:"20px" }}>
<Col md={3}>
<b>Milestones</b>
</Col>
<Col md={9}>
<Row>
<Col md={4}>
<b>Status</b>
<p>Status</p>
</Col>
<Col md={4}>
<b>Deadline</b>
<p>Deadline</p>
</Col>
<Col md={3}>
<b>Action</b>
<p>Action</p>
</Col>
<Col md={1}>
<Tooltip title="Add row">
@ -1056,23 +1064,23 @@ const DialogFormProyek = ({
<div style={{ marginBottom: 50 }}>{RenderMilestones()}</div>
</Col>
</Row>
<Row>
<Row style={{ marginTop:"20px" }}>
<Col md={3}>
<b>Potential Risk</b>
</Col>
<Col md={9}>
<Row>
<Col md={3}>
<b>Risk Level</b>
<p>Risk Level</p>
</Col>
<Col md={3}>
<b>Description</b>
<p>Description</p>
</Col>
<Col md={3}>
<b>Prevention</b>
<p>Prevention</p>
</Col>
<Col md={2}>
<b>Action</b>
<p>Action</p>
</Col>
<Col md={1}>
<Tooltip title="Add row">
@ -1089,23 +1097,23 @@ const DialogFormProyek = ({
<div style={{ marginBottom: 50 }}>{RenderRisk()}</div>
</Col>
</Row>
<Row>
<Row style={{ marginTop:"20px" }}>
<Col md={3}>
<b>Approval</b>
</Col>
<Col md={9}>
<Row>
<Col md={3}>
<b>Title</b>
<p>Title</p>
</Col>
<Col md={3}>
<b>Name</b>
<p>Name</p>
</Col>
<Col md={3}>
<b>Date</b>
<p>Date</p>
</Col>
<Col md={2}>
<b>Action</b>
<p>Action</p>
</Col>
<Tooltip title="Add row">
<Col md={1}>

82
src/views/SimproV2/CreatedProyek/ViewProject.js

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState, useRef } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button } from 'reactstrap';
import moment from 'moment';
@ -6,13 +6,18 @@ import 'antd/dist/antd.css';
import _ from 'underscore'
import './style.css'
import { formatThousand, sortBy } from '../../../const/CustomFunc';
import { BASE_OSPRO } from "../../../const/ApiConst";
import { BASE_OSPRO, PROYEK_SEARCH} from "../../../const/ApiConst";
import { Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
import axios from "../../../const/interceptorApi"
import autoTable from "jspdf-autotable";
import jsPDF from "jspdf";
const createMarkup = (element) => {
return {__html: element};
}
const ViewProject = ({ openDialog, closeDialog, toggleDialog, projectCharter, projectParticipant, projectChecklist, projectIssue, projectRisk, projectMilestone, projectApproval, projectManager, projectK3, assignHR, projectImage }) => {
const ViewProject = ({ idTask, openDialog, closeDialog, toggleDialog, projectCharter, projectParticipant, projectChecklist, projectIssue, projectRisk, projectMilestone, projectApproval, projectManager, projectK3, assignHR, projectImage }) => {
const [proyekName, setProyekName] = useState("")
const [description, setDescription] = useState("")
const [shortname, setKodeShortname] = useState("")
@ -41,6 +46,17 @@ const createMarkup = (element) => {
const [K3Search, setDataK3Search] = useState("")
const [HR, setAssignHR] = useState("")
const formatDate = "DD-MM-YYYY";
const reportTemplateRef = useRef(null);
const { t } = useTranslation();
const token = localStorage.getItem("token");
const HEADER = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
useEffect(() => {
if(!openDialog){
setProyekName("")
@ -156,6 +172,20 @@ const createMarkup = (element) => {
}
}, [assignHR]);
const handleExportPdf = async () => {
const doc = new jsPDF({
orientation: 'landscape',
unit: 'px',
format: [1130, 1000]
});
doc.html(reportTemplateRef.current, {
async callback(doc) {
await doc.save('Project Charter');
},
});
};
const RenderParticipant = () => {
if(participants && participants.length > 0){
return (
@ -353,26 +383,17 @@ const createMarkup = (element) => {
marginLeft: '5pt',
marginTop: '2pt',
marginBottom: '2pt',
fontFamily: 'Arial',
fontSize: '10pt',
fontWeight: 'bold',
};
const italicStyle = {
fontStyle: 'italic'
};
const boldStyle = {
fontWeight: 'bold',
fontVariant: 'small-caps',
};
const emptyCellStyle = {
padding: '0',
};
const renderForm = () => {
return (
<div>
<div id="pdf-content">
<table style={tableStyle} className="a">
<tbody>
<tr>
@ -480,12 +501,12 @@ const createMarkup = (element) => {
<tbody>
<tr>
<td bgcolor="#F2F2F2" style={tdStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>2.0 OBJEKTIF PROYEK (TUJUAN)</p>
<p style={ pStyle }>2.0 OBJEKTIF PROYEK (TUJUAN)</p>
</td>
</tr>
<tr>
<td style={tdStyle}>
<p style={italicStyle}>{objectives ?? '-'}</p>
<p style={{ fontStyle: 'italic' }}>{objectives ?? '-'}</p>
</td>
</tr>
</tbody>
@ -495,7 +516,7 @@ const createMarkup = (element) => {
<tbody>
<tr>
<th style={thStyle}>
<p style={{ ...pStyle, ...boldStyle }}>3.0 RUANG LINGKUP PROYEK</p>
<p style={ pStyle }>3.0 RUANG LINGKUP PROYEK</p>
</th>
</tr>
<tr>
@ -512,7 +533,7 @@ const createMarkup = (element) => {
<tbody>
<tr>
<td colSpan="3" style={thStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>4.0 ANGGOTA PROYEK</p>
<p style={ pStyle }>4.0 ANGGOTA PROYEK</p>
</td>
</tr>
<tr>
@ -534,7 +555,7 @@ const createMarkup = (element) => {
<tbody>
<tr>
<th style={thStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>5.0 STRUKTUR ORGANISASI</p>
<p style={ pStyle }>5.0 STRUKTUR ORGANISASI</p>
</th>
</tr>
<tr>
@ -555,7 +576,7 @@ const createMarkup = (element) => {
<tbody>
<tr>
<th colSpan="3" style={thStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>6.0 TARGET UTAMA &amp; MILESTONE PENCAPAIAN</p>
<p style={ pStyle }>6.0 TARGET UTAMA &amp; MILESTONE PENCAPAIAN</p>
</th>
</tr>
<tr>
@ -577,7 +598,7 @@ const createMarkup = (element) => {
<tbody>
<tr>
<td colSpan="2" style={thStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>7.0 ISU &amp; HAMBATAN UTAMA</p>
<p style={ pStyle }>7.0 ISU &amp; HAMBATAN UTAMA</p>
</td>
</tr>
<tr>
@ -591,13 +612,13 @@ const createMarkup = (element) => {
<RenderIssueProject/>
</tbody>
</table>
<p style={{ ...pStyle, fontSize: '10pt', fontStyle: 'italic' }}>*Skala 1 ke 7 (1 = kecil, 7 = besar)</p>
<p style={{ ...pStyle, fontSize: '10pt', fontWeight: 'normal', fontStyle: 'italic' }}>*Skala 1 ke 7 (1 = kecil, 7 = besar)</p>
<p>&nbsp;</p>
<table style={tableStyle} className="a6">
<tbody>
<tr>
<td colSpan="3" style={thStyle}>
<p style={{ ...pStyle, fontVariant: 'small-caps' }}>8.0 RESIKO</p>
<p style={ pStyle }>8.0 RESIKO</p>
</td>
</tr>
<tr>
@ -614,7 +635,7 @@ const createMarkup = (element) => {
<RenderRiskProject/>
</tbody>
</table>
<p style={{ ...pStyle, fontSize: '10pt', fontStyle: 'italic' }}>*Skala 1 ke 7 (1 = kecil, 7 = besar)</p>
<p style={{ ...pStyle, fontSize: '10pt', fontWeight: 'normal', fontStyle: 'italic' }}>*Skala 1 ke 7 (1 = kecil, 7 = besar)</p>
<p>&nbsp;</p>
<table style={tableStyle} className="a7">
<tbody>
@ -719,9 +740,22 @@ const createMarkup = (element) => {
return (
<>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Project</ModalHeader>
<ModalHeader className="capitalize" toggle={closeDialog}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<div>
Project
</div>
<div>
<Tooltip title={t('Export PDF')}>
<Button style={{ marginLeft: "5px" }} onClick={(e) => handleExportPdf()}><i className="fa fa-print"></i></Button>
</Tooltip>
</div>
</div>
</ModalHeader>
<ModalBody>
<div ref={reportTemplateRef}>
{renderForm()}
</div>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={closeDialog}>Close</Button>

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

@ -245,7 +245,9 @@ const CreatedProyek = ({ params, ...props }) => {
.then((res) => res)
.catch((err) => err.response);
if (result && result.data && result.data.code === 200) {
setDataDivisions(result.data.data);
const dataRes = result.data.data;
const filteredData = dataRes.filter(item => item.parent === null);
setDataDivisions(filteredData);
}
};
@ -1882,6 +1884,7 @@ const CreatedProyek = ({ params, ...props }) => {
projectK3={projectK3Search}
assignHR={projectAssignHR}
projectImage={image}
idTask={idTask}
/>
),
[openDialogViewDetail]

2
src/views/SimproV2/Divisi/DialogForm.js

@ -90,7 +90,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">{t('nameDivision')}</Label>
<Label className="capitalize">{t('Parent Division')}</Label>
<Select showSearch
value={parent}
onChange={onChangeParent}

Loading…
Cancel
Save