Browse Source

Merge pull request 'Dev-Farhan' (#14) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-frontend#14
pull/1/head
farhantock 1 year ago
parent
commit
06a5a74847
  1. 2
      src/routes.js
  2. 95
      src/services/api/modules/project/index.js
  3. 60
      src/views/Dashboard/DashboardBOD.js
  4. 1782
      src/views/Dashboard/DashboardProjectCarousell.js
  5. 107
      src/views/MapMonitoring/index.js
  6. 104
      src/views/Master/MasterRoles/DialogForm.js
  7. 84
      src/views/Master/MasterRoles/DialogMenuRoles.js
  8. 6
      src/views/Master/MasterRoles/index.js
  9. 51
      src/views/Report/k3/index.js
  10. 8
      src/views/SimproV2/ChecklistK3/DialogForm.js
  11. 1
      src/views/SimproV2/ChecklistK3/index.js
  12. 65
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  13. 73
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  14. 87
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  15. 1391
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  16. 75
      src/views/SimproV2/CreatedProyek/DialogUserGantt.js
  17. 86
      src/views/SimproV2/CreatedProyek/index.js
  18. 140
      src/views/SimproV2/Divisi/DialogForm.js
  19. 26
      src/views/SimproV2/Divisi/index.js
  20. 34
      src/views/SimproV2/ResourceWorker/index.js

2
src/routes.js

@ -56,7 +56,7 @@ const routes = [
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD }, { path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ 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', exact: true, name: 'Dashboard Project', component: DashboardProject }, { path: '/dashboard-project/:PROJECT_ID/:GANTT_ID', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/dashboard-project-carousell', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell }, { path: '/dashboard-perproject', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell },
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:SCURVE', exact: true, name: 'Dashboard Project', component: DashboardProject }, { path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:SCURVE', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/projects', exact: true, name: 'Projects', component: CreatedProyek }, { path: '/projects', exact: true, name: 'Projects', component: CreatedProyek },
{ path: '/projects/:id/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity }, { path: '/projects/:id/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity },

95
src/services/api/modules/project/index.js

@ -2,61 +2,60 @@ import { BASE_SIMPRO_LUMEN } from "../../../../const/ApiConst";
import RequestApi from '../../base'; import RequestApi from '../../base';
export default class ApiProject extends RequestApi { export default class ApiProject extends RequestApi {
static async list() { static async search(role_id) {
// const user_id = store.getState().userReducer && store.getState().userReducer.user && store.getState().userReducer.user.data_user ? store.getState().userReducer.user.data_user.id : 0; // const user_id = store.getState().userReducer && store.getState().userReducer.user && store.getState().userReducer.user.data_user ? store.getState().userReducer.user.data_user.id : 0;
const URL = `${BASE_SIMPRO_LUMEN}/project/list` const URL = `${BASE_SIMPRO_LUMEN}/project/search`
// const payload = { let hierarchy = [];
// "paging": { "start": 0, "length": 25 }, hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
// // "columns": [ const payload = {
// // { "name": "user_id", "logic_operator": "=", "value": user_id } columns: [],
// // ], select: [
// // "joins": [ "id",
// // { "nama",
// // "name": "m_proyek", "kode_sortname",
// // "column_join": "proyek_id", "type_proyek_id",
// // "column_results": [ "currency_symbol",
// // "nama", "kode_sortname", "mulai_proyek", "akhir_proyek" "mulai_proyek",
// // ] "akhir_proyek",
// // }, ],
// // {
// // "name": "m_activity", orders: { columns: ["nama"], ascending: true },
// // "column_join": "activity_id", paging: { start: 0, length: -1 },
// // "column_results": [ };
// // "name", "start_date", "end_date", "persentase_progress" if (parseInt(role_id) !== 70) {
// // ] payload["columns"] = [
// // } { name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
// // ], ];
// "orders": { "columns": ["id"], "ascending": false } }
// } return await RequestApi.Request().post(
return await RequestApi.Request().get( URL, payload,
URL,
RequestApi.HeaderWithToken()).then(res => { RequestApi.HeaderWithToken()).then(res => {
if (res) { if (res) {
if (res && res.data && res.data.data) { if (res && res.data && res.data.data) {
// console.log('ApiProject search', res.data.data) // console.log('ApiProject search', res.data.data)
if (res.data.data.length > 0) { if (res.data.data.length > 0) {
return {status: true, data: res.data.data}; return { status: true, data: res.data.data };
}
else {
return { status: false, data: null }
}
} }
else { else {
return {status: false, data: null} return { status: false, data: null };
} }
} }
else { else {
return {status: false, data: null}; alert("Please check your internet connection.", "error");
return { status: false, data: null };
}
}).catch(e => {
// console.log('error search project', e);
let error = JSON.parse(JSON.stringify(e));
console.log('error search project', error);
if (error.message) {
alert(error.message);
} }
} return { status: false, data: null };
else { });
alert("Please check your internet connection.", "error");
return {status: false, data: null};
}
}).catch(e => {
// console.log('error search project', e);
let error = JSON.parse(JSON.stringify(e));
console.log('error search project', error);
if (error.message) {
alert(error.message);
}
return {status: false, data: null};
});
} }
} }

60
src/views/Dashboard/DashboardBOD.js

@ -15,18 +15,18 @@ import { HealthByBudget, HealthBySchedule } from './Components';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const DashboardBOD = (props) => { const DashboardBOD = (props) => {
let role_id = '', user_id='',isLogin='',token=''; let role_id = '', user_id = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
token = props.location.state.token; token = props.location.state.token;
isLogin = props.location.state.isLogin; isLogin = props.location.state.isLogin;
} else { } else {
role_id = localStorage.getItem("role_id"); role_id = localStorage.getItem("role_id");
user_id = localStorage.getItem("user_id"); user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin"); isLogin = localStorage.getItem("isLogin");
} }
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -256,9 +256,9 @@ const DashboardBOD = (props) => {
return; return;
} }
if (result.status == 200 && result.data.data) { if (result.status == 200 && result.data.data) {
let dataRes = result.data.data; let dataRes = result.data.data;
const filteredData = dataRes.filter(item => item.parent === null); const filteredData = dataRes.filter(item => item.parent === null);
SET_PROJECT_PER_DIVISION(filteredData); SET_PROJECT_PER_DIVISION(filteredData);
} }
SET_READY_PROJECT_PER_DIVISION(true); SET_READY_PROJECT_PER_DIVISION(true);
@ -317,16 +317,16 @@ const DashboardBOD = (props) => {
let tableData = []; let tableData = [];
result.data.data.map((item, idx) => { result.data.data.map((item, idx) => {
let statusHealthBySchedule = 'on-schedule'; let statusHealthBySchedule = 'on-schedule';
let planningProgress = 0; let planningProgress = 0;
let actualProgress = 0; let actualProgress = 0;
let selisihProgress = 0; let selisihProgress = 0;
if(item.scurve && item.scurve[0]) { if (item.scurve && item.scurve[0]) {
planningProgress = item.scurve[0].data.percentagePlan[item.scurve[0].data.percentagePlan.length - 1] 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] actualProgress = item.scurve[0].data.percentageReal[item.scurve[0].data.percentageReal.length - 1]
} }
selisihProgress = planningProgress - actualProgress selisihProgress = planningProgress - actualProgress
if (selisihProgress > 0 && selisihProgress <= 5) { if (selisihProgress > 0 && selisihProgress <= 5) {
statusHealthBySchedule = 'warning' statusHealthBySchedule = 'warning'
@ -378,7 +378,7 @@ const DashboardBOD = (props) => {
return ( return (
<BottomModal <BottomModal
isReady={READY_TABLE_DETAIL_EXPENDITURE} isReady={READY_TABLE_DETAIL_EXPENDITURE}
title="Detail Project Expenditure" title="Detail Project"
tableHeader={[ tableHeader={[
{ title: "Project Code", key: "kode_sortname" }, { title: "Project Code", key: "kode_sortname" },
{ title: "Project Name", key: "project_name" }, { title: "Project Name", key: "project_name" },
@ -433,12 +433,12 @@ const DashboardBOD = (props) => {
</div> </div>
</div> </div>
<div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Link to="/dashboard-project-carousell" style={{ textDecoration: 'none' }}> <Link to="/dashboard-perproject" style={{ textDecoration: 'none' }}>
<div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}> <div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>
View All Gantt All Dashboard
</div> </div>
</Link> </Link>
</div> </div>
</> </>
: :
<div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}> <div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>

1782
src/views/Dashboard/DashboardProjectCarousell.js

File diff suppressed because it is too large Load Diff

107
src/views/MapMonitoring/index.js

@ -15,7 +15,7 @@ import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import { ToastContainer, toast } from "react-toastify"; import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css"; import "react-toastify/dist/ReactToastify.css";
import './MapMonitoring.css'; import './MapMonitoring.css';
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst'; import { BASE_SIMPRO_LUMEN_IMAGE, PROYEK_SEARCH } from '../../const/ApiConst';
import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png'; import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png';
import pinRouteStart from '../../assets/img/map/pin_route_green.png'; import pinRouteStart from '../../assets/img/map/pin_route_green.png';
import pinRouteEnd from '../../assets/img/map/pin_route_red.png'; import pinRouteEnd from '../../assets/img/map/pin_route_red.png';
@ -26,13 +26,32 @@ import 'leaflet.markercluster/dist/leaflet.markercluster.js'
import 'leaflet-control-geocoder/dist/Control.Geocoder.css' import 'leaflet-control-geocoder/dist/Control.Geocoder.css'
import 'leaflet-control-geocoder/dist/Control.Geocoder.js' import 'leaflet-control-geocoder/dist/Control.Geocoder.js'
import moment from 'moment'; import moment from 'moment';
import axios from "../../const/interceptorApi";
const MapMonitoring = ({ ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
const MapMonitoring = () => { } else {
role_id = localStorage.getItem("role_id");
proyek_id = localStorage.getItem("proyek_id");
user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
}
const HEADER = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
const GRID_LEFT = 6; const GRID_LEFT = 6;
const GRID_MIDDLE = 12; const GRID_MIDDLE = 12;
const GRID_RIGHT = 6; const GRID_RIGHT = 6;
const GRID_TOTAL = GRID_LEFT+GRID_MIDDLE+GRID_RIGHT; const GRID_TOTAL = GRID_LEFT + GRID_MIDDLE + GRID_RIGHT;
const mapRef = useRef() const mapRef = useRef()
const center = { const center = {
// lat: -6.200000, // lat: -6.200000,
@ -41,7 +60,7 @@ const MapMonitoring = () => {
lng: 120.13025155062624 lng: 120.13025155062624
} }
const {userPoints, mymap, openLeft, openRight, routingBarVisible, userHistory, isSearchingRoute, selectedFeature} = useSelector(state => state.mapReducer); const { userPoints, mymap, openLeft, openRight, routingBarVisible, userHistory, isSearchingRoute, selectedFeature } = useSelector(state => state.mapReducer);
const [gridMiddle, setGridMiddle] = useState(GRID_MIDDLE); const [gridMiddle, setGridMiddle] = useState(GRID_MIDDLE);
const [gridLeft, setGridLeft] = useState(0); const [gridLeft, setGridLeft] = useState(0);
const [gridRight, setGridRight] = useState(0); const [gridRight, setGridRight] = useState(0);
@ -88,45 +107,45 @@ const MapMonitoring = () => {
var startIcon = new L.Icon({ var startIcon = new L.Icon({
iconSize: [60, 60], iconSize: [60, 60],
iconAnchor: [30, 47], iconAnchor: [30, 47],
popupAnchor: [1, -24], popupAnchor: [1, -24],
iconUrl: pinRouteStart iconUrl: pinRouteStart
}); });
var endIcon = new L.Icon({ var endIcon = new L.Icon({
iconSize: [60, 60], iconSize: [60, 60],
iconAnchor: [30, 47], iconAnchor: [30, 47],
popupAnchor: [1, -24], popupAnchor: [1, -24],
iconUrl: pinRouteEnd iconUrl: pinRouteEnd
}); });
var onTripIcon = new L.Icon({ var onTripIcon = new L.Icon({
iconSize: [60, 60], iconSize: [60, 60],
iconAnchor: [30, 47], iconAnchor: [30, 47],
popupAnchor: [1, -24], popupAnchor: [1, -24],
iconUrl: pinRouteOnTrip iconUrl: pinRouteOnTrip
}); });
let userHistoryLayer = L.geoJson(userHistory, { let userHistoryLayer = L.geoJson(userHistory, {
name: 'userHistoryLayer', name: 'userHistoryLayer',
onEachFeature: function(feature, layer) { onEachFeature: function (feature, layer) {
var popupText = `<b>Status: </b>${feature.properties.type}<br> var popupText = `<b>Status: </b>${feature.properties.type}<br>
<b>Time: </b> ${feature.properties.wptime ? moment(feature.properties.wptime).format("DD-MM-YYYY HH:mm:ss") : '-'}`; <b>Time: </b> ${feature.properties.wptime ? moment(feature.properties.wptime).format("DD-MM-YYYY HH:mm:ss") : '-'}`;
layer.bindPopup(popupText, { layer.bindPopup(popupText, {
closeButton: true, closeButton: true,
// offset: L.point(0, -20) // offset: L.point(0, -20)
}); });
layer.on('click', function() { layer.on('click', function () {
layer.openPopup(); layer.openPopup();
}); });
}, },
pointToLayer: function(feature, latlng) { pointToLayer: function (feature, latlng) {
var type = feature.properties.type; var type = feature.properties.type;
if (type === 'Start') { if (type === 'Start') {
return L.marker(latlng, {icon: startIcon}); return L.marker(latlng, { icon: startIcon });
} }
else if (type === "Working") { else if (type === "Working") {
return L.marker(latlng, {icon: onTripIcon}); return L.marker(latlng, { icon: onTripIcon });
} }
else if (type === "End") { else if (type === "End") {
return L.marker(latlng, {icon: endIcon}); return L.marker(latlng, { icon: endIcon });
} }
}, },
}); });
@ -155,9 +174,11 @@ const MapMonitoring = () => {
// init for left content panel, get projects and build tree select antd // init for left content panel, get projects and build tree select antd
const getMapLeftContent = async () => { const getMapLeftContent = async () => {
store.dispatch(setMapLoading(true)); store.dispatch(setMapLoading(true));
let project = await ApiProject.list();
// console.log('project', project); let project = await ApiProject.search(role_id);
if (project && project.status && project.data && project.data.length > 0) { // console.log('projectsearch', projectsearch.data.data);
console.log('project', project);
if (project && project.data && project.data.length > 0) {
let projectData = [ let projectData = [
{ {
"title": 'All', "title": 'All',
@ -182,13 +203,13 @@ const MapMonitoring = () => {
} }
const onEachFeatureUserPoints = (feature, layer) => { const onEachFeatureUserPoints = (feature, layer) => {
layer.on('click', function(e) { layer.on('click', function (e) {
L.DomEvent.stopPropagation(e); L.DomEvent.stopPropagation(e);
if (!store.getState().mapReducer.routingBarVisible) { if (!store.getState().mapReducer.routingBarVisible) {
// proceed only when routing mode is not visible // proceed only when routing mode is not visible
showHighLight(feature, e); showHighLight(feature, e);
} }
}); });
} }
const renderClassMarker = (feature) => { const renderClassMarker = (feature) => {
@ -226,7 +247,7 @@ const MapMonitoring = () => {
let lon = feature.geometry.coordinates[0]; let lon = feature.geometry.coordinates[0];
// create a new marker using the icon style // create a new marker using the icon style
let marker = new L.Marker([lat,lon],{icon: logoMarker}); let marker = new L.Marker([lat, lon], { icon: logoMarker });
markerCluster.addLayer(marker); markerCluster.addLayer(marker);
return marker; return marker;
} }
@ -234,7 +255,7 @@ const MapMonitoring = () => {
function showHighLight(feature, e) { function showHighLight(feature, e) {
// console.log('showHighLight feature', feature); // console.log('showHighLight feature', feature);
// console.log('showHighLight e', e); // console.log('showHighLight e', e);
removeLayerByName('popupTemp'); removeLayerByName('popupTemp');
// let selectedIcon = e.target.options.icon; // let selectedIcon = e.target.options.icon;
// let classIcon = e.target.options.icon.options.className; // let classIcon = e.target.options.icon.options.className;
@ -256,7 +277,7 @@ const MapMonitoring = () => {
// popupAnchor: [0, -80] // popupAnchor: [0, -80]
// }); // });
// add highlight // add highlight
// console.log('selectedIcon', selectedIcon); // console.log('selectedIcon', selectedIcon);
// console.log('classList', e.target.options.icon.options.classList); // console.log('classList', e.target.options.icon.options.classList);
// if (!openRight) { // if (!openRight) {
@ -271,8 +292,8 @@ const MapMonitoring = () => {
// kalo bukan point bikin hightlight jadi biru // kalo bukan point bikin hightlight jadi biru
if (feature && feature.geometry && feature.geometry.type !== 'Point') { if (feature && feature.geometry && feature.geometry.type !== 'Point') {
L.geoJSON(feature, { L.geoJSON(feature, {
style: function(feature) { style: function (feature) {
return {color: 'blue'} return { color: 'blue' }
}, },
name: 'popupTemp', name: 'popupTemp',
onEachFeature: function (feature, layer) { onEachFeature: function (feature, layer) {
@ -287,7 +308,7 @@ const MapMonitoring = () => {
// opening right panel // opening right panel
store.dispatch(setOpenRight(!openRight)); store.dispatch(setOpenRight(!openRight));
store.dispatch(setSelectedFeature(feature)); store.dispatch(setSelectedFeature(feature));
} }
const MapContent = useMemo(() => { const MapContent = useMemo(() => {
return ( return (
@ -299,20 +320,20 @@ const MapMonitoring = () => {
<div id="map-area" style={{ height: '90vh', width: '100%' }} ref={mapRef}></div> <div id="map-area" style={{ height: '90vh', width: '100%' }} ref={mapRef}></div>
<button <button
title='Project List' title='Project List'
style={{position: 'absolute', top: 80, left: 10, zIndex: 999, backgroundColor:'white', backgroundSize:'34px 34px', width: '34px', height: '34px', borderRadius: '2px', borderWidth: '1px', borderColor: 'grey'}} style={{ position: 'absolute', top: 80, left: 10, zIndex: 999, backgroundColor: 'white', backgroundSize: '34px 34px', width: '34px', height: '34px', borderRadius: '2px', borderWidth: '1px', borderColor: 'grey' }}
onClick={() => store.dispatch(setOpenLeft(!openLeft))}> onClick={() => store.dispatch(setOpenLeft(!openLeft))}>
<i className='fa fa-list'></i> <i className='fa fa-list'></i>
</button> </button>
{ routingBarVisible && <RoutingBar /> } {routingBarVisible && <RoutingBar />}
{ isSearchingRoute && ( {isSearchingRoute && (
<div className="loader-container"> <div className="loader-container">
<Loader <Loader
type="TailSpin" type="TailSpin"
color="#36D7B7" color="#36D7B7"
height={100} height={100}
width={100} width={100}
/> />
</div> </div>
)} )}
</Col> </Col>
<Col span={gridRight}> <Col span={gridRight}>
@ -321,13 +342,13 @@ const MapMonitoring = () => {
<ToastContainer autoClose={5000} /> <ToastContainer autoClose={5000} />
</Row> </Row>
) )
}, [openLeft, openRight, gridLeft, gridMiddle, gridRight, routingBarVisible ]) }, [openLeft, openRight, gridLeft, gridMiddle, gridRight, routingBarVisible])
const renderGridMap = () => { const renderGridMap = () => {
let middle = GRID_MIDDLE; let middle = GRID_MIDDLE;
let left = GRID_LEFT; let left = GRID_LEFT;
let right = GRID_RIGHT; let right = GRID_RIGHT;
if (openLeft && openRight){ if (openLeft && openRight) {
middle = GRID_MIDDLE; middle = GRID_MIDDLE;
left = GRID_LEFT; left = GRID_LEFT;
right = GRID_RIGHT; right = GRID_RIGHT;

104
src/views/Master/MasterRoles/DialogForm.js

@ -5,7 +5,7 @@ import 'antd/dist/antd.css';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import axios from 'axios'; import axios from 'axios';
import { Select } from 'antd'; import { Select } from 'antd';
import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js'; import { MENU_SEARCH } from '../../../const/ApiConst.js';
const { Option } = Select const { Option } = Select
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
@ -18,7 +18,6 @@ const config = {
} }
}; };
class DialogForm extends Component { class DialogForm extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -30,6 +29,8 @@ class DialogForm extends Component {
isParentClick: false, isParentClick: false,
menu: [], menu: [],
selectedMenu: null, selectedMenu: null,
all_project: false,
company_id
} }
} }
@ -53,7 +54,8 @@ class DialogForm extends Component {
id: 0, id: 0,
name: "", name: "",
description: "", description: "",
selectedMenu: null selectedMenu: null,
company_id
}) })
} }
this.setState({ isParentClick: false }); this.setState({ isParentClick: false });
@ -61,60 +63,21 @@ class DialogForm extends Component {
} }
getAllMenu = async () => { getAllMenu = async () => {
const { companyID } = this.props; const payload = {
const { roleName } = this.props; "paging": { "start": 0, "length": -1 },
if (roleName !== "Super Admin") { "columns": [
const payload = { { "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
"paging": { ],
"start": 0, "joins": [],
"length": -1 "orders": { "columns": ["id"], "ascending": false }
}, }
"columns": [{ const result = await axios
"name": "company_id", .post(MENU_SEARCH, payload, config)
"logic_operator": "=", .then(res => res)
"value": companyID, .catch((error) => error.response);
"operator": "AND" if (result && result.data && result.data.code == 200) {
}], this.setState({ menu: result.data.data });
"joins": [{
"name": "m_menu",
"column_join": "menu_id",
"column_results": [
"name"
]
}],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data });
}
} else {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "name",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data });
}
} }
} }
showDialog = () => { showDialog = () => {
@ -133,13 +96,13 @@ class DialogForm extends Component {
} }
handleSave = () => { handleSave = () => {
const { companyID } = this.props;
const { const {
id, id,
name, name,
description, description,
selectedMenu, selectedMenu,
company_id,
all_project
} = this.state } = this.state
let data = ''; let data = '';
@ -151,7 +114,8 @@ class DialogForm extends Component {
name, name,
description, description,
selectedMenu, selectedMenu,
company_id: companyID company_id,
all_project
} }
// console.log('data', data); // console.log('data', data);
this.props.closeDialog('save', data); this.props.closeDialog('save', data);
@ -161,7 +125,8 @@ class DialogForm extends Component {
name, name,
description, description,
selectedMenu, selectedMenu,
company_id: companyID company_id,
all_project
} }
this.props.closeDialog('edit', data); this.props.closeDialog('edit', data);
} }
@ -206,14 +171,29 @@ class DialogForm extends Component {
}}> }}>
{this.state.menu.map((item) => ( {this.state.menu.map((item) => (
<option key={item.id} value={item.id}> <option key={item.id} value={item.id}>
{item.name ?? item.join_first_name} {item.name}
</option> </option>
))} ))}
</Input> </Input>
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
</Form> <FormGroup check>
<Input
id="checkedAllProject"
name="checkedAllProject"
checked={this.state.all_project}
onChange={(e) => this.setState({ all_project: e.target.checked })}
type="checkbox"
/>
<Label
check
for="checkedAllProject"
>
See All Project
</Label>
</FormGroup>
</Form >
) )
} }

84
src/views/Master/MasterRoles/DialogMenuRoles.js

@ -3,8 +3,9 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'rea
import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import axios from 'axios'; import axios from 'axios';
import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js'; import { MENU_SEARCH } from '../../../const/ApiConst.js';
import { withTranslation, WithTranslation } from 'react-i18next'; import { withTranslation, WithTranslation } from 'react-i18next';
const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
@ -51,61 +52,30 @@ class DialogMenuRoles extends Component {
} }
getAllMenu = async () => { getAllMenu = async () => {
const { companyID } = this.props; const payload = {
const { roleName } = this.props; "paging": { "start": 0, "length": -1 },
if (roleName !== "Super Admin") { "columns": [
const payload = { { "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
"paging": { ],
"start": 0, "joins": [],
"length": -1 "orders": { "columns": ["id"], "ascending": false }
}, }
"columns": [{
"name": "company_id",
"logic_operator": "=",
"value": companyID, const result = await axios
"operator": "AND" .post(MENU_SEARCH, payload, config)
}], .then(res => res)
"joins": [{ .catch((error) => error.response);
"name": "m_menu",
"column_join": "menu_id",
"column_results": [ if (result && result.data && result.data.code == 200) {
"name" this.setState({ menu: result.data.data }, () => {
] this.setStateMenu(false);
}], });
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data }, () => {
this.setStateMenu(false);
});
} else {
}
} else { } else {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "name",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data });
}
} }
} }
setStateMenu = edit => { setStateMenu = edit => {
@ -126,14 +96,13 @@ class DialogMenuRoles extends Component {
let copyStateMenu = [...this.state.stateMenu]; let copyStateMenu = [...this.state.stateMenu];
this.props.menuRoles.map((val, indexMenu) => { this.props.menuRoles.map((val, indexMenu) => {
let index = this.getIndexDataMenu(val.menu_id); let index = this.getIndexDataMenu(val.menu_id);
console.log('index true', index); console.log("index true", val.menu_id);
if (index >= 0) { if (index >= 0) {
copyStateMenu[index] = true; copyStateMenu[index] = true;
} }
}) })
this.setState({ stateMenu: [] }, () => { this.setState({ stateMenu: [] }, () => {
let check = copyStateMenu.some(this.checkArray); let check = copyStateMenu.some(this.checkArray);
console.log('icheck', check);
if (check === false) { if (check === false) {
this.setState({ allChecked: true, stateMenu: copyStateMenu }) this.setState({ allChecked: true, stateMenu: copyStateMenu })
} else { } else {
@ -182,12 +151,11 @@ class DialogMenuRoles extends Component {
renderForm = () => { renderForm = () => {
const { menu, stateMenu } = this.state const { menu, stateMenu } = this.state
console.log('stateMenu', stateMenu);
return ( return (
menu.map((val, index) => { menu.map((val, index) => {
return ( return (
<tr key={index}> <tr key={index}>
<td>{val.join_first_name ?? val.name}</td> <td>{val.name}</td>
<td><input type="checkbox" onClick={(e) => this.handleChangeCheckbox(e.target.checked, index)} defaultChecked={stateMenu[index]} /></td> <td><input type="checkbox" onClick={(e) => this.handleChangeCheckbox(e.target.checked, index)} defaultChecked={stateMenu[index]} /></td>
</tr> </tr>
) )

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

@ -198,7 +198,8 @@ class index extends Component {
name: data.name, name: data.name,
description: data.description, description: data.description,
default_page: data.selectedMenu, default_page: data.selectedMenu,
company_id: data.company_id company_id: data.company_id,
all_project: data.all_project
} }
const result = await axios.post(ROLE_ADD, formData, this.config) const result = await axios.post(ROLE_ADD, formData, this.config)
@ -219,7 +220,8 @@ class index extends Component {
name: data.name, name: data.name,
description: data.description, description: data.description,
default_page: data.selectedMenu, default_page: data.selectedMenu,
company_id: data.company_id company_id: data.company_id,
all_project: data.all_project
} }
const url = ROLE_EDIT(data.id) const url = ROLE_EDIT(data.id)
const result = await axios.put(url, formData, this.config) const result = await axios.put(url, formData, this.config)

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

@ -13,14 +13,7 @@ import { PRESENSI_SEARCH, PROYEK_SEARCH, USERPROYEK_SEARCH, K3_SEARCH, SIMPRO_BA
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const { Option } = Select const { Option } = Select
const token = localStorage.getItem('token');
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const BASE_URL = "" const BASE_URL = ""
@ -31,8 +24,33 @@ const momentFormat = 'DD-MM-YY';
const LENGTH_DATA = 10 const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, role_name = '', hierarchy = [];
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
company_id = props.location.state.company_id;
role_name = props.location.state.role_name;
hierarchy = props.location.state.hierarchy;
} else {
token = window.localStorage.getItem('token');
role_name = window.localStorage.getItem('role_name');
company_id = window.localStorage.getItem('company_id');
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
}
super(props) super(props)
this.config = {
headers: {
Authorization: `Bearer ${token}`,
"Content-type": "application/json"
}
};
this.state = { this.state = {
dataTable: [], dataTable: [],
dataExport: [], dataExport: [],
@ -61,7 +79,11 @@ class index extends Component {
allUserToProyek: [], allUserToProyek: [],
proyekIds: [], proyekIds: [],
allDataProyek: [], allDataProyek: [],
finishSetupOption: false finishSetupOption: false,
company_id: company_id,
role_name: role_name,
role_id: role_id,
hierarchy: hierarchy
} }
} }
@ -111,9 +133,14 @@ class index extends Component {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_id !== "Super Admin") {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: this.state.hierarchy, operator: "AND" }
)
}
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, config) .post(PROYEK_SEARCH, payload, this.config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -194,7 +221,7 @@ class index extends Component {
} }
const result = await axios const result = await axios
.post(K3_SEARCH, payload, config) .post(K3_SEARCH, payload, this.config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -394,7 +421,7 @@ class index extends Component {
const result = await axios const result = await axios
.post(K3_SEARCH, payload, config) .post(K3_SEARCH, payload, this.config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);

8
src/views/SimproV2/ChecklistK3/DialogForm.js

@ -7,7 +7,7 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
@ -31,7 +31,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: name, name: name,
description description,
company_id
} }
closeDialog('save', data); closeDialog('save', data);
@ -39,7 +40,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
data = { data = {
id, id,
name: name, name: name,
description description,
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

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

@ -285,6 +285,7 @@ const ChecklistK3 = ({ params }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
company_id={company_id}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

65
src/views/SimproV2/CreatedProyek/AsignCustProject.js

@ -5,15 +5,15 @@ import { Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import { import {
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
ASSIGN_HR_PROJECT_DELETE ASSIGN_HR_PROJECT_DELETE
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignCust from './DialogAssignCust'; import FormAsignCust from './DialogAssignCust';
const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => { const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, company_id }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -25,11 +25,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
const [alertDelete, setAlertDelete] = useState(false) const [alertDelete, setAlertDelete] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [openDialogFormTools, setOpenDialogFormTools] = useState(false) const [openDialogFormTools, setOpenDialogFormTools] = useState(false)
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true); setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
@ -64,11 +64,11 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
const filteredData = dataRes.filter(item => item.is_customer === true); const filteredData = dataRes.filter(item => item.is_customer === true);
setdataUserToProject(filteredData); setdataUserToProject(filteredData);
setLoading(false); setLoading(false);
} else { } else {
setLoading(false); setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -119,7 +119,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
key: 'x', key: 'x',
className: "nowrap", className: "nowrap",
render: (text, record) => <><Tooltip title={`Delete Request Resource ${text.id}`}> render: (text, record) => <><Tooltip title={`Delete Request Resource ${text.id}`}>
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> <Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>{" "}</>, </Tooltip>{" "}</>,
}, },
{ title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" } { title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" }
@ -137,28 +137,28 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
const renderForm = () => { const renderForm = () => {
return ( return (
<div style={{"overflowX":"scroll"}}> <div style={{ "overflowX": "scroll" }}>
{RenderTable} {RenderTable}
</div> </div>
) )
} }
const handleCloseDialogFormTools = (type, data) => { const handleCloseDialogFormTools = (type, data) => {
if (type === "add") { if (type === "add") {
getDataAssignHr() getDataAssignHr()
} }
if (type === "success") { if (type === "success") {
NotificationManager.success( NotificationManager.success(
`Assign Customer Project berhasil disimpan!`, `Assign Customer Project berhasil disimpan!`,
"Success!!" "Success!!"
); );
} else if (type === "failed") { } else if (type === "failed") {
NotificationManager.error( NotificationManager.error(
`Assign Customer Project gagal disimpan!`, `Assign Customer Project gagal disimpan!`,
"Failed!!" "Failed!!"
); );
} }
setOpenDialogFormTools(false) setOpenDialogFormTools(false)
} }
const toogleDialogFormTools = () => { const toogleDialogFormTools = () => {
@ -189,10 +189,10 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
<div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Spin tip="Loading..." spinning={loading}> <Spin tip="Loading..." spinning={loading}>
{renderForm()} {renderForm()}
</Spin> </Spin>
</ModalBody> </ModalBody>
</Modal> </Modal>
<FormAsignCust <FormAsignCust
@ -200,6 +200,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
closeDialog={handleCloseDialogFormTools} closeDialog={handleCloseDialogFormTools}
toggleDialog={toogleDialogFormTools} toggleDialog={toogleDialogFormTools}
idTask={idTask} idTask={idTask}
company_id={company_id}
/> />
</> </>
) )

73
src/views/SimproV2/CreatedProyek/AsignHrProject.js

@ -4,14 +4,14 @@ import { Button, Form } from 'reactstrap';
import { Table, Tooltip, Spin } from 'antd'; import { Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import moment from 'moment'; import moment from 'moment';
import { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst'; import { USER_SEARCH, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignHr from './FormAsignHr'; import FormAsignHr from './FormAsignHr';
import { formatThousand } from '../../../const/CustomFunc'; import { formatThousand } from '../../../const/CustomFunc';
const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsResource, proyekName }) => { const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, company_id, proyekName }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -25,18 +25,18 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
const [openDialogFormTools, setOpenDialogFormTools] = useState(false) const [openDialogFormTools, setOpenDialogFormTools] = useState(false)
const [dataEdit, setDataEdit] = useState(null) const [dataEdit, setDataEdit] = useState(null)
const [listUser, setListUser] = useState([]) const [listUser, setListUser] = useState([])
const [listRole, setListRole] = useState([]) const [listRole, setListRole] = useState([])
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (idTask > 0) { if (idTask > 0) {
setLoading(true); setLoading(true);
getDataAssignHr(); getDataAssignHr();
} }
}, [openDialog]); }, [openDialog]);
useEffect(() => { useEffect(() => {
if (openDialog) { if (openDialog) {
getDataProjectRole(); getDataProjectRole();
getDataUser(); getDataUser();
} }
@ -50,8 +50,8 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
}, },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" }, { "name": "name", "logic_operator": "ilike", "value": "", "table_name": "m_users" },
{ "name": "proyek_id", "logic_operator": "=", "value": idTask }, { "name": "proyek_id", "logic_operator": "=", "value": idTask },
{ "name": "is_customer", "logic_operator": "=", "value": "false" } { "name": "is_customer", "logic_operator": "=", "value": "false" }
], ],
"joins": [ "joins": [
{ "name": "m_users", "column_join": "user_id", "column_results": ["name"] }, { "name": "m_users", "column_join": "user_id", "column_results": ["name"] },
@ -72,23 +72,38 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [] let dataRes = result.data.data || []
setdataUserToProject(dataRes); setdataUserToProject(dataRes);
setLoading(false); setLoading(false);
} else { } else {
setLoading(false); setLoading(false);
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
const getDataUser = async () => { const getDataUser = async () => {
const HEADER_ADW = {
headers: { const payload = {
"Authorization": `${TOKEN_ADW}` "select": [
"id",
"name",
"role_id"
],
"paging": {
"start": 0,
"length": -1
},
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id },
],
"orders": {
"columns": [
"id"
],
"ascending": false
} }
} }
const result = await axios const result = await axios
// .get(`${API_ADW}employees`, HEADER_ADW) .post(USER_SEARCH, payload, HEADER)
.get(USER_LIST, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.data.length != 0) { if (result && result.data && result.data.data.length != 0) {
@ -161,7 +176,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
} }
const handleOpenDialogFormTools = () => { const handleOpenDialogFormTools = () => {
setOpenDialogFormTools(true) setOpenDialogFormTools(true)
} }
const handleCancel = () => { const handleCancel = () => {
@ -177,10 +192,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
key: 'x', key: 'x',
className: "nowrap", className: "nowrap",
render: (text, record) => <><Tooltip title="Delete Request Resource"> render: (text, record) => <><Tooltip title="Delete Request Resource">
<Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button> <Button size={"sm"} color='danger' onClick={() => handleDelete(text.id)}><i className="fa fa-trash"></i></Button>
</Tooltip>{" "}<Tooltip title="Edit Request Resource"> </Tooltip>{" "}<Tooltip title="Edit Request Resource">
<Button size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button> <Button size={"sm"} color='primary' onClick={() => handleEdit(text)}><i className="fa fa-edit"></i></Button>
</Tooltip></>, </Tooltip></>,
}, },
{ title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" }, { title: 'Name Human Resource', dataIndex: 'join_first_name', key: 'join_first_name', className: "nowrap" },
{ title: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" }, { title: 'Role Human Resource', dataIndex: 'join_second_name', key: 'join_second_name', className: "nowrap" },
@ -204,18 +219,18 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
const renderForm = () => { const renderForm = () => {
return ( return (
<div style={{"overflowX":"scroll"}}> <div style={{ "overflowX": "scroll" }}>
{RenderTable} {RenderTable}
</div> </div>
) )
} }
const handleCloseDialogFormTools = (type, data) => { const handleCloseDialogFormTools = (type, data) => {
if(type=="add"){ if (type == "add") {
addDataAssignHr(data); addDataAssignHr(data);
}else if(type=="edit"){ } else if (type == "edit") {
editDataAssignHr(data); editDataAssignHr(data);
}else{ } else {
setDataEdit(null) setDataEdit(null)
setOpenDialogFormTools(false) setOpenDialogFormTools(false)
} }
@ -237,7 +252,7 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
} }
} }
const editDataAssignHr = async (payload) => { const editDataAssignHr = async (payload) => {
let url = ASSIGN_HR_PROJECT_EDIT(payload.id) let url = ASSIGN_HR_PROJECT_EDIT(payload.id)
const result = await axios const result = await axios
.put(url, payload, HEADER) .put(url, payload, HEADER)
@ -283,10 +298,10 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
<div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button> <div>Assign Human Resource - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
<Spin tip="Loading..." spinning={loading}> <Spin tip="Loading..." spinning={loading}>
{renderForm()} {renderForm()}
</Spin> </Spin>
</ModalBody> </ModalBody>
{/* <ModalFooter> {/* <ModalFooter>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>Close</Button>

87
src/views/SimproV2/CreatedProyek/DialogAssignCust.js

@ -12,7 +12,7 @@ import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) => { const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, company_id }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -46,19 +46,20 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
"name", "name",
"role_id" "role_id"
], ],
"paging": { "paging": {
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "role_id", "logic_operator": "=", "value": 44 } { "name": "role_id", "logic_operator": "=", "value": 44 },
], { "name": "company_id", "logic_operator": "=", "value": company_id },
"orders": { ],
"columns": [ "orders": {
"id" "columns": [
], "id"
"ascending": false ],
} "ascending": false
}
} }
const URL = USER_SEARCH; const URL = USER_SEARCH;
const result = await axios const result = await axios
@ -90,7 +91,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
handleCLearData() handleCLearData()
} }
const saveCustProject= async () => { const saveCustProject = async () => {
const formData = { const formData = {
user_id: targetKeys, user_id: targetKeys,
@ -102,9 +103,9 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
closeDialog('success') closeDialog('success')
}else{ } else {
closeDialog('failed') closeDialog('failed')
} }
} }
@ -120,32 +121,32 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
const getCustProject = async () => { const getCustProject = async () => {
const payload = { const payload = {
"select": [ "select": [
"id", "id",
"user_id", "user_id",
"proyek_id", "proyek_id",
"is_customer" "is_customer"
], ],
"columns": [ "columns": [
{ "name": "proyek_id", "logic_operator": "=", "value": idTask }, { "name": "proyek_id", "logic_operator": "=", "value": idTask },
{"name": "is_customer", "logic_operator": "=", "value": "true"} { "name": "is_customer", "logic_operator": "=", "value": "true" }
] ]
} }
const result = await axios const result = await axios
.post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER) .post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
console.log("cek get assign HR is custumer",result.data.data) console.log("cek get assign HR is custumer", result.data.data)
let data = result.data.data || [] let data = result.data.data || []
let newTargetKeys = [] let newTargetKeys = []
if (data.length > 0) { if (data.length > 0) {
data.map((val,index)=> { data.map((val, index) => {
newTargetKeys.push(val.user_id) newTargetKeys.push(val.user_id)
}); });
} }
setTargetKeys(newTargetKeys) setTargetKeys(newTargetKeys)
} }
} }
const renderForm = () => { const renderForm = () => {
@ -158,16 +159,16 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
overflow: "auto" overflow: "auto"
}}> }}>
<Transfer <Transfer
showSearch showSearch
titles={['Available Customer', 'Granted to']} titles={['Available Customer', 'Granted to']}
dataSource={assignCustomer} dataSource={assignCustomer}
targetKeys={targetKeys} targetKeys={targetKeys}
onChange={handleChange} onChange={handleChange}
render={item => item.title} render={item => item.title}
listStyle={{ listStyle={{
width: 250, width: 250,
height: 300, height: 300,
}} }}
/> />
</div> </div>
) )
@ -176,7 +177,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
return ( return (
<> <>
<Modal size="lg" style={{maxWidth: '600px', width: '100%'}} isOpen={openDialog} toggle={toggleDialog}> <Modal size="lg" style={{ maxWidth: '600px', width: '100%' }} isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Add Customer</ModalHeader> <ModalHeader className="capitalize" toggle={closeDialog}>Add Customer</ModalHeader>
<ModalBody> <ModalBody>
{renderForm()} {renderForm()}

1391
src/views/SimproV2/CreatedProyek/DialogFormProyek.js

File diff suppressed because it is too large Load Diff

75
src/views/SimproV2/CreatedProyek/DialogUserGantt.js

@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form } from 'reactstrap'; import { Button, Form } from 'reactstrap';
import axios from "../../../const/interceptorApi"; import axios from "../../../const/interceptorApi";
import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH, USER_LIST} from '../../../const/ApiConst'; import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH, USER_LIST } from '../../../const/ApiConst';
import { Transfer } from 'antd'; import { Transfer, Spin } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => { const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const HEADER = { const HEADER = {
headers: { headers: {
@ -17,7 +17,7 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [targetKeys, setTargetKeys] = useState([]) const [targetKeys, setTargetKeys] = useState([])
const [humanResource, setHumanResource] = useState([]) const [humanResource, setHumanResource] = useState([])
const [loading, setLoading] = useState(true);
const handleCLearData = () => { const handleCLearData = () => {
setId(0) setId(0)
@ -25,16 +25,16 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
} }
useEffect(() => { useEffect(() => {
if(!openDialog){ if (!openDialog) {
handleCLearData() handleCLearData()
} else { } else {
getDataHumanResource(); getDataHumanResource();
} }
}, [openDialog]) }, [openDialog])
useEffect(() => { useEffect(() => {
if(idGantt && idGantt > 0){ if (idGantt && idGantt > 0) {
getUserGantt() getUserGantt()
} }
}, [idGantt]) }, [idGantt])
@ -64,28 +64,30 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
} }
const getUserGantt = async () => { const getUserGantt = async () => {
setLoading(true)
const payload = { const payload = {
"columns": [ "columns": [
{ "name": "version_gantt_id", "logic_operator": "=", "value": idGantt, "operator": "AND" } { "name": "version_gantt_id", "logic_operator": "=", "value": idGantt, "operator": "AND" }
] ]
} }
const result = await axios const result = await axios
.post(USER_VERSION_GANTT_SEARCH, payload, HEADER) .post(USER_VERSION_GANTT_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
console.log("cek resource get user gantt",result.data.data) console.log("cek resource get user gantt", result.data.data)
setUserGantt(result.data.data); setUserGantt(result.data.data);
}else{ setLoading(false)
} else {
} }
} }
const setUserGantt = (data) => { const setUserGantt = (data) => {
let newTargetKeys = [] let newTargetKeys = []
data.map((val,index)=> { data.map((val, index) => {
newTargetKeys.push(val.user_id) newTargetKeys.push(val.user_id)
}); });
setTargetKeys(newTargetKeys) setTargetKeys(newTargetKeys)
} }
@ -95,11 +97,11 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
handleCLearData() handleCLearData()
} }
const saveVersionGantt= async () => { const saveVersionGantt = async () => {
const formData = { const formData = {
user_id:targetKeys, user_id: targetKeys,
version_gantt_id:idGantt version_gantt_id: idGantt
} }
const result = await axios const result = await axios
@ -108,9 +110,9 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
.catch((error) => error.response); .catch((error) => error.response);
if(result && result.status==200){ if (result && result.status == 200) {
closeDialog('success') closeDialog('success')
}else{ } else {
closeDialog('failed') closeDialog('failed')
} }
} }
@ -134,16 +136,19 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
overflow: "auto" overflow: "auto"
}}> }}>
<Transfer <Transfer
showSearch showSearch
titles={['Available HR', 'Granted to']} filterOption={(inputValue, option) =>
dataSource={humanResource} option.title.toLowerCase().includes(inputValue.toLowerCase())
targetKeys={targetKeys} }
onChange={handleChange} titles={['Available HR', 'Granted to']}
render={item => item.title} dataSource={humanResource}
listStyle={{ targetKeys={targetKeys}
width: 250, onChange={handleChange}
height: 300, render={item => item.title}
}} listStyle={{
width: 250,
height: 300,
}}
/> />
</div> </div>
) )
@ -152,10 +157,12 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
return ( return (
<> <>
<Modal size="lg" style={{maxWidth: '600px', width: '100%'}} isOpen={openDialog} toggle={toggleDialog}> <Modal size="lg" style={{ maxWidth: '600px', width: '100%' }} isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Gantt Permission</ModalHeader> <ModalHeader className="capitalize" toggle={closeDialog}>Gantt Permission</ModalHeader>
<ModalBody> <ModalBody>
{renderForm()} <Spin tip="Loading..." spinning={loading}>
{renderForm()}
</Spin>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button color="primary" onClick={() => handleSave()}>Save</Button>{' '} <Button color="primary" onClick={() => handleSave()}>Save</Button>{' '}

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

@ -23,31 +23,23 @@ import {
} from "antd"; } from "antd";
import { import {
PROJECT_APPROVAL_ADD, PROJECT_APPROVAL_ADD,
PROJECT_APPROVAL_EDIT,
PROJECT_PARTICIPANT_ADD, PROJECT_PARTICIPANT_ADD,
PROJECT_CHECKLIST_ADD, PROJECT_CHECKLIST_ADD,
PROJECT_ISSUE_ADD, PROJECT_ISSUE_ADD,
PROJECT_RISK_ADD, PROJECT_RISK_ADD,
PROJECT_PARTICIPANT_EDIT,
PROJECT_MILESTONE_ADD, PROJECT_MILESTONE_ADD,
PROJECT_MILESTONE_EDIT,
PROJECT_PARTICIPANT_DELETE_BY_PROYEK, PROJECT_PARTICIPANT_DELETE_BY_PROYEK,
PROJECT_MILESTONE_DELETE_BY_PROYEK, PROJECT_MILESTONE_DELETE_BY_PROYEK,
PROJECT_APPROVAL_DELETE_BY_PROYEK, PROJECT_APPROVAL_DELETE_BY_PROYEK,
USER_LIST, USER_SEARCH,
TYPE_PROYEK,
PROJECT_TYPE_SEARCH,
PROYEK_ADD, PROYEK_ADD,
PROYEK_SEARCH, PROYEK_SEARCH,
PROYEK_SEARCH_BY_USER,
PROYEK_EDIT, PROYEK_EDIT,
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
PROJECT_CHECKLIST_SEARCH, PROJECT_CHECKLIST_SEARCH,
PROYEK_DELETE, PROYEK_DELETE,
TOOLS_RESOURCE_SEARCH,
MATERIAL_RESOURCE_SEARCH,
USER_SEARCH,
PROJECT_CHARTER_SEARCH,
HIERARCHY_FTTH_SEARCH,
PROJECT_ISSUE_SEARCH, PROJECT_ISSUE_SEARCH,
PROJECT_RISK_SEARCH, PROJECT_RISK_SEARCH,
PROJECT_CHECKLIST_DELETE_BY_PROYEK, PROJECT_CHECKLIST_DELETE_BY_PROYEK,
@ -61,18 +53,15 @@ import {
PROJECT_APPROVAL_SEARCH, PROJECT_APPROVAL_SEARCH,
CHECKLIST_K3_LIST, CHECKLIST_K3_LIST,
VERSION_GANTT_SEARCH, VERSION_GANTT_SEARCH,
PHASE_PROYEK, PROJECT_PHASE_SEARCH,
DIVISI_LIST, DIVISI_SEARCH,
BASE_OSPRO, BASE_OSPRO,
IMAGE_UPLOAD, IMAGE_UPLOAD,
IMAGE_GET_BY_ID, IMAGE_GET_BY_ID,
IMAGE_DELETE, IMAGE_DELETE,
} from "../../../const/ApiConst"; } from "../../../const/ApiConst";
import { import {
formatNumber, formatThousand
formatRupiah,
formatThousand,
renderFormatRupiah,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
import moment from "moment"; import moment from "moment";
// import DialogFormResource from './DialogFormResource'; // import DialogFormResource from './DialogFormResource';
@ -96,7 +85,7 @@ const url = "";
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => { const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = ''; let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0;
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
@ -109,6 +98,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id = localStorage.getItem("user_id"); user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin"); isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
} }
const history = useHistory(); const history = useHistory();
const HEADER = { const HEADER = {
@ -234,8 +224,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetTipeProject = async () => { const handleGetTipeProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(TYPE_PROYEK, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -245,8 +244,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetPhaseProject = async () => { const handleGetPhaseProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(PHASE_PROYEK, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -255,8 +263,17 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleGetDivisions = async () => { const handleGetDivisions = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(DIVISI_LIST, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -266,9 +283,18 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const handleGetDataPm = async (text) => { const handleGetDataPm = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios const result = await axios
.get(USER_LIST, HEADER) .post(USER_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
.catch((err) => err.response); .catch((err) => err.response);
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
@ -304,6 +330,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const getDataProyek = async () => { const getDataProyek = async () => {
setLoading(true);
let start = 0; let start = 0;
let hierarchy = []; let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy"))); hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
@ -468,10 +495,6 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const handleOpenDialog = (id) => {
setOpenDialog(true);
setidTask(id);
};
const handleOpenDialogProyek = async (id) => { const handleOpenDialogProyek = async (id) => {
setOpenDialogProyek(true); setOpenDialogProyek(true);
@ -531,12 +554,6 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAssignK3(true); setOpenDialogAssignK3(true);
}; };
const handleOpenDialogTools = (data) => {
setOpenDialogTools(true);
setidTask(data.id);
setProyekName(data.nama);
setUserProyek(data.user_proyeks);
};
const handleOpenDialogViewDetail = async (data) => { const handleOpenDialogViewDetail = async (data) => {
setLoading(true); setLoading(true);
@ -1132,6 +1149,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const editProyek = async (data) => { const editProyek = async (data) => {
setLoading(true)
const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter; const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter;
const imageObject = data.imageStructureOrg; const imageObject = data.imageStructureOrg;
@ -1852,6 +1870,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignHr} handleClose={handleCloseDialogAsignHr}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={company_id}
/> />
), ),
[openDialogAsignHR] [openDialogAsignHR]
@ -1867,6 +1886,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignCust} handleClose={handleCloseDialogAsignCust}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={company_id}
/> />
), ),
[openDialogAsignCust] [openDialogAsignCust]

140
src/views/SimproV2/Divisi/DialogForm.js

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { import {
Modal, ModalHeader, ModalBody, ModalFooter, Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row Button, Form, FormGroup, Label, Input, Col, Row
} from 'reactstrap'; } from 'reactstrap';
import { Select } from 'antd'; import { Select } from 'antd';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
@ -10,30 +10,30 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, company_id }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
const [parent, setParent] = useState(null) const [parent, setParent] = useState(null)
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [color, setColor] = useState('') const [color, setColor] = useState('')
const { t } = useTranslation() const { t } = useTranslation()
const onChangeParent = (val) => { const onChangeParent = (val) => {
setParent(val) setParent(val)
} }
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit") { if (typeDialog === "Edit") {
setId(dataEdit.id) setId(dataEdit.id)
setDescription(dataEdit.description) setDescription(dataEdit.description)
setName(dataEdit.name) setName(dataEdit.name)
setParent(dataEdit.parent) setParent(dataEdit.parent)
setColor(dataEdit.color) setColor(dataEdit.color)
} else { } else {
setId(0) setId(0)
setColor('') setColor('')
} }
}, [dataEdit, openDialog]) }, [dataEdit, openDialog])
const validation = () => { const validation = () => {
if (!name || name === "") { if (!name || name === "") {
@ -51,7 +51,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
name, name,
description, description,
parent, parent,
color color,
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
@ -60,7 +61,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
name, name,
description, description,
parent, parent,
color color,
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -70,34 +72,34 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setParent(null) setParent(null)
setColor('') setColor('')
} }
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
setId(0) setId(0)
setDescription('') setDescription('')
setName('') setName('')
setParent(null) setParent(null)
} }
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
<Row> <Row>
<Col md={12}> <Col md={12}>
<span style={{ color: "red" }}>*</span> Wajib diisi. <span style={{ color: "red" }}>*</span> Wajib diisi.
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize">{t('name')}<span style={{ color: "red" }}>*</span></Label> <Label className="capitalize">{t('name')}<span style={{ color: "red" }}>*</span></Label>
<Input <Input
type="text" type="text"
value={name} value={name}
onChange={(e) => setName(e.target.value)} onChange={(e) => setName(e.target.value)}
placeholder={t('inputName')} placeholder={t('inputName')}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
@ -116,13 +118,13 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col md={12}> <Col md={12}>
<FormGroup> <FormGroup>
<Label className="capitalize">{t('description')}</Label> <Label className="capitalize">{t('description')}</Label>
<Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} /> <Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} />
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
@ -131,25 +133,25 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
</Form> </Form>
) )
} }
return ( return (
<> <>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> <Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Save" ? `Add` : "Edit"} {t('division')}</ModalHeader> <ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Save" ? `Add` : "Edit"} {t('division')}</ModalHeader>
<ModalBody> <ModalBody>
{renderForm()} {renderForm()}
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button color="primary" onClick={() => handleSave()}>{typeDialog}</Button>{' '} <Button color="primary" onClick={() => handleSave()}>{typeDialog}</Button>{' '}
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>{t('cancel')}</Button> <Button className="capitalize" color="secondary" onClick={() => handleCancel()}>{t('cancel')}</Button>
</ModalFooter> </ModalFooter>
</Modal> </Modal>
</> </>
) )
} }

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

@ -69,8 +69,31 @@ const ProjectType = ({ params, ...props }) => {
}, [dataExport]) }, [dataExport])
const getListDivision = async () => { const getListDivision = async () => {
const payload = {
columns: [],
"orders": {
"ascending": true,
"columns": [
'name'
]
},
"paging": {
"length": 0,
"start": -1
}
}
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
}
const listDivions = await axios const listDivions = await axios
.get(DIVISI_LIST, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -321,6 +344,7 @@ const ProjectType = ({ params, ...props }) => {
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
dataDivisions={dataDivisions} dataDivisions={dataDivisions}
company_id={company_id}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

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

@ -87,7 +87,17 @@ const ResourceWorker = ({ params, ...props }) => {
const getRoleList = async () => { const getRoleList = async () => {
const formData = { const formData = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false },
"columns": [],
}
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
} }
const result = await axios const result = await axios
@ -103,7 +113,18 @@ const ResourceWorker = ({ params, ...props }) => {
const getDivisiList = async () => { const getDivisiList = async () => {
const formData = { const formData = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false },
"columns": [],
}
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
} }
const result = await axios const result = await axios
@ -248,12 +269,6 @@ const ResourceWorker = ({ params, ...props }) => {
} }
const handleSync = async () => {
await axios.get(USER_SYNC, HEADER)
.then(res => res)
.catch((error) => error.response)
}
const handleExportExcel = async () => { const handleExportExcel = async () => {
let start = 0; let start = 0;
@ -580,9 +595,6 @@ const ResourceWorker = ({ params, ...props }) => {
<Tooltip title={t('hradd')}> <Tooltip title={t('hradd')}>
<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>
</Tooltip> </Tooltip>
<Tooltip title="HR Sync">
<Button style={{ background: "#007bff ", color: "#fff", marginLeft: "5px" }} onClick={() => handleSync()}><i className="fa fa-spinner"></i></Button>
</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>
</Tooltip> </Tooltip>

Loading…
Cancel
Save