Browse Source

HR

pull/1/head
khaidralirahman 10 months ago
parent
commit
db8397684a
  1. 36
      src/views/SimproV2/ResourceWorker/index.js

36
src/views/SimproV2/ResourceWorker/index.js

@ -8,11 +8,19 @@ import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DownloadOutlined } from '@ant-design/icons'; import { DownloadOutlined } from '@ant-design/icons';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { useLocation } from "react-router-dom";
import { Pagination, Table, Button, Tooltip, Spin } from 'antd'; import { Pagination, Table, Button, Tooltip, Spin } from 'antd';
import { import {
USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE, ROLE_SEARCH, DIVISI_SEARCH, USER_SHIFT_ADD, COMPANY_MANAGEMENT_LIST USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE, ROLE_SEARCH, DIVISI_SEARCH, USER_SHIFT_ADD, COMPANY_MANAGEMENT_LIST
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
const ResourceWorker = ({ params, ...props }) => { const ResourceWorker = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '';
@ -28,7 +36,7 @@ const ResourceWorker = ({ params, ...props }) => {
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
} }
const location = useLocation();
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -547,14 +555,29 @@ const ResourceWorker = ({ params, ...props }) => {
key: 'x', key: 'x',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={t('edit')}> <Tooltip title={t('edit')}>
<Button size="small" type="link" style={{ color: 'orange' }} onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button> {
checkActMenup(location.pathname, 'update') ?
<i size="small" type="link" style={{ color: 'green', marginRight: '5px', cursor: "pointer" }} onClick={() => handleEdit(text)} className="fa fa-edit"></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
<Button size="small" type="link" style={{ color: 'red' }} onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> {
checkActMenup(location.pathname, 'delete') ?
<i size="small" type="link" style={{ color: 'red', marginRight: '5px', cursor: "pointer" }} onClick={() => handleDelete(text.id)} className="fa fa-trash"></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title="Set User"> <Tooltip title="Set User">
<Button size="small" type="link" style={{ color: 'lightblue' }} onClick={() => handleSetWorker(text)}><i className="fa fa-key"></i></Button> {
checkActMenup(location.pathname, 'update') ?
<i Button size="small" type="link" style={{ color: 'blue', marginRight: '4px', cursor: "pointer" }} onClick={() => handleSetWorker(text)} className="fa fa-key"></i>
:
null
}
</Tooltip> </Tooltip>
</>, </>,
}, },
@ -638,7 +661,12 @@ const ResourceWorker = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('hradd')}> <Tooltip title={t('hradd')}>
{
checkActMenup(location.pathname, 'create') ?
<Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button> <Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('exportExcel')}> <Tooltip title={t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>

Loading…
Cancel
Save