Browse Source

Merge pull request 'staging upload 23-03-30' (#2) from staging into master

Reviewed-on: ordo/adw-frontend#2
pull/2/head
ibnu 2 years ago
parent
commit
bc8abaca23
  1. 24
      src/views/Dashboard/DashboardBOD.js
  2. 26
      src/views/Dashboard/DashboardProject.js
  3. 1
      src/views/SimproV2/CreatedProyek/DialogFormGantt.js

24
src/views/Dashboard/DashboardBOD.js

@ -11,6 +11,7 @@ import { capitalizeFirstLetter, sortBy } from '../../const/CustomFunc';
import ContentLoader from 'react-content-loader'; import ContentLoader from 'react-content-loader';
import toRupiah from '@develoka/angka-rupiah-js'; import toRupiah from '@develoka/angka-rupiah-js';
import Icon from '@iconify/react'; import Icon from '@iconify/react';
import { HealthByBudget, HealthBySchedule } from './Components';
const DashboardBOD = () => { const DashboardBOD = () => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
@ -301,6 +302,23 @@ const DashboardBOD = () => {
if (result.data.data.length > 0) { if (result.data.data.length > 0) {
let tableData = []; let tableData = [];
result.data.data.map((item, idx) => { result.data.data.map((item, idx) => {
let statusHealthBySchedule = 'on-schedule';
let planningProgress = 0;
let actualProgress = 0;
let selisihProgress = 0;
// planningProgress = item.scurve[0].data.percentagePlan[item.scurve[0].data.percentagePlan.length - 1]
// actualProgress = item.scurve[0].data.percentageReal[item.scurve[0].data.percentageReal.length - 1]
selisihProgress = planningProgress - actualProgress
if (selisihProgress > 0 && selisihProgress <= 5) {
statusHealthBySchedule = 'warning'
}
else if (selisihProgress > 5) {
statusHealthBySchedule = 'danger'
}
let outstanding_balance = 0; let outstanding_balance = 0;
if (item.invoice) { if (item.invoice) {
outstanding_balance = item.invoice.invoiced - item.invoice.paid; outstanding_balance = item.invoice.invoiced - item.invoice.paid;
@ -327,7 +345,8 @@ const DashboardBOD = () => {
"invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-', "invoice": item.invoice?.invoiced ? toRupiah(item.invoice.invoiced) : '-',
"cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-', "cash_in": item.invoice?.paid ? toRupiah(item.invoice.paid) : '-',
"outstanding_balance": outstanding_balance, "outstanding_balance": outstanding_balance,
"progress": `${item.scurve?.progress ? item.scurve.progress : 0}%` "budget": <HealthByBudget status {...item.budget_health} />,
"schedule": <HealthBySchedule status={statusHealthBySchedule} />
}) })
}); });
console.log('tableData', tableData); console.log('tableData', tableData);
@ -354,7 +373,8 @@ const DashboardBOD = () => {
{ title: "Invoice", key: "invoice" }, { title: "Invoice", key: "invoice" },
{ title: "Cash In", key: "cash_in" }, { title: "Cash In", key: "cash_in" },
{ title: "Outstanding Balance", key: "outstanding_balance" }, { title: "Outstanding Balance", key: "outstanding_balance" },
{ title: "Progress", key: "progress" }, { title: "Budget", key: "budget" },
{ title: "Schedule", key: "schedule" },
]} ]}
tableData={DATA_DETAIL_EXPENDITURE} tableData={DATA_DETAIL_EXPENDITURE}
closeModal={() => setOpenDetailedView(false)} closeModal={() => setOpenDetailedView(false)}

26
src/views/Dashboard/DashboardProject.js

@ -73,6 +73,7 @@ const DashboardProject = () => {
const [isSendingComment, setIsSendingComment] = useState(false); const [isSendingComment, setIsSendingComment] = useState(false);
const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false); const [isReadyProjectDetail, setIsReadyProjectDetail] = useState(false);
const [isReadySCurve, setIsReadySCurve] = useState(false); const [isReadySCurve, setIsReadySCurve] = useState(false);
const [isReadyGantt, setIsReadyGantt] = useState(false);
const [isReadyOverdueActivities, setIsReadyOverdueActivities] = useState(false); const [isReadyOverdueActivities, setIsReadyOverdueActivities] = useState(false);
const [isReadyIntegrationInvoice, setIsReadyIntegrationInvoice] = useState(false); const [isReadyIntegrationInvoice, setIsReadyIntegrationInvoice] = useState(false);
const [isReadyReportDistribution, setIsReadyReportDistribution] = useState(false); const [isReadyReportDistribution, setIsReadyReportDistribution] = useState(false);
@ -84,6 +85,7 @@ const DashboardProject = () => {
const [assignedHr, setAssignedHr] = useState([]); const [assignedHr, setAssignedHr] = useState([]);
const [assignedHrCount, setAssignedHrCount] = useState(0); const [assignedHrCount, setAssignedHrCount] = useState(0);
const [actualHrCount, setActualHrCount] = useState(0); const [actualHrCount, setActualHrCount] = useState(0);
const [dataGantt, setDataGantt] = useState({});
let history = useHistory(); let history = useHistory();
@ -93,6 +95,7 @@ const DashboardProject = () => {
getOverdueActivities() getOverdueActivities()
getReportDistribution() getReportDistribution()
getComments() getComments()
getGantt()
return () => { return () => {
console.log('unmount RenderMap'); console.log('unmount RenderMap');
} }
@ -138,6 +141,19 @@ const DashboardProject = () => {
} }
} }
const getGantt = async () => {
setIsReadyGantt(false)
const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}`
try {
const response = await axios.get(url, HEADER)
setDataGantt(response)
setIsReadyGantt(true)
} catch (error) {
console.error('Failed to get gantt data:', error)
setIsReadyGantt(true)
}
}
const getAssignedHR = async () => { const getAssignedHR = async () => {
const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}` const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`
try { try {
@ -648,8 +664,8 @@ const DashboardProject = () => {
</Col> </Col>
<Col span={7} style={{ fontSize: 11, fontWeight: 'bold' }}><i className="fa fa-calendar" style={{ marginRight: 8 }}></i>Add Cost to Complete</Col> <Col span={7} style={{ fontSize: 11, fontWeight: 'bold' }}><i className="fa fa-calendar" style={{ marginRight: 8 }}></i>Add Cost to Complete</Col>
<Col span={5} style={{ fontSize: 11 }}> <Col span={5} style={{ fontSize: 11 }}>
{isReadySCurve ? {isReadyGantt ?
addCostToComplete ? renderFormatRupiah(addCostToComplete, 'Rp.') : '-' dataGantt.data.data.cost_to_complete ? renderFormatRupiah(dataGantt.data.data.cost_to_complete.toString(), 'Rp.') : '-'
: <SingleTextLoader width={100} height={10} /> : <SingleTextLoader width={100} height={10} />
} }
</Col> </Col>
@ -698,6 +714,12 @@ const DashboardProject = () => {
} }
</Col> </Col>
<Col span={7} style={{ fontSize: 11, fontWeight: 'bold' }}><i className="fa fa-calendar" style={{ marginRight: 8 }}></i>Committed Cost</Col> <Col span={7} style={{ fontSize: 11, fontWeight: 'bold' }}><i className="fa fa-calendar" style={{ marginRight: 8 }}></i>Committed Cost</Col>
<Col span={5} style={{ fontSize: 11 }}>
{isReadyGantt ?
dataGantt.data.data.committed_cost ? renderFormatRupiah(dataGantt.data.data.committed_cost.toString(), 'Rp.') : '-'
: <SingleTextLoader width={100} height={10} />
}
</Col>
</Row> </Row>
</div> </div>
</div> </div>

1
src/views/SimproV2/CreatedProyek/DialogFormGantt.js

@ -23,7 +23,6 @@ const DialogFormGantt = ({ openDialog, closeDialog, toggleDialog, idTask }) => {
setId(0) setId(0)
setName("") setName("")
setDesctription("") setDesctription("")
setCalculationType("")
} }
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save