Browse Source

Dashboard customer

pull/2/head
Wahyu Ramadhan 1 year ago
parent
commit
d1b3250741
  1. 32
      src/views/SimproV2/CreatedProyek/FormAsignHr.js
  2. 49
      src/views/SimproV2/CreatedProyek/index.js

32
src/views/SimproV2/CreatedProyek/FormAsignHr.js

@ -22,6 +22,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
const [accrue, setAccrue] = useState("") const [accrue, setAccrue] = useState("")
const [baseCalender, setBaseCalender] = useState("") const [baseCalender, setBaseCalender] = useState("")
const [listHr, setListHr] = useState([]) const [listHr, setListHr] = useState([])
const [isCustomer, setIsCustomer] = useState(false)
const handleClearData = () => { const handleClearData = () => {
setUser(null) setUser(null)
@ -29,6 +30,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
setProjectRole(null) setProjectRole(null)
setGroupR("") setGroupR("")
setMaxUsed("") setMaxUsed("")
setIsCustomer(false)
setStandartRate("") setStandartRate("")
setUomStandartRate(null) setUomStandartRate(null)
setOverTimeRate("") setOverTimeRate("")
@ -67,6 +69,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
setProjectRole(dataEdit.project_role) setProjectRole(dataEdit.project_role)
setGroupR(dataEdit.group_r) setGroupR(dataEdit.group_r)
setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '') setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '')
setIsCustomer(dataEdit.is_customer)
setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '') setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '')
setUomStandartRate(dataEdit.uom_standart_rate) setUomStandartRate(dataEdit.uom_standart_rate)
setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '') setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '')
@ -91,6 +94,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
proyek_id: idTask, proyek_id: idTask,
user_id:user, user_id:user,
project_role:projectRole, project_role:projectRole,
is_customer: isCustomer,
max_used:maxUsed.replaceAll(".", ""), max_used:maxUsed.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""), standart_rate:standartRate.replaceAll(".", ""),
uom_standart_rate:uomStandartRate, uom_standart_rate:uomStandartRate,
@ -104,6 +108,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
proyek_id: idTask, proyek_id: idTask,
user_id:user, user_id:user,
project_role:projectRole, project_role:projectRole,
is_customer: isCustomer,
max_used:maxUsed.replaceAll(".", ""), max_used:maxUsed.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""), standart_rate:standartRate.replaceAll(".", ""),
uom_standart_rate:uomStandartRate, uom_standart_rate:uomStandartRate,
@ -157,6 +162,33 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
<Row>
<Col>
<FormGroup>
<Label>Customer</Label>
<div>
<Select
value={isCustomer}
defaultValue={false}
style={{
width: 235,
}}
onChange={(val) => setIsCustomer(val)}
options={[
{
value: true,
label: 'Yes',
},
{
value: false,
label: 'No',
}
]}
/>
</div>
</FormGroup>
</Col>
</Row>
<div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}> <div style={{widht:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}>
<FormGroup style={{flexBasis:"49%"}}> <FormGroup style={{flexBasis:"49%"}}>
<Label>Standart Rate</Label> <Label>Standart Rate</Label>

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

@ -229,6 +229,23 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const handleDashboard = async (text) => {
const URL = `${BASE_OSPRO}/api/project/detail/${text.id}`;
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
if (!result) {
NotificationManager.error(`Could not connect to internet.`, "Failed");
return;
}
if (result.status !== 200) {
NotificationManager.error(`Get project detail failed, ${result.data.message}`, "Failed");
return;
}
else if (result.status == 200 && result.data.data) {
history.push(`dashboard-customer/${text.id}/${result.data.gantt.last_gantt_id}`);
}
}
const getDataProyek = async () => { const getDataProyek = async () => {
let start = 0; let start = 0;
@ -1107,6 +1124,16 @@ const CreatedProyek = ({ params, ...props }) => {
dataIndex: "", dataIndex: "",
key: "x", key: "x",
render: (text, record) => ( render: (text, record) => (
role_id == "44"
?
<>
<Tooltip title="Dashboard Project">
<Button size="small" onClick={() => handleDashboard(text)} type="link" style={{ color: "green" }}>
<i className="fa fa-line-chart"></i>
</Button>
</Tooltip>
</>
:
<> <>
<Popover <Popover
placement="rightTop" placement="rightTop"
@ -1420,14 +1447,20 @@ const CreatedProyek = ({ params, ...props }) => {
/> />
</Col> </Col>
<Col> <Col>
<Tooltip title="Add Project"> {
<Button role_id == "44" // role kustomer
style={{ background: "#4caf50", color: "#fff" }} ?
onClick={() => handleOpenDialogProyek(0)} null
> :
<i className="fa fa-plus"></i> <Tooltip title="Add Project">
</Button> <Button
</Tooltip> style={{ background: "#4caf50", color: "#fff" }}
onClick={() => handleOpenDialogProyek(0)}
>
<i className="fa fa-plus"></i>
</Button>
</Tooltip>
}
<Tooltip title="Export Excel"> <Tooltip title="Export Excel">
<Popover <Popover
// content={<a onClick={hide}>Close</a>} // content={<a onClick={hide}>Close</a>}

Loading…
Cancel
Save