Browse Source

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

Reviewed-on: ordo/adw-frontend#89
pull/2/head
ibnu 1 year ago
parent
commit
ab4a82cbac
  1. 1
      src/views/Report/k3/index.js
  2. 9
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  3. 32
      src/views/SimproV2/CreatedProyek/FormAsignHr.js
  4. 49
      src/views/SimproV2/CreatedProyek/index.js

1
src/views/Report/k3/index.js

@ -103,6 +103,7 @@ class index extends Component {
getAllProyek = async () => {
const payload = {
"select": ["id", "nama"],
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "nama", "logic_operator": "ilike", "value": "", "operator": "AND" }

9
src/views/SimproV2/CreatedProyek/DialogGantt.js

@ -31,18 +31,13 @@ const DialogGantt = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName
const [humanResource, setHumanResource] = useState([])
useEffect(() => {
if (hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
if (openDialog && hierarchyId > 0 || idTask > 0 && !openDialogHierarchy) {
getdataGantt();
}
}, [hierarchyId, idTask, openDialog])
useEffect(() => {
if (!openDialog) {
setDataGantt([]);
} else {
}
}, [openDialog])
}, [hierarchyId, idTask, openDialog])
const getDataHumanResource = async () => {
const result = await axios

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

@ -22,6 +22,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
const [accrue, setAccrue] = useState("")
const [baseCalender, setBaseCalender] = useState("")
const [listHr, setListHr] = useState([])
const [isCustomer, setIsCustomer] = useState(false)
const handleClearData = () => {
setUser(null)
@ -29,6 +30,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
setProjectRole(null)
setGroupR("")
setMaxUsed("")
setIsCustomer(false)
setStandartRate("")
setUomStandartRate(null)
setOverTimeRate("")
@ -67,6 +69,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
setProjectRole(dataEdit.project_role)
setGroupR(dataEdit.group_r)
setMaxUsed(dataEdit.max_used ? formatNumber(dataEdit.max_used.toString()) : '')
setIsCustomer(dataEdit.is_customer)
setStandartRate(dataEdit.standart_rate ? formatNumber(dataEdit.standart_rate.toString()) : '')
setUomStandartRate(dataEdit.uom_standart_rate)
setOverTimeRate(dataEdit.overtime_rate ? formatNumber(dataEdit.overtime_rate.toString()) : '')
@ -91,6 +94,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
proyek_id: idTask,
user_id:user,
project_role:projectRole,
is_customer: isCustomer,
max_used:maxUsed.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""),
uom_standart_rate:uomStandartRate,
@ -104,6 +108,7 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
proyek_id: idTask,
user_id:user,
project_role:projectRole,
is_customer: isCustomer,
max_used:maxUsed.replaceAll(".", ""),
standart_rate:standartRate.replaceAll(".", ""),
uom_standart_rate:uomStandartRate,
@ -157,6 +162,33 @@ const FormAsignHr = ({ openDialog, closeDialog, toggleDialog, idTask, dataEdit,
</FormGroup>
</Col>
</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"}}>
<FormGroup style={{flexBasis:"49%"}}>
<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 () => {
let start = 0;
@ -1107,6 +1124,16 @@ const CreatedProyek = ({ params, ...props }) => {
dataIndex: "",
key: "x",
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
placement="rightTop"
@ -1420,14 +1447,20 @@ const CreatedProyek = ({ params, ...props }) => {
/>
</Col>
<Col>
<Tooltip title="Add Project">
<Button
style={{ background: "#4caf50", color: "#fff" }}
onClick={() => handleOpenDialogProyek(0)}
>
<i className="fa fa-plus"></i>
</Button>
</Tooltip>
{
role_id == "44" // role kustomer
?
null
:
<Tooltip title="Add Project">
<Button
style={{ background: "#4caf50", color: "#fff" }}
onClick={() => handleOpenDialogProyek(0)}
>
<i className="fa fa-plus"></i>
</Button>
</Tooltip>
}
<Tooltip title="Export Excel">
<Popover
// content={<a onClick={hide}>Close</a>}

Loading…
Cancel
Save