Browse Source

Merge pull request 'staging' (#11) from staging into master

Reviewed-on: #11
master
farhantock 2 months ago
parent
commit
fc4c967a57
  1. 59
      src/views/Dashboard/DashboardBOD.js
  2. 21
      src/views/Dashboard/DashboardProject.js
  3. 4
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  4. 6
      src/views/SimproV2/CreatedProyek/ViewProject.js
  5. 11
      src/views/SimproV2/CreatedProyek/index.js

59
src/views/Dashboard/DashboardBOD.js

@ -61,6 +61,7 @@ const DashboardBOD = (props) => {
const [READY_TABLE_DETAIL_EXPENDITURE, SET_READY_TABLE_DETAIL_EXPENDITURE] = useState(false); const [READY_TABLE_DETAIL_EXPENDITURE, SET_READY_TABLE_DETAIL_EXPENDITURE] = useState(false);
const [DATA_DETAIL_EXPENDITURE, SET_DATA_DETAIL_EXPENDITURE] = useState([]); const [DATA_DETAIL_EXPENDITURE, SET_DATA_DETAIL_EXPENDITURE] = useState([]);
useEffect(() => { useEffect(() => {
actualProgressProject();
getCompanyCashFlow(); // expenditure getCompanyCashFlow(); // expenditure
getCompanyExpenditureColor(); // expenditure Color getCompanyExpenditureColor(); // expenditure Color
getCompanyFinancialHealthColor(); // financial health Color getCompanyFinancialHealthColor(); // financial health Color
@ -111,6 +112,11 @@ const DashboardBOD = (props) => {
SET_PROJECT_EXPENDITURE_COLOR(result.data.data) SET_PROJECT_EXPENDITURE_COLOR(result.data.data)
} }
const actualProgressProject = async () => {
const URL = `${BASE_OSPRO}/api/project/actual-progress-project-command`;
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
}
const getCompanyFinancialHealthColor = async () => { const getCompanyFinancialHealthColor = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
@ -437,20 +443,11 @@ const DashboardBOD = (props) => {
<div style={{ color: '#888888', fontSize: 12 }}>Total Project Expenditure from on-going project.</div> <div style={{ color: '#888888', fontSize: 12 }}>Total Project Expenditure from on-going project.</div>
</div> </div>
{PROJECT_EXPENDITURE ? {PROJECT_EXPENDITURE ?
<>
<div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }} onClick={handleGetDetailExpenditure}> <div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }} onClick={handleGetDetailExpenditure}>
<div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}> <div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>
Detailed View Detailed View
</div> </div>
</div> </div>
{/* <div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Link to="/dashboard-perproject" style={{ textDecoration: 'none' }}>
<div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>
All Dashboard
</div>
</Link>
</div> */}
</>
: :
<div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>Detailed View</div> <div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>Detailed View</div>
@ -475,12 +472,7 @@ const DashboardBOD = (props) => {
y: { y: {
ticks: { ticks: {
autoSkip: false, autoSkip: false,
stepSize: 2, stepSize: 2
// callback: function (value) {
// if (value === 0 || value === null || value === undefined) {
// return '';
// }
// }
} }
} }
}, },
@ -501,38 +493,41 @@ const DashboardBOD = (props) => {
data={{ data={{
labels: [ labels: [
`Target Pendapatan ${moment().format('YYYY')}`, `Target Pendapatan ${moment().format('YYYY')}`,
'Realisasi Pendapatan', 'Income Year',
'Realisasi Cash In', 'Total Nilai Proyek',
'Anggaran Biaya', // 'Anggaran Biaya',
'Realisasi Anggaran Biaya', // 'Realisasi Anggaran Biaya',
'Laba' // 'Laba'
], ],
datasets: [ datasets: [
{ {
label: '', label: '',
data: [ data: [
PROJECT_EXPENDITURE?.total_budget || 0, // PROJECT_EXPENDITURE?.total_budget || 0,
PROJECT_EXPENDITURE?.total_expenditure || 0, // PROJECT_EXPENDITURE?.total_expenditure || 0,
PROJECT_EXPENDITURE?.total_invoice ? Math.floor(PROJECT_EXPENDITURE.total_invoice) : 0, // PROJECT_EXPENDITURE?.total_invoice ? Math.floor(PROJECT_EXPENDITURE.total_invoice) : 0,
PROJECT_EXPENDITURE?.total_paid_invoice || 0, // PROJECT_EXPENDITURE?.total_paid_invoice || 0,
PROJECT_EXPENDITURE?.total_paid_invoice || 0, // PROJECT_EXPENDITURE?.total_paid_invoice || 0,
PROJECT_EXPENDITURE?.total_paid_invoice || 0 // PROJECT_EXPENDITURE?.total_paid_invoice || 0
98000000000,
PROJECT_EXPENDITURE?.total_income_year || 0,
PROJECT_EXPENDITURE?.total_value_proyek || 0
], ],
borderColor: [ borderColor: [
PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8', PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8',
PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e', PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e',
PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16', PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747', // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000', // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37' // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
], ],
backgroundColor: [ backgroundColor: [
PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8', PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8',
PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e', PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e',
PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16', PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747', // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000', // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37' // PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
], ],
borderRadius: 5, borderRadius: 5,
borderSkipped: false borderSkipped: false

21
src/views/Dashboard/DashboardProject.js

@ -152,8 +152,7 @@ const DashboardProject = (props) => {
async function fetchData() { async function fetchData() {
await Promise.all([ await Promise.all([
getManpower(), getManpower(),
getAssignedHR(), getAssignedHR()
...(assignedHr.length > 0 ? [getActualHR()] : []),
]); ]);
} }
fetchData(); fetchData();
@ -219,9 +218,13 @@ const DashboardProject = (props) => {
today.isBetween(moment(item.start_date), moment(item.end_date)) today.isBetween(moment(item.start_date), moment(item.end_date))
) )
.map((item) => item.user_id); .map((item) => item.user_id);
setAssignedHrCount(assignedList.length); const uniqueUserIds = new Set(assignedList);
setAssignedHr(assignedList); setAssignedHrCount(uniqueUserIds.size);
if (assignedList.length > 0) {
getActualHR(assignedList)
}
} catch (error) { } catch (error) {
console.error("Failed to get assigned HR:", error);
} }
}; };
@ -439,7 +442,7 @@ const DashboardProject = (props) => {
result.data.data[0].data?.percentageReal[ result.data.data[0].data?.percentageReal[
result.data.data[0].data?.percentageReal.length - 1 result.data.data[0].data?.percentageReal.length - 1
]; ];
setActualProgress(actualProgress); setActualProgress(+(Math.round(actualProgress + "e+2") + "e-2"));
} }
selisihProgress = planningProgress - actualProgress; selisihProgress = planningProgress - actualProgress;
if (selisihProgress > 0 && selisihProgress <= 20) { if (selisihProgress > 0 && selisihProgress <= 20) {
@ -506,10 +509,10 @@ const DashboardProject = (props) => {
return; return;
} }
if (result.status !== 200) { if (result.status !== 200) {
NotificationManager.error( // NotificationManager.error(
`Get integration invoice failed, ${result.data.message}`, // `Get integration invoice failed, ${result.data.message}`,
"Failed" // "Failed"
); // );
setIsReadyIntegrationInvoice(true); setIsReadyIntegrationInvoice(true);
return; return;
} else if (result.status == 200 && result.data.data) { } else if (result.status == 200 && result.data.data) {

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

@ -765,7 +765,7 @@ const DialogFormProyek = ({
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}> <Label className="capitalize" style={{ fontWeight: "bold" }}>
Nilai Kontrak<span style={{ color: "red" }}>*</span> Anggaran Biaya<span style={{ color: "red" }}>*</span>
</Label> </Label>
<Row> <Row>
<Col md={4}> <Col md={4}>
@ -807,7 +807,7 @@ const DialogFormProyek = ({
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}> <Label className="capitalize" style={{ fontWeight: "bold" }}>
Anggaran Biaya<span style={{ color: "red" }}>*</span> Nilai Kontrak<span style={{ color: "red" }}>*</span>
</Label> </Label>
<Input <Input

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

@ -433,7 +433,7 @@ const ViewProject = ({ idTask, openDialog, closeDialog, toggleDialog, projectCha
const renderForm = () => { const renderForm = () => {
return ( return (
<div id="pdf-content" style={paddingTable}> <div id="pdf-content" style={paddingTable}>
<h3>Indentitas Proyek</h3> <h3>Identitas Proyek</h3>
<table style={tableStyle} className="a"> <table style={tableStyle} className="a">
<tbody> <tbody>
<tr> <tr>
@ -494,7 +494,7 @@ const ViewProject = ({ idTask, openDialog, closeDialog, toggleDialog, projectCha
<p style={pStyle}>Nilai Kontrak</p> <p style={pStyle}>Nilai Kontrak</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p>&nbsp;{valueProyek ?? '-'}</p> <p style={{ ...pStyle, fontWeight: 'normal' }}>{currency}. {formatThousand(budget)}</p>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -510,7 +510,7 @@ const ViewProject = ({ idTask, openDialog, closeDialog, toggleDialog, projectCha
<p style={pStyle}>Anggaran Biaya</p> <p style={pStyle}>Anggaran Biaya</p>
</td> </td>
<td colSpan="2" style={tdStyle}> <td colSpan="2" style={tdStyle}>
<p style={{ ...pStyle, fontWeight: 'normal' }}>{currency}. {formatThousand(budget)}</p> <p>&nbsp;{valueProyek ?? '-'}</p>
</td> </td>
</tr> </tr>
<tr> <tr>

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

@ -378,6 +378,7 @@ const CreatedProyek = ({ params, ...props }) => {
"value_proyek", "value_proyek",
"income_year", "income_year",
"deleted_at", "deleted_at",
"persentase_progress",
"deleted_by_id" "deleted_by_id"
], ],
joins: [ joins: [
@ -395,10 +396,11 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["nama"], ascending: true }, orders: { columns: ["nama"], ascending: true },
paging: { start: start, length: rowsPerPage }, paging: { start: start, length: rowsPerPage },
}; };
if (all_project === 'false' || all_project === 'null') {
payload.columns.push( payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
); );
}
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)
@ -1526,7 +1528,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">Indentitas Proyek</span> <span className="menu-text">Identitas 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">
@ -1758,6 +1760,11 @@ const CreatedProyek = ({ params, ...props }) => {
: `${formatThousand(text)}`; : `${formatThousand(text)}`;
}, },
}, },
{
title: "Total Progress (%)", dataIndex: "persentase_progress", key: "persentase_progress", render: (text, record) => {
return text ? +(Math.round(text + "e+2") + "e-2") + '%' : 0 + '%'
}
},
{ {
title: "Project Type", title: "Project Type",
dataIndex: "color_progress", dataIndex: "color_progress",

Loading…
Cancel
Save