Browse Source

Merge pull request 'Upload 2024-03-06' (#69) from staging into master

Reviewed-on: ibnu/generic-ospro-frontend#69
pull/1/head
farhantock 10 months ago
parent
commit
690b2b8d29
  1. 40
      src/const/CustomFunc.js
  2. 2
      src/routes.js
  3. 296
      src/views/Dashboard/DashboardDyna.js
  4. 27
      src/views/Master/MasterRoles/index.js
  5. 13
      src/views/Master/MenuCompany/index.js
  6. 28
      src/views/Master/ProjectPhase/index.js
  7. 21
      src/views/Master/RoleProject/index.js
  8. 24
      src/views/SimproV2/ChecklistK3/index.js
  9. 29
      src/views/SimproV2/CreatedProyek/index.js
  10. 31
      src/views/SimproV2/Divisi/index.js
  11. 22
      src/views/SimproV2/ProjectType/index.js
  12. 36
      src/views/SimproV2/ResourceWorker/index.js
  13. 25
      src/views/SimproV2/Satuan/index.js
  14. 14
      src/views/SimproV2/Settings/DialogForm.js

40
src/const/CustomFunc.js

@ -164,6 +164,46 @@ export const QUERY_BUILDER_FIELD_SALES =
}, },
} }
export const checkActMenup = (menuPath, actProp) => {
let foundObj;
let entireObj = JSON.parse(localStorage.getItem("menu_login"));
JSON.stringify(entireObj, (_, nestedValue) => {
if (nestedValue && nestedValue.url === menuPath) {
foundObj = nestedValue;
}
return nestedValue;
});
let output = false;
let actValue = actProp.trim().toLowerCase()
switch (actValue) {
case "create":
if (foundObj[actValue] === true) {
output = true;
} else {
output = false;
}
case "read":
if (foundObj[actValue] === true) {
output = true;
}
case "update":
if (foundObj[actValue] === true) {
output = true;
}
case "delete":
if (foundObj[actValue] === true) {
output = true;
}
// default:
// output = false
}
return output;
// return foundObj[actProp];
};
export const QUERY_BUILDER_FIELD_CUSTOMER = export const QUERY_BUILDER_FIELD_CUSTOMER =
{ {
"properties->name": { "properties->name": {

2
src/routes.js

@ -50,6 +50,7 @@ const UserShift = React.lazy(() => import('./views/SimproV2/UserShift'));
const Kanban = React.lazy(() => import('./views/SimproV2/Kanban')); const Kanban = React.lazy(() => import('./views/SimproV2/Kanban'));
// const DashboardProject = React.lazy(() => import('./views/DashboardProject')); // const DashboardProject = React.lazy(() => import('./views/DashboardProject'));
const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD')); const DashboardBOD = React.lazy(() => import('./views/Dashboard/DashboardBOD'));
const DashboardDyna = React.lazy(() => import('./views/Dashboard/DashboardDyna'));
const DashboardDND = React.lazy(() => import('./components/wj/App')) const DashboardDND = React.lazy(() => import('./components/wj/App'))
const DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCustomer')); const DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCustomer'));
const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject')); const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject'));
@ -63,6 +64,7 @@ const SalesContact = React.lazy(() => import('./views/SimproV2/SalesContact'))
const routes = [ const routes = [
{ path: '/', exact: true, name: 'Home' }, { path: '/', exact: true, name: 'Home' },
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD }, { path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ path: '/dashboard-dyna', name: 'DashboardBOD', component: DashboardDyna },
{ path: '/dashboard-dnd', name: 'DashboardBOD', component: DashboardDND }, { path: '/dashboard-dnd', name: 'DashboardBOD', component: DashboardDND },
{ path: '/dashboard-customer/:PROJECT_ID/:GANTT_ID/:SCURVE', name: 'DashboardCustomer', component: DashboardCustomer }, { path: '/dashboard-customer/:PROJECT_ID/:GANTT_ID/:SCURVE', name: 'DashboardCustomer', component: DashboardCustomer },
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:Header', exact: true, name: 'Dashboard Project', component: DashboardProject }, { path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:Header', exact: true, name: 'Dashboard Project', component: DashboardProject },

296
src/views/Dashboard/DashboardDyna.js

@ -0,0 +1,296 @@
import React, { useState } from 'react';
import { Row, Col, Button, Modal } from 'antd';
import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { Widgets } from 'react-awesome-query-builder';
const DashboardDyna = () => {
const [templates, setTemplates] = useState([]);
const [widgets, setWidgets] = useState([]);
const [templateColSpan, setTemplateColSpan] = useState(5);
const [widgetColSpan, setWidgetColSpan] = useState(5);
const [dashboardColSpan, setDashboardColSpan] = useState(19);
const [isModalOpen, setIsModalOpen] = useState(false);
const [templateIndex, setTemplateIndex] = useState(0);
const [columnIndex, setColumnIndex] = useState(0);
const addWidget = (widget) => {
// Make a copy of the current widgets state
const newWidgets = [...widgets];
if (!newWidgets[templateIndex]) {
newWidgets[templateIndex] = []
}
// Make sure the templateIndex and columnIndex are within bounds
// if (templateIndex <= newWidgets.length && columnIndex <= newWidgets[templateIndex].length) {
// Make a copy of the nested array at templateIndex
const nestedArray = [...newWidgets[templateIndex]];
// Update the value at columnIndex
nestedArray[columnIndex] = widget;
// Update the nested array in the newWidgets array
newWidgets[templateIndex] = nestedArray;
// Update the state with the newWidgets array
setWidgets(newWidgets);
// }
const lastIndex = templates.length - 1;
if (lastIndex >= 0) {
let id = templates[templateIndex].id;
let updatedTemplate = checkTemplate(id, newWidgets, true);
let updatedTemplates = [...templates];
updatedTemplates[templateIndex] = updatedTemplate;
setTemplates(updatedTemplates);
}
};
const addTemplate = (template) => {
const lastIndex = templates.length - 1;
setTemplates([...templates, checkTemplate(template)]);
};
const clearTemplates = () => {
setTemplates([]);
clearWidgets()
};
const clearWidgets = () => {
setWidgets([]);
};
const showModal = (template = 0, column = 0) => {
setTemplateIndex(template);
setColumnIndex(column);
setIsModalOpen(true);
};
const handleOk = () => {
setIsModalOpen(false);
};
const handleCancel = () => {
setIsModalOpen(false);
};
const checkTemplate = (template, widgets = null, add_widget = false) => {
let component, widgetCount, id = template;
let templateIndex = templates.length;
if (add_widget) {
templateIndex--
}
switch (template) {
case 0:
component = (
<Row style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={24} onClick={() => showModal(templateIndex, 0)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][0] : null}
</div>
</Col>
</Row>
);
widgetCount = 1;
break;
case 1:
component = (
<Row style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10, height: '25vh' }}>
<Col span={5} onClick={() => showModal(templateIndex, 0)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][0] : null}
</div> </Col>
<Col span={5} onClick={() => showModal(templateIndex, 1)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][1] : null}
</div> </Col>
<Col span={5} onClick={() => showModal(templateIndex, 2)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][2] : null}
</div> </Col>
<Col span={6} onClick={() => showModal(templateIndex, 3)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][3] : null}
</div> </Col>
</Row>
);
widgetCount = 4;
break;
case 2:
component = (
<Row style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10, height: '25vh' }}>
<Col span={5} onClick={() => showModal(templateIndex, 0)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][0] : null}
</div> </Col>
<Col span={18} onClick={() => showModal(templateIndex, 1)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][1] : null}
</div> </Col>
</Row>
);
widgetCount = 2;
break;
case 3:
component = (
<Row style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10, height: '25vh' }}>
<Col span={17} onClick={() => showModal(templateIndex, 0)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][0] : null}
</div> </Col>
<Col span={6} onClick={() => showModal(templateIndex, 1)}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10, height: '25vh' }}>
{widgets ? widgets[templateIndex][1] : null}
</div> </Col>
</Row>
);
widgetCount = 2;
break;
default:
break;
}
return { component, widgetCount, id };
};
const toggleTemplateColumn = () => {
if (templateColSpan === 1) {
setTemplateColSpan(5);
setDashboardColSpan(dashboardColSpan - 4);
} else {
setTemplateColSpan(1);
setDashboardColSpan(dashboardColSpan + 4);
}
};
const toggleWidgetColumn = () => {
if (widgetColSpan === 1) {
setWidgetColSpan(5);
setDashboardColSpan(dashboardColSpan - 4);
} else {
setWidgetColSpan(1);
setDashboardColSpan(dashboardColSpan + 4);
}
};
return (
<div style={{ marginLeft: -25, marginRight: -25 }}>
<Row>
<Col span={templateColSpan}>
<div style={{ backgroundColor: '#F8F8F8', margin: 2, paddingLeft: 20, paddingRight: 20, paddingTop: 10, height: '90vh' }}>
<div style={{ display: 'flex', flexDirection: 'row', marginBottom: 10 }}>
<div style={{ flex: 20, display: 'flex', flexDirection: 'column' }}>
{templateColSpan === 1 ?
<Button icon={<RightOutlined />} onClick={toggleTemplateColumn}></Button>
:
<>
<div style={{ color: '#444444', fontSize: 14, fontWeight: 'bold', marginBottom: 10 }}>Template</div>
<Row onClick={() => addTemplate(0)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={24}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
</Row>
<Row onClick={() => addTemplate(1)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={6}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
</Row>
<Row onClick={() => addTemplate(2)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={18}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
</Row>
<Row onClick={() => addTemplate(3)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={17}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={6}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
</Row>
<Button icon={<LeftOutlined />} onClick={toggleTemplateColumn}></Button>
</>
}
</div>
</div>
</div>
</Col>
<Col span={dashboardColSpan}>
<div style={{ backgroundColor: '#F8F8F8', margin: 2, paddingLeft: 20, paddingRight: 20, paddingTop: 10, height: '90vh' }}>
<div style={{ display: 'flex', flexDirection: 'row', marginBottom: 10 }}>
<div style={{ flex: 20, display: 'flex', flexDirection: 'column' }}>
<div style={{ color: '#444444', fontSize: 14, fontWeight: 'bold', marginBottom: 10 }}>Dashboard</div>
{templates.length > 0 ? templates.map((template) => {
return template.component;
}) : null}
<Button onClick={() => clearTemplates()}>Clear</Button>
</div>
</div>
</div>
</Col>
</Row>
<Modal title="Widgets" open={isModalOpen} onOk={handleOk} onCancel={handleCancel}>
<div style={{ backgroundColor: '#F8F8F8', margin: 2, paddingLeft: 20, paddingRight: 20, paddingTop: 10 }}>
<div style={{ display: 'flex', flexDirection: 'row', marginBottom: 10 }}>
<div style={{ flex: 20, display: 'flex', flexDirection: 'column' }}>
{widgetColSpan === 1 ?
<Button icon={<RightOutlined />} onClick={toggleWidgetColumn}></Button>
:
<>
<div style={{ color: '#444444', fontSize: 14, fontWeight: 'bold', marginBottom: 10 }}>Widget</div>
<Row onClick={() => addWidget(0)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={18}>
<div style={{ padding: 0 }}>Pie Chart Project By Role</div>
</Col>
</Row>
<Row onClick={() => addWidget(1)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={18}>
<div style={{ padding: 0 }}>Pie Chart Project By Role</div>
</Col>
</Row>
<Row onClick={() => addWidget(2)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={18}>
<div style={{ padding: 0 }}>Pie Chart Project By Role</div>
</Col>
</Row>
<Row onClick={() => addWidget(3)} style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
<Col span={5}>
<div style={{ backgroundColor: '#CCCCCC', padding: 10 }} />
</Col>
<Col span={18}>
<div style={{ padding: 0 }}>Pie Chart Project By Role</div>
</Col>
</Row>
</>
}
</div>
</div>
</div>
</Modal>
</div>
);
};
export default DashboardDyna;

27
src/views/Master/MasterRoles/index.js

@ -10,6 +10,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { ROLE_ADD, ROLE_SEARCH, ROLE_EDIT, ROLE_DELETE, ROLEMENU_ADD, ROLEMENU_SEARCH, ROLEMENU_DELETE_ROLE } from '../../../const/ApiConst.js'; import { ROLE_ADD, ROLE_SEARCH, ROLE_EDIT, ROLE_DELETE, ROLEMENU_ADD, ROLEMENU_SEARCH, ROLEMENU_DELETE_ROLE } from '../../../const/ApiConst.js';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc';
const LENGTH_DATA = 10 const LENGTH_DATA = 10
@ -66,15 +67,30 @@ class index extends Component {
className: 'nowrap', className: 'nowrap',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={this.props.t('menuRoles')}> <Tooltip title={this.props.t('menuRoles')}>
<i className="cil-menu" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text.id)}></i> {
checkActMenup('/roles', 'update') ?
<i className="cil-menu fa-lg" style={{ color: 'green', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleMenuRoles(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('delete')}> <Tooltip title={this.props.t('delete')}>
{
checkActMenup('/roles', 'delete') ?
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i> <i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('edit')}> <Tooltip title={this.props.t('edit')}>
{
checkActMenup('/roles', 'update') ?
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i> <i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
:
null
}
</Tooltip> </Tooltip>
</>, </>,
}, },
@ -503,7 +519,14 @@ class index extends Component {
</Col> </Col>
<Col> <Col>
<Tooltip title={this.props.t('rolesAdd')}> <Tooltip title={this.props.t('rolesAdd')}>
<Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button> {
checkActMenup('/roles', 'create') ?
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i>
</Button>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('exportExcel')}> <Tooltip title={this.props.t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button>

13
src/views/Master/MenuCompany/index.js

@ -10,6 +10,8 @@ import { MENU_ADD, MENU_SEARCH, MENU_EDIT, MENU_DELETE, MENU_LIST, MENU_COMPANY_
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc.js';
import { useLocation } from "react-router-dom";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const column = [ const column = [
{ name: "Nama" }, { name: "Nama" },
@ -34,6 +36,7 @@ const Index = ({ params, ...props }) => {
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
} }
const location = useLocation()
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [allDataMenu, setAllDataMenu] = useState([]) const [allDataMenu, setAllDataMenu] = useState([])
const [clickOpenModal, setClickOpenModal] = useState(false) const [clickOpenModal, setClickOpenModal] = useState(false)
@ -340,10 +343,20 @@ const Index = ({ params, ...props }) => {
key: 'x', key: 'x',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
{
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i> <i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('edit')}> <Tooltip title={t('edit')}>
{
checkActMenup(location.pathname, 'update') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i> <i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i>
:
null
}
</Tooltip> </Tooltip>
</>, </>,
}, },

28
src/views/Master/ProjectPhase/index.js

@ -9,6 +9,14 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, COMPANY_MANAGEMENT_LIST, BASE_OSPRO } from '../../../const/ApiConst'; import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, COMPANY_MANAGEMENT_LIST, BASE_OSPRO } from '../../../const/ApiConst';
import { Pagination, Button, Tooltip, Table } from 'antd'; import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
import { useLocation } from "react-router-dom";
const ProjectPhase = ({ params, ...props }) => { const ProjectPhase = ({ params, ...props }) => {
@ -26,6 +34,7 @@ const ProjectPhase = ({ params, ...props }) => {
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",
@ -350,10 +359,20 @@ const ProjectPhase = ({ params, ...props }) => {
className: 'nowrap', className: 'nowrap',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
<i className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i> {
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('Edit')}> <Tooltip title={t('Edit')}>
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i> {
checkActMenup(location.pathname, 'update') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i>
:
null
}
</Tooltip>{" "} </Tooltip>{" "}
</>, </>,
}, },
@ -429,7 +448,12 @@ const ProjectPhase = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('projectPhase')}> <Tooltip title={t('projectPhase')}>
{
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>

21
src/views/Master/RoleProject/index.js

@ -9,6 +9,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { PROJECT_ROLE_ADD, PROJECT_ROLE_SEARCH, PROJECT_ROLE_EDIT, PROJECT_ROLE_DELETE } from '../../../const/ApiConst.js'; import { PROJECT_ROLE_ADD, PROJECT_ROLE_SEARCH, PROJECT_ROLE_EDIT, PROJECT_ROLE_DELETE } from '../../../const/ApiConst.js';
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc';
const LENGTH_DATA = 10 const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
@ -63,10 +64,20 @@ class index extends Component {
className: 'nowrap', className: 'nowrap',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={this.props.t('delete')}> <Tooltip title={this.props.t('delete')}>
{
checkActMenup('/project-role', 'delete') ?
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i> <i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('edit')}> <Tooltip title={this.props.t('edit')}>
{
checkActMenup('/project-role', 'update') ?
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i> <i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
:
null
}
</Tooltip> </Tooltip>
</>, </>,
}, },
@ -124,7 +135,7 @@ class index extends Component {
} }
if (this.state.role_name !== "Super Admin") { if (this.state.role_name !== "Super Admin") {
formData.columns.push( formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }, { "name": "company_id", "logic_operator": "=", "value": parseInt(this.state.company_id), "operator": "AND" },
) )
} else { } else {
formData.columns.push( formData.columns.push(
@ -403,7 +414,13 @@ class index extends Component {
</Col> </Col>
<Col> <Col>
<Tooltip title={this.props.t('rolesAdd')}> <Tooltip title={this.props.t('rolesAdd')}>
<Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button> {
checkActMenup('/roles', 'create') ?
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i>
</Button>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('exportExcel')}> <Tooltip title={this.props.t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button>

24
src/views/SimproV2/ChecklistK3/index.js

@ -10,6 +10,14 @@ import {
CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE, CHECKLIST_K3_SEARCH, COMPANY_MANAGEMENT_LIST CHECKLIST_K3_ADD, CHECKLIST_K3_EDIT, CHECKLIST_K3_DELETE, CHECKLIST_K3_SEARCH, COMPANY_MANAGEMENT_LIST
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom";
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const config = { const config = {
@ -34,6 +42,7 @@ const ChecklistK3 = ({ 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",
@ -363,7 +372,12 @@ const ChecklistK3 = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('ChecklistK3Add')}> <Tooltip title={t('ChecklistK3Add')}>
{
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" }} color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
@ -390,10 +404,20 @@ const ChecklistK3 = ({ params, ...props }) => {
<tr key={n.id}> <tr key={n.id}>
<td className='nowrap'> <td className='nowrap'>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
{
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i> <i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('edit')}> <Tooltip title={t('edit')}>
{
checkActMenup(location.pathname, 'edit') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i> <i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
:
null
}
</Tooltip> </Tooltip>
</td> </td>
{role_name === 'Super Admin' && {role_name === 'Super Admin' &&

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

@ -61,9 +61,6 @@ import {
IMAGE_GET_BY_ID, IMAGE_GET_BY_ID,
IMAGE_DELETE, IMAGE_DELETE,
} from "../../../const/ApiConst"; } from "../../../const/ApiConst";
import {
formatThousand
} from "../../../const/CustomFunc";
import moment from "moment"; import moment from "moment";
// import DialogFormResource from './DialogFormResource'; // import DialogFormResource from './DialogFormResource';
import DialogFormMaterial from "./DataRequestMaterial"; import DialogFormMaterial from "./DataRequestMaterial";
@ -72,6 +69,13 @@ import DialogDocument from "./DialogDocument";
import DialogInitDocument from "./DialogInitDocument"; import DialogInitDocument from "./DialogInitDocument";
import DialogGantt from "./DialogGantt"; import DialogGantt from "./DialogGantt";
import DialogHierarchy from "./DialogHierarchy"; import DialogHierarchy from "./DialogHierarchy";
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
// import DialogAsignHr from './AsignHrProject'; // import DialogAsignHr from './AsignHrProject';
import AssignHrProject from "./AsignHrProject"; import AssignHrProject from "./AsignHrProject";
import AssignCustProject from "./AsignCustProject"; import AssignCustProject from "./AsignCustProject";
@ -80,7 +84,7 @@ import ViewProject from "./ViewProject";
import ReportAnalysis from "./ReportAnalysis"; import ReportAnalysis from "./ReportAnalysis";
import { Icon } from "@iconify/react"; import { Icon } from "@iconify/react";
// import SubProyekComp from './SubProyekComp'; // import SubProyekComp from './SubProyekComp';
import { Link, useHistory, withRouter } from "react-router-dom"; import { Link, useHistory, withRouter, useLocation } from "react-router-dom";
import { t } from "i18next"; import { t } from "i18next";
const url = ""; const url = "";
@ -100,6 +104,7 @@ const CreatedProyek = ({ params, ...props }) => {
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
} }
const location = useLocation();
const history = useHistory(); const history = useHistory();
const HEADER = { const HEADER = {
headers: { headers: {
@ -1727,10 +1732,17 @@ const CreatedProyek = ({ params, ...props }) => {
content={popupMenu(text, record)} content={popupMenu(text, record)}
trigger="click" trigger="click"
> >
{
checkActMenup(location.pathname, 'read') ?
<Button size="small" type="link" style={{ color: "green" }}> <Button size="small" type="link" style={{ color: "green" }}>
<i className="fa fa-ellipsis-v"></i> <i className="fa fa-ellipsis-v"></i>
</Button> </Button>
:
null
}
</Popover> </Popover>
{
checkActMenup(location.pathname, 'update') ?
<Popover <Popover
placement="rightTop" placement="rightTop"
title={text.nama} title={text.nama}
@ -1752,6 +1764,9 @@ const CreatedProyek = ({ params, ...props }) => {
</Button> </Button>
)} )}
</Popover> </Popover>
:
null
}
</> </>
), ),
}, },
@ -2106,12 +2121,18 @@ const CreatedProyek = ({ params, ...props }) => {
<Col> <Col>
{parseInt(role_id) == 44 ? null : ( // role kustomer {parseInt(role_id) == 44 ? null : ( // role kustomer
<Tooltip title="Add Project"> <Tooltip title="Add Project">
{
checkActMenup(location.pathname, 'create') ?
<Button <Button
style={{ background: "#4caf50", color: "#fff" }} style={{ background: "#4caf50", color: "#fff" }}
onClick={() => handleOpenDialogProyek(0)} onClick={() => handleOpenDialogProyek(0)}
> >
<i className="fa fa-plus"></i> <i className="fa fa-plus"></i>
</Button> </Button>
:
null
}
</Tooltip> </Tooltip>
)} )}
<Tooltip title="Export"> <Tooltip title="Export">

31
src/views/SimproV2/Divisi/index.js

@ -8,6 +8,14 @@ import { DIVISI_LIST, DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH, COM
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip, Table, Spin } from 'antd'; import { Pagination, Button, Tooltip, Table, Spin } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom";
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ params, ...props }) => {
@ -24,7 +32,7 @@ const ProjectType = ({ 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",
@ -400,13 +408,29 @@ const ProjectType = ({ params, ...props }) => {
render: (text, record) => render: (text, record) =>
<> <>
<Tooltip title="Hapus"> <Tooltip title="Hapus">
{
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i> <i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title="Add"> <Tooltip title="Add">
{
checkActMenup(location.pathname, 'create') ?
<i id="TooltipEdit" className="cil-level-down fa-sm" style={{ color: 'blue', marginRight: 10, cursor: "pointer" }} onClick={() => handleAddChild(text)}></i> <i id="TooltipEdit" className="cil-level-down fa-sm" style={{ color: 'blue', marginRight: 10, cursor: "pointer" }} onClick={() => handleAddChild(text)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title="Edit"> <Tooltip title="Edit">
{
checkActMenup(location.pathname, 'update') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i> <i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i>
:
null
}
</Tooltip> </Tooltip>
</> </>
, ,
@ -511,7 +535,12 @@ const ProjectType = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('divisionAdd')}> <Tooltip title={t('divisionAdd')}>
{
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>

22
src/views/SimproV2/ProjectType/index.js

@ -11,6 +11,8 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { PROJECT_TYPE_ADD, PROJECT_TYPE_EDIT, PROJECT_TYPE_DELETE, PROJECT_TYPE_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst'; import { PROJECT_TYPE_ADD, PROJECT_TYPE_EDIT, PROJECT_TYPE_DELETE, PROJECT_TYPE_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { Pagination, Button, Tooltip, Table } from 'antd'; import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc.js';
import { useLocation } from "react-router-dom";
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ params, ...props }) => {
@ -27,6 +29,7 @@ const ProjectType = ({ 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",
@ -353,10 +356,20 @@ const ProjectType = ({ params, ...props }) => {
className: 'nowrap', className: 'nowrap',
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
<i className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i> {
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('edit')}> <Tooltip title={t('edit')}>
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i> {
checkActMenup(location.pathname, 'update') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i>
:
null
}
</Tooltip>{" "} </Tooltip>{" "}
<Tooltip title="Template Gantt"> <Tooltip title="Template Gantt">
<i className="fa fa-gears" style={{ color: 'blue', cursor: "pointer" }} onClick={() => handleDialogIg(text.id)}></i> <i className="fa fa-gears" style={{ color: 'blue', cursor: "pointer" }} onClick={() => handleDialogIg(text.id)}></i>
@ -430,7 +443,12 @@ const ProjectType = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('projectType')}> <Tooltip title={t('projectType')}>
{
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>

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>

25
src/views/SimproV2/Satuan/index.js

@ -8,6 +8,14 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Button, Tooltip } from 'antd'; import { Pagination, Button, Tooltip } from 'antd';
import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst'; import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom";
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
const Satuan = ({ params, ...props }) => { const Satuan = ({ params, ...props }) => {
@ -24,7 +32,7 @@ const Satuan = ({ 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",
@ -352,7 +360,12 @@ const Satuan = ({ params, ...props }) => {
</Col> </Col>
<Col> <Col>
<Tooltip title={t('uomAdd')}> <Tooltip title={t('uomAdd')}>
{
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" }} color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button> <Button style={{ marginLeft: "5px" }} color="primary" onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
@ -380,11 +393,21 @@ const Satuan = ({ params, ...props }) => {
<td className='nowrap'> <td className='nowrap'>
<Tooltip title={t('delete')}> <Tooltip title={t('delete')}>
{
checkActMenup(location.pathname, 'delete') ?
<i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i> <i id="TooltipDelete" className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => handleDelete(n.id)}></i>
:
null
}
</Tooltip> </Tooltip>
<Tooltip title={t('ubah')}> <Tooltip title={t('ubah')}>
{
checkActMenup(location.pathname, 'update') ?
<i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i> <i id="TooltipEdit" className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(n)}></i>
:
null
}
</Tooltip> </Tooltip>
</td> </td>
{role_name === 'Super Admin' && {role_name === 'Super Admin' &&

14
src/views/SimproV2/Settings/DialogForm.js

@ -185,9 +185,9 @@ const DialogForm = ({
return ( return (
<Form> <Form>
<Row> <Row>
<Col md={12}> <Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Image Profile</Label> <Label className="capitalize">Image Profile</Label>
<Input <Input
type="file" type="file"
accept="image/*" accept="image/*"
@ -205,25 +205,33 @@ const DialogForm = ({
</p> </p>
</small> </small>
</FormGroup> </FormGroup>
</Col>
<Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize">Username</Label> <Label className="capitalize">Username</Label>
<Input type="text" value={userName || userNameProp} onChange={(e) => setUserName(e.target.value)} /> <Input type="text" value={userName || userNameProp} onChange={(e) => setUserName(e.target.value)} />
</FormGroup> </FormGroup>
</Col>
<Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize">Email</Label> <Label className="capitalize">Email</Label>
<Input type="text" value={email || emailProp} onChange={(e) => setEmail(e.target.value)} /> <Input type="text" value={email || emailProp} onChange={(e) => setEmail(e.target.value)} />
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={12}> <Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize">Old Password</Label> <Label className="capitalize">Old Password</Label>
<Input type="text" value={oldPassword} onChange={(e) => setOldPassword(e.target.value)} /> <Input type="text" value={oldPassword} onChange={(e) => setOldPassword(e.target.value)} />
</FormGroup> </FormGroup>
</Col>
<Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize">New Password</Label> <Label className="capitalize">New Password</Label>
<Input type="text" value={newPassword} onChange={(e) => setNewPassword(e.target.value)} /> <Input type="text" value={newPassword} onChange={(e) => setNewPassword(e.target.value)} />
</FormGroup> </FormGroup>
</Col>
<Col md={4}>
<FormGroup> <FormGroup>
<Label className="capitalize">Confirm New Password</Label> <Label className="capitalize">Confirm New Password</Label>
<Input type="text" value={newPasswordConfirm} onChange={(e) => setNewPasswordConfirm(e.target.value)} /> <Input type="text" value={newPasswordConfirm} onChange={(e) => setNewPasswordConfirm(e.target.value)} />

Loading…
Cancel
Save