staging #11

Merged
farhantock merged 10 commits from staging into master 2 months ago
  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 [DATA_DETAIL_EXPENDITURE, SET_DATA_DETAIL_EXPENDITURE] = useState([]);
useEffect(() => {
actualProgressProject();
getCompanyCashFlow(); // expenditure
getCompanyExpenditureColor(); // expenditure Color
getCompanyFinancialHealthColor(); // financial health Color
@ -111,6 +112,11 @@ const DashboardBOD = (props) => {
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 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)
@ -437,20 +443,11 @@ const DashboardBOD = (props) => {
<div style={{ color: '#888888', fontSize: 12 }}>Total Project Expenditure from on-going project.</div>
</div>
{PROJECT_EXPENDITURE ?
<>
<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' }}>
Detailed View
</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={{ 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: {
ticks: {
autoSkip: false,
stepSize: 2,
// callback: function (value) {
// if (value === 0 || value === null || value === undefined) {
// return '';
// }
// }
stepSize: 2
}
}
},
@ -501,38 +493,41 @@ const DashboardBOD = (props) => {
data={{
labels: [
`Target Pendapatan ${moment().format('YYYY')}`,
'Realisasi Pendapatan',
'Realisasi Cash In',
'Anggaran Biaya',
'Realisasi Anggaran Biaya',
'Laba'
'Income Year',
'Total Nilai Proyek',
// 'Anggaran Biaya',
// 'Realisasi Anggaran Biaya',
// 'Laba'
],
datasets: [
{
label: '',
data: [
PROJECT_EXPENDITURE?.total_budget || 0,
PROJECT_EXPENDITURE?.total_expenditure || 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_budget || 0,
// PROJECT_EXPENDITURE?.total_expenditure || 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
98000000000,
PROJECT_EXPENDITURE?.total_income_year || 0,
PROJECT_EXPENDITURE?.total_value_proyek || 0
],
borderColor: [
PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8',
PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e',
PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
],
backgroundColor: [
PROJECT_EXPENDITURE_COLOR?.total_budget || '#480ca8',
PROJECT_EXPENDITURE_COLOR?.total_expenditure || '#b5179e',
PROJECT_EXPENDITURE_COLOR?.total_invoice || '#a26a16',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#4c4747',
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#e00000',
// PROJECT_EXPENDITURE_COLOR?.total_paid_invoice || '#033a37'
],
borderRadius: 5,
borderSkipped: false

21
src/views/Dashboard/DashboardProject.js

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

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

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

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

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

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

@ -378,6 +378,7 @@ const CreatedProyek = ({ params, ...props }) => {
"value_proyek",
"income_year",
"deleted_at",
"persentase_progress",
"deleted_by_id"
],
joins: [
@ -395,10 +396,11 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["nama"], ascending: true },
paging: { start: start, length: rowsPerPage },
};
if (all_project === 'false' || all_project === 'null') {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
}
const result = await axios
.post(PROYEK_SEARCH, payload, HEADER)
@ -1526,7 +1528,7 @@ const CreatedProyek = ({ params, ...props }) => {
<span className="menu-icon">
<i className="fa fa-eye"></i>
</span>
<span className="menu-text">Indentitas Proyek</span>
<span className="menu-text">Identitas Proyek</span>
</div>
<div className="menu-list" onClick={() => handleOpenDokumen(text)}>
<span className="menu-icon">
@ -1758,6 +1760,11 @@ const CreatedProyek = ({ params, ...props }) => {
: `${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",
dataIndex: "color_progress",

Loading…
Cancel
Save