Browse Source

Merge pull request 'dev-wahyun' (#7) from dev-wahyun into staging

Reviewed-on: #7
pull/8/head
ibnu 5 months ago
parent
commit
575ecf41c6
  1. 40
      src/const/ApiConst.js
  2. 67
      src/containers/DefaultLayout/DefaultLayout.js
  3. 2
      src/routes.js
  4. 31
      src/views/Dashboard/DashboardBOD.js
  5. 3
      src/views/Dashboard/DashboardCustomer.js
  6. 119
      src/views/Dashboard/DashboardProject.js
  7. 5
      src/views/Dashboard/DashboardProjectCarousell.js
  8. 5
      src/views/MapMonitoring/index.js
  9. 13
      src/views/Master/MasterAbsensi/index.js
  10. 53
      src/views/Master/MasterBroadcast/DialogForm.js
  11. 51
      src/views/Master/MasterBroadcast/index.js
  12. 8
      src/views/Master/MasterCompany/index.js
  13. 62
      src/views/Master/MasterRoles/DialogForm.js
  14. 7
      src/views/Master/MasterRoles/DialogMenuRoles.js
  15. 49
      src/views/Master/MasterRoles/index.js
  16. 7
      src/views/Master/ProjectExpenditure/DialogForm.js
  17. 13
      src/views/Master/ProjectExpenditure/index.js
  18. 7
      src/views/Master/ProjectFinancialHealth/DialogForm.js
  19. 13
      src/views/Master/ProjectFinancialHealth/index.js
  20. 7
      src/views/Master/ProjectInvoice/DialogForm.js
  21. 13
      src/views/Master/ProjectInvoice/index.js
  22. 47
      src/views/Master/ProjectPhase/DialogForm.js
  23. 71
      src/views/Master/ProjectPhase/index.js
  24. 7
      src/views/Master/ProjectScheduleHealth/DialogForm.js
  25. 13
      src/views/Master/ProjectScheduleHealth/index.js
  26. 3
      src/views/Master/Proyek/index.js
  27. 73
      src/views/Master/RoleProject/DialogForm.js
  28. 73
      src/views/Master/RoleProject/index.js
  29. 8
      src/views/Pages/Login/Login.js
  30. 26
      src/views/Report/k3/index.js
  31. 49
      src/views/SimproV2/ChecklistK3/DialogForm.js
  32. 75
      src/views/SimproV2/ChecklistK3/index.js
  33. 3
      src/views/SimproV2/Closing/index.js
  34. 5
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  35. 8
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  36. 5
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  37. 16
      src/views/SimproV2/CreatedProyek/DialogDocument.js
  38. 57
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  39. 4
      src/views/SimproV2/CreatedProyek/DialogGantt.js
  40. 10
      src/views/SimproV2/CreatedProyek/FormDocument.js
  41. 152
      src/views/SimproV2/CreatedProyek/index.js
  42. 5
      src/views/SimproV2/DemoRequest/index.js
  43. 71
      src/views/SimproV2/Divisi/DialogForm.js
  44. 79
      src/views/SimproV2/Divisi/index.js
  45. 6
      src/views/SimproV2/Gantt/GanttFrame.js
  46. 4
      src/views/SimproV2/Gantt/index.js
  47. 27
      src/views/SimproV2/LimitasiUser/index.js
  48. 13
      src/views/SimproV2/PanicButton/index.js
  49. 4
      src/views/SimproV2/PlanningHarian/index.js
  50. 26
      src/views/SimproV2/Presence/index.js
  51. 8
      src/views/SimproV2/Profile/index.js
  52. 41
      src/views/SimproV2/ProjectType/DialogForm.js
  53. 70
      src/views/SimproV2/ProjectType/index.js
  54. 10
      src/views/SimproV2/ResourceMaterial/index.js
  55. 43
      src/views/SimproV2/ResourceWorker/DialogForm.js
  56. 80
      src/views/SimproV2/ResourceWorker/index.js
  57. 54
      src/views/SimproV2/Satuan/DialogForm.js
  58. 69
      src/views/SimproV2/Satuan/index.js
  59. 12
      src/views/SimproV2/Settings/components/MyProfile/Index.js
  60. 21
      src/views/SimproV2/Settings/components/Plan/Container1.js
  61. 2
      src/views/testgantt/index.js

40
src/const/ApiConst.js

@ -126,11 +126,11 @@ export let BASE_OSPRO = "https://si-api.ospro.id";
export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`; export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`; export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`; export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name, dateFile) => { export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file) => {
return `${BASE_OSPRO}/assets/${company_name}/${dateFile}/file/project/${file}`; return `${BASE_OSPRO}/assets/file/project/${file}`;
} }
export let BASE_SIMPRO_LUMEN_IMAGE_COMPANY = (file, company_name, dateFile) => { export let BASE_SIMPRO_LUMEN_IMAGE_COMPANY = (file) => {
return `${BASE_OSPRO}/assets/${company_name}/${dateFile}/image/${file}`; return `${BASE_OSPRO}/assets/image/${file}`;
} }
export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`; export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`;
@ -289,9 +289,7 @@ export const TRANSACTION_DELETE = (id) => {
}; };
export const TRANSACTION_LIST = `${BASE_SIMPRO_LUMEN}/product-transaction/list`; export const TRANSACTION_LIST = `${BASE_SIMPRO_LUMEN}/product-transaction/list`;
export const STORAGE_LIMIT_INFORMATION = (company_name) => { export const STORAGE_LIMIT_INFORMATION = `${BASE_SIMPRO_LUMEN}/information-storage`;
return `${BASE_SIMPRO_LUMEN}/information-storage/${company_name}`;
};
export const STORAGE_LIMIT_INFORMATION_ALL_COMPANY = `${BASE_SIMPRO_LUMEN}/information-storage-all-company` export const STORAGE_LIMIT_INFORMATION_ALL_COMPANY = `${BASE_SIMPRO_LUMEN}/information-storage-all-company`
export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`; export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`;
@ -320,11 +318,11 @@ export const DOCUMENT_SEARCH = `${BASE_SIMPRO_LUMEN}/document-project/search`;
export const DOCUMENT_EDIT = (id) => { export const DOCUMENT_EDIT = (id) => {
return `${BASE_SIMPRO_LUMEN}/document-project/update/${id}`; return `${BASE_SIMPRO_LUMEN}/document-project/update/${id}`;
}; };
export const DOCUMENT_DELETE = (id, company_id) => { export const DOCUMENT_DELETE = (id) => {
return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/document-project/delete/${id}`;
}; };
export const DOCUMENT_DOWNLOAD = (id, company_id) => { export const DOCUMENT_DOWNLOAD = (id) => {
return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/document-project/download/${id}`;
}; };
export const ROLE_ADD = `${BASE_SIMPRO_LUMEN}/role/add`; export const ROLE_ADD = `${BASE_SIMPRO_LUMEN}/role/add`;
@ -436,8 +434,8 @@ export const PROYEK_GET_ID = (id) => {
export const PROYEK_EDIT = (id) => { export const PROYEK_EDIT = (id) => {
return `${BASE_SIMPRO_LUMEN}/project/update/${id}`; return `${BASE_SIMPRO_LUMEN}/project/update/${id}`;
}; };
export const PROYEK_DELETE = (id, company_id) => { export const PROYEK_DELETE = (id) => {
return `${BASE_SIMPRO_LUMEN}/project/delete/${id}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/project/delete/${id}`;
}; };
export const PROJECT_ROLE_ADD = `${BASE_SIMPRO_LUMEN}/project-role/add`; export const PROJECT_ROLE_ADD = `${BASE_SIMPRO_LUMEN}/project-role/add`;
@ -722,8 +720,8 @@ export const ASSIGN_HR_PROJECT_SEARCH = `${BASE_SIMPRO_LUMEN}/user-to-proyek/sea
export const ASSIGN_HR_PROJECT_EDIT = (id) => { export const ASSIGN_HR_PROJECT_EDIT = (id) => {
return `${BASE_SIMPRO_LUMEN}/user-to-proyek/update/${id}`; return `${BASE_SIMPRO_LUMEN}/user-to-proyek/update/${id}`;
}; };
export const ASSIGN_HR_PROJECT_DELETE = (id, company_id) => { export const ASSIGN_HR_PROJECT_DELETE = (id) => {
return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/user-to-proyek/delete/${id}`;
}; };
export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`; export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`;
@ -741,8 +739,8 @@ export const FOLDER_DOCUMENT_PROYEK_ADD = `${BASE_SIMPRO_LUMEN}/folder-document-
export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`; export const FOLDER_DOCUMENT_PROYEK_SEARCH = `${BASE_SIMPRO_LUMEN}/folder-document-proyek/search`;
export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) => export const FOLDER_DOCUMENT_PROYEK_UPDATE = (id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/update/${id}`;
export const FOLDER_DOCUMENT_PROYEK_DELETE = (id, company_id) => export const FOLDER_DOCUMENT_PROYEK_DELETE = (id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}/${company_id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/delete/${id}`;
export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) => export const FOLDER_DOCUMENT_PROYEK_GET_TREE = (proyek_id) =>
`${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`; `${BASE_SIMPRO_LUMEN}/folder-document-proyek/get-tree/${proyek_id}`;
@ -793,11 +791,11 @@ export const IMAGE_SEARCH = `${BASE_SIMPRO_LUMEN}/image/search`;
export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`; export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`;
export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`; export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`;
export const IMAGE_MULTIPLE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/multiple-upload`; export const IMAGE_MULTIPLE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/multiple-upload`;
export const IMAGE_MULTIPLE_DELETE = (id, category, company_id) => { export const IMAGE_MULTIPLE_DELETE = (id, category) => {
return `${BASE_SIMPRO_LUMEN}/image/multiple-delete/${id}/${category}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/image/multiple-delete/${id}/${category}`;
} }
export const IMAGE_DELETE = (id, category, company_id) => { export const IMAGE_DELETE = (id, category) => {
return `${BASE_SIMPRO_LUMEN}/image/delete/${id}/${category}/${company_id}`; return `${BASE_SIMPRO_LUMEN}/image/delete/${id}/${category}`;
} }

67
src/containers/DefaultLayout/DefaultLayout.js

@ -39,16 +39,14 @@ class DefaultLayout extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
let role_id = '', token = '', company_id = 0, menu = '' let role_id = '', token = '', menu = ''
if (props.location.state && props.location.state.role_id) { if (props.location.state && props.location.state.role_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
token = props.location.state.token; token = props.location.state.token;
company_id = props.location.state.company_id;
menu = props.location.state.menu_login; menu = props.location.state.menu_login;
} else { } else {
role_id = localStorage.getItem("role_id"); role_id = localStorage.getItem("role_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
company_id = localStorage.getItem('company_id');
menu = localStorage.getItem("menu_login"); menu = localStorage.getItem("menu_login");
} }
@ -59,8 +57,7 @@ class DefaultLayout extends Component {
routes2: routes, routes2: routes,
finalRoutes: [], finalRoutes: [],
breadrCrumbReady: false, breadrCrumbReady: false,
minimized: true, minimized: true
company_id: company_id
}; };
} }
async componentDidMount() { async componentDidMount() {
@ -70,6 +67,7 @@ class DefaultLayout extends Component {
if (!localStorage.getItem("token")) { if (!localStorage.getItem("token")) {
this.signOut(); this.signOut();
} }
this.getQueryParams();
window.myData = "Data dari komponen React"; window.myData = "Data dari komponen React";
try { try {
const storedData = localStorage.getItem('configApp'); const storedData = localStorage.getItem('configApp');
@ -136,6 +134,12 @@ class DefaultLayout extends Component {
LayoutHelper.sidebarToggle(!this.state.minimized); LayoutHelper.sidebarToggle(!this.state.minimized);
}; };
getQueryParams() {
const searchParams = new URLSearchParams(this.props.location.search);
const dashboardGantt = searchParams.get('dashboardGantt');
this.setState({ dashboardGantt });
}
setFinalRoutes = () => { setFinalRoutes = () => {
const { routes2 } = this.state; const { routes2 } = this.state;
if (routes2) { if (routes2) {
@ -161,7 +165,6 @@ class DefaultLayout extends Component {
e.preventDefault() e.preventDefault()
} }
await localStorage.removeItem("role_id"); await localStorage.removeItem("role_id");
await localStorage.removeItem("company_id");
document.getElementById('title').innerText = 'OSPRO'; document.getElementById('title').innerText = 'OSPRO';
this.setFavicon(`${process.env.PUBLIC_URL}/OSPRO.ico`); this.setFavicon(`${process.env.PUBLIC_URL}/OSPRO.ico`);
await window.localStorage.clear(); await window.localStorage.clear();
@ -267,7 +270,7 @@ class DefaultLayout extends Component {
} }
getAppBreadcrumb = () => { getAppBreadcrumb = () => {
const { u_group } = this.state; const { u_group, dashboardGantt } = this.state;
if (u_group == 'kominfo') { if (u_group == 'kominfo') {
routes.map((route, idx) => { routes.map((route, idx) => {
if (route.path == '/dashboard-kominfo') { if (route.path == '/dashboard-kominfo') {
@ -279,7 +282,7 @@ class DefaultLayout extends Component {
}); });
} }
else { else {
if (!window.location.href.includes("dashboard")) { if (!window.location.href.includes("dashboard") || window.location.href.includes("dashboard-project") && !dashboardGantt) {
return <AppBreadcrumb appRoutes={this.state.finalRoutes} router={router} /> return <AppBreadcrumb appRoutes={this.state.finalRoutes} router={router} />
} }
} }
@ -299,12 +302,11 @@ class DefaultLayout extends Component {
const { location } = this.props; const { location } = this.props;
const { pathname } = location; const { pathname } = location;
let renderSidebar = false let renderSidebar = false
const isDashboardProject = this.props.location.pathname.startsWith('/dashboard-project/');
if (pathname.includes("/dashboard-project")) { if (pathname.includes("/dashboard-project")) {
// Remove the base URL and hash // Remove the base URL and hash
const path = pathname.replace("/dashboard-project/", ""); const path = pathname.replace("/dashboard-project/", "");
// Split the remaining path by "/"
// Split the remaining path by "/"
const parts = path.split("/"); const parts = path.split("/");
if (parts[2] == "1") { if (parts[2] == "1") {
renderSidebar = true renderSidebar = true
@ -313,37 +315,33 @@ class DefaultLayout extends Component {
return ( return (
<div className="app"> <div className="app">
{!window.location.href.includes("false-header") && (
<AppHeader fixed>
<DefaultHeader />
</AppHeader>
)
}
<div className="app-body"> <div className="app-body">
{!window.location.href.includes("dashboard-project") || renderSidebar ? ( {(isDashboardProject ? true : !window.location.href.includes("dashboard-project")) || renderSidebar ? (
<AppSidebar minimized={this.state.minimized} fixed display="lg"> (!this.state.dashboardGantt ? (
<AppSidebar minimized={this.state.minimized} fixed display="lg">
<AppSidebarHeader /> <hr />
<AppSidebarForm /> <AppSidebarHeader />
<Suspense> <AppSidebarForm />
<Suspense>
{this.getMenu()} {this.getMenu()}
</Suspense> </Suspense>
<AppSidebarFooter /> <AppSidebarFooter />
{this.state.minimized ? null : {this.state.minimized ? null :
<UncontrolledDropdown direction="down"> <UncontrolledDropdown direction="down">
<DropdownToggle nav> <DropdownToggle nav>
<i className="nav-icon fa fa-user-circle"></i> {localStorage.getItem('user_name')} <i className="nav-icon fa fa-user-circle"></i> {localStorage.getItem('user_name')}
</DropdownToggle> </DropdownToggle>
<DropdownMenu right> <DropdownMenu right>
<DropdownItem color="primary" size="sm" onClick={() => handleChangeLng("id")}>ID</DropdownItem> <DropdownItem color="primary" size="sm" onClick={() => handleChangeLng("id")}>ID</DropdownItem>
<DropdownItem color="success" size="sm" onClick={() => handleChangeLng("en")}>EN</DropdownItem> <DropdownItem color="success" size="sm" onClick={() => handleChangeLng("en")}>EN</DropdownItem>
<DropdownItem href="#/settings"><i className="fa fa-user"></i>Profile</DropdownItem> <DropdownItem href="#/settings"><i className="fa fa-user"></i>Profile</DropdownItem>
<DropdownItem onClick={e => this.signOut(e)}><i className="fa fa-sign-out"></i> Logout</DropdownItem> <DropdownItem onClick={e => this.signOut(e)}><i className="fa fa-sign-out"></i> Logout</DropdownItem>
</DropdownMenu> </DropdownMenu>
</UncontrolledDropdown>} </UncontrolledDropdown>}
<button className='sidebar-minimizer mt-auto' type='button' onClick={this.toggleMinimized}> <button className='sidebar-minimizer mt-auto' type='button' onClick={this.toggleMinimized}>
</button> </button>
</AppSidebar> </AppSidebar>
) : null)
) : null} ) : null}
<main className="main"> <main className="main">
{this.state.breadrCrumbReady ? this.getAppBreadcrumb() : null} {this.state.breadrCrumbReady ? this.getAppBreadcrumb() : null}
@ -364,7 +362,6 @@ class DefaultLayout extends Component {
user_id={props.location.state ? props.location.state.user_id : localStorage.getItem("user_id")} user_id={props.location.state ? props.location.state.user_id : localStorage.getItem("user_id")}
role_id={props.location.state ? props.location.state.role_id : localStorage.getItem("role_id")} role_id={props.location.state ? props.location.state.role_id : localStorage.getItem("role_id")}
isLogin={props.location.state ? props.location.state.isLogin : localStorage.getItem("isLogin")} isLogin={props.location.state ? props.location.state.isLogin : localStorage.getItem("isLogin")}
company_id={props.location.state ? props.location.state.company_id : localStorage.getItem("company_id")}
role_name={props.location.state ? props.location.state.role_name : localStorage.getItem("role_name")} role_name={props.location.state ? props.location.state.role_name : localStorage.getItem("role_name")}
all_project={props.location.state ? props.location.state.all_project : localStorage.getItem("all_project")} all_project={props.location.state ? props.location.state.all_project : localStorage.getItem("all_project")}
token={props.location.state ? props.location.state.token : localStorage.getItem("token")} token={props.location.state ? props.location.state.token : localStorage.getItem("token")}

2
src/routes.js

@ -68,7 +68,7 @@ const routes = [
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD }, { path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ path: '/dashboard-dyna', name: 'DashboardBOD', component: DashboardDyna }, { path: '/dashboard-dyna', name: 'DashboardBOD', component: DashboardDyna },
{ 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', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/dashboard-perproject', 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 },

31
src/views/Dashboard/DashboardBOD.js

@ -15,13 +15,12 @@ import { HealthByBudget, HealthBySchedule } from './Components';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Card, CardBody, CardHeader, Input } from "reactstrap"; import { Card, CardBody, CardHeader, Input } from "reactstrap";
const DashboardBOD = (props) => { const DashboardBOD = (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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -81,7 +80,7 @@ const DashboardBOD = (props) => {
// project expenditure // project expenditure
const getCompanyCashFlow = async () => { const getCompanyCashFlow = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project Expenditure."; const content = "Get Project Expenditure.";
@ -107,31 +106,31 @@ const DashboardBOD = (props) => {
// Project Expenditure Color // Project Expenditure Color
const getCompanyExpenditureColor = async () => { const getCompanyExpenditureColor = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure-color/${company_id}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure-color/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
SET_PROJECT_EXPENDITURE_COLOR(result.data.data) SET_PROJECT_EXPENDITURE_COLOR(result.data.data)
} }
const getCompanyFinancialHealthColor = async () => { const getCompanyFinancialHealthColor = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${company_id}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-financial-health-color/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
SET_PROJECT_FINANCIAL_HEALTH_COLOR(result.data.data) SET_PROJECT_FINANCIAL_HEALTH_COLOR(result.data.data)
} }
const getCompanyScheduleHealthColor = async () => { const getCompanyScheduleHealthColor = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-schedule-health-color/${company_id}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-schedule-health-color/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
SET_PROJECT_SCHEDULE_HEALTH_COLOR(result.data.data) SET_PROJECT_SCHEDULE_HEALTH_COLOR(result.data.data)
} }
const getCompanyInvoiceColor = async () => { const getCompanyInvoiceColor = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-invoice-color/${company_id}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-invoice-color/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
SET_PROJECT_INVOICE_COLOR(result.data.data) SET_PROJECT_INVOICE_COLOR(result.data.data)
} }
const getInvoiceOutstanding = async () => { const getInvoiceOutstanding = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-invoice-outstanding/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-invoice-outstanding/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project Invoice vs Cash In."; const content = "Get Project Invoice vs Cash In.";
@ -154,7 +153,7 @@ const DashboardBOD = (props) => {
} }
const getProjectPerScheduleHealth = async () => { const getProjectPerScheduleHealth = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-schedule-health/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-schedule-health/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Schedule Health."; const content = "Get Project by Schedule Health.";
@ -178,7 +177,7 @@ const DashboardBOD = (props) => {
} }
const getProjectPerBudgetHealth = async () => { const getProjectPerBudgetHealth = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-budget-health/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Budget Health."; const content = "Get Project by Budget Health.";
@ -201,7 +200,7 @@ const DashboardBOD = (props) => {
} }
const getProjectBudgetHealthPerDivision = async () => { const getProjectBudgetHealthPerDivision = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-budget-health-per-division/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Schedule Health per Division."; const content = "Get Project by Schedule Health per Division.";
@ -225,7 +224,7 @@ const DashboardBOD = (props) => {
} }
const getProjectScheduleHealthPerDivision = async () => { const getProjectScheduleHealthPerDivision = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-schedule-health-per-division/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Schedule Health."; const content = "Get Project by Schedule Health.";
@ -248,7 +247,7 @@ const DashboardBOD = (props) => {
} }
const getProjectPerPhase = async () => { const getProjectPerPhase = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-phase/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-phase/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Phase."; const content = "Get Project by Phase.";
@ -273,7 +272,7 @@ const DashboardBOD = (props) => {
} }
const getTotalProjectPerDivision = async () => { const getTotalProjectPerDivision = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-per-division/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project by Division."; const content = "Get Project by Division.";
@ -298,7 +297,7 @@ const DashboardBOD = (props) => {
} }
const getTotalProjectValuePerDivision = async () => { const getTotalProjectValuePerDivision = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-total-project-value-per-division/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project Value by Division"; const content = "Get Project Value by Division";
@ -327,7 +326,7 @@ const DashboardBOD = (props) => {
return; return;
} }
setOpenDetailedView(true); setOpenDetailedView(true);
const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure/${company_id}/${all_project}/${hierarchy}/${role_name}` const URL = `${BASE_OSPRO}/api/dashboard/get-detail-expenditure/${all_project}/${hierarchy}/${role_name}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Detail Expenditure"; const content = "Get Detail Expenditure";

3
src/views/Dashboard/DashboardCustomer.js

@ -26,13 +26,12 @@ const center = {
} }
const DashboardCustomer = (props) => { const DashboardCustomer = (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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;

119
src/views/Dashboard/DashboardProject.js

@ -31,57 +31,39 @@ import {
import { Fab, Action } from "react-tiny-fab"; import { Fab, Action } from "react-tiny-fab";
import "react-tiny-fab/dist/styles.css"; import "react-tiny-fab/dist/styles.css";
import { useHistory, useLocation, useParams } from "react-router-dom"; import { useHistory, useLocation, useParams } from "react-router-dom";
import { Icon } from '@iconify/react';
import arrowLeft from '@iconify/icons-ion/ios-arrow-back';
const { TextArea } = Input; const { TextArea } = Input;
const styles = {
cardContainer: {
backgroundColor: "#F8F8F8",
margin: 2,
paddingLeft: 20,
paddingRight: 20,
paddingTop: 10,
},
cardHeaderContainer: {
display: "flex",
flexDirection: "row",
marginBottom: 10,
},
cardChartContainer: {
position: "relative",
height: "21vh",
margin: "auto",
paddingBottom: 10,
justifyContent: "center",
},
cardTitle: { color: "#444444", fontSize: 16, fontWeight: "bold" },
cardSubtitle: { color: "#888888", fontSize: 12 },
};
const center = { const center = {
lat: -6.2, lat: -6.2,
lng: 106.816666, lng: 106.816666,
}; };
const DashboardProject = (props) => { const DashboardProject = (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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
hierarchy = props.hierarchy; hierarchy = props.hierarchy;
user_name = props.user_name; user_name = props.user_name;
} }
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}, },
}; };
const { PROJECT_ID, GANTT_ID, SCURVE } = useParams(); const { PROJECT_ID, GANTT_ID, SCURVE } = useParams();
const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}&company_id=${company_id}`; const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}`;
// const URL_GANTT = `http://localhost:8444/generic-ospro-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}&company_id=${company_id}`; // const URL_GANTT = `http://localhost:8444/generic-ospro-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1&role_name=${role_name}`;
const mapRef = useRef(); const mapRef = useRef();
const [projectName, setProjectName] = useState(""); const [projectName, setProjectName] = useState("");
@ -98,6 +80,7 @@ const DashboardProject = (props) => {
const [activeTabIdx, setActiveTabIdx] = useState(0); const [activeTabIdx, setActiveTabIdx] = useState(0);
const [activeTabCommentIdx, setActiveTabCommentIdx] = useState(0); const [activeTabCommentIdx, setActiveTabCommentIdx] = useState(0);
const [planningProgress, setPlanningProgress] = useState(0); const [planningProgress, setPlanningProgress] = useState(0);
const [planningProgressToDay, setPlanningProgressToDay] = useState(0);
const [actualProgress, setActualProgress] = useState(0); const [actualProgress, setActualProgress] = useState(0);
const [currentBudget, setCurrentBudget] = useState(null); const [currentBudget, setCurrentBudget] = useState(null);
const [addCostToComplete, setAddCostToComplete] = useState(null); const [addCostToComplete, setAddCostToComplete] = useState(null);
@ -135,6 +118,7 @@ const DashboardProject = (props) => {
const [isReadyGanttParents, setIsReadyGanttParents] = useState(false); const [isReadyGanttParents, setIsReadyGanttParents] = useState(false);
const [calculationStatus, setCalculationStatus] = useState(false); const [calculationStatus, setCalculationStatus] = useState(false);
const [isHierarchy, setIsHierarchy] = useState(null); const [isHierarchy, setIsHierarchy] = useState(null);
const [dashboardGantt, setDashboardStatus] = useState(false);
let history = useHistory(); let history = useHistory();
useEffect(() => { useEffect(() => {
getProjectDetail(); getProjectDetail();
@ -143,9 +127,11 @@ const DashboardProject = (props) => {
getComments(); getComments();
getGantt(); getGantt();
getGanttParents(); getGanttParents();
getQueryParams();
return () => { return () => {
}; };
}, []); }, []);
useEffect(() => { useEffect(() => {
if (isHierarchy != null) { if (isHierarchy != null) {
getSCurve(); getSCurve();
@ -155,11 +141,13 @@ const DashboardProject = (props) => {
window.removeEventListener("message", handleIframeMessage); window.removeEventListener("message", handleIframeMessage);
}; };
}, [isHierarchy]); }, [isHierarchy]);
useEffect(() => { useEffect(() => {
if (activeTabIdx === 1) { if (activeTabIdx === 1) {
initMap(); initMap();
} }
}, [activeTabIdx]); }, [activeTabIdx]);
useEffect(() => { useEffect(() => {
async function fetchData() { async function fetchData() {
await Promise.all([ await Promise.all([
@ -170,6 +158,7 @@ const DashboardProject = (props) => {
} }
fetchData(); fetchData();
}, []); }, []);
useEffect(() => { useEffect(() => {
let deviation = 0; let deviation = 0;
if (plannedCost && totalCost) { if (plannedCost && totalCost) {
@ -177,9 +166,11 @@ const DashboardProject = (props) => {
} }
setRemToComplete(deviation.toString()); setRemToComplete(deviation.toString());
}, [plannedCost, totalCost]); }, [plannedCost, totalCost]);
const handleRedirect = () => { const handleRedirect = () => {
history.push("/projects/" + GANTT_ID + "/" + PROJECT_ID + "/gantt"); history.push("/projects/" + GANTT_ID + "/" + PROJECT_ID + "/gantt");
}; };
const getManpower = async () => { const getManpower = async () => {
const url = `${BASE_OSPRO}/api/project/manpower/${PROJECT_ID}`; const url = `${BASE_OSPRO}/api/project/manpower/${PROJECT_ID}`;
try { try {
@ -188,6 +179,7 @@ const DashboardProject = (props) => {
} catch (error) { } catch (error) {
} }
}; };
const getGantt = async () => { const getGantt = async () => {
setIsReadyGantt(false); setIsReadyGantt(false);
const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}`; const url = `${BASE_OSPRO}/api/version-gantt/edit/${GANTT_ID}`;
@ -204,6 +196,7 @@ const DashboardProject = (props) => {
setIsReadyGantt(true); setIsReadyGantt(true);
} }
}; };
const getGanttParents = async () => { const getGanttParents = async () => {
setIsReadyGanttParents(false); setIsReadyGanttParents(false);
const url = `${BASE_OSPRO}/api/hierarchy-ftths/tree-gantt/${GANTT_ID}`; const url = `${BASE_OSPRO}/api/hierarchy-ftths/tree-gantt/${GANTT_ID}`;
@ -215,6 +208,7 @@ const DashboardProject = (props) => {
setIsReadyGanttParents(true); setIsReadyGanttParents(true);
} }
}; };
const getAssignedHR = async () => { const getAssignedHR = async () => {
const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`; const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`;
try { try {
@ -230,6 +224,7 @@ const DashboardProject = (props) => {
} catch (error) { } catch (error) {
} }
}; };
const getActualHR = async () => { const getActualHR = async () => {
const dateStart = moment().startOf("day").toDate(); const dateStart = moment().startOf("day").toDate();
const dateEnd = moment().endOf("day").toDate(); const dateEnd = moment().endOf("day").toDate();
@ -269,6 +264,7 @@ const DashboardProject = (props) => {
console.error("Failed to get actual HR:", error); console.error("Failed to get actual HR:", error);
} }
}; };
const getProjectDetail = async () => { const getProjectDetail = async () => {
setIsReadyProjectDetail(false); setIsReadyProjectDetail(false);
let URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`; let URL = `${BASE_OSPRO}/api/project/detail/${PROJECT_ID}`;
@ -353,6 +349,7 @@ const DashboardProject = (props) => {
} }
} }
}; };
const getSCurve = async () => { const getSCurve = async () => {
setIsReadySCurve(false); setIsReadySCurve(false);
let URL = `${BASE_OSPRO}/api/project/get-s-curve`; let URL = `${BASE_OSPRO}/api/project/get-s-curve`;
@ -385,6 +382,7 @@ const DashboardProject = (props) => {
let selisihProgress = 0; let selisihProgress = 0;
let planningProgress = 0; let planningProgress = 0;
let actualProgress = 0; let actualProgress = 0;
let progressPlanToDay = 0;
let statusHealthBySchedule = "behind-schedule"; let statusHealthBySchedule = "behind-schedule";
if ( if (
result.data.data.length > 0 && result.data.data.length > 0 &&
@ -424,6 +422,14 @@ const DashboardProject = (props) => {
planningProgress = result.data.data[0].data?.percentagePlan[n]; planningProgress = result.data.data[0].data?.percentagePlan[n];
setPlanningProgress(planningProgress); setPlanningProgress(planningProgress);
} }
if (
result.data.data.length > 0 &&
result.data.data[0].data?.progressPlanToDay &&
result.data.data[0].data?.progressPlanToDay != null
) {
progressPlanToDay = result.data.data[0].data?.progressPlanToDay;
setPlanningProgressToDay(+(Math.round(progressPlanToDay + "e+2") + "e-2"));
}
if ( if (
result.data.data.length > 0 && result.data.data.length > 0 &&
result.data.data[0].data?.percentageReal && result.data.data[0].data?.percentageReal &&
@ -445,6 +451,7 @@ const DashboardProject = (props) => {
setIsReadySCurve(true); setIsReadySCurve(true);
} }
}; };
const getOverdueActivities = async () => { const getOverdueActivities = async () => {
setIsReadyOverdueActivities(false); setIsReadyOverdueActivities(false);
const URL = `${BASE_OSPRO}/api/project/get-overdue-activities`; const URL = `${BASE_OSPRO}/api/project/get-overdue-activities`;
@ -478,6 +485,7 @@ const DashboardProject = (props) => {
setIsReadyOverdueActivities(true); setIsReadyOverdueActivities(true);
} }
}; };
const getIntegrationInvoice = async (kode_sortname, id, gantt_id = null) => { const getIntegrationInvoice = async (kode_sortname, id, gantt_id = null) => {
setIsReadyIntegrationInvoice(false); setIsReadyIntegrationInvoice(false);
const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`; const URL = `${BASE_OSPRO}/api/project/get-integration-invoice`;
@ -521,6 +529,7 @@ const DashboardProject = (props) => {
setIsReadyIntegrationInvoice(true); setIsReadyIntegrationInvoice(true);
} }
}; };
const getReportDistribution = async () => { const getReportDistribution = async () => {
setIsReadyReportDistribution(false); setIsReadyReportDistribution(false);
const URL = `${BASE_OSPRO}/api/project/get-report-distribution`; const URL = `${BASE_OSPRO}/api/project/get-report-distribution`;
@ -553,6 +562,7 @@ const DashboardProject = (props) => {
setIsReadyReportDistribution(true); setIsReadyReportDistribution(true);
} }
}; };
const getComments = async () => { const getComments = async () => {
setIsReadyComments(false); setIsReadyComments(false);
const URL = `${BASE_OSPRO}/api/project-comment/search`; const URL = `${BASE_OSPRO}/api/project-comment/search`;
@ -581,6 +591,7 @@ const DashboardProject = (props) => {
orders: { columns: ["created_at"], ascending: false }, orders: { columns: ["created_at"], ascending: false },
paging: { start: 0, length: -1 }, paging: { start: 0, length: -1 },
}; };
const result = await axios const result = await axios
.post(URL, payload, HEADER) .post(URL, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -602,6 +613,7 @@ const DashboardProject = (props) => {
setIsReadyComments(true); setIsReadyComments(true);
} }
}; };
const handleSendComment = async () => { const handleSendComment = async () => {
setIsSendingComment(true); setIsSendingComment(true);
if (comment === "") { if (comment === "") {
@ -641,10 +653,23 @@ const DashboardProject = (props) => {
getComments(); getComments();
} }
}; };
const resetInputComment = () => { const resetInputComment = () => {
setComment(""); setComment("");
setIsSendingComment(false); setIsSendingComment(false);
}; };
const getQueryParams = () => {
const searchParams = new URLSearchParams(props.location.search);
const dashboardGantt = searchParams.get('dashboardGantt');
setDashboardStatus(dashboardGantt);
}
const handleBack = async () => {
const domainUrl = window.location.origin;
!SCURVE ? (dashboardGantt ? window.parent.location.reload() : window.location.replace(`${domainUrl}/#/projects/${GANTT_ID}/${PROJECT_ID}/gantt`)) : window.history.go(-1);
};
const initMap = () => { const initMap = () => {
let mymap = L.map("map-area", { let mymap = L.map("map-area", {
center: center, center: center,
@ -656,6 +681,7 @@ const DashboardProject = (props) => {
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors', '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}).addTo(mymap); }).addTo(mymap);
}; };
useEffect(() => { useEffect(() => {
if (mymap) { if (mymap) {
if (reportDistribution.length > 0) { if (reportDistribution.length > 0) {
@ -667,6 +693,7 @@ const DashboardProject = (props) => {
} }
} }
}, [mymap, reportDistribution]); }, [mymap, reportDistribution]);
useEffect(() => { useEffect(() => {
// Add event listener for receiving messages from the iframe // Add event listener for receiving messages from the iframe
window.addEventListener("message", handleIframeMessage); window.addEventListener("message", handleIframeMessage);
@ -675,6 +702,7 @@ const DashboardProject = (props) => {
window.removeEventListener("message", handleIframeMessage); window.removeEventListener("message", handleIframeMessage);
}; };
}, []); }, []);
const handleIframeMessage = (event) => { const handleIframeMessage = (event) => {
if (event.data && event.data.action === "getUrl") { if (event.data && event.data.action === "getUrl") {
const childUrl = window.location.href; const childUrl = window.location.href;
@ -685,6 +713,7 @@ const DashboardProject = (props) => {
); );
} }
}; };
const RenderGantt = useMemo( const RenderGantt = useMemo(
() => ( () => (
<iframe <iframe
@ -701,6 +730,7 @@ const DashboardProject = (props) => {
), ),
[activeTabIdx] [activeTabIdx]
); );
const RenderComments = useMemo(() => { const RenderComments = useMemo(() => {
return ( return (
<> <>
@ -804,12 +834,25 @@ const DashboardProject = (props) => {
); );
}, [overdueActivities, isReadyOverdueActivities]); }, [overdueActivities, isReadyOverdueActivities]);
return ( return (
<div style={{ marginLeft: -25, marginRight: -25 }}> <div style={{ marginLeft: dashboardGantt ? -80 : -25, marginRight: -25 }}>
<NotificationContainer /> <NotificationContainer />
<Row> <Row>
<Col span={18}> <Col span={18}>
<Row> <Row>
<Col span={8}> <Col span={2}>
<Button
style={{
height: "100%",
width: "100%",
fontSize: "18px"
}}
onClick={handleBack}
type="primary"
>
<Icon icon={arrowLeft} style={{ fontSize: "20px" }} /> Back
</Button>
</Col>
<Col span={6}>
<div <div
style={{ style={{
border: "solid", border: "solid",
@ -858,14 +901,14 @@ const DashboardProject = (props) => {
} }
return SCURVE && SCURVE == "1" return SCURVE && SCURVE == "1"
? projectName ? projectName
? calculationStatus // ? calculationStatus
? projectName + " - S-Curve Ready" // ? projectName + " - S-Curve Ready"
: projectName + " - S-Curve Loading" // : projectName + " - S-Curve Loading"
: null // : null
: projectName + : projectName
parentNames + // + parentNames +
" - " + // " - " +
dataGantt.data.data.name_version; // dataGantt.data.data.name_version;
})() })()
) : ( ) : (
<SingleTextLoader /> <SingleTextLoader />
@ -1416,7 +1459,7 @@ const DashboardProject = (props) => {
</div> </div>
{isReadySCurve ? ( {isReadySCurve ? (
<ProgressPlanningBar <ProgressPlanningBar
progress={planningProgress > 100 ? 100 : planningProgress} progress={planningProgressToDay > 100 ? 100 : planningProgressToDay}
/> />
) : ( ) : (
<SingleTextLoader width={"100%"} height={30} /> <SingleTextLoader width={"100%"} height={30} />

5
src/views/Dashboard/DashboardProjectCarousell.js

@ -70,13 +70,12 @@ const center = {
}; };
const DashboardProject = ({args,...props}) => { const DashboardProject = ({args,...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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -129,7 +128,7 @@ const DashboardProject = ({args,...props}) => {
setIsReadyProjectDetail(false); setIsReadyProjectDetail(false);
setIsReadySCurve(false) setIsReadySCurve(false)
setIsReadySCurve(false); setIsReadySCurve(false);
const URL = `${BASE_OSPRO}/api/project-carausell/${company_id}/${all_project}/${hierarchy}`; const URL = `${BASE_OSPRO}/api/project-carausell/${all_project}/${hierarchy}`;
const result = await axios const result = await axios
.get(URL, HEADER) .get(URL, HEADER)
.then((res) => res) .then((res) => res)

5
src/views/MapMonitoring/index.js

@ -29,13 +29,12 @@ import moment from 'moment';
import axios from "../../const/interceptorApi"; import axios from "../../const/interceptorApi";
const MapMonitoring = ({ ...props }) => { const MapMonitoring = ({ ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='', configApp={}; let role_id = 0, user_id = 0, isLogin = false, token = '', all_project = null, role_name='', hierarchy=[], user_name='', configApp={};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -225,7 +224,7 @@ const MapMonitoring = ({ ...props }) => {
const pointToLayerUserPoints = (feature, latlng) => { const pointToLayerUserPoints = (feature, latlng) => {
let imgSrc = DEFAULT_USER_ICON; let imgSrc = DEFAULT_USER_ICON;
if (feature && feature.properties && feature.properties.image && feature.properties.image !== '') { if (feature && feature.properties && feature.properties.image && feature.properties.image !== '') {
imgSrc = `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(feature.properties.image, JSON.parse(configApp).company_name, moment(feature.properties.created_at).format('YYYY-MM'))}` imgSrc = `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(feature.properties.image)}`
} }
let img = `<img src="${imgSrc}" />` let img = `<img src="${imgSrc}" />`
let logoMarker = L.divIcon({ let logoMarker = L.divIcon({

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

@ -203,15 +203,6 @@ class index extends Component {
"ascending": false "ascending": false
} }
} }
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(ABSENSI_SEARCH, payload, config) .post(ABSENSI_SEARCH, payload, config)
@ -463,9 +454,6 @@ class index extends Component {
Edit Edit
</Tooltip> </Tooltip>
</td> */} </td> */}
{this.state.role_name === 'Super Admin' &&
<td>{n.join_second_company_name ? n.join_second_company_name : ""}</td>
}
<td>{n.join_first_name ? n.join_first_name : ""}</td> <td>{n.join_first_name ? n.join_first_name : ""}</td>
<td>{n.description ? n.description : "-"}</td> <td>{n.description ? n.description : "-"}</td>
<td>{n.created_at ? moment(n.created_at).format("YYYY-MM-DD") : "-"}</td> <td>{n.created_at ? moment(n.created_at).format("YYYY-MM-DD") : "-"}</td>
@ -512,7 +500,6 @@ class index extends Component {
render() { render() {
const t = this.props; const t = this.props;
const column = [ const column = [
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('nameHR') }, { name: this.props.t('nameHR') },
{ name: this.props.t('description') }, { name: this.props.t('description') },
{ name: this.props.t('dateAbsent') }, { name: this.props.t('dateAbsent') },

53
src/views/Master/MasterBroadcast/DialogForm.js

@ -52,17 +52,11 @@ class DialogForm extends Component {
idEmployeeDivision: [], idEmployeeDivision: [],
idOrganization: [], idOrganization: [],
disableTransfer: true, disableTransfer: true,
listCompany: [],
company_id: this.props.company_id,
role_name: '' role_name: ''
} }
} }
async componentDidMount() { async componentDidMount() {
if (this.props.company_id !== null) {
this.getDataRole();
this.getDataUsers();
}
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
} }
@ -74,16 +68,14 @@ class DialogForm extends Component {
id: dataEdit.id, id: dataEdit.id,
title: dataEdit.title_notif, title: dataEdit.title_notif,
description: dataEdit.description, description: dataEdit.description,
message: dataEdit.message_notif, message: dataEdit.message_notif
company_id: dataEdit.company_id
}) })
} else { } else {
this.setState({ this.setState({
id: 0, id: 0,
title: "", title: "",
description: "", description: "",
message: "", message: ""
company_id: 0
}) })
} }
this.setState({ isParentClick: false }); this.setState({ isParentClick: false });
@ -138,9 +130,6 @@ class DialogForm extends Component {
penerima, penerima,
} = this.state } = this.state
let {
company_id
} = this.state
let idSend = []; let idSend = [];
let send_to_type = "all"; let send_to_type = "all";
if (penerima === "all") { if (penerima === "all") {
@ -161,16 +150,12 @@ class DialogForm extends Component {
} else { } else {
idSend = idSend; idSend = idSend;
} }
if (this.props.role_name !== 'Super Admin') {
company_id = parseInt(this.props.company_id)
}
const data = { const data = {
title, title,
description, description,
message, message,
send_to_type, send_to_type,
id: idSend, id: idSend
company_id: company_id
} }
if (param === 'registered' || param === 'send') { if (param === 'registered' || param === 'send') {
this.props.handleSaveBroadcast(param, data) this.props.handleSaveBroadcast(param, data)
@ -217,14 +202,6 @@ class DialogForm extends Component {
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [
{
"name": "company_id",
"logic_operator": "=",
"value": this.state.company_id,
"operator": "AND"
}
],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
@ -266,12 +243,6 @@ class DialogForm extends Component {
"value": "", "value": "",
"operator": "AND", "operator": "AND",
"table_name": "m_users" "table_name": "m_users"
},
{
"name": "company_id",
"logic_operator": "=",
"value": this.state.company_id,
"operator": "AND"
} }
], ],
"orders": { "orders": {
@ -320,29 +291,11 @@ class DialogForm extends Component {
}; };
handleSelectCompany = (selectedOption) => {
const selectedCompanyId = selectedOption.value;
this.setState({ company_id: selectedCompanyId }, () => {
this.getDataRole();
this.getDataUsers();
});
}
renderForm = () => { renderForm = () => {
const t = this.props const t = this.props
const { errorTitle, errorMessage } = this.state const { errorTitle, errorMessage } = this.state
return ( return (
<Form> <Form>
{this.props.role_name === 'Super Admin' && (
<FormGroup>
<Label>{this.props.t('company')}</Label>
<Select
options={this.props.listCompany.map(company => ({ value: company.id, label: company.company_name }))}
onChange={this.handleSelectCompany}
value={this.state.company_id}
/>
</FormGroup>
)}
<FormGroup> <FormGroup>
<Label>{this.props.t('receiver')}</Label> <Label>{this.props.t('receiver')}</Label>
<Input type="select" value={this.state.penerima} onChange={(e) => this.handleChangePenerima(e.target.value)}> <Input type="select" value={this.state.penerima} onChange={(e) => this.handleChangePenerima(e.target.value)}>

51
src/views/Master/MasterBroadcast/index.js

@ -5,7 +5,7 @@ import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import { USER_LIST, BASE_SIMPRO_LUMEN, ROLE_LIST, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap'; import { Button, Card, CardBody, CardHeader, DropdownItem, DropdownMenu, DropdownToggle, Input, InputGroup, InputGroupButtonDropdown, Table, Row, Col } from 'reactstrap';
import { DatePicker, Pagination } from 'antd'; import { DatePicker, Pagination } from 'antd';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
@ -66,9 +66,7 @@ class index extends Component {
totalPage: 0, totalPage: 0,
typeClock: "All", typeClock: "All",
typeDialog: 'Save', typeDialog: 'Save',
role_name: props.role_name || '', role_name: props.role_name || ''
company_id: props.company_id,
listCompany: []
} }
} }
@ -82,17 +80,6 @@ class index extends Component {
if (startDate !== prevState.startDate) this.getDataBroadcast() if (startDate !== prevState.startDate) this.getDataBroadcast()
} }
getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ listCompany: result.data.data })
}
}
handleSearch = e => { handleSearch = e => {
const value = e.target.value const value = e.target.value
this.setState({ search: value, currentPage: 1 }) this.setState({ search: value, currentPage: 1 })
@ -139,24 +126,6 @@ class index extends Component {
} }
} }
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
} else {
payload.columns.push(
{
"name": "company_id",
"logic_operator": "=",
"value": this.state.company_id,
"operator": "AND"
}
)
}
const result = await axios const result = await axios
.post(url, payload, config) .post(url, payload, config)
.then(res => res) .then(res => res)
@ -164,7 +133,6 @@ class index extends Component {
if (result && result.data) { if (result && result.data) {
if (result.data.code === 200) { if (result.data.code === 200) {
this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord }); this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord });
this.getDataCompany()
} else { } else {
NotificationManager.error('Failed retreiving data!!', 'Failed'); NotificationManager.error('Failed retreiving data!!', 'Failed');
} }
@ -217,8 +185,7 @@ class index extends Component {
"status_send": type, "status_send": type,
"send_to_type": "all", "send_to_type": "all",
"message_notif": data.message, "message_notif": data.message,
"description": data.description, "description": data.description
"company_id": data.company_id
} }
const paramRoles = { const paramRoles = {
@ -227,8 +194,7 @@ class index extends Component {
"send_to_type": "roles", "send_to_type": "roles",
"message_notif": data.message, "message_notif": data.message,
"description": data.description, "description": data.description,
"send_to_id": data.id, "send_to_id": data.id
"company_id": data.company_id
} }
const paramUsers = { const paramUsers = {
@ -237,8 +203,7 @@ class index extends Component {
"send_to_type": "users", "send_to_type": "users",
"message_notif": data.message, "message_notif": data.message,
"description": data.description, "description": data.description,
"send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null, "send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null
"company_id": data.company_id
} }
if (data.send_to_type === "all") { if (data.send_to_type === "all") {
@ -491,9 +456,6 @@ class index extends Component {
</Col> </Col>
</Row> </Row>
</td> </td>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_first_company_name ? n.join_first_company_name : "-"}</td>
}
<td>{n.title_notif}</td> <td>{n.title_notif}</td>
<td>{n.message_notif !== "" ? n.message_notif : "-"}</td> <td>{n.message_notif !== "" ? n.message_notif : "-"}</td>
<td>{n.description !== "" ? n.description : "-"}</td> <td>{n.description !== "" ? n.description : "-"}</td>
@ -560,7 +522,6 @@ class index extends Component {
render() { render() {
const column = [ const column = [
{ name: this.props.t('action') }, { name: this.props.t('action') },
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('title') }, { name: this.props.t('title') },
{ name: this.props.t('message') }, { name: this.props.t('message') },
{ name: this.props.t('description') }, { name: this.props.t('description') },
@ -595,9 +556,7 @@ class index extends Component {
dataEdit={this.state.dataEdit} dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog} showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo} dataHs={this.state.dataIdHo}
company_id={this.state.company_id}
role_name={this.state.role_name} role_name={this.state.role_name}
listCompany={this.state.listCompany}
/> />
<DialogDetail <DialogDetail
openDialog={this.state.openDialogDetail} openDialog={this.state.openDialogDetail}

8
src/views/Master/MasterCompany/index.js

@ -443,7 +443,7 @@ const MasterCompany = ({ params }) => {
// Delete Image Function // Delete Image Function
const deleteImageHeader = async (id) => { const deleteImageHeader = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_header', companyID != '' ? companyID : 'undifined'); const URL = IMAGE_DELETE(id, 'company_logo_header');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -452,7 +452,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageLogin = async (id) => { const deleteImageLogin = async (id) => {
const URL = IMAGE_DELETE(id, 'company_logo_login', companyID != '' ? companyID : 'undifined'); const URL = IMAGE_DELETE(id, 'company_logo_login');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -461,7 +461,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageFavicon = async (id) => { const deleteImageFavicon = async (id) => {
const URL = IMAGE_DELETE(id, 'company_favicon', companyID != '' ? companyID : 'undifined'); const URL = IMAGE_DELETE(id, 'company_favicon');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -470,7 +470,7 @@ const MasterCompany = ({ params }) => {
}; };
const deleteImageSlider = async (id) => { const deleteImageSlider = async (id) => {
const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', companyID != '' ? companyID : 'undifined'); const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login');
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)

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

@ -5,7 +5,7 @@ import { withTranslation } from 'react-i18next';
import axios from 'axios'; import axios from 'axios';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
import { Select } from 'antd'; import { Select } from 'antd';
import { COMPANY_MANAGEMENT_LIST, MENU_SEARCH } from '../../../const/ApiConst.js'; import { MENU_SEARCH } from '../../../const/ApiConst.js';
const { Option } = Select const { Option } = Select
@ -18,12 +18,9 @@ class DialogForm extends Component {
description: "", description: "",
openDialog: false, openDialog: false,
isParentClick: false, isParentClick: false,
companyList: [],
scompany_id:null,
menu: [], menu: [],
selectedMenu: null, selectedMenu: null,
all_project: false, all_project: false,
company_id: props.company_id || null,
role_name: props.role_name || '', role_name: props.role_name || '',
token: props.token || '', token: props.token || '',
config: { config: {
@ -35,7 +32,6 @@ class DialogForm extends Component {
} }
} }
async componentDidMount() { async componentDidMount() {
this.getDataProyekCompany();
this.getAllMenu(); this.getAllMenu();
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
} }
@ -47,36 +43,20 @@ class DialogForm extends Component {
id: dataEdit.id, id: dataEdit.id,
name: dataEdit.name, name: dataEdit.name,
description: dataEdit.description, description: dataEdit.description,
selectedMenu: dataEdit.default_page, selectedMenu: dataEdit.default_page
scompany_id : dataEdit.company_id
}) })
} else { } else {
this.setState({ this.setState({
id: 0, id: 0,
name: "", name: "",
description: "", description: "",
selectedMenu: null, selectedMenu: null
scompany_id : null
}) })
} }
this.setState({ isParentClick: false }); this.setState({ isParentClick: false });
} }
} }
getDataProyekCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, this.state.config)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
this.setState({companyList: dataRes})
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
getAllMenu = async () => { getAllMenu = async () => {
const payload = { const payload = {
"paging": { "start": 0, "length": -1 }, "paging": { "start": 0, "length": -1 },
@ -100,10 +80,6 @@ class DialogForm extends Component {
} }
validation = () => { validation = () => {
if (this.state.role_name === 'Super Admin' && !this.state.scompany_id || this.state.scompany_id === "") {
alert("Company data cannot be empty!");
return true;
}
if (!this.state.name || this.state.name === "") { if (!this.state.name || this.state.name === "") {
alert("Role Name cannot be empty!"); alert("Role Name cannot be empty!");
return true; return true;
@ -125,8 +101,6 @@ class DialogForm extends Component {
description, description,
selectedMenu, selectedMenu,
role_name, role_name,
company_id,
scompany_id,
all_project all_project
} = this.state } = this.state
@ -139,7 +113,6 @@ class DialogForm extends Component {
name, name,
description, description,
selectedMenu, selectedMenu,
company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
all_project all_project
} }
@ -150,7 +123,6 @@ class DialogForm extends Component {
name, name,
description, description,
selectedMenu, selectedMenu,
company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
all_project all_project
} }
this.props.closeDialog('edit', data); this.props.closeDialog('edit', data);
@ -163,9 +135,6 @@ class DialogForm extends Component {
this.props.closeDialog('cancel', 'none') this.props.closeDialog('cancel', 'none')
} }
onChangeCompanyProject = (val) => {
this.setState({scompany_id : val});
};
renderForm = () => { renderForm = () => {
const { t } = this.props; const { t } = this.props;
return ( return (
@ -176,31 +145,6 @@ class DialogForm extends Component {
</Col> </Col>
</Row> </Row>
<Row> <Row>
{
this.state.role_name === 'Super Admin' && (
<Col md={12}>
<FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={this.state.scompany_id}
defaultValue={this.state.scompany_id}
onChange={this.onChangeCompanyProject}
style={{ width: "100%" }}
>
{this.state.companyList.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
)
}
<Col md={12}> <Col md={12}>
<FormGroup> <FormGroup>
<Label>{this.props.t('nameRole')}<span style={{ color: "red" }}>*</span></Label> <Label>{this.props.t('nameRole')}<span style={{ color: "red" }}>*</span></Label>

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

@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import { Button, Form } from 'reactstrap'; import { Button, Form } from 'reactstrap';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import axios from 'axios'; import axios from 'axios';
import { MENU_COMPANY_SEARCH } from '../../../const/ApiConst.js'; import { MENU_SEARCH } from '../../../const/ApiConst';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const config = { const config = {
headers: headers:
@ -68,11 +68,8 @@ export default class DialogMenuRoles extends Component {
], ],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" }
)
const result = await axios const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config) .post(MENU_SEARCH, payload, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {

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

@ -51,7 +51,6 @@ class index extends Component {
all_project: props.all_project || null, all_project: props.all_project || null,
hierarchy: props.hierarchy || [], hierarchy: props.hierarchy || [],
user_name: props.user_name || '', user_name: props.user_name || '',
company_id: props.company_id || 0,
config: { config: {
headers: { headers: {
Authorization: `Bearer ${props.token || ''}`, Authorization: `Bearer ${props.token || ''}`,
@ -92,18 +91,6 @@ class index extends Component {
</Tooltip> </Tooltip>
</>, </>,
}, },
...(this.state.role_name === 'Super Admin'
? [
{
title: this.props.t('company'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => (
<span>{record.join_first_company_name}</span>
),
}
]
: []),
{ title: this.props.t('nameRole'), dataIndex: 'name', key: 'name', className: "nowrap" }, { title: this.props.t('nameRole'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: this.props.t('description'), dataIndex: 'description', key: 'description' }, { title: this.props.t('description'), dataIndex: 'description', key: 'description' },
] ]
@ -148,18 +135,6 @@ class index extends Component {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" },
)
} else {
formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
formData.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(ROLE_SEARCH, formData, this.state.config) .post(ROLE_SEARCH, formData, this.state.config)
.then(res => res) .then(res => res)
@ -226,7 +201,6 @@ 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,
all_project: data.all_project all_project: data.all_project
} }
@ -247,7 +221,6 @@ 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,
all_project: data.all_project all_project: data.all_project
} }
const url = ROLE_EDIT(data.id) const url = ROLE_EDIT(data.id)
@ -264,7 +237,7 @@ class index extends Component {
} }
handleEdit = (data) => { handleEdit = (data) => {
this.setState({ dataEdit: data, company_id: data.company_id }); this.setState({ dataEdit: data });
this.handleOpenDialog('Edit'); this.handleOpenDialog('Edit');
} }
@ -324,7 +297,7 @@ class index extends Component {
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
this.setState({ menuRoles: result.data.data, idRoles: data.id, company_id: data.company_id }, () => { this.setState({ menuRoles: result.data.data, idRoles: data.id }, () => {
this.handleOpenDialogMr(); this.handleOpenDialogMr();
}); });
} }
@ -395,19 +368,6 @@ class index extends Component {
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" },
)
} else {
formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
formData.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(ROLE_SEARCH, formData, this.state.config) .post(ROLE_SEARCH, formData, this.state.config)
.then(res => res) .then(res => res)
@ -418,9 +378,6 @@ class index extends Component {
const dataExport = []; const dataExport = [];
dataRes.map((val, index) => { dataRes.map((val, index) => {
let row = {}; let row = {};
if (this.state.role_name === 'Super Admin') {
row.Company = val.join_first_company_name;
}
row.Nama = val.name; row.Nama = val.name;
row.Deskripsi = val.description; row.Deskripsi = val.description;
dataExport.push(row); dataExport.push(row);
@ -478,7 +435,6 @@ class index extends Component {
dataEdit={this.state.dataEdit} dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog} showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo} dataHs={this.state.dataIdHo}
company_id={this.state.company_id}
role_name={this.state.role_name} role_name={this.state.role_name}
token={this.state.token} token={this.state.token}
/> />
@ -488,7 +444,6 @@ class index extends Component {
idRoles={this.state.idRoles} idRoles={this.state.idRoles}
showDialog={showDialog => this.showMenuRolesDialog = showDialog} showDialog={showDialog => this.showMenuRolesDialog = showDialog}
menuRoles={this.state.menuRoles} menuRoles={this.state.menuRoles}
company_id={this.state.company_id}
role_name={this.state.role_name} role_name={this.state.role_name}
role_id={this.state.role_id} role_id={this.state.role_id}
token={this.state.token} token={this.state.token}

7
src/views/Master/ProjectExpenditure/DialogForm.js

@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectExpenditure, name: projectExpenditure,
color, color
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name: projectExpenditure, name: projectExpenditure,
color, color
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

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

@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const ProjectExpenditure = ({ params, ...props }) => { const ProjectExpenditure = ({ 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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -85,15 +84,7 @@ const ProjectExpenditure = ({ params, ...props }) => {
"start": start "start": start
} }
} }
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 result = await axios const result = await axios
.post(PROJECT_EXPENDITURE_SEARCH, payload, HEADER) .post(PROJECT_EXPENDITURE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)

7
src/views/Master/ProjectFinancialHealth/DialogForm.js

@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectFinancialHealth, name: projectFinancialHealth,
color, color
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name: projectFinancialHealth, name: projectFinancialHealth,
color, color
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

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

@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const ProjectFinancialHealth = ({ params, ...props }) => { const ProjectFinancialHealth = ({ 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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -85,15 +84,7 @@ const ProjectFinancialHealth = ({ params, ...props }) => {
"start": start "start": start
} }
} }
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 result = await axios const result = await axios
.post(PROJECT_FINANCIAL_HEALTH_SEARCH, payload, HEADER) .post(PROJECT_FINANCIAL_HEALTH_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)

7
src/views/Master/ProjectInvoice/DialogForm.js

@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectInvoice, name: projectInvoice,
color, color
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name: projectInvoice, name: projectInvoice,
color, color
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

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

@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const ProjectInvoice = ({ params, ...props }) => { const ProjectInvoice = ({ 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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -85,15 +84,7 @@ const ProjectInvoice = ({ params, ...props }) => {
"start": start "start": start
} }
} }
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 result = await axios const result = await axios
.post(PROJECT_INVOICE_SEARCH, payload, HEADER) .post(PROJECT_INVOICE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)

47
src/views/Master/ProjectPhase/DialogForm.js

@ -10,18 +10,16 @@ import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Select } from 'antd'; import { Select } from 'antd';
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
const [color, setColor] = useState('') const [color, setColor] = useState('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation(); const { t } = useTranslation();
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit") { if (typeDialog === "Edit") {
setId(dataEdit.id) setId(dataEdit.id)
setProjectType(dataEdit.name) setProjectType(dataEdit.name)
setColor(dataEdit.color) setColor(dataEdit.color)
setSelectedCompany(dataEdit.company_id)
} else { } else {
setId(0) setId(0)
setColor('') setColor('')
@ -32,24 +30,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name: projectType, name: projectType,
color, color
company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: projectType, name: projectType,
color, color
company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -61,10 +51,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -82,33 +68,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

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

@ -6,27 +6,22 @@ import axios from "../../../const/interceptorApi"
import moment from 'moment' import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications'; 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, 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 { import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup, checkActMenup,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
const ProjectPhase = ({ params, ...props }) => { const ProjectPhase = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -58,7 +53,6 @@ const ProjectPhase = ({ params, ...props }) => {
const [search, setSearch] = useState('') const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
getDataProjectPhase() getDataProjectPhase()
@ -71,21 +65,6 @@ const ProjectPhase = ({ params, ...props }) => {
} }
}, [dataExport]) }, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataProjectPhase = async () => { const getDataProjectPhase = async () => {
let start = 0; let start = 0;
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
@ -116,21 +95,7 @@ const ProjectPhase = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_PHASE_SEARCH, payload, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -189,21 +154,6 @@ const ProjectPhase = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_PHASE_SEARCH, payload, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
@ -214,9 +164,6 @@ const ProjectPhase = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((val, index) => { resData.map((val, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama = val.name; dataRow.Nama = val.name;
dataRow.Color = val.color; dataRow.Color = val.color;
excelData.push(dataRow) excelData.push(dataRow)
@ -376,16 +323,6 @@ const ProjectPhase = ({ params, ...props }) => {
</Tooltip>{" "} </Tooltip>{" "}
</>, </>,
}, },
...(role_name === 'Super Admin' ?
[{
title: t('companyName'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => (
<span>{record.join_first_company_name}</span>
)
}]
: []),
{ {
title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap"
}, },
@ -435,9 +372,7 @@ const ProjectPhase = ({ params, ...props }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
listCompany={listCompany}
role_name={role_name} role_name={role_name}
company_id={company_id}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

7
src/views/Master/ProjectScheduleHealth/DialogForm.js

@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectScheduleHealth, name: projectScheduleHealth,
color, color
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name: projectScheduleHealth, name: projectScheduleHealth,
color, color
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

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

@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const ProjectScheduleHealth = ({ params, ...props }) => { const ProjectScheduleHealth = ({ 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 = '', all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -85,15 +84,7 @@ const ProjectScheduleHealth = ({ params, ...props }) => {
"start": start "start": start
} }
} }
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 result = await axios const result = await axios
.post(PROJECT_SCHEDULE_HEALTH_SEARCH, payload, HEADER) .post(PROJECT_SCHEDULE_HEALTH_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)

3
src/views/Master/Proyek/index.js

@ -48,7 +48,6 @@ const data = [
const url = ""; const url = "";
const proyek_id = localStorage.getItem('proyek_id'); const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const company_id = window.localStorage.getItem('company_id');
const IndexRole = ({ params }) => { const IndexRole = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
@ -215,7 +214,7 @@ const IndexRole = ({ params }) => {
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete, company_id); let urlDel = PROYEK_DELETE(idDelete);
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);

73
src/views/Master/RoleProject/DialogForm.js

@ -2,7 +2,6 @@ import React, { Component } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label, Input } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter, 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 { COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst.js';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
import { Select } from 'antd'; import { Select } from 'antd';
@ -15,10 +14,7 @@ class DialogForm extends Component {
name: "", name: "",
description: "", description: "",
openDialog: false, openDialog: false,
companyList: [],
scompany_id:null,
isParentClick: false, isParentClick: false,
company_id: props.company_id || null,
role_name: props.role_name || '', role_name: props.role_name || '',
token: props.token || '', token: props.token || '',
config: { config: {
@ -32,7 +28,6 @@ class DialogForm extends Component {
async componentDidMount() { async componentDidMount() {
this.props.showDialog(this.showDialog); this.props.showDialog(this.showDialog);
this.getDataProyekCompany();
} }
async componentDidUpdate() { async componentDidUpdate() {
@ -42,15 +37,13 @@ class DialogForm extends Component {
this.setState({ this.setState({
id: dataEdit.id, id: dataEdit.id,
name: dataEdit.name, name: dataEdit.name,
description: dataEdit.description, description: dataEdit.description
scompany_id : dataEdit.company_id
}) })
} else { } else {
this.setState({ this.setState({
id: 0, id: 0,
name: "", name: "",
description: "", description: ""
scompany_id:null
}) })
} }
this.setState({ isParentClick: false }); this.setState({ isParentClick: false });
@ -62,58 +55,29 @@ class DialogForm extends Component {
this.setState({ isParentClick: true }); this.setState({ isParentClick: true });
} }
getDataProyekCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, this.state.config)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
this.setState({companyList: dataRes})
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
validation = () => {
if (this.state.role_name === 'Super Admin' && !this.state.scompany_id || this.state.scompany_id === "") {
alert("Company data cannot be empty!");
return true;
}
}
handleSave = () => { handleSave = () => {
const { const {
id, id,
name, name,
description, description
role_name,
company_id,
scompany_id
} = this.state } = this.state
let data = ''; let data = '';
const err = this.validation();
if(!err) {
if (this.props.typeDialog === "Save") { if (this.props.typeDialog === "Save") {
data = { data = {
id, id,
name, name,
description, description
company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
} }
this.props.closeDialog('save', data); this.props.closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name, name,
description, description
company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
} }
this.props.closeDialog('edit', data); this.props.closeDialog('edit', data);
} }
}
this.setState({ id: 0 }); this.setState({ id: 0 });
} }
@ -121,37 +85,10 @@ class DialogForm extends Component {
this.props.closeDialog('cancel', 'none') this.props.closeDialog('cancel', 'none')
} }
onChangeCompanyProject = (val) => {
this.setState({scompany_id : val});
};
renderForm = () => { renderForm = () => {
const { t } = this.props; const { t } = this.props;
return ( return (
<Form> <Form>
{
this.state.role_name === 'Super Admin' && (
<FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={this.state.scompany_id}
defaultValue={this.state.scompany_id}
onChange={this.onChangeCompanyProject}
style={{ width: "100%" }}
>
{this.state.companyList.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
)
}
<FormGroup> <FormGroup>
<Label>{this.props.t('name')}</Label> <Label>{this.props.t('name')}</Label>
<Input type="text" value={this.state.name} onChange={(e) => this.setState({ name: e.target.value })} placeholder={this.props.t('inputName')} /> <Input type="text" value={this.state.name} onChange={(e) => this.setState({ name: e.target.value })} placeholder={this.props.t('inputName')} />

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

@ -39,7 +39,6 @@ class index extends Component {
tooltipTambah: false, tooltipTambah: false,
totalPage: 0, totalPage: 0,
typeDialog: 'Save', typeDialog: 'Save',
company_id: props.company_id || 0,
role_name: props.role_name || '', role_name: props.role_name || '',
role_id: props.role_id || 0, role_id: props.role_id || 0,
user_id: props.user_id || 0, user_id: props.user_id || 0,
@ -65,32 +64,22 @@ class index extends Component {
render: (text, record) => <> render: (text, record) => <>
<Tooltip title={this.props.t('delete')}> <Tooltip title={this.props.t('delete')}>
{ {
checkActMenup('/project-role', '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 null
} }
</Tooltip> </Tooltip>
<Tooltip title={this.props.t('edit')}> <Tooltip title={this.props.t('edit')}>
{ {
checkActMenup('/project-role', 'update') ? 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 null
} }
</Tooltip> </Tooltip>
</>, </>,
}, },
{
title: this.state.role_name === 'Super Admin' ? "Company Name" : null,
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return this.state.role_name === 'Super Admin' ? (
<span>{record.join_first_company_name}</span>
) : null;
}
},
{ title: this.props.t('name'), dataIndex: 'name', key: 'name', className: "nowrap" }, { title: this.props.t('name'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: this.props.t('description'), dataIndex: 'description', key: 'description' }, { title: this.props.t('description'), dataIndex: 'description', key: 'description' },
]; ];
@ -133,21 +122,7 @@ class index extends Component {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(this.state.company_id), "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
formData.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
formData.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_ROLE_SEARCH, formData, this.state.config) .post(PROJECT_ROLE_SEARCH, formData, this.state.config)
.then(res => res) .then(res => res)
@ -212,8 +187,7 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.description
company_id: data.company_id
} }
const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config) const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config)
@ -233,8 +207,7 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.description
company_id : data.company_id
} }
const url = PROJECT_ROLE_EDIT(data.id) const url = PROJECT_ROLE_EDIT(data.id)
const result = await axios.put(url, formData, this.state.config) const result = await axios.put(url, formData, this.state.config)
@ -315,21 +288,7 @@ class index extends Component {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
)
} else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
payload.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_ROLE_SEARCH, payload, this.state.config) .post(PROJECT_ROLE_SEARCH, payload, this.state.config)
.then(res => res) .then(res => res)
@ -339,9 +298,6 @@ class index extends Component {
const dataExport = []; const dataExport = [];
dataRes.map((val, index) => { dataRes.map((val, index) => {
let row = {}; let row = {};
if (this.state.role_name === 'Super Admin') {
row.Company = val.join_first_company_name;
}
row.Nama = val.name; row.Nama = val.name;
row.Deskripsi = val.description; row.Deskripsi = val.description;
dataExport.push(row); dataExport.push(row);
@ -401,7 +357,6 @@ class index extends Component {
dataEdit={this.state.dataEdit} dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog} showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo} dataHs={this.state.dataIdHo}
company_id={this.state.company_id}
role_name={this.state.role_name} role_name={this.state.role_name}
token={this.state.token} token={this.state.token}
/> />

8
src/views/Pages/Login/Login.js

@ -134,7 +134,7 @@ class Login extends Component {
} }
} }
getDataMenu = async (token, role_id, hierarchy, user_id, company_id, role_name, all_project, user_name, configApp) => { getDataMenu = async (token, role_id, hierarchy, user_id, role_name, all_project, user_name, configApp) => {
const config = { const config = {
headers: headers:
{ {
@ -167,7 +167,6 @@ class Login extends Component {
user_id, user_id,
token, token,
isLogin: true, isLogin: true,
company_id,
role_name, role_name,
all_project, all_project,
user_name, user_name,
@ -186,7 +185,6 @@ class Login extends Component {
user_id, user_id,
token, token,
isLogin: true, isLogin: true,
company_id,
role_name, role_name,
all_project, all_project,
user_name, user_name,
@ -209,7 +207,6 @@ class Login extends Component {
user_id, user_id,
token, token,
isLogin: true, isLogin: true,
company_id,
role_name, role_name,
all_project, all_project,
user_name, user_name,
@ -259,13 +256,12 @@ class Login extends Component {
if (doLogin && doLogin.data && doLogin.data.code === 200) { if (doLogin && doLogin.data && doLogin.data.code === 200) {
const { access_token, data_user } = doLogin.data.data const { access_token, data_user } = doLogin.data.data
this.getDataRole(access_token, data_user.role_id) this.getDataRole(access_token, data_user.role_id)
this.getDataMenu(access_token, data_user.role_id, data_user.hierarchy, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project, data_user.user_name, data_user.configApp) this.getDataMenu(access_token, data_user.role_id, data_user.hierarchy, data_user.id, data_user.role.name, data_user.role.all_project, data_user.user_name, data_user.configApp)
window.localStorage.setItem('isLogin', true); window.localStorage.setItem('isLogin', true);
window.localStorage.setItem('token', access_token); window.localStorage.setItem('token', access_token);
window.localStorage.setItem('user_id', data_user.id); window.localStorage.setItem('user_id', data_user.id);
window.localStorage.setItem('user_name', data_user.name); window.localStorage.setItem('user_name', data_user.name);
window.localStorage.setItem('role_id', data_user.role_id); window.localStorage.setItem('role_id', data_user.role_id);
window.localStorage.setItem('company_id', data_user.company_id);
window.localStorage.setItem('role_name', data_user.role.name); window.localStorage.setItem('role_name', data_user.role.name);
window.localStorage.setItem('all_project', data_user.role.all_project); window.localStorage.setItem('all_project', data_user.role.all_project);
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy)); window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy));

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

@ -26,13 +26,12 @@ const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp={}; let role_id = 0, user_id = 0, isLogin = false, token = '', all_project = null, role_name = '', hierarchy = [], user_name = '', configApp={};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -76,9 +75,7 @@ class index extends Component {
proyekIds: [], proyekIds: [],
allDataProyek: [], allDataProyek: [],
finishSetupOption: false, finishSetupOption: false,
company_id: company_id,
role_name: role_name, role_name: role_name,
companyName: JSON.parse(configApp).company_name,
role_id: role_id, role_id: role_id,
hierarchy: hierarchy hierarchy: hierarchy
} }
@ -210,24 +207,8 @@ class index extends Component {
if (currentProyek) { if (currentProyek) {
payload.columns.push({ "name": "proyek_id", "logic_operator": "=", "value": this.state.currentProyek }) payload.columns.push({ "name": "proyek_id", "logic_operator": "=", "value": this.state.currentProyek })
if (this.state.role_name === "Super Admin") {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
} else { } else {
payload.columns.push({ "name": "proyek_id", "logic_operator": "in", "value": this.state.proyekIds }) payload.columns.push({ "name": "proyek_id", "logic_operator": "in", "value": this.state.proyekIds })
if (this.state.role_name === "Super Admin") {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
} }
const result = await axios const result = await axios
@ -481,9 +462,6 @@ class index extends Component {
{dataTable2.length !== 0 ? dataTable2.map((n) => { {dataTable2.length !== 0 ? dataTable2.map((n) => {
return ( return (
<tr key={n.id}> <tr key={n.id}>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_third_company_name ? n.join_third_company_name : "-"}</td>
}
<td>{n.join_first_name ? n.join_first_name : "-"}</td> <td>{n.join_first_name ? n.join_first_name : "-"}</td>
<td>{n.join_second_nama ? n.join_second_nama : "-"}</td> <td>{n.join_second_nama ? n.join_second_nama : "-"}</td>
<td>{n.report_date ? moment(n.report_date).format("DD-MM-YYYY") : "-"}</td> <td>{n.report_date ? moment(n.report_date).format("DD-MM-YYYY") : "-"}</td>
@ -553,7 +531,6 @@ class index extends Component {
render() { render() {
const column = [ const column = [
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('nameHR') }, { name: this.props.t('nameHR') },
{ name: this.props.t('projectName') }, { name: this.props.t('projectName') },
{ name: this.props.t('dateReport') }, { name: this.props.t('dateReport') },
@ -585,7 +562,6 @@ class index extends Component {
closeDialog={this.handleCloseDialog} closeDialog={this.handleCloseDialog}
toggleDialog={() => this.toggleAddDialog} toggleDialog={() => this.toggleAddDialog}
dataImage={this.state.dataImage} dataImage={this.state.dataImage}
companyName={this.state.companyName}
showDialog={showDialog => this.showChildDialog = showDialog} showDialog={showDialog => this.showChildDialog = showDialog}
/> />
<Card> <Card>

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

@ -8,11 +8,10 @@ import { useTranslation } from 'react-i18next';
import { Select } from 'antd'; import { Select } from 'antd';
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
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('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
@ -20,7 +19,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(dataEdit.id) setId(dataEdit.id)
setDescription(dataEdit.description) setDescription(dataEdit.description)
setName(dataEdit.name) setName(dataEdit.name)
setSelectedCompany(dataEdit.company_id);
} else { } else {
handleClearData() handleClearData()
@ -29,26 +27,17 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: name, name: name,
description: description, description: description
company_id: parseInt(company_id),
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: name, name: name,
description: description, description: description
company_id: company_id,
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
@ -64,13 +53,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
setName('') setName('')
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -88,33 +72,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

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

@ -7,17 +7,11 @@ import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Button, Tooltip, } from 'antd'; import { Pagination, Button, Tooltip, } from 'antd';
import { 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
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { import { checkActMenup } from "../../../const/CustomFunc";
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const config = { const config = {
@ -29,13 +23,12 @@ const config = {
}; };
const ChecklistK3 = ({ params, ...props }) => { const ChecklistK3 = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -64,10 +57,8 @@ const ChecklistK3 = ({ params, ...props }) => {
const [search, setSearch] = useState('') const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation() const { t } = useTranslation()
const column = [ const column = [
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('name') }, { name: t('name') },
{ name: t('description') }, { name: t('description') },
].filter(column => column && column.name) ].filter(column => column && column.name)
@ -82,30 +73,11 @@ const ChecklistK3 = ({ params, ...props }) => {
} }
}, [dataExport]) }, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataChecklistK3 = async () => { const getDataChecklistK3 = async () => {
let start = 0; let start = 0;
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage start = (currentPage * rowsPerPage) - rowsPerPage
} }
const payload = { const payload = {
group_column: { group_column: {
"operator": "AND", "operator": "AND",
@ -132,22 +104,6 @@ const ChecklistK3 = ({ params, ...props }) => {
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(CHECKLIST_K3_SEARCH, payload, config) .post(CHECKLIST_K3_SEARCH, payload, config)
.then(res => res) .then(res => res)
@ -190,21 +146,6 @@ const ChecklistK3 = ({ params, ...props }) => {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(CHECKLIST_K3_SEARCH, payload, config) .post(CHECKLIST_K3_SEARCH, payload, config)
@ -216,9 +157,6 @@ const ChecklistK3 = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((val, index) => { resData.map((val, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama = val.name; dataRow.Nama = val.name;
dataRow.Deskripsi = val.description; dataRow.Deskripsi = val.description;
excelData.push(dataRow) excelData.push(dataRow)
@ -359,8 +297,6 @@ const ChecklistK3 = ({ params, ...props }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
company_id={company_id}
listCompany={listCompany}
role_name={role_name} role_name={role_name}
/> />
<Card> <Card>
@ -420,11 +356,6 @@ const ChecklistK3 = ({ params, ...props }) => {
} }
</Tooltip> </Tooltip>
</td> </td>
{role_name === 'Super Admin' &&
(
<td>{n.join_first_company_name}</td>
)
}
<td>{n.name}</td> <td>{n.name}</td>
<td>{n.description}</td> <td>{n.description}</td>
</tr> </tr>

3
src/views/SimproV2/Closing/index.js

@ -14,7 +14,6 @@ import { formatRupiah } from '../../../const/CustomFunc'
const url = ""; const url = "";
const proyek_id = localStorage.getItem('proyek_id'); const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const company_id = window.localStorage.getItem('company_id');
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const Closing = ({ params, ...props }) => { const Closing = ({ params, ...props }) => {
@ -145,7 +144,7 @@ const Closing = ({ params, ...props }) => {
const toggleAddDialogView = () => setOpenDialogViewDetail(!openDialogViewDetail) const toggleAddDialogView = () => setOpenDialogViewDetail(!openDialogViewDetail)
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete, company_id) let urlDel = PROYEK_DELETE(idDelete)
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);

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

@ -13,7 +13,7 @@ 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, company_id, token }) => { const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, token }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -83,7 +83,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete, parseInt(company_id)) let urlDel = ASSIGN_HR_PROJECT_DELETE(idDelete)
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -198,7 +198,6 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
closeDialog={handleCloseDialogFormTools} closeDialog={handleCloseDialogFormTools}
toggleDialog={toogleDialogFormTools} toggleDialog={toogleDialogFormTools}
idTask={idTask} idTask={idTask}
company_id={company_id}
token={token} token={token}
/> />
</> </>

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

@ -11,7 +11,7 @@ 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, company_id, proyekName, token }) => { const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, token }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -91,9 +91,6 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, compan
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id) },
],
"orders": { "orders": {
"columns": [ "columns": [
"id" "id"
@ -117,9 +114,6 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, compan
"start": 0, "start": 0,
"length": -1 "length": -1
}, },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id) },
],
"joins": [], "joins": [],
"orders": { "orders": {
"columns": [ "columns": [

5
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, company_id, token }) => { const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, token }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -50,8 +50,7 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, compa
"length": -1 "length": -1
}, },
"columns": [ "columns": [
{ "name": "is_customer", "logic_operator": "=", "value": true }, { "name": "is_customer", "logic_operator": "=", "value": true }
{ "name": "company_id", "logic_operator": "=", "value": company_id },
], ],
"orders": { "orders": {
"columns": [ "columns": [

16
src/views/SimproV2/CreatedProyek/DialogDocument.js

@ -10,7 +10,7 @@ import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import DialogRequest from './FormDocument'; import DialogRequest from './FormDocument';
import DialogRequestFolder from './FormFolderDocument'; import DialogRequestFolder from './FormFolderDocument';
const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, companyId, token, role_name, companyName }) => { const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, token, role_name }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -73,7 +73,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const handleDownload = (id, file) => { const handleDownload = (id, file) => {
fetch(DOCUMENT_DOWNLOAD(id, parseInt(companyId)), { fetch(DOCUMENT_DOWNLOAD(id), {
headers: new Headers({ headers: new Headers({
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': `Bearer ${token}` 'Authorization': `Bearer ${token}`
@ -91,8 +91,8 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
}); });
} }
const handleShow = (file, dateFile) => { const handleShow = (file) => {
const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, companyName, dateFile)}` const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file)}`
window.open(urlShow); window.open(urlShow);
} }
@ -118,14 +118,13 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
const renderShowDokumen = (data) => { const renderShowDokumen = (data) => {
let arrayFile = data.file.split(".") let arrayFile = data.file.split(".")
const dateFile = moment(data.created_at).format('YYYY-MM');
let length = arrayFile.length let length = arrayFile.length
length = length - 1 length = length - 1
const fileExt = arrayFile[length]; const fileExt = arrayFile[length];
if (["pdf", "png", "jpg", "jpeg", "gif"].includes(fileExt)) { if (["pdf", "png", "jpg", "jpeg", "gif"].includes(fileExt)) {
return ( return (
<Tooltip title="View Document"> <Tooltip title="View Document">
<Button size={"sm"} color='info' style={{ color: "#FFFFFF" }} onClick={() => handleShow(data.file, dateFile)}><i className="fa fa-eye"></i></Button> <Button size={"sm"} color='info' style={{ color: "#FFFFFF" }} onClick={() => handleShow(data.file)}><i className="fa fa-eye"></i></Button>
</Tooltip> </Tooltip>
) )
} }
@ -200,7 +199,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = DOCUMENT_DELETE(idDelete, parseInt(companyId)) let urlDel = DOCUMENT_DELETE(idDelete)
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -218,7 +217,7 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
} }
const onConfirmDeleteFolder = async () => { const onConfirmDeleteFolder = async () => {
let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete, parseInt(companyId)) let urlDel = FOLDER_DOCUMENT_PROYEK_DELETE(idDelete)
const result = await axios.delete(urlDel, HEADER) const result = await axios.delete(urlDel, HEADER)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
@ -314,7 +313,6 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
idTask={parseInt(idTask)} idTask={parseInt(idTask)}
parentIdNewFolder={parentIdNewFolder} parentIdNewFolder={parentIdNewFolder}
dataEdit={dataEdit} dataEdit={dataEdit}
companyId={companyId}
token={token} token={token}
role_name={role_name} role_name={role_name}
/> />

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

@ -32,10 +32,8 @@ const DialogFormProyek = ({
dataDivisions, dataDivisions,
dataPM, dataPM,
projectImage, projectImage,
company_id,
role_name, role_name,
token, token
companyList
}) => { }) => {
const HEADER = { const HEADER = {
headers: { headers: {
@ -65,8 +63,6 @@ const DialogFormProyek = ({
const [organization, setProjectStructureOrg] = useState(null); const [organization, setProjectStructureOrg] = useState(null);
const [finance, setFinance] = useState(""); const [finance, setFinance] = useState("");
const [investor, setInvestor] = useState(""); const [investor, setInvestor] = useState("");
const [company, setCompany] = useState("");
const [scompany_id, setCompanyId] = useState(null);
const [step, setStep] = useState(1); const [step, setStep] = useState(1);
const [currencyList, setCurrencyList] = useState(null); const [currencyList, setCurrencyList] = useState(null);
const [currencyCode, setCurrencyCode] = useState("IDR"); const [currencyCode, setCurrencyCode] = useState("IDR");
@ -117,8 +113,6 @@ const DialogFormProyek = ({
setWorkArea(val.area_kerja); setWorkArea(val.area_kerja);
setProjectDuration(val.durasi_proyek); setProjectDuration(val.durasi_proyek);
setInvestor(val.investor); setInvestor(val.investor);
setCompany(val.company);
setCompanyId(val.company_id)
setFinance(val.finance); setFinance(val.finance);
setObjectives(val.project_objectives ? val.project_objectives : ""); setObjectives(val.project_objectives ? val.project_objectives : "");
setTestingEnv(val.testing_environment); setTestingEnv(val.testing_environment);
@ -209,8 +203,6 @@ const DialogFormProyek = ({
setProjectDuration(""); setProjectDuration("");
setDivisiProject(null); setDivisiProject(null);
setProjectStructureOrg(null); setProjectStructureOrg(null);
setCompany("");
setCompanyId(null)
setCurrencyCode("IDR"); setCurrencyCode("IDR");
setCurrencySymbol("Rp"); setCurrencySymbol("Rp");
setCurrencyName("Indonesian rupiah"); setCurrencyName("Indonesian rupiah");
@ -268,7 +260,6 @@ const DialogFormProyek = ({
pm_id: pic, pm_id: pic,
investor, investor,
finance, finance,
company,
area_kerja: workArea, area_kerja: workArea,
durasi_proyek: parseInt(duration), durasi_proyek: parseInt(duration),
late_consequence: late, late_consequence: late,
@ -280,7 +271,6 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id),
value_proyek: valueProyek, value_proyek: valueProyek,
income_year: incomeYearly income_year: incomeYearly
}; };
@ -301,7 +291,6 @@ const DialogFormProyek = ({
pm_id: pic, pm_id: pic,
investor, investor,
finance, finance,
company,
area_kerja: workArea, area_kerja: workArea,
durasi_proyek: parseInt(duration), durasi_proyek: parseInt(duration),
late_consequence: late, late_consequence: late,
@ -313,7 +302,6 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: role_name !== "Super Admin" ? parseInt(company_id) : parseInt(scompany_id),
value_proyek: valueProyek, value_proyek: valueProyek,
income_year: incomeYearly income_year: incomeYearly
}; };
@ -334,10 +322,6 @@ const DialogFormProyek = ({
setTypeproject(val); setTypeproject(val);
}; };
const onChangeCompanyProject = (val) => {
setCompanyId(val);
};
const onChangePhaseProject = (val) => { const onChangePhaseProject = (val) => {
setPhaseProject(val); setPhaseProject(val);
}; };
@ -424,10 +408,6 @@ const DialogFormProyek = ({
alert("End Date cannot be empty!"); alert("End Date cannot be empty!");
return false; return false;
} }
if (role_name === 'Super Admin' && !scompany_id || scompany_id === "") {
alert("Company data cannot be empty!");
return false;
}
if (!biaya || biaya === "") { if (!biaya || biaya === "") {
alert("Budget cannot be empty!"); alert("Budget cannot be empty!");
return false; return false;
@ -782,41 +762,6 @@ const DialogFormProyek = ({
</Col> </Col>
</Row> </Row>
<Row> <Row>
{
role_name === 'Super Admin' && (
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={scompany_id}
defaultValue={scompany_id}
onChange={onChangeCompanyProject}
style={{ width: "100%" }}
>
{companyList.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
)
}
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Company</Label>
<Input
type="text"
value={company}
onChange={(e) => setCompany(e.target.value)}
/>
</FormGroup>
</Col>
<Col md={6}> <Col md={6}>
<FormGroup> <FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}> <Label className="capitalize" style={{ fontWeight: "bold" }}>

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

@ -13,7 +13,7 @@ import DialogUserGantt from './DialogUserGantt';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const { Option } = Select const { Option } = Select
const DialogGantt = ({ openDialog, closeDialog, role_name, toggleDialog, idTask, proyekName, companyId, companyName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => { const DialogGantt = ({ openDialog, closeDialog, role_name, toggleDialog, idTask, proyekName, hierarchyId, hierarchyName, openDialogHierarchy, isLogin, token, role_id, user_id, dataViewStartDate }) => {
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -132,9 +132,7 @@ const DialogGantt = ({ openDialog, closeDialog, role_name, toggleDialog, idTask,
token, token,
role_id, role_id,
user_id, user_id,
company_id: companyId,
dataViewStartDate, dataViewStartDate,
companyName,
role_name, role_name,
ganttName : text.name_version ganttName : text.name_version
} }

10
src/views/SimproV2/CreatedProyek/FormDocument.js

@ -1,12 +1,12 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import axios from "../../../const/interceptorApi"; import axios from "../../../const/interceptorApi";
import { DOCUMENT_ADD } from '../../../const/ApiConst'; import { DOCUMENT_ADD } from '../../../const/ApiConst';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder, token, role_name, companyId }) => { const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder, token }) => {
const HEADER = { const HEADER = {
headers: { headers: {
@ -34,15 +34,13 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
const uploadDokumen = async () => { const uploadDokumen = async () => {
const formData = new FormData; const formData = new FormData;
formData.append('company_id', parseInt(companyId));
formData.append('dokumen', file, file.name); formData.append('dokumen', file, file.name);
if (parentIdNewFolder > 0) { if (parentIdNewFolder > 0) {
formData.append('ref_id', parentIdNewFolder); // folder_id formData.append('ref_id', parentIdNewFolder);
formData.append('type_dokumen', 'project-document-in-folder'); formData.append('type_dokumen', 'project-document-in-folder');
} }
else { else {
formData.append('ref_id', idTask); // proyek_id formData.append('ref_id', idTask);
formData.append('type_dokumen', 'project-document-out-folder') formData.append('type_dokumen', 'project-document-out-folder')
} }

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

@ -32,15 +32,13 @@ import {
PROJECT_MILESTONE_DELETE_BY_PROYEK, PROJECT_MILESTONE_DELETE_BY_PROYEK,
PROJECT_APPROVAL_DELETE_BY_PROYEK, PROJECT_APPROVAL_DELETE_BY_PROYEK,
USER_SEARCH, USER_SEARCH,
PROYEK_DELETE,
PROJECT_TYPE_SEARCH, PROJECT_TYPE_SEARCH,
PROYEK_ADD, PROYEK_ADD,
PROYEK_SEARCH, PROYEK_SEARCH,
COMPANY_MANAGEMENT_LIST,
PROYEK_EDIT, PROYEK_EDIT,
ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_SEARCH,
PROJECT_CHECKLIST_SEARCH, PROJECT_CHECKLIST_SEARCH,
PROYEK_DELETE,
PROJECT_ISSUE_SEARCH, PROJECT_ISSUE_SEARCH,
PROJECT_RISK_SEARCH, PROJECT_RISK_SEARCH,
PROJECT_CHECKLIST_DELETE_BY_PROYEK, PROJECT_CHECKLIST_DELETE_BY_PROYEK,
@ -70,10 +68,7 @@ import DialogInitDocument from "./DialogInitDocument";
import DialogGantt from "./DialogGantt"; import DialogGantt from "./DialogGantt";
import DialogHierarchy from "./DialogHierarchy"; import DialogHierarchy from "./DialogHierarchy";
import { import {
formatNumber,
formatRupiah,
formatThousand, formatThousand,
renderFormatRupiah,
checkActMenup, checkActMenup,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
// import DialogAsignHr from './AsignHrProject'; // import DialogAsignHr from './AsignHrProject';
@ -92,13 +87,12 @@ const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => { const CreatedProyek = ({ params, ...props }) => {
let pageRow = 10; let pageRow = 10;
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {}; let role_id = 0, user_id = 0, isLogin = false, token = '', all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -125,7 +119,6 @@ const CreatedProyek = ({ params, ...props }) => {
const [idTask, setidTask] = useState(0); const [idTask, setidTask] = useState(0);
const [projectId, setProjectId] = useState(0); const [projectId, setProjectId] = useState(0);
const [dataTable, setDatatable] = useState([]); const [dataTable, setDatatable] = useState([]);
const [companyList, setDataCompany] = useState([]);
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [totalPage, setTotalPage] = useState(0); const [totalPage, setTotalPage] = useState(0);
@ -159,8 +152,6 @@ const CreatedProyek = ({ params, ...props }) => {
const [openDialogDoc, setOpenDialogDoc] = useState(false); const [openDialogDoc, setOpenDialogDoc] = useState(false);
const [proyekName, setProyekName] = useState(""); const [proyekName, setProyekName] = useState("");
const [openDialogProyek, setOpenDialogProyek] = useState(false); const [openDialogProyek, setOpenDialogProyek] = useState(false);
const [companyId, setCompanyId] = useState(role_name !== 'Super Admin' ? company_id : 0);
const [companyName, setCompanyName] = useState('');
// project charter // project charter
const [projectCharter, setProjectCharter] = useState(null); const [projectCharter, setProjectCharter] = useState(null);
const [projectParticipant, setProjectParticipant] = useState(null); const [projectParticipant, setProjectParticipant] = useState(null);
@ -210,12 +201,6 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}, [openDialogProyek]); }, [openDialogProyek]);
useEffect(() => {
if (role_name === 'Super Admin') {
getDataProyekCompany();
}
}, [])
useEffect(() => { useEffect(() => {
if (parseInt(role_id) === 44) { if (parseInt(role_id) === 44) {
getDataProyekByCustomer() getDataProyekByCustomer()
@ -255,11 +240,6 @@ const CreatedProyek = ({ params, ...props }) => {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name !== 'Super Admin') {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(PROJECT_TYPE_SEARCH, payload, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -276,11 +256,6 @@ const CreatedProyek = ({ params, ...props }) => {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name !== 'Super Admin') {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(PROJECT_PHASE_SEARCH, payload, HEADER) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -297,11 +272,7 @@ const CreatedProyek = ({ params, ...props }) => {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name !== 'Super Admin') {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(DIVISI_SEARCH, payload, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -320,11 +291,7 @@ const CreatedProyek = ({ params, ...props }) => {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name !== 'Super Admin') {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }
)
}
const result = await axios const result = await axios
.post(USER_SEARCH, payload, HEADER) .post(USER_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -336,22 +303,6 @@ const CreatedProyek = ({ params, ...props }) => {
} }
}; };
const getDataProyekCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
setDataCompany(dataRes);
setLoading(false);
} else {
setLoading(false);
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
const handleDashboard = async (id) => { const handleDashboard = async (id) => {
const URL = `${BASE_OSPRO}/api/project/detail/${id}`; const URL = `${BASE_OSPRO}/api/project/detail/${id}`;
const result = await axios const result = await axios
@ -426,7 +377,6 @@ const CreatedProyek = ({ params, ...props }) => {
"akhir_proyek", "akhir_proyek",
"value_proyek", "value_proyek",
"income_year", "income_year",
"company_id",
"deleted_at", "deleted_at",
"deleted_by_id" "deleted_by_id"
], ],
@ -446,23 +396,9 @@ const CreatedProyek = ({ params, ...props }) => {
paging: { start: start, length: rowsPerPage }, paging: { start: start, length: rowsPerPage },
}; };
if (role_name !== 'Super Admin' && all_project === 'true') { payload.columns.push(
payload.columns.push( { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" } );
);
}
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)
@ -582,7 +518,6 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenDialogProyek = async (text) => { const handleOpenDialogProyek = async (text) => {
setCompanyId(text.company_id);
setOpenDialogProyek(true); setOpenDialogProyek(true);
setidTask(text.id); setidTask(text.id);
if (text.id !== 0) { if (text.id !== 0) {
@ -594,8 +529,6 @@ const CreatedProyek = ({ params, ...props }) => {
setDataViewStartDate(data.mulai_proyek) setDataViewStartDate(data.mulai_proyek)
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setCompanyId(data.company_id);
setOpenDialogGantt(true); setOpenDialogGantt(true);
}; };
@ -630,16 +563,12 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenAsignHr = (data) => { const handleOpenAsignHr = (data) => {
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setOpenDialogAsignHR(true); setOpenDialogAsignHR(true);
}; };
const handleOpenAsignCust = (data) => { const handleOpenAsignCust = (data) => {
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setOpenDialogAsignCust(true); setOpenDialogAsignCust(true);
}; };
@ -1009,7 +938,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const onConfirmDelete = async () => { const onConfirmDelete = async () => {
let urlDel = PROYEK_DELETE(idDelete, company_id); let urlDel = PROYEK_DELETE(idDelete);
const result = await axios const result = await axios
.delete(urlDel, HEADER) .delete(urlDel, HEADER)
.then((res) => res) .then((res) => res)
@ -1230,8 +1159,7 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const deleteImage = async (id) => { const deleteImage = async (id) => {
const company_id = localStorage.getItem("company_id"); const URL = IMAGE_DELETE(id, 'project_structure_organization');
const URL = IMAGE_DELETE(id, 'project_structure_organization', company_id);
await axios await axios
.delete(URL, HEADER) .delete(URL, HEADER)
.then(res => res) .then(res => res)
@ -1435,25 +1363,11 @@ const CreatedProyek = ({ params, ...props }) => {
joins: [], joins: [],
orders: { columns: ["id"], ascending: false }, orders: { columns: ["id"], ascending: false },
}; };
if (all_project === 'false' || all_project === 'null') {
if (role_name !== 'Super Admin' && all_project === 'true') {
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
);
}
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push( payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
); );
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
} }
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -1464,9 +1378,6 @@ const CreatedProyek = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((n, index) => { resData.map((n, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = n.join_first_company_name;
}
dataRow.Sortname = n.kode_sortname ? n.kode_sortname : ""; dataRow.Sortname = n.kode_sortname ? n.kode_sortname : "";
dataRow["Nama Project"] = n.nama ? n.nama : ""; dataRow["Nama Project"] = n.nama ? n.nama : "";
dataRow["Tanggal Mulai"] = n.mulai_proyek dataRow["Tanggal Mulai"] = n.mulai_proyek
@ -1476,7 +1387,6 @@ const CreatedProyek = ({ params, ...props }) => {
? moment(n.akhir_proyek).format(format) ? moment(n.akhir_proyek).format(format)
: "-"; : "-";
dataRow["Area Kerja"] = n.area_kerja ? n.area_kerja : ""; dataRow["Area Kerja"] = n.area_kerja ? n.area_kerja : "";
dataRow["Perusahaan"] = n.company ? n.company : "";
dataRow["Keterangan"] = n.keterangan ? n.keterangan : ""; dataRow["Keterangan"] = n.keterangan ? n.keterangan : "";
dataRow["Dianggap sukses ketika"] = n.considered_success_when dataRow["Dianggap sukses ketika"] = n.considered_success_when
? n.considered_success_when ? n.considered_success_when
@ -1501,7 +1411,7 @@ const CreatedProyek = ({ params, ...props }) => {
const handleExportPdf = async () => { const handleExportPdf = async () => {
const doc = new jsPDF(); const doc = new jsPDF();
let headers = [ let headers = [
[role_name === 'Super Admin' ? "Company" : null, "Project Name", "Nilai Kontrak", "Pendapatan Pertahun", "Anggaran Biaya", "Project Type", "PM", "Time Project"], ["Project Name", "Nilai Kontrak", "Pendapatan Pertahun", "Anggaran Biaya", "Project Type", "PM", "Time Project"],
]; ];
const payload = { const payload = {
@ -1550,25 +1460,11 @@ const CreatedProyek = ({ params, ...props }) => {
], ],
orders: { columns: ["nama"], ascending: true }, orders: { columns: ["nama"], ascending: true },
}; };
if (all_project === 'false' || all_project === 'null') {
if (role_name !== 'Super Admin' && all_project === 'true') {
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
);
}
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push( payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" } { name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
); );
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
} }
const result = await axios const result = await axios
.post(PROYEK_SEARCH, payload, HEADER) .post(PROYEK_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -1576,7 +1472,6 @@ const CreatedProyek = ({ params, ...props }) => {
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let resData = result.data.data; let resData = result.data.data;
const data = resData.map((elt) => [ const data = resData.map((elt) => [
role_name === 'Super Admin' ? elt.join_third_company_name : null,
elt.nama, elt.nama,
`Rp. ${formatThousand(elt.rencana_biaya)}`, `Rp. ${formatThousand(elt.rencana_biaya)}`,
elt.join_second_name, elt.join_second_name,
@ -1618,8 +1513,6 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenDokumen = async (data) => { const handleOpenDokumen = async (data) => {
await setidTask(data.id); await setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
setCompanyId(data.company_id);
setCompanyName(role_name === 'Super Admin' ? data.join_third_company_name : JSON.parse(configApp).company_name);
setOpenDialogDoc(true); setOpenDialogDoc(true);
}; };
@ -1716,9 +1609,7 @@ const CreatedProyek = ({ params, ...props }) => {
role_id, role_id,
user_id, user_id,
role_name, role_name,
company_id: text.company_id,
dataViewStartDate, dataViewStartDate,
companyName: (role_name === 'Super Admin' ? text.join_third_company_name : JSON.parse(configApp).company_name),
ganttName : res.name_version ganttName : res.name_version
} }
}}> }}>
@ -1836,15 +1727,6 @@ const CreatedProyek = ({ params, ...props }) => {
</> </>
), ),
}, },
...(role_name === 'Super Admin' ? [
{
title: t('company'),
dataIndex: "join_third_company_name",
key: "join_third_company_name",
render: (text, record) => (
<span>{record.join_third_company_name}</span>
)
}] : []),
{ title: "Project Name", dataIndex: "nama", key: "nama", width: 200 }, { title: "Project Name", dataIndex: "nama", key: "nama", width: 200 },
{ {
title: "Pendapatan Pertahun", dataIndex: "income_year", title: "Pendapatan Pertahun", dataIndex: "income_year",
@ -1974,9 +1856,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataDivisions={dataDivisions} dataDivisions={dataDivisions}
dataPM={dataPm} dataPM={dataPm}
projectImage={image} projectImage={image}
company_id={company_id}
role_name={role_name} role_name={role_name}
companyList={companyList}
token={token} token={token}
/> />
), ),
@ -2039,7 +1919,6 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignHr} handleClose={handleCloseDialogAsignHr}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={companyId}
token={token} token={token}
/> />
), ),
@ -2056,7 +1935,6 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignCust} handleClose={handleCloseDialogAsignCust}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
company_id={companyId}
token={token} token={token}
/> />
), ),
@ -2093,10 +1971,8 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogDoc} handleClose={handleCloseDialogDoc}
idTask={idTask} idTask={idTask}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId}
token={token} token={token}
role_name={role_name} role_name={role_name}
companyName={companyName}
/> />
), ),
[openDialogDoc] [openDialogDoc]
@ -2148,9 +2024,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id={user_id} user_id={user_id}
token={token} token={token}
isLogin={isLogin} isLogin={isLogin}
companyName={companyName}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId}
role_name={role_name} role_name={role_name}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
/> />
@ -2169,9 +2043,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id={user_id} user_id={user_id}
token={token} token={token}
isLogin={isLogin} isLogin={isLogin}
companyName={companyName}
proyekName={proyekName} proyekName={proyekName}
companyId={companyId}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
/> />
), ),

5
src/views/SimproV2/DemoRequest/index.js

@ -11,13 +11,12 @@ import { useTranslation } from 'react-i18next';
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -46,8 +45,6 @@ const ProjectType = ({ params, ...props }) => {
const [search, setSearch] = useState("") const [search, setSearch] = useState("")
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [dataDemo, setDataDemo] = useState([])
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation() const { t } = useTranslation()
const column = [ const column = [
{ name: t('name') }, { name: t('name') },

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

@ -10,13 +10,12 @@ 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, company_id, role_name, listCompany }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, role_name }) => {
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 [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
const onChangeParent = (val) => { const onChangeParent = (val) => {
@ -31,17 +30,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setParent(dataEdit.parent) setParent(dataEdit.parent)
setColor(dataEdit.color) setColor(dataEdit.color)
setParent(dataEdit.parent); setParent(dataEdit.parent);
setSelectedCompany(dataEdit.company_id);
} else if (typeDialog === "addChild") { } else if (typeDialog === "addChild") {
setParent(dataEdit.id); setParent(dataEdit.id);
setColor(dataEdit.color) setColor(dataEdit.color)
setSelectedCompany(dataEdit.company_id);
} else { } else {
setId(0) setId(0)
setColor('') setColor('')
setDescription('') setDescription('')
setParent(null) setParent(null)
setSelectedCompany(null)
} }
}, [dataEdit, openDialog]) }, [dataEdit, openDialog])
@ -57,16 +53,12 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const err = validation(); const err = validation();
if (!err) { if (!err) {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name, name,
description, description,
parent, parent,
color, color
company_id: company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else if (typeDialog === "addChild") { } else if (typeDialog === "addChild") {
@ -75,8 +67,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
parent: parent, parent: parent,
name: name, name: name,
description, description,
color, color
company_id: company_id
}; };
closeDialog('save', data); closeDialog('save', data);
} else if (typeDialog === "Edit") { } else if (typeDialog === "Edit") {
@ -86,33 +77,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
name, name,
description, description,
parent, parent,
color, color
company_id: company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
setId(0) setId(0);
setDescription('') setDescription('');
setName('') setName('');
setParent(null) setParent(null);
setColor('') setColor('');
setSelectedCompany(null)
} }
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none');
setId(0) setId(0);
setDescription('') setDescription('');
setName('') setName('');
setParent(null) setParent(null);
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -165,33 +149,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

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

@ -4,28 +4,23 @@ import React, { useState, useEffect, useMemo } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH, COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst'; import { DIVISI_ADD, DIVISI_EDIT, DIVISI_DELETE, DIVISI_SEARCH } from '../../../const/ApiConst';
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 { useLocation } from "react-router-dom";
import { import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup, checkActMenup,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -55,11 +50,9 @@ const ProjectType = ({ params, ...props }) => {
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [dataDivisions, setDataDivisions] = useState([]) const [dataDivisions, setDataDivisions] = useState([])
const [listCompany, setListCompany] = useState([])
const [loading, setLoading] = useState(true) const [loading, setLoading] = useState(true)
const { t } = useTranslation() const { t } = useTranslation()
const column = [ const column = [
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('nameDivision') }, { name: t('nameDivision') },
{ name: t('description') }, { name: t('description') },
{ name: t('color') }, { name: t('color') },
@ -74,20 +67,6 @@ const ProjectType = ({ params, ...props }) => {
exportExcel() exportExcel()
} }
}, [dataExport]) }, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getListDivision = async () => { const getListDivision = async () => {
const payload = { const payload = {
@ -115,18 +94,6 @@ const ProjectType = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const listDivions = await axios const listDivions = await axios
.post(DIVISI_SEARCH, payload, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
@ -175,18 +142,6 @@ const ProjectType = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(DIVISI_SEARCH, payload, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
@ -235,21 +190,7 @@ const ProjectType = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(DIVISI_SEARCH, payload, HEADER) .post(DIVISI_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
@ -259,9 +200,6 @@ const ProjectType = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((val, index) => { resData.map((val, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow["Nama Divisi"] = val.name; dataRow["Nama Divisi"] = val.name;
dataRow.Deskripsi = val.description; dataRow.Deskripsi = val.description;
excelData.push(dataRow) excelData.push(dataRow)
@ -429,15 +367,6 @@ const ProjectType = ({ params, ...props }) => {
</> </>
, ,
}, },
...(role_name === 'Super Admin' ? [
{
title: t('company'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => (
<span>{record.join_first_company_name}</span>
)
}] : []),
{ title: 'Nama', dataIndex: 'name', key: 'name' }, { title: 'Nama', dataIndex: 'name', key: 'name' },
{ title: 'Deskripsi', dataIndex: 'description', key: 'description' }, { title: 'Deskripsi', dataIndex: 'description', key: 'description' },
{ {
@ -515,8 +444,6 @@ const ProjectType = ({ params, ...props }) => {
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
dataDivisions={dataDivisions} dataDivisions={dataDivisions}
company_id={company_id}
listCompany={listCompany}
role_name={role_name} role_name={role_name}
/> />
<Card> <Card>

6
src/views/SimproV2/Gantt/GanttFrame.js

@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react';
import { useHistory, withRouter } from 'react-router-dom'; import { useHistory, withRouter } from 'react-router-dom';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo(({ versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name, ganttName }) => { const GanttFrame = React.memo(({ versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, role_name, ganttName }) => {
const history = useHistory(); const history = useHistory();
const iframeSrc = `https://si-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}&company_name=${company_name}&gantt_name=${ganttName}`; // const iframeSrc = `https://si-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&gantt_name=${ganttName}`;
// const iframeSrc = `http://localhost:8444/surveyor_indonesia_gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&company_id=${companyId}&company_name=${company_name}&gantt_name=${ganttName}`; const iframeSrc = `http://localhost:8444/surveyor_indonesia_gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&gantt_name=${ganttName}`;
const [batchEntityData, setBatchEntityData] = useState(null); const [batchEntityData, setBatchEntityData] = useState(null);
useEffect(() => { useEffect(() => {

4
src/views/SimproV2/Gantt/index.js

@ -10,7 +10,7 @@ let roCount = 0;
const Gantt = (props) => { const Gantt = (props) => {
const location = useLocation(); const location = useLocation();
const { company_id, dataViewStartDate, companyName, role_name } = location.state || {}; const { dataViewStartDate, role_name } = location.state || {};
let role_id = '', userId = '', isLogin = '', token = '', ganttName = ''; let role_id = '', userId = '', isLogin = '', token = '', ganttName = '';
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) {
@ -113,10 +113,8 @@ const Gantt = (props) => {
token={token} token={token}
ro={ro} ro={ro}
role_name={role_name} role_name={role_name}
companyId={company_id}
timestamp={timestamp} timestamp={timestamp}
dataViewStartDate={dataViewStartDate} dataViewStartDate={dataViewStartDate}
company_name={companyName}
ganttName={ganttName} ganttName={ganttName}
/> />
)} )}

27
src/views/SimproV2/LimitasiUser/index.js

@ -35,7 +35,6 @@ class index extends Component {
tooltipMenu: false, tooltipMenu: false,
tooltipTambah: false, tooltipTambah: false,
totalPage: 0, totalPage: 0,
company_id: props.company_id || 0,
role_name: props.role_name || '', role_name: props.role_name || '',
role_id: props.role_id || 0, role_id: props.role_id || 0,
user_id: props.user_id || 0, user_id: props.user_id || 0,
@ -53,7 +52,6 @@ class index extends Component {
}; };
this.columns = [ this.columns = [
{ title: this.props.t('Company'), dataIndex: 'company_name', key: 'company_name', className: "nowrap" },
{ {
title: this.props.t('Expired Date'), dataIndex: 'exp_ospro', key: 'exp_ospro', title: this.props.t('Expired Date'), dataIndex: 'exp_ospro', key: 'exp_ospro',
render: (text,record) => { render: (text,record) => {
@ -116,8 +114,7 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.descriptio
company_id: data.company_id
} }
const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config) const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config)
@ -137,8 +134,7 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.description
company_id : data.company_id
} }
const url = PROJECT_ROLE_EDIT(data.id) const url = PROJECT_ROLE_EDIT(data.id)
const result = await axios.put(url, formData, this.state.config) const result = await axios.put(url, formData, this.state.config)
@ -218,21 +214,7 @@ class index extends Component {
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (this.state.role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" },
)
} else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
payload.joins.push(
{ "name": "m_company", "column_join": "company_id", "column_results": ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_ROLE_SEARCH, payload, this.state.config) .post(PROJECT_ROLE_SEARCH, payload, this.state.config)
.then(res => res) .then(res => res)
@ -242,9 +224,6 @@ class index extends Component {
const dataExport = []; const dataExport = [];
dataRes.map((val, index) => { dataRes.map((val, index) => {
let row = {}; let row = {};
if (this.state.role_name === 'Super Admin') {
row.Company = val.join_first_company_name;
}
row.Nama = val.name; row.Nama = val.name;
row.Deskripsi = val.description; row.Deskripsi = val.description;
dataExport.push(row); dataExport.push(row);

13
src/views/SimproV2/PanicButton/index.js

@ -121,15 +121,6 @@ class index extends Component {
} }
} }
if (this.state.role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: this.state.search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PANIC_BUTTON_SEARCH, payload, config) .post(PANIC_BUTTON_SEARCH, payload, config)
.then(res => res) .then(res => res)
@ -285,9 +276,6 @@ class index extends Component {
<i id="tooltipMap" className="fa fa-map" style={{ color: 'black', cursor: "pointer" }} onClick={() => this.handleMap(n)}></i> <i id="tooltipMap" className="fa fa-map" style={{ color: 'black', cursor: "pointer" }} onClick={() => this.handleMap(n)}></i>
</Tooltip> </Tooltip>
</td> </td>
{this.state.role_name === 'Super Admin' &&
<td>{n.join_second_company_name ? n.join_second_company_name : "-"}</td>
}
<td>{n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"}</td> <td>{n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"}</td>
<td>{n.join_first_name !== null ? n.join_first_name : "-"}</td> <td>{n.join_first_name !== null ? n.join_first_name : "-"}</td>
<td>{n.status_response !== null ? n.status_response : "-"}</td> <td>{n.status_response !== null ? n.status_response : "-"}</td>
@ -334,7 +322,6 @@ class index extends Component {
render() { render() {
const column = [ const column = [
{ name: this.props.t('action') }, { name: this.props.t('action') },
this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
{ name: this.props.t('date') }, { name: this.props.t('date') },
{ name: this.props.t('nameHR') }, { name: this.props.t('nameHR') },
{ name: this.props.t('statusResponse') }, { name: this.props.t('statusResponse') },

4
src/views/SimproV2/PlanningHarian/index.js

@ -8,9 +8,7 @@ import DialogForm from './DialogForm';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Table, Button, Tooltip } from 'antd'; import { Pagination, Table, Button, Tooltip } from 'antd';
import { import {
BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH, PROYEK_EDIT, PROYEK_DELETE, PROYEK_SEARCH,USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE,ROLE_SEARCH
USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE,
USERROLE_SEARCH, ROLE_SEARCH
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import moment from 'moment' import moment from 'moment'

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

@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const Index = ({ params, ...props }) => { const Index = ({ params, ...props }) => {
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {}; let role_id = 0, user_id = 0, isLogin = false, token = '', all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {};
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -93,17 +92,6 @@ const Index = ({ params, ...props }) => {
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
} }
if (role_name === 'Super Admin') {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.columns.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PRESENCE_SEARCH, payload, config) .post(PRESENCE_SEARCH, payload, config)
.then(res => res) .then(res => res)
@ -255,18 +243,6 @@ const Index = ({ params, ...props }) => {
</Tooltip> </Tooltip>
</>, </>,
}, },
...(role_name === 'Super Admin'
? [
{
title: t('company'),
dataIndex: "join_second_company_name",
key: "join_second_company_name",
render: (text, record) => (
<span>{record.join_second_company_name}</span>
)
},
]
: []),
{ title: t('nik'), dataIndex: 'join_first_ktp_number', key: 'join_first_ktp_number' }, { title: t('nik'), dataIndex: 'join_first_ktp_number', key: 'join_first_ktp_number' },
{ title: t('nameHR'), dataIndex: 'join_first_name', key: 'join_first_name' }, { title: t('nameHR'), dataIndex: 'join_first_name', key: 'join_first_name' },
{ title: t('presenceIn'), dataIndex: 'clock_in', key: 'clock_in', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}</div>) }, { title: t('presenceIn'), dataIndex: 'clock_in', key: 'clock_in', render: (text, record) => (<div style={{ whiteSpace: "nowrap" }}>{text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}</div>) },

8
src/views/SimproV2/Profile/index.js

@ -1,11 +1,9 @@
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import React, { useState, useEffect, useMemo } from 'react'; import React, { useState, useEffect } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table, Button } from 'reactstrap'; import { Card, Col, Row, Button } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Pagination, Tooltip } from 'antd'; import { USER_EDIT } from '../../../const/ApiConst';
import { USER_EDIT, SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../const/ApiConst';
import profile from '../../../assets/img/profile.png' import profile from '../../../assets/img/profile.png'
import DialogForm from './DialogForm' import DialogForm from './DialogForm'
import { ROLE_SEARCH, USER_GET_ID } from '../../../const/ApiConst' import { ROLE_SEARCH, USER_GET_ID } from '../../../const/ApiConst'

41
src/views/SimproV2/ProjectType/DialogForm.js

@ -9,13 +9,12 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
const [uom, setUom] = useState('') const [uom, setUom] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState() const [unitPrice, setUnitPrice] = useState()
const [selectedCompany, setSelectedCompany] = useState(null)
const [isMultiLocation, setIsMultiLocation] = useState(false); const [isMultiLocation, setIsMultiLocation] = useState(false);
const { t } = useTranslation(); const { t } = useTranslation();
@ -30,7 +29,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setUnitPrice(dataEdit.unit_price) setUnitPrice(dataEdit.unit_price)
setUom(dataEdit.uom) setUom(dataEdit.uom)
setProjectType(dataEdit.name) setProjectType(dataEdit.name)
setSelectedCompany(dataEdit.company_id)
setIsMultiLocation(dataEdit.is_multiLocation) setIsMultiLocation(dataEdit.is_multiLocation)
} else { } else {
handleClear() handleClear()
@ -39,14 +37,10 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectType, name: projectType,
description, description,
company_id: parseInt(company_id),
is_multiLocation: isMultiLocation is_multiLocation: isMultiLocation
} }
@ -56,7 +50,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
id, id,
name: projectType, name: projectType,
description, description,
company_id: parseInt(company_id),
is_multiLocation: isMultiLocation is_multiLocation: isMultiLocation
} }
closeDialog('edit', data); closeDialog('edit', data);
@ -68,7 +61,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0) setId(0)
setProjectType('') setProjectType('')
setDescription('') setDescription('')
setSelectedCompany(null)
setIsMultiLocation(false) setIsMultiLocation(false)
} }
@ -78,10 +70,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
handleClear(); handleClear();
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -108,33 +96,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</div> </div>
</FormGroup> </FormGroup>
</Col> </Col>
{
role_name === 'Super Admin' && (
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
)
}
</Row> </Row>
</Form> </Form>
) )

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

@ -8,7 +8,7 @@ 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 { 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 } 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 { checkActMenup } from '../../../const/CustomFunc.js';
@ -16,13 +16,12 @@ import { useLocation } from "react-router-dom";
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -53,7 +52,6 @@ const ProjectType = ({ params, ...props }) => {
const [search, setSearch] = useState('') const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation(); const { t } = useTranslation();
useEffect(() => { useEffect(() => {
getDataProjectType() getDataProjectType()
@ -66,29 +64,11 @@ const ProjectType = ({ params, ...props }) => {
} }
}, [dataExport]) }, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataProjectType = async () => { const getDataProjectType = async () => {
let start = 0; let start = 0;
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage start = (currentPage * rowsPerPage) - rowsPerPage
} }
const payload = { const payload = {
group_column: { group_column: {
"operator": "AND", "operator": "AND",
@ -114,21 +94,7 @@ const ProjectType = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER)
.then(res => res) .then(res => res)
@ -185,21 +151,6 @@ const ProjectType = ({ params, ...props }) => {
}, },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(PROJECT_TYPE_SEARCH, payload, HEADER) .post(PROJECT_TYPE_SEARCH, payload, HEADER)
@ -211,9 +162,6 @@ const ProjectType = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((val, index) => { resData.map((val, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama = val.name; dataRow.Nama = val.name;
dataRow.Deskripsi = val.description; dataRow.Deskripsi = val.description;
excelData.push(dataRow) excelData.push(dataRow)
@ -376,16 +324,6 @@ const ProjectType = ({ params, ...props }) => {
</Tooltip> </Tooltip>
</>, </>,
}, },
...(role_name === 'Super Admin' ? [
{
title: t('company'),
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => (
<span>{record.join_first_company_name}</span>
)
}] : []),
{ title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" }, { title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: t('description'), dataIndex: 'description', key: 'description' }, { title: t('description'), dataIndex: 'description', key: 'description' },
]; ];
@ -424,8 +362,6 @@ const ProjectType = ({ params, ...props }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
listCompany={listCompany}
company_id={company_id}
role_name={role_name} role_name={role_name}
/> />
<DialogInitialGantt <DialogInitialGantt

10
src/views/SimproV2/ResourceMaterial/index.js

@ -10,22 +10,14 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Table, Button, Tooltip, Tabs, Collapse } from 'antd'; import { Pagination, Table, Button, Tooltip, Tabs, Collapse } from 'antd';
import { formatRupiah, formatNumber, renderLabelStatus } from '../../../const/CustomFunc' import { formatRupiah, formatNumber, renderLabelStatus } from '../../../const/CustomFunc'
import { import {
BASE_SIMPRO,
PROYEK_ADD, PROYEK_SEARCH, PROYEK_EDIT, PROYEK_DELETE,
MATERIAL_RESOURCE_ADD, MATERIAL_RESOURCE_EDIT, MATERIAL_RESOURCE_DELETE, MATERIAL_RESOURCE_SEARCH, MATERIAL_RESOURCE_ADD, MATERIAL_RESOURCE_EDIT, MATERIAL_RESOURCE_DELETE, MATERIAL_RESOURCE_SEARCH,
REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_EDIT, REQUEST_MATERIAL_SEARCH, REQUEST_MATERIAL_EDIT, SATUAN_SEARCH
REQUEST_MATERIAL_UPDATE_WAREHOUSE_SITE, SATUAN_SEARCH
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const { Panel } = Collapse; const { Panel } = Collapse;
const url = "";
const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id');
const format = "DD-MM-YYYY";
const groupBy = (array, key) => { const groupBy = (array, key) => {
return array.reduce((result, currentValue) => { return array.reduce((result, currentValue) => {
(result[currentValue[key]] = result[currentValue[key]] || []).push( (result[currentValue[key]] = result[currentValue[key]] || []).push(

43
src/views/SimproV2/ResourceWorker/DialogForm.js

@ -10,7 +10,7 @@ import { formatNumber } from '../../../const/CustomFunc'
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, roleList, divisiList, role_name, companyList, company_id }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, roleList, divisiList, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [resourceName, setResourceName] = useState('') const [resourceName, setResourceName] = useState('')
const [username, setUsername] = useState('') const [username, setUsername] = useState('')
@ -26,7 +26,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const [ktpNumber, setKtpNumber] = useState('') const [ktpNumber, setKtpNumber] = useState('')
const [biayaPerJam, setBiayaPerJam] = useState('') const [biayaPerJam, setBiayaPerJam] = useState('')
const [roleId, setRoleId] = useState('') const [roleId, setRoleId] = useState('')
const [scompany_id, setCompanyId] = useState(null);
const [address, setAddress] = useState('') const [address, setAddress] = useState('')
const [divisionId, setDivisionId] = useState('') const [divisionId, setDivisionId] = useState('')
const [statusResource, setStatusResource] = useState('active') const [statusResource, setStatusResource] = useState('active')
@ -45,7 +44,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setPhoneNo(dataEdit.phone_number) setPhoneNo(dataEdit.phone_number)
setEmail(dataEdit.email) setEmail(dataEdit.email)
setGender(dataEdit.gender) setGender(dataEdit.gender)
setCompanyId(dataEdit.company_id)
setBirthDate(dataEdit.birth_date ? moment(dataEdit.birth_date) : "") setBirthDate(dataEdit.birth_date ? moment(dataEdit.birth_date) : "")
setBirthPlace(dataEdit.birth_place) setBirthPlace(dataEdit.birth_place)
setBloodType(dataEdit.blood_type) setBloodType(dataEdit.blood_type)
@ -74,7 +72,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setRoleId('') setRoleId('')
setDivisionId('') setDivisionId('')
setAddress('') setAddress('')
setCompanyId(null)
setStatusResource('active') setStatusResource('active')
setStatusRestriction(false) setStatusRestriction(false)
setStatusCustomer(false) setStatusCustomer(false)
@ -116,8 +113,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
ktp_number: ktpNumber, ktp_number: ktpNumber,
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction, status_boundary: statusRestriction
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
} }
if(statusCustomer === false) { if(statusCustomer === false) {
@ -149,8 +145,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
id, id,
username, username,
password, password,
email, email
company_id: parseInt(company_id)
} }
closeDialog('edit', data); closeDialog('edit', data);
@ -170,8 +165,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
biaya_per_jam: biayaPerJam.replace('.', ''), biaya_per_jam: biayaPerJam.replace('.', ''),
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction, status_boundary: statusRestriction
company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
} }
if(statusCustomer === false) { if(statusCustomer === false) {
data.role_id = roleId; data.role_id = roleId;
@ -188,10 +182,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
} }
} }
const onChangeCompanyProject = (val) => {
setCompanyId(val);
};
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
} }
@ -318,31 +308,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col> </Col>
</Row> </Row>
<Row> <Row>
{
role_name === 'Super Admin' && (
<Col md={6} style={{ marginTop:'15px' }}>
<FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={scompany_id}
defaultValue={scompany_id}
onChange={onChangeCompanyProject}
style={{ width: "100%" }}
>
{companyList.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
)
}
{ {
statusCustomer === false && ( statusCustomer === false && (
<> <>

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

@ -9,7 +9,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { useLocation } from "react-router-dom"; 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
} from '../../../const/ApiConst'; } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
@ -17,13 +17,12 @@ import {
} from "../../../const/CustomFunc"; } 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -45,7 +44,6 @@ const ResourceWorker = ({ params, ...props }) => {
const [dataExport, setDataExport] = useState([]) const [dataExport, setDataExport] = useState([])
const [dataTable, setDatatable] = useState([]) const [dataTable, setDatatable] = useState([])
const [divisiList, setDivisiList] = useState([]) const [divisiList, setDivisiList] = useState([])
const [companyList, setDataCompany] = useState([]);
const [idDelete, setIdDelete] = useState(0) const [idDelete, setIdDelete] = useState(0)
const [openDialog, setOpenDialog] = useState(false) const [openDialog, setOpenDialog] = useState(false)
const [openDialogShift, setOpenDialogShift] = useState(false) const [openDialogShift, setOpenDialogShift] = useState(false)
@ -62,9 +60,6 @@ const ResourceWorker = ({ params, ...props }) => {
useEffect(() => { useEffect(() => {
getRoleList() getRoleList()
getDivisiList() getDivisiList()
if(role_name === 'Super Admin') {
getDataProyekCompany();
}
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -93,15 +88,7 @@ const ResourceWorker = ({ params, ...props }) => {
"orders": { "columns": ["id"], "ascending": false }, "orders": { "columns": ["id"], "ascending": false },
"columns": [], "columns": [],
} }
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(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
.post(ROLE_SEARCH, formData, HEADER) .post(ROLE_SEARCH, formData, HEADER)
.then(res => res) .then(res => res)
@ -118,12 +105,6 @@ const ResourceWorker = ({ params, ...props }) => {
"columns": [], "columns": [],
} }
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
)
}
const result = await axios const result = await axios
.post(DIVISI_SEARCH, formData, HEADER) .post(DIVISI_SEARCH, formData, HEADER)
.then(res => res) .then(res => res)
@ -223,19 +204,6 @@ const ResourceWorker = ({ params, ...props }) => {
} }
} }
if (role_name !== "Super Admin") {
payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
)
} else {
payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
);
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
);
}
const result = await axios const result = await axios
.post(USER_SEARCH, payload, HEADER) .post(USER_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
@ -251,22 +219,6 @@ const ResourceWorker = ({ params, ...props }) => {
} }
} }
const getDataProyekCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
setDataCompany(dataRes);
setLoading(false);
} else {
setLoading(false);
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
const handleSearch = e => { const handleSearch = e => {
const value = e.target.value const value = e.target.value
setSearch(value); setSearch(value);
@ -372,18 +324,6 @@ const ResourceWorker = ({ params, ...props }) => {
} }
} }
if (role_name !== "Super Admin") {
payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
)
} else {
payload.group_column.where.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
);
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
);
}
const result = await axios const result = await axios
.post(USER_SEARCH, payload, HEADER) .post(USER_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
@ -394,9 +334,6 @@ const ResourceWorker = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((n, index) => { resData.map((n, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = n.join_third_company_name;
}
dataRow["NIK (Nomor Induk Karyawan)"] = n.ktp_number; dataRow["NIK (Nomor Induk Karyawan)"] = n.ktp_number;
dataRow["Employee Name"] = n.name; dataRow["Employee Name"] = n.name;
dataRow["Divisi"] = n.join_second_name; dataRow["Divisi"] = n.join_second_name;
@ -594,15 +531,6 @@ const ResourceWorker = ({ params, ...props }) => {
</Tooltip> </Tooltip>
</>, </>,
}, },
...(role_name === 'Super Admin' ? [
{
title: t('company'),
dataIndex: "join_third_company_name",
key: "join_third_company_name",
render: (text, record) => (
<span>{record.join_third_company_name}</span>
)
}] : []),
{ title: t('nik'), dataIndex: 'ktp_number', key: 'ktp_number' }, { title: t('nik'), dataIndex: 'ktp_number', key: 'ktp_number' },
{ title: t('nameHR'), dataIndex: 'name', key: 'name' }, { title: t('nameHR'), dataIndex: 'name', key: 'name' },
{ title: t('division'), dataIndex: 'join_second_name', key: 'join_second_name' }, { title: t('division'), dataIndex: 'join_second_name', key: 'join_second_name' },
@ -654,8 +582,6 @@ const ResourceWorker = ({ params, ...props }) => {
roleList={roleList} roleList={roleList}
divisiList={divisiList} divisiList={divisiList}
role_name={role_name} role_name={role_name}
companyList={companyList}
company_id={company_id}
/> />
<DialogFormUserShift <DialogFormUserShift
openDialog={openDialogShift} openDialog={openDialogShift}

54
src/views/SimproV2/Satuan/DialogForm.js

@ -8,11 +8,10 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select; const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
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('')
const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation() const { t } = useTranslation()
@ -21,7 +20,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(dataEdit.id) setId(dataEdit.id)
setDescription(dataEdit.description) setDescription(dataEdit.description)
setName(dataEdit.name) setName(dataEdit.name)
setSelectedCompany(dataEdit.company_id);
} else { } else {
setId(0) setId(0)
} }
@ -30,32 +28,22 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = parseInt(selectedCompany)
}
data = { data = {
name: name, name: name,
description: description, description: description
company_id: parseInt(company_id)
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = parseInt(selectedCompany)
}
data = { data = {
id, id,
name: name, name: name,
description: description, description: description
company_id: parseInt(company_id)
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
setId(0) setId(0);
setDescription('') setDescription('');
setSelectedCompany(null)
} }
@ -63,13 +51,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
closeDialog('cancel', 'none') closeDialog('cancel', 'none')
setId(0) setId(0)
setDescription('') setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => {
setSelectedCompany(val);
};
const renderForm = () => { const renderForm = () => {
return ( return (
<Form> <Form>
@ -87,33 +70,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">
{t('company')}<span style={{ color: "red" }}>*</span>
</Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
style={{ width: "100%" }}
>
{listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
</Row>
}
</Form> </Form>
) )
} }

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

@ -6,26 +6,21 @@ import axios from "../../../const/interceptorApi"
import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications'; 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 } from '../../../const/ApiConst';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
checkActMenup, checkActMenup,
} from "../../../const/CustomFunc"; } from "../../../const/CustomFunc";
const Satuan = ({ params, ...props }) => { const Satuan = ({ 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 = '', all_project = null, role_name = '', hierarchy = [], user_name = '';
if (props && props.role_id && props.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.role_id; role_id = props.role_id;
user_id = props.user_id; user_id = props.user_id;
token = props.token; token = props.token;
isLogin = props.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project; all_project = props.all_project;
role_name = props.role_name; role_name = props.role_name;
isLogin = props.isLogin; isLogin = props.isLogin;
@ -54,7 +49,6 @@ const Satuan = ({ params, ...props }) => {
const [search, setSearch] = useState('') const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0) const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save') const [typeDialog, setTypeDialog] = useState('Save')
const [listCompany, setListCompany] = useState([])
const { t } = useTranslation() const { t } = useTranslation()
useEffect(() => { useEffect(() => {
getDataSatuan() getDataSatuan()
@ -67,35 +61,16 @@ const Satuan = ({ params, ...props }) => {
} }
}, [dataExport]) }, [dataExport])
useEffect(() => {
getDataCompany()
}, [])
const column = [ const column = [
role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('name') }, { name: t('name') },
{ name: t('description') }, { name: t('description') },
].filter(column => column && column.name); ].filter(column => column && column.name);
const getDataCompany = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
setListCompany(result.data.data);
}
}
const getDataSatuan = async () => { const getDataSatuan = async () => {
let start = 0; let start = 0;
if (currentPage !== 1 && currentPage > 1) { if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage start = (currentPage * rowsPerPage) - rowsPerPage
} }
const payload = { const payload = {
group_column: { group_column: {
"operator": "AND", "operator": "AND",
@ -122,20 +97,6 @@ const Satuan = ({ params, ...props }) => {
'joins': [] 'joins': []
} }
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
)
} else {
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(SATUAN_SEARCH, payload, HEADER) .post(SATUAN_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
@ -177,21 +138,7 @@ const Satuan = ({ params, ...props }) => {
"orders": { "columns": ["id"], "ascending": false }, "orders": { "columns": ["id"], "ascending": false },
'joins': [] 'joins': []
} }
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" },
)
payload.joins.push(
{ name: "m_company", column_join: "company_id", column_results: ["company_name"] }
)
payload.group_column.where.push(
{ name: "company_name", logic_operator: "~*", value: search, table_name: "m_company" }
)
}
const result = await axios const result = await axios
.post(SATUAN_SEARCH, payload, HEADER) .post(SATUAN_SEARCH, payload, HEADER)
.then(res => res) .then(res => res)
@ -201,9 +148,6 @@ const Satuan = ({ params, ...props }) => {
const excelData = []; const excelData = [];
resData.map((val, index) => { resData.map((val, index) => {
let dataRow = {}; let dataRow = {};
if (role_name === 'Super Admin') {
dataRow.Company = val.join_first_company_name;
}
dataRow.Nama = val.name; dataRow.Nama = val.name;
dataRow.Deskripsi = val.description; dataRow.Deskripsi = val.description;
excelData.push(dataRow) excelData.push(dataRow)
@ -344,9 +288,7 @@ const Satuan = ({ params, ...props }) => {
dataEdit={dataEdit} dataEdit={dataEdit}
clickOpenModal={clickOpenModal} clickOpenModal={clickOpenModal}
dataParent={allDataMenu} dataParent={allDataMenu}
listCompany={listCompany}
role_name={role_name} role_name={role_name}
company_id={company_id}
/> />
<Card> <Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>
@ -407,11 +349,6 @@ const Satuan = ({ params, ...props }) => {
} }
</Tooltip> </Tooltip>
</td> </td>
{role_name === 'Super Admin' &&
(
<td>{n.join_first_company_name}</td>
)
}
<td>{n.name}</td> <td>{n.name}</td>
<td>{n.description}</td> <td>{n.description}</td>
</tr> </tr>

12
src/views/SimproV2/Settings/components/MyProfile/Index.js

@ -14,10 +14,9 @@ import { Modal, ModalBody, ModalFooter, Button } from 'reactstrap';
const Index = () => { const Index = () => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const user_id = localStorage.getItem("user_id") const user_id = localStorage.getItem("user_id")
let company_id = '', configApp = ''; let configApp = '';
const role = window.localStorage.getItem('role_name'); const role = window.localStorage.getItem('role_name');
if(role !== 'Super Admin') { if(role !== 'Super Admin') {
company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp')); configApp = JSON.parse(window.localStorage.getItem('configApp'));
} }
const config = { const config = {
@ -132,9 +131,6 @@ const Index = () => {
formData.append('ref_id', id); formData.append('ref_id', id);
formData.append('category', 'profile_picture'); formData.append('category', 'profile_picture');
formData.append('files', data); formData.append('files', data);
if(role !== 'Super Admin') {
formData.append('company_name', configApp.company_name);
}
await axios await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART) .post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
.then(res => res) .then(res => res)
@ -143,7 +139,7 @@ const Index = () => {
// Delete Image Function // Delete Image Function
const deleteImageProfile = async (id) => { const deleteImageProfile = async (id) => {
const URL = IMAGE_DELETE(id, 'profile_picture', company_id != '' ? company_id : 'undifined'); const URL = IMAGE_DELETE(id, 'profile_picture');
await axios await axios
.delete(URL, config) .delete(URL, config)
.then(res => res) .then(res => res)
@ -254,7 +250,7 @@ const Index = () => {
<div className={stylesHead.img} style={{ cursor:imageProfile ? 'pointer' : '' }} onClick={imageProfile ? () => handleImageClick() : ''}> <div className={stylesHead.img} style={{ cursor:imageProfile ? 'pointer' : '' }} onClick={imageProfile ? () => handleImageClick() : ''}>
<img className={stylesHead.obejct11} src={ <img className={stylesHead.obejct11} src={
imageProfile ? ( imageProfile ? (
`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp?.company_name : 'undifined', moment(imageProfile?.created_at).format('YYYY-MM'))}` `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image)}`
) : profile ) : profile
} /> } />
</div> </div>
@ -416,7 +412,7 @@ const Index = () => {
<img <img
src={ src={
imageProfile ? ( imageProfile ? (
`${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image, role != 'Super Admin' ? configApp?.company_name : 'undifined', moment(imageProfile?.created_at).format('YYYY-MM'))}` `${BASE_SIMPRO_LUMEN_IMAGE_COMPANY(imageProfile?.image,)}`
) : profile ) : profile
} }
style={{ maxWidth: "100%" }} style={{ maxWidth: "100%" }}

21
src/views/SimproV2/Settings/components/Plan/Container1.js

@ -12,14 +12,13 @@ const Container1 = () => {
const [totalPage, setTotalPage] = useState(0); const [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]); const [transaction, setTransaction] = useState([]);
const [storage, setLimitInformation] = useState(0) const [storage, setLimitInformation] = useState(0)
const currentDate = new Date(); // Now date const currentDate = new Date();
const givenDate = new Date(transaction.exp_ospro); // Parse exp ospro to date format const givenDate = new Date(transaction.exp_ospro);
const differenceInMillis = givenDate.getTime() - currentDate.getTime(); // Get time difference const differenceInMillis = givenDate.getTime() - currentDate.getTime();
const differenceInDays = role !== 'Super Admin' ? Math.ceil(differenceInMillis / (1000 * 60 * 60 * 24)) : 30; const differenceInDays = role !== 'Super Admin' ? Math.ceil(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
let company_id = '', configApp = ''; let configApp = '';
if(role !== 'Super Admin') { if(role !== 'Super Admin') {
company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp')); configApp = JSON.parse(window.localStorage.getItem('configApp'));
} }
const config = { const config = {
@ -39,14 +38,10 @@ const Container1 = () => {
const getDataProyek = async () => { const getDataProyek = async () => {
const payload = { const payload = {
"columns": [
{"name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND"}
],
"select": [ "select": [
"nama", "nama",
"mulai_proyek", "mulai_proyek",
"akhir_proyek", "akhir_proyek"
"company_id"
], ],
}; };
const result = await axios const result = await axios
@ -63,11 +58,7 @@ const Container1 = () => {
const getDataTransaction = async () => { const getDataTransaction = async () => {
const formData = { const formData = {
"paging": {"start": 0, "length": 1}, "paging": {"start": 0, "length": 1},
"columns": [
{"name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND"}
],
"select": [ "select": [
"company_id",
"type_paket", "type_paket",
"amount", "amount",
"exp_ospro", "exp_ospro",
@ -88,7 +79,7 @@ const Container1 = () => {
} }
const getLimitInformation = async () => { const getLimitInformation = async () => {
const url = STORAGE_LIMIT_INFORMATION(role !== 'Super Admin' ? configApp.company_name : 'Super Admin'); const url = STORAGE_LIMIT_INFORMATION;
const result = await axios const result = await axios
.get(url, config) .get(url, config)
.then((res) => res) .then((res) => res)

2
src/views/testgantt/index.js

@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react';
import Timeline from 'react-calendar-timeline' import Timeline from 'react-calendar-timeline'
import 'react-calendar-timeline/lib/Timeline.css' import 'react-calendar-timeline/lib/Timeline.css'
import moment from 'moment'; import moment from 'moment';
import { BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH_DETAIL, PROYEK_EDIT, PROYEK_DELETE } from '../../const/ApiConst'; import { BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH_DETAIL } from '../../const/ApiConst';
import axios from 'axios'; import axios from 'axios';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { Button } from 'antd'; import { Button } from 'antd';

Loading…
Cancel
Save