+
-
+
+
+
+
{
}
return SCURVE && SCURVE == "1"
? projectName
- ? calculationStatus
- ? projectName + " - S-Curve Ready"
- : projectName + " - S-Curve Loading"
- : null
- : projectName +
- parentNames +
- " - " +
- dataGantt.data.data.name_version;
+ // ? calculationStatus
+ // ? projectName + " - S-Curve Ready"
+ // : projectName + " - S-Curve Loading"
+ // : null
+ : projectName
+ // + parentNames +
+ // " - " +
+ // dataGantt.data.data.name_version;
})()
) : (
@@ -1416,7 +1459,7 @@ const DashboardProject = (props) => {
{isReadySCurve ? (
100 ? 100 : planningProgress}
+ progress={planningProgressToDay > 100 ? 100 : planningProgressToDay}
/>
) : (
diff --git a/src/views/Dashboard/DashboardProjectCarousell.js b/src/views/Dashboard/DashboardProjectCarousell.js
index b0555f0..04247e6 100644
--- a/src/views/Dashboard/DashboardProjectCarousell.js
+++ b/src/views/Dashboard/DashboardProjectCarousell.js
@@ -70,13 +70,12 @@ const center = {
};
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -129,7 +128,7 @@ const DashboardProject = ({args,...props}) => {
setIsReadyProjectDetail(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
.get(URL, HEADER)
.then((res) => res)
diff --git a/src/views/MapMonitoring/index.js b/src/views/MapMonitoring/index.js
index 9b558dd..13d805e 100644
--- a/src/views/MapMonitoring/index.js
+++ b/src/views/MapMonitoring/index.js
@@ -29,13 +29,12 @@ import moment from 'moment';
import axios from "../../const/interceptorApi";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -225,7 +224,7 @@ const MapMonitoring = ({ ...props }) => {
const pointToLayerUserPoints = (feature, latlng) => {
let imgSrc = DEFAULT_USER_ICON;
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 = ``
let logoMarker = L.divIcon({
diff --git a/src/views/Master/MasterAbsensi/index.js b/src/views/Master/MasterAbsensi/index.js
index b8e26f5..0d490f6 100644
--- a/src/views/Master/MasterAbsensi/index.js
+++ b/src/views/Master/MasterAbsensi/index.js
@@ -1,601 +1,588 @@
-import React, { Component } from 'react';
-import { Card, CardBody, CardHeader, Col, Row, Table, Input, InputGroup } from 'reactstrap';
-import { Button } from 'reactstrap';
-import axios from 'axios';
-import moment from 'moment';
-import SweetAlert from 'react-bootstrap-sweetalert';
-import DialogForm from './DialogForm';
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import { Pagination, Tooltip } from 'antd';
-import { DatePicker, Select } from 'antd';
-import * as XLSX from 'xlsx';
-import { ABSENSI_SEARCH, ABSENSI_ADD, ABSENSI_DELETE, ABSENSI_EDIT, PROYEK_SEARCH, USERPROYEK_SEARCH } from '../../../const/ApiConst.js';
-import MapConfig from '../../MapConfig/MapConfig';
-import { withTranslation } from 'react-i18next';
-const { RangePicker } = DatePicker;
-const { Option } = Select
-const token = window.localStorage.getItem('token');
-const config = {
- headers:
- {
- Authorization: `Bearer ${token}`,
- "Content-type": `application/json`
- }
-};
-
-
-const BASE_URL = "";
-const LENGTH_DATA = 10
-
-class index extends Component {
- constructor(props) {
- super(props)
- this.state = {
- dataTable: [],
- dataExport: [],
- openDialog: false,
- typeDialog: 'Save',
- dataEdit: null,
- alertDelete: false,
- idDelete: 0,
- dataGs: [],
- dataIdHo: [],
- search: "",
- page: 0,
- rowsPerPage: LENGTH_DATA,
- currentPage: 1,
- totalPage: 0,
- tooltipEdit: false,
- tooltipDelete: false,
- startDate: moment(moment().format("YYYY-M-D")),
- endDate: moment(moment().format("YYYY-M-D")),
- currentDay: 'today',
- tooltipTambah: false,
- tooltipExport: false,
- currentProyek: parseInt(localStorage.getItem('role_id')) === 2 ? parseInt(localStorage.getItem('proyek_id')) : null,
- allUserToProyek: [],
- allDataProyek: [],
- finishSetupOption: false,
- role_name: props.role_name || '',
- role_id: props.role_id || 0,
- user_id: props.user_id || 0,
- isLogin: props.isLogin || false,
- token: props.token || '',
- all_project: props.all_project || null,
- hierarchy: props.hierarchy || [],
- user_name: props.user_name || '',
- }
- }
-
- async componentDidMount() {
- this.getDataAbsensi();
- this.getAllProyek();
- this.setUpFirstProyek();
- }
-
- async componentDidUpdate(prevProps, prevState) {
- const { search, startDate, dataExport, currentProyek, allUserToProyek } = this.state
- if (search !== prevState.search) this.getDataAbsensi()
- if (startDate !== prevState.startDate) this.getDataAbsensi()
- if (dataExport !== prevState.dataExport) {
- if (dataExport.length > 0) {
- this.exportExcel()
- }
- }
- if (currentProyek !== prevState.currentProyek) {
- if (localStorage.getItem('role_id') !== 2) {
- this.getUserProyek();
- }
- }
- if (allUserToProyek !== prevState.allUserToProyek) {
- this.getDataAbsensi();
- }
- }
-
- setUpFirstProyek = () => {
- if (parseInt(localStorage.getItem('role_id')) === 2) {
- this.setState({ disableProyek: true });
- } else {
- this.setState({ currentProyek: null })
- }
- }
-
- handleSearch = e => {
- const value = e.target.value
- this.setState({ search: value, currentPage: 1 })
- };
-
- getAllProyek = async () => {
- const payload = {
- "paging": { "start": 0, "length": -1 },
- "columns": [
- { "name": "nama", "logic_operator": "ilike", "value": "", "operator": "AND" }
- ],
- "joins": [],
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- const result = await axios
- .post(PROYEK_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- this.setState({ allDataProyek: result.data.data })
- } else {
- }
- }
-
-
- getUserProyek = async () => {
- const payload = {
- "paging": { "start": 0, "length": -1 },
- "joins": [],
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- if (parseInt(localStorage.getItem('role_id')) === 1) {
- if (this.state.currentProyek && this.state.currentProyek > 0) {
- payload['columns'] = [
- { "name": "proyek_id", "logic_operator": "=", "value": `${this.state.currentProyek}`, "operator": "AND" }
- ]
- }
- } else {
- payload['columns'] = [
- { "name": "proyek_id", "logic_operator": "=", "value": `${localStorage.getItem('proyek_id')}`, "operator": "AND" }
- ]
- }
-
-
- const result = await axios
- .post(USERPROYEK_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- this.setState({ allUserToProyek: result.data.data })
- } else {
- }
- }
-
- getDataAbsensi = async () => {
- let url = "";
-
- let start = 0;
- if (this.state.currentPage !== 1 && this.state.currentPage > 1) {
- start = (this.state.currentPage * this.state.rowsPerPage) - this.state.rowsPerPage
- }
-
- let dateStart = moment(this.state.startDate).format("YYYY-MM-DD 00:00:00");
- let dateEnd = moment(this.state.endDate).format("YYYY-MM-DD 23:59:59");
-
- const payload = {
- "paging": {
- "start": start,
- "length": this.state.rowsPerPage
- },
- "filter_columns": [
- {
- "name": "name",
- "value": "",
- "table_name": "m_users"
- }
- ],
- "columns": [
- { "name": "created_at", "logic_operator": "range", "value": dateStart, "value1": dateEnd, "operator": "AND" },
- { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND", "table_name": "m_users" }
- ],
- "joins": [
- {
- "name": "m_users",
- "column_join": "user_id",
- "column_results": [
- "name",
- ]
- }
- ],
- "orders": {
- "columns": [
- "id"
- ],
- "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
- .post(ABSENSI_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- let totalRecord = result.data.totalRecord
- let resData = result.data.data || []
-
- this.setState({ dataTable: resData, totalPage: totalRecord });
- } else {
- NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
- }
- }
-
- handleOpenDialog = (type) => {
- this.setState({ openDialog: true, typeDialog: type })
- this.showChildDialog();
- }
-
- handleCloseDialog = (type, data) => {
- if (type === "save") {
- this.saveAbsensi(data);
- } else if (type === "edit") {
- this.editDataAbsensi(data);
- }
-
- this.setState({ openDialog: false })
- }
-
- toggleAddDialog = () => {
- this.setState({ openDialog: !this.state.openDialog })
- }
-
- onConfirmDelete = async () => {
- const { idDelete } = this.state
- let url = ABSENSI_DELETE(idDelete)
- const result = await axios.delete(url, MapConfig)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- this.getDataAbsensi()
- this.setState({ idDelete: 0, alertDelete: false })
- NotificationManager.success('Data absensi berhasil dihapus!!', 'Success!!');
- } else {
- this.getDataAbsensi()
- this.setState({ idDelete: 0, alertDelete: false })
- NotificationManager.error('Data absensi gagal dihapus!!', 'Failed!!');
- }
- }
-
- saveAbsensi = async (data) => {
-
- const formData = {
- user_id: data.idEmployee,
- description: data.description,
- created_at: data.dateAbsent
- }
- const result = await axios.post(ABSENSI_ADD, formData, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- this.getDataAbsensi();
- NotificationManager.success('Data absensi berhasil ditambahkan!!', 'Success!!');
- } else {
- NotificationManager.error(`${result.data.message}`, 'Failed!!');
- }
-
- }
-
- editDataAbsensi = async (data) => {
- let url = ABSENSI_EDIT(data.id)
-
- const formData = {
- user_id: data.idEmployee,
- description: data.description,
- created_at: data.dateAbsent
- }
-
- const result = await axios.put(url, formData, config)
- .then(res => res)
- .catch((error) => error.response);
- if (result && result.data && result.data.code == 200) {
- this.getDataAbsensi();
- NotificationManager.success('Data absensi berhasil diedit!!', 'Success!!');
- } else {
- NotificationManager.error('Data absensi gagal diedit!!', 'Failed!!');
- }
-
- }
-
-
- handleEdit = (data) => {
- this.setState({ dataEdit: data });
- this.handleOpenDialog('Edit');
- }
-
- handleDelete = (id) => {
- this.setState({ alertDelete: true, idDelete: id });
- }
-
- onShowSizeChange = (current, pageSize) => {
- this.setState({ rowsPerPage: pageSize }, () => {
- this.getDataAbsensi();
- })
- }
-
- onPagination = (current, pageSize) => {
- this.setState({ currentPage: current, page: (current - 1) * pageSize }, () => {
- this.getDataAbsensi();
- })
- }
-
- toggle = (param) => {
- if (param === "edit") {
- this.setState(prevState => ({ tooltipEdit: !prevState.tooltipEdit }))
- } else if (param === "delete") {
- this.setState(prevState => ({ tooltipDelete: !prevState.tooltipDelete }))
- } else if (param === "tambah") {
- this.setState(prevState => ({ tooltipTambah: !prevState.tooltipTambah }))
- } else if (param === "export") {
- this.setState(prevState => ({ tooltipExport: !prevState.tooltipExport }))
- }
- }
-
- handleDatePicker = (date, dateString) => {
- this.setState({ startDate: date[0], endDate: date[1] }, () => {
- this.getDataAbsensi();
- })
- }
-
- handleTipe = (e) => {
- this.setState({ typeClock: e.target.value }, () => {
- this.getDataAbsensi();
- });
- }
-
- handleExportExcel = async () => {
- let dateStart = moment(this.state.startDate).format("YYYY-MM-DD 00:00:00");
- let dateEnd = moment(this.state.endDate).format("YYYY-MM-DD 23:59:59");
- const payload = {
- "paging": {
- "start": 0,
- "length": -1
- },
- "filter_columns": [
- {
- "name": "name",
- "value": "",
- "table_name": "m_users"
- }
- ],
- "columns": [
- { "name": "created_at", "logic_operator": "range", "value": dateStart, "value1": dateEnd, "operator": "AND" },
- { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND", "table_name": "m_users" }
- ],
- "joins": [
- {
- "name": "m_users",
- "column_join": "user_id",
- "column_results": [
- "name",
- ]
- }
- ],
- "orders": {
- "columns": [
- "id"
- ],
- "ascending": false
- }
- }
-
-
-
- const result = await axios
- .post(ABSENSI_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- let resData = result.data.data || []
- const excelData = [];
-
- resData.map((n, index) => {
- let dataRow = {
- "Nama Human Resource": n.join_first_name ? n.join_first_name : "",
- "Deskripsi": n.description ? n.description : "",
- "Tanggal Absensi": n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY") : "-",
- }
- excelData.push(dataRow)
- })
- this.setState({ dataExport: excelData })
- } else {
- NotificationManager.error('Gagal Export Data!!', 'Failed');
- }
- }
-
- exportExcel = () => {
- const dataExcel = this.state.dataExport || [];
- const fileName = `Data Absensi.xlsx`;
- const ws = XLSX.utils.json_to_sheet(dataExcel);
- const wb = XLSX.utils.book_new();
- XLSX.utils.book_append_sheet(wb, ws, `Data Absensi`);
-
- XLSX.writeFile(wb, fileName);
- this.setState({ dataExport: [] })
- }
-
- setupSelectProyek = () => {
- let allDataProyek = this.state.allDataProyek
- return (
- <>
- {allDataProyek.map((val, index) => {
- return (
-
- )
- })
- }
- >
- )
- }
-
- onChangeProyek = (val) => {
- this.setState({ currentProyek: val });
- }
-
- renderTable = () => {
- const t = this.props;
- const dataTable2 = this.state.dataTable || [];
- return (
-
- {dataTable2.length !== 0 ? dataTable2.map((n) => {
- return (
-
- {/*
- this.handleDelete(n.id)}>
- this.toggle("delete")}>
- Delete
-
-
- this.handleEdit(n)}>
- this.toggle("edit")}>
- Edit
-
- | */}
- {this.state.role_name === 'Super Admin' &&
- {n.join_second_company_name ? n.join_second_company_name : ""} |
- }
- {n.join_first_name ? n.join_first_name : ""} |
- {n.description ? n.description : "-"} |
- {n.created_at ? moment(n.created_at).format("YYYY-MM-DD") : "-"} |
-
- )
- }) :
- {this.props.t('noData')} |
-
- }
-
- )
- }
-
- handleChangeDay = (e) => {
- const val = e.target.value;
- this.setState({ currentDay: val });
- if (val === "today") {
- this.setState({
- startDate: moment(moment().format("YYYY-M-D")),
- endDate: moment(moment().format("YYYY-M-D")),
- currentPage: 1
- })
- } else if (val === "3 day") {
- this.setState({
- startDate: moment(moment().subtract(3, "days").format("YYYY-M-D")),
- endDate: moment(moment().format("YYYY-M-D")),
- currentPage: 1
- })
- } else if (val === "7 day") {
- this.setState({
- startDate: moment(moment().subtract(7, "days").format("YYYY-M-D")),
- endDate: moment(moment().format("YYYY-M-D")),
- currentPage: 1
- })
- } else {
- this.setState({
- startDate: moment(moment().format("YYYY-M-D")),
- endDate: moment(moment().format("YYYY-M-D")),
- currentPage: 1
- })
- }
- }
-
- render() {
- const t = this.props;
- const column = [
- this.state.role_name === 'Super Admin' ? { name: this.props.t('company') } : null,
- { name: this.props.t('nameHR') },
- { name: this.props.t('description') },
- { name: this.props.t('dateAbsent') },
- ].filter(column => column && column.name);
-
- const { tooltipTambah, tooltipExport, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete } = this.state
- return (
-
-
-
this.setState({ alertDelete: false, idDelete: 0 })}
- focusCancelBtn
- >
- {this.props.t('deleteMsg')}
-
-
this.toggleAddDialog}
- typeDialog={this.state.typeDialog}
- dataEdit={this.state.dataEdit}
- showDialog={showDialog => this.showChildDialog = showDialog}
- dataHs={this.state.dataIdHo}
- />
-
-
- {this.props.params.name}
-
-
-
-
-
-
-
-
-
-
- this.handleChangeDay(e)} defaultValue={this.state.currentDay}>
-
-
-
-
-
-
- {' '}
-
-
-
-
-
-
-
-
- {/* Actions | */}
- {column.map((i, index) => {
- return (
- {i.name} |
- )
- })}
-
-
- {this.renderTable()}
-
-
-
-
-
- )
- }
-}
-export default withTranslation()(index);
+import React, { Component } from 'react';
+import { Card, CardBody, CardHeader, Col, Row, Table, Input, InputGroup } from 'reactstrap';
+import { Button } from 'reactstrap';
+import axios from 'axios';
+import moment from 'moment';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import DialogForm from './DialogForm';
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import { Pagination, Tooltip } from 'antd';
+import { DatePicker, Select } from 'antd';
+import * as XLSX from 'xlsx';
+import { ABSENSI_SEARCH, ABSENSI_ADD, ABSENSI_DELETE, ABSENSI_EDIT, PROYEK_SEARCH, USERPROYEK_SEARCH } from '../../../const/ApiConst.js';
+import MapConfig from '../../MapConfig/MapConfig';
+import { withTranslation } from 'react-i18next';
+const { RangePicker } = DatePicker;
+const { Option } = Select
+const token = window.localStorage.getItem('token');
+const config = {
+ headers:
+ {
+ Authorization: `Bearer ${token}`,
+ "Content-type": `application/json`
+ }
+};
+
+
+const BASE_URL = "";
+const LENGTH_DATA = 10
+
+class index extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ dataTable: [],
+ dataExport: [],
+ openDialog: false,
+ typeDialog: 'Save',
+ dataEdit: null,
+ alertDelete: false,
+ idDelete: 0,
+ dataGs: [],
+ dataIdHo: [],
+ search: "",
+ page: 0,
+ rowsPerPage: LENGTH_DATA,
+ currentPage: 1,
+ totalPage: 0,
+ tooltipEdit: false,
+ tooltipDelete: false,
+ startDate: moment(moment().format("YYYY-M-D")),
+ endDate: moment(moment().format("YYYY-M-D")),
+ currentDay: 'today',
+ tooltipTambah: false,
+ tooltipExport: false,
+ currentProyek: parseInt(localStorage.getItem('role_id')) === 2 ? parseInt(localStorage.getItem('proyek_id')) : null,
+ allUserToProyek: [],
+ allDataProyek: [],
+ finishSetupOption: false,
+ role_name: props.role_name || '',
+ role_id: props.role_id || 0,
+ user_id: props.user_id || 0,
+ isLogin: props.isLogin || false,
+ token: props.token || '',
+ all_project: props.all_project || null,
+ hierarchy: props.hierarchy || [],
+ user_name: props.user_name || '',
+ }
+ }
+
+ async componentDidMount() {
+ this.getDataAbsensi();
+ this.getAllProyek();
+ this.setUpFirstProyek();
+ }
+
+ async componentDidUpdate(prevProps, prevState) {
+ const { search, startDate, dataExport, currentProyek, allUserToProyek } = this.state
+ if (search !== prevState.search) this.getDataAbsensi()
+ if (startDate !== prevState.startDate) this.getDataAbsensi()
+ if (dataExport !== prevState.dataExport) {
+ if (dataExport.length > 0) {
+ this.exportExcel()
+ }
+ }
+ if (currentProyek !== prevState.currentProyek) {
+ if (localStorage.getItem('role_id') !== 2) {
+ this.getUserProyek();
+ }
+ }
+ if (allUserToProyek !== prevState.allUserToProyek) {
+ this.getDataAbsensi();
+ }
+ }
+
+ setUpFirstProyek = () => {
+ if (parseInt(localStorage.getItem('role_id')) === 2) {
+ this.setState({ disableProyek: true });
+ } else {
+ this.setState({ currentProyek: null })
+ }
+ }
+
+ handleSearch = e => {
+ const value = e.target.value
+ this.setState({ search: value, currentPage: 1 })
+ };
+
+ getAllProyek = async () => {
+ const payload = {
+ "paging": { "start": 0, "length": -1 },
+ "columns": [
+ { "name": "nama", "logic_operator": "ilike", "value": "", "operator": "AND" }
+ ],
+ "joins": [],
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ const result = await axios
+ .post(PROYEK_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ this.setState({ allDataProyek: result.data.data })
+ } else {
+ }
+ }
+
+
+ getUserProyek = async () => {
+ const payload = {
+ "paging": { "start": 0, "length": -1 },
+ "joins": [],
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ if (parseInt(localStorage.getItem('role_id')) === 1) {
+ if (this.state.currentProyek && this.state.currentProyek > 0) {
+ payload['columns'] = [
+ { "name": "proyek_id", "logic_operator": "=", "value": `${this.state.currentProyek}`, "operator": "AND" }
+ ]
+ }
+ } else {
+ payload['columns'] = [
+ { "name": "proyek_id", "logic_operator": "=", "value": `${localStorage.getItem('proyek_id')}`, "operator": "AND" }
+ ]
+ }
+
+
+ const result = await axios
+ .post(USERPROYEK_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ this.setState({ allUserToProyek: result.data.data })
+ } else {
+ }
+ }
+
+ getDataAbsensi = async () => {
+ let url = "";
+
+ let start = 0;
+ if (this.state.currentPage !== 1 && this.state.currentPage > 1) {
+ start = (this.state.currentPage * this.state.rowsPerPage) - this.state.rowsPerPage
+ }
+
+ let dateStart = moment(this.state.startDate).format("YYYY-MM-DD 00:00:00");
+ let dateEnd = moment(this.state.endDate).format("YYYY-MM-DD 23:59:59");
+
+ const payload = {
+ "paging": {
+ "start": start,
+ "length": this.state.rowsPerPage
+ },
+ "filter_columns": [
+ {
+ "name": "name",
+ "value": "",
+ "table_name": "m_users"
+ }
+ ],
+ "columns": [
+ { "name": "created_at", "logic_operator": "range", "value": dateStart, "value1": dateEnd, "operator": "AND" },
+ { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND", "table_name": "m_users" }
+ ],
+ "joins": [
+ {
+ "name": "m_users",
+ "column_join": "user_id",
+ "column_results": [
+ "name",
+ ]
+ }
+ ],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+
+ const result = await axios
+ .post(ABSENSI_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ let totalRecord = result.data.totalRecord
+ let resData = result.data.data || []
+
+ this.setState({ dataTable: resData, totalPage: totalRecord });
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ }
+ }
+
+ handleOpenDialog = (type) => {
+ this.setState({ openDialog: true, typeDialog: type })
+ this.showChildDialog();
+ }
+
+ handleCloseDialog = (type, data) => {
+ if (type === "save") {
+ this.saveAbsensi(data);
+ } else if (type === "edit") {
+ this.editDataAbsensi(data);
+ }
+
+ this.setState({ openDialog: false })
+ }
+
+ toggleAddDialog = () => {
+ this.setState({ openDialog: !this.state.openDialog })
+ }
+
+ onConfirmDelete = async () => {
+ const { idDelete } = this.state
+ let url = ABSENSI_DELETE(idDelete)
+ const result = await axios.delete(url, MapConfig)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ this.getDataAbsensi()
+ this.setState({ idDelete: 0, alertDelete: false })
+ NotificationManager.success('Data absensi berhasil dihapus!!', 'Success!!');
+ } else {
+ this.getDataAbsensi()
+ this.setState({ idDelete: 0, alertDelete: false })
+ NotificationManager.error('Data absensi gagal dihapus!!', 'Failed!!');
+ }
+ }
+
+ saveAbsensi = async (data) => {
+
+ const formData = {
+ user_id: data.idEmployee,
+ description: data.description,
+ created_at: data.dateAbsent
+ }
+ const result = await axios.post(ABSENSI_ADD, formData, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ this.getDataAbsensi();
+ NotificationManager.success('Data absensi berhasil ditambahkan!!', 'Success!!');
+ } else {
+ NotificationManager.error(`${result.data.message}`, 'Failed!!');
+ }
+
+ }
+
+ editDataAbsensi = async (data) => {
+ let url = ABSENSI_EDIT(data.id)
+
+ const formData = {
+ user_id: data.idEmployee,
+ description: data.description,
+ created_at: data.dateAbsent
+ }
+
+ const result = await axios.put(url, formData, config)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code == 200) {
+ this.getDataAbsensi();
+ NotificationManager.success('Data absensi berhasil diedit!!', 'Success!!');
+ } else {
+ NotificationManager.error('Data absensi gagal diedit!!', 'Failed!!');
+ }
+
+ }
+
+
+ handleEdit = (data) => {
+ this.setState({ dataEdit: data });
+ this.handleOpenDialog('Edit');
+ }
+
+ handleDelete = (id) => {
+ this.setState({ alertDelete: true, idDelete: id });
+ }
+
+ onShowSizeChange = (current, pageSize) => {
+ this.setState({ rowsPerPage: pageSize }, () => {
+ this.getDataAbsensi();
+ })
+ }
+
+ onPagination = (current, pageSize) => {
+ this.setState({ currentPage: current, page: (current - 1) * pageSize }, () => {
+ this.getDataAbsensi();
+ })
+ }
+
+ toggle = (param) => {
+ if (param === "edit") {
+ this.setState(prevState => ({ tooltipEdit: !prevState.tooltipEdit }))
+ } else if (param === "delete") {
+ this.setState(prevState => ({ tooltipDelete: !prevState.tooltipDelete }))
+ } else if (param === "tambah") {
+ this.setState(prevState => ({ tooltipTambah: !prevState.tooltipTambah }))
+ } else if (param === "export") {
+ this.setState(prevState => ({ tooltipExport: !prevState.tooltipExport }))
+ }
+ }
+
+ handleDatePicker = (date, dateString) => {
+ this.setState({ startDate: date[0], endDate: date[1] }, () => {
+ this.getDataAbsensi();
+ })
+ }
+
+ handleTipe = (e) => {
+ this.setState({ typeClock: e.target.value }, () => {
+ this.getDataAbsensi();
+ });
+ }
+
+ handleExportExcel = async () => {
+ let dateStart = moment(this.state.startDate).format("YYYY-MM-DD 00:00:00");
+ let dateEnd = moment(this.state.endDate).format("YYYY-MM-DD 23:59:59");
+ const payload = {
+ "paging": {
+ "start": 0,
+ "length": -1
+ },
+ "filter_columns": [
+ {
+ "name": "name",
+ "value": "",
+ "table_name": "m_users"
+ }
+ ],
+ "columns": [
+ { "name": "created_at", "logic_operator": "range", "value": dateStart, "value1": dateEnd, "operator": "AND" },
+ { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND", "table_name": "m_users" }
+ ],
+ "joins": [
+ {
+ "name": "m_users",
+ "column_join": "user_id",
+ "column_results": [
+ "name",
+ ]
+ }
+ ],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+
+
+
+ const result = await axios
+ .post(ABSENSI_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data || []
+ const excelData = [];
+
+ resData.map((n, index) => {
+ let dataRow = {
+ "Nama Human Resource": n.join_first_name ? n.join_first_name : "",
+ "Deskripsi": n.description ? n.description : "",
+ "Tanggal Absensi": n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY") : "-",
+ }
+ excelData.push(dataRow)
+ })
+ this.setState({ dataExport: excelData })
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ exportExcel = () => {
+ const dataExcel = this.state.dataExport || [];
+ const fileName = `Data Absensi.xlsx`;
+ const ws = XLSX.utils.json_to_sheet(dataExcel);
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, `Data Absensi`);
+
+ XLSX.writeFile(wb, fileName);
+ this.setState({ dataExport: [] })
+ }
+
+ setupSelectProyek = () => {
+ let allDataProyek = this.state.allDataProyek
+ return (
+ <>
+ {allDataProyek.map((val, index) => {
+ return (
+
+ )
+ })
+ }
+ >
+ )
+ }
+
+ onChangeProyek = (val) => {
+ this.setState({ currentProyek: val });
+ }
+
+ renderTable = () => {
+ const t = this.props;
+ const dataTable2 = this.state.dataTable || [];
+ return (
+
+ {dataTable2.length !== 0 ? dataTable2.map((n) => {
+ return (
+
+ {/*
+ this.handleDelete(n.id)}>
+ this.toggle("delete")}>
+ Delete
+
+
+ this.handleEdit(n)}>
+ this.toggle("edit")}>
+ Edit
+
+ | */}
+ {n.join_first_name ? n.join_first_name : ""} |
+ {n.description ? n.description : "-"} |
+ {n.created_at ? moment(n.created_at).format("YYYY-MM-DD") : "-"} |
+
+ )
+ }) :
+ {this.props.t('noData')} |
+
+ }
+
+ )
+ }
+
+ handleChangeDay = (e) => {
+ const val = e.target.value;
+ this.setState({ currentDay: val });
+ if (val === "today") {
+ this.setState({
+ startDate: moment(moment().format("YYYY-M-D")),
+ endDate: moment(moment().format("YYYY-M-D")),
+ currentPage: 1
+ })
+ } else if (val === "3 day") {
+ this.setState({
+ startDate: moment(moment().subtract(3, "days").format("YYYY-M-D")),
+ endDate: moment(moment().format("YYYY-M-D")),
+ currentPage: 1
+ })
+ } else if (val === "7 day") {
+ this.setState({
+ startDate: moment(moment().subtract(7, "days").format("YYYY-M-D")),
+ endDate: moment(moment().format("YYYY-M-D")),
+ currentPage: 1
+ })
+ } else {
+ this.setState({
+ startDate: moment(moment().format("YYYY-M-D")),
+ endDate: moment(moment().format("YYYY-M-D")),
+ currentPage: 1
+ })
+ }
+ }
+
+ render() {
+ const t = this.props;
+ const column = [
+ { name: this.props.t('nameHR') },
+ { name: this.props.t('description') },
+ { name: this.props.t('dateAbsent') },
+ ].filter(column => column && column.name);
+
+ const { tooltipTambah, tooltipExport, dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete } = this.state
+ return (
+
+
+
this.setState({ alertDelete: false, idDelete: 0 })}
+ focusCancelBtn
+ >
+ {this.props.t('deleteMsg')}
+
+
this.toggleAddDialog}
+ typeDialog={this.state.typeDialog}
+ dataEdit={this.state.dataEdit}
+ showDialog={showDialog => this.showChildDialog = showDialog}
+ dataHs={this.state.dataIdHo}
+ />
+
+
+ {this.props.params.name}
+
+
+
+
+
+
+
+
+
+
+ this.handleChangeDay(e)} defaultValue={this.state.currentDay}>
+
+
+
+
+
+
+ {' '}
+
+
+
+
+
+
+
+
+ {/* Actions | */}
+ {column.map((i, index) => {
+ return (
+ {i.name} |
+ )
+ })}
+
+
+ {this.renderTable()}
+
+
+
+
+
+ )
+ }
+}
+export default withTranslation()(index);
diff --git a/src/views/Master/MasterBroadcast/DialogForm.js b/src/views/Master/MasterBroadcast/DialogForm.js
index 6f264dd..6d7801b 100644
--- a/src/views/Master/MasterBroadcast/DialogForm.js
+++ b/src/views/Master/MasterBroadcast/DialogForm.js
@@ -1,434 +1,387 @@
-import 'antd/dist/antd.css';
-import React, { Component } from 'react';
-import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
-import Select from 'react-select';
-import axios from 'axios';
-import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST, USER_SEARCH } from '../../../const/ApiConst';
-import { Transfer } from 'antd';
-import { withTranslation } from 'react-i18next';
-
-
-const token = window.localStorage.getItem('token');
-
-const config = {
- headers:
- {
- Authorization: `Bearer ${token}`,
- "Content-type": `application/json`
- }
-};
-
-
-const ERROR_TITLE = "judul is required!"
-const ERROR_MESSAGE = "message is required!"
-const BASE_URL = "https://oslog.id/geohr-api/";
-const roleName = window.localStorage.getItem('role_name');
-let countError = 0;
-class DialogForm extends Component {
- constructor(props) {
- super(props)
- this.state = {
- id: 0,
- title: "",
- description: "",
- message: "",
- openDialog: false,
- isParentClick: false,
- errorTitle: "",
- errorMessage: "",
- errorDivision: "",
- errorEmployee: "",
- penerima: "all",
- displayKaryawan: "none",
- displayDivisi: "none",
- listOrganizationSelect: [],
- currentSelectDiv: null,
- dataEmployee: [],
- dataSourceEmployee: [],
- idOrganization: 0,
- targetKeys: [],
- selectedKeys: [],
- allEmployeeId: [],
- idEmployeeDivision: [],
- idOrganization: [],
- disableTransfer: true,
- listCompany: [],
- company_id: this.props.company_id,
- role_name: ''
- }
- }
-
- async componentDidMount() {
- if (this.props.company_id !== null) {
- this.getDataRole();
- this.getDataUsers();
- }
- this.props.showDialog(this.showDialog);
- }
-
- async componentDidUpdate() {
- if (this.state.isParentClick === true) {
- if (this.props.typeDialog === "Edit") {
- const { dataEdit } = this.props
- this.setState({
- id: dataEdit.id,
- title: dataEdit.title_notif,
- description: dataEdit.description,
- message: dataEdit.message_notif,
- company_id: dataEdit.company_id
- })
- } else {
- this.setState({
- id: 0,
- title: "",
- description: "",
- message: "",
- company_id: 0
- })
- }
- this.setState({ isParentClick: false });
- }
- }
-
-
- showDialog = () => {
- this.setState({ isParentClick: true });
- }
-
-
-
- validate = () => {
- let isError = false
- const { title, message, penerima } = this.state
- if (title === "") {
- isError = true
- this.setState({ errorTitle: ERROR_TITLE })
- } else if (title.length < 3 || title.length > 100) {
- isError = true
- this.setState({ errorTitle: "Title minimum 3-100 karakter!" })
- }
-
- if (message === "") {
- isError = true
- this.setState({ errorMessage: ERROR_MESSAGE })
- } else if (message.length < 3 || message.length > 200) {
- isError = true
- this.setState({ errorMessage: "message minimum 3-200 karakter!" })
- }
-
- if (penerima === "division") {
- if (this.state.idOrganization === 0) {
- this.setState({ errorDivision: "Silahkan pilih divisi penerima!" })
- }
- } else if (penerima === "karyawan") {
- if (this.state.selectedKeys.length === 0) {
- this.setState({ errorEmployee: "Silahkan pilih karyawan penerima!" })
- }
- }
- return isError
- }
- handleSave = (param) => {
- let err = this.validate()
- if (!err) {
- const {
- id,
- title,
- description,
- message,
- penerima,
-
- } = this.state
- let {
- company_id
- } = this.state
- let idSend = [];
- let send_to_type = "all";
- if (penerima === "all") {
- idSend = this.state.allEmployeeId;
- send_to_type = "all";
- } else if (penerima === "organization") {
- idSend = this.state.idOrganization;
- send_to_type = "roles";
- } else if (penerima === "karyawan") {
- idSend = this.state.targetKeys;
- send_to_type = "users";
- }
-
- if (Array.isArray(idSend)) {
- idSend = idSend.map(function (e) {
- return e.toString()
- });
- } else {
- idSend = idSend;
- }
- if (this.props.role_name !== 'Super Admin') {
- company_id = parseInt(this.props.company_id)
- }
- const data = {
- title,
- description,
- message,
- send_to_type,
- id: idSend,
- company_id: company_id
- }
- if (param === 'registered' || param === 'send') {
- this.props.handleSaveBroadcast(param, data)
- }
- this.setState({ id: 0, idOrganization: 0, currentSelectDiv: null, targetKeys: [], penerima: "all", displayKaryawan: "none", displayDivisi: "none", disableTransfer: true });
- }
- }
-
- handleCancel = () => {
- this.props.handleSaveBroadcast('cancel', 'none')
- }
-
- handleChangePenerima = type => {
- if (type === "organization") {
- this.setState({ displayDivisi: "block", displayKaryawan: "none", disableTransfer: true, errorDivision: "", targetKeys: [] })
- } else if (type === "karyawan") {
- this.setState({ displayKaryawan: "block", displayDivisi: "none", disableTransfer: false, errorEmployee: "", idEmployeeDivision: [], currentSelectDiv: null })
- } else {
- this.setState({ displayKaryawan: "none", displayDivisi: "none", disableTransfer: true, errorDivision: "", errorEmployee: "", targetKeys: [], idEmployeeDivision: [], currentSelectDiv: null })
- }
- this.setState({ penerima: type });
- }
-
- handleSelectOrganization = (inputValue, actionMeta) => {
- this.setState({ idOrganization: inputValue.value, currentSelectDiv: { value: inputValue.value, label: inputValue.label }, errorDivision: "" }, () => {
- this.setEmployeeOrganization();
- });
- }
-
- setEmployeeOrganization = () => {
- let arrEd = this.state.dataEmployee.data;
- let cek = arrEd.filter(this.filterId)
-
- this.setState({ idEmployeeDivision: cek })
- }
-
- filterId = (val) => {
- return val.organization_id == this.state.idOrganization
- }
-
- getDataRole = async () => {
- const payload = {
- "paging": {
- "start": 0,
- "length": -1
- },
- "columns": [
- {
- "name": "company_id",
- "logic_operator": "=",
- "value": this.state.company_id,
- "operator": "AND"
- }
- ],
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- const result = await axios
- .post(ROLE_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- this.setState({ dataDivision: result.data.data }, () => {
- this.setDataOrganization();
- })
- } else {
- }
- }
-
- setDataOrganization = () => {
- const { dataDivision } = this.state
- const listOrganization = []
- dataDivision.map((val, index) => {
- listOrganization.push({
- value: val.id,
- label: val.name
- })
- })
- this.setState({ listOrganizationSelect: listOrganization })
- }
-
- getDataUsers = async () => {
- const payload = {
- "paging": {
- "start": 0,
- "length": -1
- },
- "columns": [
- {
- "name": "name",
- "logic_operator": "like",
- "value": "",
- "operator": "AND",
- "table_name": "m_users"
- },
- {
- "name": "company_id",
- "logic_operator": "=",
- "value": this.state.company_id,
- "operator": "AND"
- }
- ],
- "orders": {
- "columns": [
- "id"
- ],
- "ascending": false
- }
- }
- //TODO should use search instead
- const result = await axios
- .post(USER_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.status == 200) {
- this.setState({ dataEmployee: result.data }, () => {
- this.setDataEmployee();
- });
- } else {
- }
- }
-
- setDataEmployee = () => {
- const listEmployee = [];
- const allIdEmployee = [];
- this.state.dataEmployee.data.map((val, index) => {
- allIdEmployee.push(val.id);
- listEmployee.push({
- key: val.id,
- id: val.id,
- title: val.name
- });
- })
-
- this.setState({ dataSourceEmployee: listEmployee, allEmployeeId: allIdEmployee })
- }
-
- handleChangeTransfer = (nextTargetKeys, direction, moveKeys) => {
- this.setState({ targetKeys: nextTargetKeys, errorEmployee: "" });
-
- };
-
- handleSelectChangeTransfer = (sourceSelectedKeys, targetSelectedKeys) => {
- this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys], errorEmployee: "" });
-
- };
-
- handleSelectCompany = (selectedOption) => {
- const selectedCompanyId = selectedOption.value;
- this.setState({ company_id: selectedCompanyId }, () => {
- this.getDataRole();
- this.getDataUsers();
- });
- }
-
- renderForm = () => {
- const t = this.props
- const { errorTitle, errorMessage } = this.state
- return (
-
- )
- }
- handleCloseDialog = () => {
- this.props.closeDialog()
- this.setState({
- errorTitle: "",
- errorMessage: "",
- errorDivision: "",
- errorEmployee: ""
- })
- }
- render() {
- return (
-
- {this.props.t('broadcastDetail')}
-
- {this.renderForm()}
-
-
- {' '}
- {' '}
-
-
-
- )
- }
-}
-export default withTranslation()(DialogForm);
\ No newline at end of file
+import 'antd/dist/antd.css';
+import React, { Component } from 'react';
+import { Button, Form, FormFeedback, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
+import Select from 'react-select';
+import axios from 'axios';
+import { BASE_URL_GEOHR_API2, ROLE_SEARCH, USER_WASPANG, USER_LIST, USER_SEARCH } from '../../../const/ApiConst';
+import { Transfer } from 'antd';
+import { withTranslation } from 'react-i18next';
+
+
+const token = window.localStorage.getItem('token');
+
+const config = {
+ headers:
+ {
+ Authorization: `Bearer ${token}`,
+ "Content-type": `application/json`
+ }
+};
+
+
+const ERROR_TITLE = "judul is required!"
+const ERROR_MESSAGE = "message is required!"
+const BASE_URL = "https://oslog.id/geohr-api/";
+const roleName = window.localStorage.getItem('role_name');
+let countError = 0;
+class DialogForm extends Component {
+ constructor(props) {
+ super(props)
+ this.state = {
+ id: 0,
+ title: "",
+ description: "",
+ message: "",
+ openDialog: false,
+ isParentClick: false,
+ errorTitle: "",
+ errorMessage: "",
+ errorDivision: "",
+ errorEmployee: "",
+ penerima: "all",
+ displayKaryawan: "none",
+ displayDivisi: "none",
+ listOrganizationSelect: [],
+ currentSelectDiv: null,
+ dataEmployee: [],
+ dataSourceEmployee: [],
+ idOrganization: 0,
+ targetKeys: [],
+ selectedKeys: [],
+ allEmployeeId: [],
+ idEmployeeDivision: [],
+ idOrganization: [],
+ disableTransfer: true,
+ role_name: ''
+ }
+ }
+
+ async componentDidMount() {
+ this.props.showDialog(this.showDialog);
+ }
+
+ async componentDidUpdate() {
+ if (this.state.isParentClick === true) {
+ if (this.props.typeDialog === "Edit") {
+ const { dataEdit } = this.props
+ this.setState({
+ id: dataEdit.id,
+ title: dataEdit.title_notif,
+ description: dataEdit.description,
+ message: dataEdit.message_notif
+ })
+ } else {
+ this.setState({
+ id: 0,
+ title: "",
+ description: "",
+ message: ""
+ })
+ }
+ this.setState({ isParentClick: false });
+ }
+ }
+
+
+ showDialog = () => {
+ this.setState({ isParentClick: true });
+ }
+
+
+
+ validate = () => {
+ let isError = false
+ const { title, message, penerima } = this.state
+ if (title === "") {
+ isError = true
+ this.setState({ errorTitle: ERROR_TITLE })
+ } else if (title.length < 3 || title.length > 100) {
+ isError = true
+ this.setState({ errorTitle: "Title minimum 3-100 karakter!" })
+ }
+
+ if (message === "") {
+ isError = true
+ this.setState({ errorMessage: ERROR_MESSAGE })
+ } else if (message.length < 3 || message.length > 200) {
+ isError = true
+ this.setState({ errorMessage: "message minimum 3-200 karakter!" })
+ }
+
+ if (penerima === "division") {
+ if (this.state.idOrganization === 0) {
+ this.setState({ errorDivision: "Silahkan pilih divisi penerima!" })
+ }
+ } else if (penerima === "karyawan") {
+ if (this.state.selectedKeys.length === 0) {
+ this.setState({ errorEmployee: "Silahkan pilih karyawan penerima!" })
+ }
+ }
+ return isError
+ }
+ handleSave = (param) => {
+ let err = this.validate()
+ if (!err) {
+ const {
+ id,
+ title,
+ description,
+ message,
+ penerima,
+
+ } = this.state
+ let idSend = [];
+ let send_to_type = "all";
+ if (penerima === "all") {
+ idSend = this.state.allEmployeeId;
+ send_to_type = "all";
+ } else if (penerima === "organization") {
+ idSend = this.state.idOrganization;
+ send_to_type = "roles";
+ } else if (penerima === "karyawan") {
+ idSend = this.state.targetKeys;
+ send_to_type = "users";
+ }
+
+ if (Array.isArray(idSend)) {
+ idSend = idSend.map(function (e) {
+ return e.toString()
+ });
+ } else {
+ idSend = idSend;
+ }
+ const data = {
+ title,
+ description,
+ message,
+ send_to_type,
+ id: idSend
+ }
+ if (param === 'registered' || param === 'send') {
+ this.props.handleSaveBroadcast(param, data)
+ }
+ this.setState({ id: 0, idOrganization: 0, currentSelectDiv: null, targetKeys: [], penerima: "all", displayKaryawan: "none", displayDivisi: "none", disableTransfer: true });
+ }
+ }
+
+ handleCancel = () => {
+ this.props.handleSaveBroadcast('cancel', 'none')
+ }
+
+ handleChangePenerima = type => {
+ if (type === "organization") {
+ this.setState({ displayDivisi: "block", displayKaryawan: "none", disableTransfer: true, errorDivision: "", targetKeys: [] })
+ } else if (type === "karyawan") {
+ this.setState({ displayKaryawan: "block", displayDivisi: "none", disableTransfer: false, errorEmployee: "", idEmployeeDivision: [], currentSelectDiv: null })
+ } else {
+ this.setState({ displayKaryawan: "none", displayDivisi: "none", disableTransfer: true, errorDivision: "", errorEmployee: "", targetKeys: [], idEmployeeDivision: [], currentSelectDiv: null })
+ }
+ this.setState({ penerima: type });
+ }
+
+ handleSelectOrganization = (inputValue, actionMeta) => {
+ this.setState({ idOrganization: inputValue.value, currentSelectDiv: { value: inputValue.value, label: inputValue.label }, errorDivision: "" }, () => {
+ this.setEmployeeOrganization();
+ });
+ }
+
+ setEmployeeOrganization = () => {
+ let arrEd = this.state.dataEmployee.data;
+ let cek = arrEd.filter(this.filterId)
+
+ this.setState({ idEmployeeDivision: cek })
+ }
+
+ filterId = (val) => {
+ return val.organization_id == this.state.idOrganization
+ }
+
+ getDataRole = async () => {
+ const payload = {
+ "paging": {
+ "start": 0,
+ "length": -1
+ },
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ const result = await axios
+ .post(ROLE_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ this.setState({ dataDivision: result.data.data }, () => {
+ this.setDataOrganization();
+ })
+ } else {
+ }
+ }
+
+ setDataOrganization = () => {
+ const { dataDivision } = this.state
+ const listOrganization = []
+ dataDivision.map((val, index) => {
+ listOrganization.push({
+ value: val.id,
+ label: val.name
+ })
+ })
+ this.setState({ listOrganizationSelect: listOrganization })
+ }
+
+ getDataUsers = async () => {
+ const payload = {
+ "paging": {
+ "start": 0,
+ "length": -1
+ },
+ "columns": [
+ {
+ "name": "name",
+ "logic_operator": "like",
+ "value": "",
+ "operator": "AND",
+ "table_name": "m_users"
+ }
+ ],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+ //TODO should use search instead
+ const result = await axios
+ .post(USER_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.status == 200) {
+ this.setState({ dataEmployee: result.data }, () => {
+ this.setDataEmployee();
+ });
+ } else {
+ }
+ }
+
+ setDataEmployee = () => {
+ const listEmployee = [];
+ const allIdEmployee = [];
+ this.state.dataEmployee.data.map((val, index) => {
+ allIdEmployee.push(val.id);
+ listEmployee.push({
+ key: val.id,
+ id: val.id,
+ title: val.name
+ });
+ })
+
+ this.setState({ dataSourceEmployee: listEmployee, allEmployeeId: allIdEmployee })
+ }
+
+ handleChangeTransfer = (nextTargetKeys, direction, moveKeys) => {
+ this.setState({ targetKeys: nextTargetKeys, errorEmployee: "" });
+
+ };
+
+ handleSelectChangeTransfer = (sourceSelectedKeys, targetSelectedKeys) => {
+ this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys], errorEmployee: "" });
+
+ };
+
+ renderForm = () => {
+ const t = this.props
+ const { errorTitle, errorMessage } = this.state
+ return (
+
+ )
+ }
+ handleCloseDialog = () => {
+ this.props.closeDialog()
+ this.setState({
+ errorTitle: "",
+ errorMessage: "",
+ errorDivision: "",
+ errorEmployee: ""
+ })
+ }
+ render() {
+ return (
+
+ {this.props.t('broadcastDetail')}
+
+ {this.renderForm()}
+
+
+ {' '}
+ {' '}
+
+
+
+ )
+ }
+}
+export default withTranslation()(DialogForm);
diff --git a/src/views/Master/MasterBroadcast/index.js b/src/views/Master/MasterBroadcast/index.js
index 2622210..c32abb3 100644
--- a/src/views/Master/MasterBroadcast/index.js
+++ b/src/views/Master/MasterBroadcast/index.js
@@ -5,7 +5,7 @@ import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios';
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 { DatePicker, Pagination } from 'antd';
import { NotificationContainer, NotificationManager } from 'react-notifications';
@@ -66,9 +66,7 @@ class index extends Component {
totalPage: 0,
typeClock: "All",
typeDialog: 'Save',
- role_name: props.role_name || '',
- company_id: props.company_id,
- listCompany: []
+ role_name: props.role_name || ''
}
}
@@ -82,17 +80,6 @@ class index extends Component {
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 => {
const value = e.target.value
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
.post(url, payload, config)
.then(res => res)
@@ -164,7 +133,6 @@ class index extends Component {
if (result && result.data) {
if (result.data.code === 200) {
this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord });
- this.getDataCompany()
} else {
NotificationManager.error('Failed retreiving data!!', 'Failed');
}
@@ -217,8 +185,7 @@ class index extends Component {
"status_send": type,
"send_to_type": "all",
"message_notif": data.message,
- "description": data.description,
- "company_id": data.company_id
+ "description": data.description
}
const paramRoles = {
@@ -227,8 +194,7 @@ class index extends Component {
"send_to_type": "roles",
"message_notif": data.message,
"description": data.description,
- "send_to_id": data.id,
- "company_id": data.company_id
+ "send_to_id": data.id
}
const paramUsers = {
@@ -237,8 +203,7 @@ class index extends Component {
"send_to_type": "users",
"message_notif": data.message,
"description": data.description,
- "send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null,
- "company_id": data.company_id
+ "send_to_id": data.send_to_type == "users" ? data.id.map((id, index) => id) : null
}
if (data.send_to_type === "all") {
@@ -491,9 +456,6 @@ class index extends Component {
- {this.state.role_name === 'Super Admin' &&
- {n.join_first_company_name ? n.join_first_company_name : "-"} |
- }
{n.title_notif} |
{n.message_notif !== "" ? n.message_notif : "-"} |
{n.description !== "" ? n.description : "-"} |
@@ -560,7 +522,6 @@ class index extends Component {
render() {
const column = [
{ 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('message') },
{ name: this.props.t('description') },
@@ -595,9 +556,7 @@ class index extends Component {
dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo}
- company_id={this.state.company_id}
role_name={this.state.role_name}
- listCompany={this.state.listCompany}
/>
{
// Delete Image Function
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
.delete(URL, HEADER)
.then(res => res)
@@ -452,7 +452,7 @@ const MasterCompany = ({ params }) => {
};
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
.delete(URL, HEADER)
.then(res => res)
@@ -461,7 +461,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageFavicon = async (id) => {
- const URL = IMAGE_DELETE(id, 'company_favicon', companyID != '' ? companyID : 'undifined');
+ const URL = IMAGE_DELETE(id, 'company_favicon');
await axios
.delete(URL, HEADER)
.then(res => res)
@@ -470,7 +470,7 @@ const MasterCompany = ({ params }) => {
};
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
.delete(URL, HEADER)
.then(res => res)
diff --git a/src/views/Master/MasterRoles/DialogForm.js b/src/views/Master/MasterRoles/DialogForm.js
index caad24e..ac82a36 100644
--- a/src/views/Master/MasterRoles/DialogForm.js
+++ b/src/views/Master/MasterRoles/DialogForm.js
@@ -5,7 +5,7 @@ import { withTranslation } from 'react-i18next';
import axios from 'axios';
import { NotificationManager } from 'react-notifications';
import { Select } from 'antd';
-import { COMPANY_MANAGEMENT_LIST, MENU_SEARCH } from '../../../const/ApiConst.js';
+import { MENU_SEARCH } from '../../../const/ApiConst.js';
const { Option } = Select
@@ -18,12 +18,9 @@ class DialogForm extends Component {
description: "",
openDialog: false,
isParentClick: false,
- companyList: [],
- scompany_id:null,
menu: [],
selectedMenu: null,
all_project: false,
- company_id: props.company_id || null,
role_name: props.role_name || '',
token: props.token || '',
config: {
@@ -35,7 +32,6 @@ class DialogForm extends Component {
}
}
async componentDidMount() {
- this.getDataProyekCompany();
this.getAllMenu();
this.props.showDialog(this.showDialog);
}
@@ -47,36 +43,20 @@ class DialogForm extends Component {
id: dataEdit.id,
name: dataEdit.name,
description: dataEdit.description,
- selectedMenu: dataEdit.default_page,
- scompany_id : dataEdit.company_id
+ selectedMenu: dataEdit.default_page
})
} else {
this.setState({
id: 0,
name: "",
description: "",
- selectedMenu: null,
- scompany_id : null
+ selectedMenu: null
})
}
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 () => {
const payload = {
"paging": { "start": 0, "length": -1 },
@@ -100,10 +80,6 @@ class DialogForm extends Component {
}
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 === "") {
alert("Role Name cannot be empty!");
return true;
@@ -125,8 +101,6 @@ class DialogForm extends Component {
description,
selectedMenu,
role_name,
- company_id,
- scompany_id,
all_project
} = this.state
@@ -139,7 +113,6 @@ class DialogForm extends Component {
name,
description,
selectedMenu,
- company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
all_project
}
@@ -150,7 +123,6 @@ class DialogForm extends Component {
name,
description,
selectedMenu,
- company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
all_project
}
this.props.closeDialog('edit', data);
@@ -163,9 +135,6 @@ class DialogForm extends Component {
this.props.closeDialog('cancel', 'none')
}
- onChangeCompanyProject = (val) => {
- this.setState({scompany_id : val});
- };
renderForm = () => {
const { t } = this.props;
return (
@@ -176,31 +145,6 @@ class DialogForm extends Component {
- {
- this.state.role_name === 'Super Admin' && (
-
-
-
-
-
-
- )
- }
diff --git a/src/views/Master/MasterRoles/DialogMenuRoles.js b/src/views/Master/MasterRoles/DialogMenuRoles.js
index ab8c026..86f4a40 100644
--- a/src/views/Master/MasterRoles/DialogMenuRoles.js
+++ b/src/views/Master/MasterRoles/DialogMenuRoles.js
@@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import { Button, Form } from 'reactstrap';
import 'antd/dist/antd.css';
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 config = {
headers:
@@ -68,11 +68,8 @@ export default class DialogMenuRoles extends Component {
],
"orders": { "columns": ["id"], "ascending": false }
}
- payload.columns.push(
- { "name": "company_id", "logic_operator": "=", "value": this.props.company_id, "operator": "AND" }
- )
const result = await axios
- .post(MENU_COMPANY_SEARCH, payload, config)
+ .post(MENU_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js
index 123d531..47e91cd 100644
--- a/src/views/Master/MasterRoles/index.js
+++ b/src/views/Master/MasterRoles/index.js
@@ -51,7 +51,6 @@ class index extends Component {
all_project: props.all_project || null,
hierarchy: props.hierarchy || [],
user_name: props.user_name || '',
- company_id: props.company_id || 0,
config: {
headers: {
Authorization: `Bearer ${props.token || ''}`,
@@ -92,18 +91,6 @@ class index extends Component {
>,
},
- ...(this.state.role_name === 'Super Admin'
- ? [
- {
- title: this.props.t('company'),
- dataIndex: "join_first_company_name",
- key: "join_first_company_name",
- render: (text, record) => (
- {record.join_first_company_name}
- ),
- }
- ]
- : []),
{ title: this.props.t('nameRole'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: this.props.t('description'), dataIndex: 'description', key: 'description' },
]
@@ -148,18 +135,6 @@ class index extends Component {
"joins": [],
"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
.post(ROLE_SEARCH, formData, this.state.config)
.then(res => res)
@@ -226,7 +201,6 @@ class index extends Component {
name: data.name,
description: data.description,
default_page: data.selectedMenu,
- company_id: data.company_id,
all_project: data.all_project
}
@@ -247,7 +221,6 @@ class index extends Component {
name: data.name,
description: data.description,
default_page: data.selectedMenu,
- company_id: data.company_id,
all_project: data.all_project
}
const url = ROLE_EDIT(data.id)
@@ -264,7 +237,7 @@ class index extends Component {
}
handleEdit = (data) => {
- this.setState({ dataEdit: data, company_id: data.company_id });
+ this.setState({ dataEdit: data });
this.handleOpenDialog('Edit');
}
@@ -324,7 +297,7 @@ class index extends Component {
.then(res => res)
.catch((error) => error.response);
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();
});
}
@@ -395,19 +368,6 @@ class index extends Component {
"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
.post(ROLE_SEARCH, formData, this.state.config)
.then(res => res)
@@ -418,9 +378,6 @@ class index extends Component {
const dataExport = [];
dataRes.map((val, index) => {
let row = {};
- if (this.state.role_name === 'Super Admin') {
- row.Company = val.join_first_company_name;
- }
row.Nama = val.name;
row.Deskripsi = val.description;
dataExport.push(row);
@@ -478,7 +435,6 @@ class index extends Component {
dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo}
- company_id={this.state.company_id}
role_name={this.state.role_name}
token={this.state.token}
/>
@@ -488,7 +444,6 @@ class index extends Component {
idRoles={this.state.idRoles}
showDialog={showDialog => this.showMenuRolesDialog = showDialog}
menuRoles={this.state.menuRoles}
- company_id={this.state.company_id}
role_name={this.state.role_name}
role_id={this.state.role_id}
token={this.state.token}
diff --git a/src/views/Master/ProjectExpenditure/DialogForm.js b/src/views/Master/ProjectExpenditure/DialogForm.js
index 1bf2886..6373c3a 100644
--- a/src/views/Master/ProjectExpenditure/DialogForm.js
+++ b/src/views/Master/ProjectExpenditure/DialogForm.js
@@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css";
import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next';
-const company_id = localStorage.getItem("company_id")
const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0)
@@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") {
data = {
name: projectExpenditure,
- color,
- company_id
+ color
}
closeDialog('save', data);
} else {
data = {
id,
name: projectExpenditure,
- color,
- company_id
+ color
}
closeDialog('edit', data);
}
diff --git a/src/views/Master/ProjectExpenditure/index.js b/src/views/Master/ProjectExpenditure/index.js
index c9b227d..e7653a8 100644
--- a/src/views/Master/ProjectExpenditure/index.js
+++ b/src/views/Master/ProjectExpenditure/index.js
@@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -85,15 +84,7 @@ const ProjectExpenditure = ({ params, ...props }) => {
"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
.post(PROJECT_EXPENDITURE_SEARCH, payload, HEADER)
.then((res) => res)
diff --git a/src/views/Master/ProjectFinancialHealth/DialogForm.js b/src/views/Master/ProjectFinancialHealth/DialogForm.js
index aed6397..d00dd8f 100644
--- a/src/views/Master/ProjectFinancialHealth/DialogForm.js
+++ b/src/views/Master/ProjectFinancialHealth/DialogForm.js
@@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css";
import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next';
-const company_id = localStorage.getItem("company_id")
const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0)
@@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") {
data = {
name: projectFinancialHealth,
- color,
- company_id
+ color
}
closeDialog('save', data);
} else {
data = {
id,
name: projectFinancialHealth,
- color,
- company_id
+ color
}
closeDialog('edit', data);
}
diff --git a/src/views/Master/ProjectFinancialHealth/index.js b/src/views/Master/ProjectFinancialHealth/index.js
index 28f9fcd..59576e2 100644
--- a/src/views/Master/ProjectFinancialHealth/index.js
+++ b/src/views/Master/ProjectFinancialHealth/index.js
@@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -85,15 +84,7 @@ const ProjectFinancialHealth = ({ params, ...props }) => {
"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
.post(PROJECT_FINANCIAL_HEALTH_SEARCH, payload, HEADER)
.then((res) => res)
diff --git a/src/views/Master/ProjectInvoice/DialogForm.js b/src/views/Master/ProjectInvoice/DialogForm.js
index 2a42dc1..cd02234 100644
--- a/src/views/Master/ProjectInvoice/DialogForm.js
+++ b/src/views/Master/ProjectInvoice/DialogForm.js
@@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css";
import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next';
-const company_id = localStorage.getItem("company_id")
const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0)
@@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") {
data = {
name: projectInvoice,
- color,
- company_id
+ color
}
closeDialog('save', data);
} else {
data = {
id,
name: projectInvoice,
- color,
- company_id
+ color
}
closeDialog('edit', data);
}
diff --git a/src/views/Master/ProjectInvoice/index.js b/src/views/Master/ProjectInvoice/index.js
index c030d1d..ca652ee 100644
--- a/src/views/Master/ProjectInvoice/index.js
+++ b/src/views/Master/ProjectInvoice/index.js
@@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -85,15 +84,7 @@ const ProjectInvoice = ({ params, ...props }) => {
"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
.post(PROJECT_INVOICE_SEARCH, payload, HEADER)
.then((res) => res)
diff --git a/src/views/Master/ProjectPhase/DialogForm.js b/src/views/Master/ProjectPhase/DialogForm.js
index 05d02be..9318254 100644
--- a/src/views/Master/ProjectPhase/DialogForm.js
+++ b/src/views/Master/ProjectPhase/DialogForm.js
@@ -1,132 +1,91 @@
-import React, { useEffect, useState } from 'react'
-import {
- Modal, ModalHeader, ModalBody, ModalFooter,
- Button, Form, FormGroup, Label, Input, Col, Row
-} from 'reactstrap';
-import 'antd/dist/antd.css';
-import InputColor from "./InputColor";
-import "./styles.css";
-import "rc-color-picker/assets/index.css";
-import { useTranslation } from 'react-i18next';
-import { Select } from 'antd';
-const { Option } = Select
-const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
- const [id, setId] = useState(0)
- const [projectType, setProjectType] = useState('')
- const [color, setColor] = useState('')
- const [selectedCompany, setSelectedCompany] = useState(null)
- const { t } = useTranslation();
- useEffect(() => {
- if (typeDialog === "Edit") {
- setId(dataEdit.id)
- setProjectType(dataEdit.name)
- setColor(dataEdit.color)
- setSelectedCompany(dataEdit.company_id)
- } else {
- setId(0)
- setColor('')
- setProjectType('')
- }
- }, [dataEdit, openDialog])
-
- const handleSave = () => {
- let data = '';
- if (typeDialog === "Save") {
- if (role_name === 'Super Admin') {
- company_id = selectedCompany
- }
- data = {
- name: projectType,
- color,
- company_id: company_id
- }
- closeDialog('save', data);
- } else {
- if (role_name === 'Super Admin') {
- company_id = selectedCompany
- }
- data = {
- id,
- name: projectType,
- color,
- company_id: company_id
- }
- closeDialog('edit', data);
- }
- setId(0)
- }
-
- const handleCancel = () => {
- closeDialog('cancel', 'none')
- setId(0)
- }
-
- const onChangeCompany = (val) => {
- setSelectedCompany(val);
- };
-
- const renderForm = () => {
- return (
-
- )
- }
-
- return (
- <>
-
- {typeDialog == "Save" ? `Add` : "Edit"} data
-
- {renderForm()}
-
-
- {' '}
-
-
-
- >
- )
-}
-
-export default DialogForm;
+import React, { useEffect, useState } from 'react'
+import {
+ Modal, ModalHeader, ModalBody, ModalFooter,
+ Button, Form, FormGroup, Label, Input, Col, Row
+} from 'reactstrap';
+import 'antd/dist/antd.css';
+import InputColor from "./InputColor";
+import "./styles.css";
+import "rc-color-picker/assets/index.css";
+import { useTranslation } from 'react-i18next';
+import { Select } from 'antd';
+const { Option } = Select
+const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
+ const [id, setId] = useState(0)
+ const [projectType, setProjectType] = useState('')
+ const [color, setColor] = useState('')
+ const { t } = useTranslation();
+ useEffect(() => {
+ if (typeDialog === "Edit") {
+ setId(dataEdit.id)
+ setProjectType(dataEdit.name)
+ setColor(dataEdit.color)
+ } else {
+ setId(0)
+ setColor('')
+ setProjectType('')
+ }
+ }, [dataEdit, openDialog])
+
+ const handleSave = () => {
+ let data = '';
+ if (typeDialog === "Save") {
+ data = {
+ name: projectType,
+ color
+ }
+ closeDialog('save', data);
+ } else {
+ data = {
+ id,
+ name: projectType,
+ color
+ }
+ closeDialog('edit', data);
+ }
+ setId(0)
+ }
+
+ const handleCancel = () => {
+ closeDialog('cancel', 'none')
+ setId(0)
+ }
+
+ const renderForm = () => {
+ return (
+
+ )
+ }
+
+ return (
+ <>
+
+ {typeDialog == "Save" ? `Add` : "Edit"} data
+
+ {renderForm()}
+
+
+ {' '}
+
+
+
+ >
+ )
+}
+
+export default DialogForm;
diff --git a/src/views/Master/ProjectPhase/index.js b/src/views/Master/ProjectPhase/index.js
index 708e91a..204ce2a 100644
--- a/src/views/Master/ProjectPhase/index.js
+++ b/src/views/Master/ProjectPhase/index.js
@@ -6,27 +6,22 @@ import axios from "../../../const/interceptorApi"
import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
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 { useTranslation } from 'react-i18next';
import {
- formatNumber,
- formatRupiah,
- formatThousand,
- renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
import { useLocation } from "react-router-dom";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -58,7 +53,6 @@ const ProjectPhase = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
- const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
useEffect(() => {
getDataProjectPhase()
@@ -71,21 +65,6 @@ const ProjectPhase = ({ params, ...props }) => {
}
}, [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 () => {
let start = 0;
if (currentPage !== 1 && currentPage > 1) {
@@ -116,21 +95,7 @@ const ProjectPhase = ({ params, ...props }) => {
},
'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
.post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res)
@@ -189,21 +154,6 @@ const ProjectPhase = ({ params, ...props }) => {
},
'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
.post(PROJECT_PHASE_SEARCH, payload, HEADER)
@@ -214,9 +164,6 @@ const ProjectPhase = ({ params, ...props }) => {
const excelData = [];
resData.map((val, index) => {
let dataRow = {};
- if (role_name === 'Super Admin') {
- dataRow.Company = val.join_first_company_name;
- }
dataRow.Nama = val.name;
dataRow.Color = val.color;
excelData.push(dataRow)
@@ -376,16 +323,6 @@ const ProjectPhase = ({ params, ...props }) => {
{" "}
>,
},
- ...(role_name === 'Super Admin' ?
- [{
- title: t('companyName'),
- dataIndex: "join_first_company_name",
- key: "join_first_company_name",
- render: (text, record) => (
- {record.join_first_company_name}
- )
- }]
- : []),
{
title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap"
},
@@ -435,9 +372,7 @@ const ProjectPhase = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
- listCompany={listCompany}
role_name={role_name}
- company_id={company_id}
/>
diff --git a/src/views/Master/ProjectScheduleHealth/DialogForm.js b/src/views/Master/ProjectScheduleHealth/DialogForm.js
index 7b77ead..2e2f646 100644
--- a/src/views/Master/ProjectScheduleHealth/DialogForm.js
+++ b/src/views/Master/ProjectScheduleHealth/DialogForm.js
@@ -9,7 +9,6 @@ import InputColor from "./InputColor";
import "./styles.css";
import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next';
-const company_id = localStorage.getItem("company_id")
const { Option } = Select;
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0)
@@ -33,16 +32,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") {
data = {
name: projectScheduleHealth,
- color,
- company_id
+ color
}
closeDialog('save', data);
} else {
data = {
id,
name: projectScheduleHealth,
- color,
- company_id
+ color
}
closeDialog('edit', data);
}
diff --git a/src/views/Master/ProjectScheduleHealth/index.js b/src/views/Master/ProjectScheduleHealth/index.js
index 36bc06f..3ce800f 100644
--- a/src/views/Master/ProjectScheduleHealth/index.js
+++ b/src/views/Master/ProjectScheduleHealth/index.js
@@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -85,15 +84,7 @@ const ProjectScheduleHealth = ({ params, ...props }) => {
"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
.post(PROJECT_SCHEDULE_HEALTH_SEARCH, payload, HEADER)
.then((res) => res)
diff --git a/src/views/Master/Proyek/index.js b/src/views/Master/Proyek/index.js
index 3a63728..503db44 100644
--- a/src/views/Master/Proyek/index.js
+++ b/src/views/Master/Proyek/index.js
@@ -48,7 +48,6 @@ const data = [
const url = "";
const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id');
-const company_id = window.localStorage.getItem('company_id');
const IndexRole = ({ params }) => {
const token = localStorage.getItem("token")
@@ -215,7 +214,7 @@ const IndexRole = ({ params }) => {
}
const onConfirmDelete = async () => {
- let urlDel = PROYEK_DELETE(idDelete, company_id);
+ let urlDel = PROYEK_DELETE(idDelete);
const result = await axios.delete(urlDel, HEADER)
.then(res => res)
.catch((error) => error.response);
diff --git a/src/views/Master/RoleProject/DialogForm.js b/src/views/Master/RoleProject/DialogForm.js
index d52f788..3e80e2a 100644
--- a/src/views/Master/RoleProject/DialogForm.js
+++ b/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 'antd/dist/antd.css';
import axios from 'axios';
-import { COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst.js';
import { withTranslation } from 'react-i18next';
import { NotificationManager } from 'react-notifications';
import { Select } from 'antd';
@@ -15,10 +14,7 @@ class DialogForm extends Component {
name: "",
description: "",
openDialog: false,
- companyList: [],
- scompany_id:null,
isParentClick: false,
- company_id: props.company_id || null,
role_name: props.role_name || '',
token: props.token || '',
config: {
@@ -32,7 +28,6 @@ class DialogForm extends Component {
async componentDidMount() {
this.props.showDialog(this.showDialog);
- this.getDataProyekCompany();
}
async componentDidUpdate() {
@@ -42,15 +37,13 @@ class DialogForm extends Component {
this.setState({
id: dataEdit.id,
name: dataEdit.name,
- description: dataEdit.description,
- scompany_id : dataEdit.company_id
+ description: dataEdit.description
})
} else {
this.setState({
id: 0,
name: "",
- description: "",
- scompany_id:null
+ description: ""
})
}
this.setState({ isParentClick: false });
@@ -62,58 +55,29 @@ class DialogForm extends Component {
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 = () => {
const {
id,
name,
- description,
- role_name,
- company_id,
- scompany_id
+ description
} = this.state
let data = '';
- const err = this.validation();
- if(!err) {
if (this.props.typeDialog === "Save") {
data = {
id,
name,
- description,
- company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
+ description
}
this.props.closeDialog('save', data);
} else {
data = {
id,
name,
- description,
- company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
+ description
}
this.props.closeDialog('edit', data);
}
- }
this.setState({ id: 0 });
}
@@ -121,37 +85,10 @@ class DialogForm extends Component {
this.props.closeDialog('cancel', 'none')
}
- onChangeCompanyProject = (val) => {
- this.setState({scompany_id : val});
- };
-
renderForm = () => {
const { t } = this.props;
return (
- {
- role_name === 'Super Admin' && (
-
-
-
-
-
-
- )
- }
-
-
-
- setCompany(e.target.value)}
- />
-
-
- {role_name === 'Super Admin' &&
-
-
-
-
-
-
-
-
- }
)
}
diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js
index c1667c0..c2f1980 100644
--- a/src/views/SimproV2/Divisi/index.js
+++ b/src/views/SimproV2/Divisi/index.js
@@ -4,28 +4,23 @@ import React, { useState, useEffect, useMemo } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi"
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 { Pagination, Button, Tooltip, Table, Spin } from 'antd';
import { useTranslation } from 'react-i18next';
import { useLocation } from "react-router-dom";
import {
- formatNumber,
- formatRupiah,
- formatThousand,
- renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -55,11 +50,9 @@ const ProjectType = ({ params, ...props }) => {
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
const [dataDivisions, setDataDivisions] = useState([])
- const [listCompany, setListCompany] = useState([])
const [loading, setLoading] = useState(true)
const { t } = useTranslation()
const column = [
- role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('nameDivision') },
{ name: t('description') },
{ name: t('color') },
@@ -74,20 +67,6 @@ const ProjectType = ({ params, ...props }) => {
exportExcel()
}
}, [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 payload = {
@@ -115,18 +94,6 @@ const ProjectType = ({ params, ...props }) => {
},
'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
.post(DIVISI_SEARCH, payload, HEADER)
@@ -175,18 +142,6 @@ const ProjectType = ({ params, ...props }) => {
},
'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
.post(DIVISI_SEARCH, payload, HEADER)
@@ -235,21 +190,7 @@ const ProjectType = ({ params, ...props }) => {
},
'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
.post(DIVISI_SEARCH, payload, HEADER)
.then(res => res)
@@ -259,9 +200,6 @@ const ProjectType = ({ params, ...props }) => {
const excelData = [];
resData.map((val, index) => {
let dataRow = {};
- if (role_name === 'Super Admin') {
- dataRow.Company = val.join_first_company_name;
- }
dataRow["Nama Divisi"] = val.name;
dataRow.Deskripsi = val.description;
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) => (
-
{record.join_first_company_name}
- )
- }] : []),
{ title: 'Nama', dataIndex: 'name', key: 'name' },
{ title: 'Deskripsi', dataIndex: 'description', key: 'description' },
{
@@ -515,8 +444,6 @@ const ProjectType = ({ params, ...props }) => {
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
dataDivisions={dataDivisions}
- company_id={company_id}
- listCompany={listCompany}
role_name={role_name}
/>
diff --git a/src/views/SimproV2/Gantt/GanttFrame.js b/src/views/SimproV2/Gantt/GanttFrame.js
index be06e2f..05cc2b2 100644
--- a/src/views/SimproV2/Gantt/GanttFrame.js
+++ b/src/views/SimproV2/Gantt/GanttFrame.js
@@ -2,11 +2,11 @@ import React, { useEffect, useState } from 'react';
import { useHistory, withRouter } from 'react-router-dom';
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 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}×tamp=${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}×tamp=${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}×tamp=${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}×tamp=${timestamp}&start=${dataViewStartDate}&role_name=${role_name}&gantt_name=${ganttName}`;
const [batchEntityData, setBatchEntityData] = useState(null);
useEffect(() => {
diff --git a/src/views/SimproV2/Gantt/index.js b/src/views/SimproV2/Gantt/index.js
index 5a2d04c..43443a3 100644
--- a/src/views/SimproV2/Gantt/index.js
+++ b/src/views/SimproV2/Gantt/index.js
@@ -10,7 +10,7 @@ let roCount = 0;
const Gantt = (props) => {
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 = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
@@ -113,10 +113,8 @@ const Gantt = (props) => {
token={token}
ro={ro}
role_name={role_name}
- companyId={company_id}
timestamp={timestamp}
dataViewStartDate={dataViewStartDate}
- company_name={companyName}
ganttName={ganttName}
/>
)}
diff --git a/src/views/SimproV2/LimitasiUser/index.js b/src/views/SimproV2/LimitasiUser/index.js
index a764c37..20c7751 100644
--- a/src/views/SimproV2/LimitasiUser/index.js
+++ b/src/views/SimproV2/LimitasiUser/index.js
@@ -35,7 +35,6 @@ class index extends Component {
tooltipMenu: false,
tooltipTambah: false,
totalPage: 0,
- company_id: props.company_id || 0,
role_name: props.role_name || '',
role_id: props.role_id || 0,
user_id: props.user_id || 0,
@@ -53,7 +52,6 @@ class index extends Component {
};
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',
render: (text,record) => {
@@ -116,8 +114,7 @@ class index extends Component {
const formData = {
name: data.name,
- description: data.description,
- company_id: data.company_id
+ description: data.descriptio
}
const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config)
@@ -137,8 +134,7 @@ class index extends Component {
const formData = {
name: data.name,
- description: data.description,
- company_id : data.company_id
+ description: data.description
}
const url = PROJECT_ROLE_EDIT(data.id)
const result = await axios.put(url, formData, this.state.config)
@@ -218,21 +214,7 @@ class index extends Component {
"joins": [],
"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
.post(PROJECT_ROLE_SEARCH, payload, this.state.config)
.then(res => res)
@@ -242,9 +224,6 @@ class index extends Component {
const dataExport = [];
dataRes.map((val, index) => {
let row = {};
- if (this.state.role_name === 'Super Admin') {
- row.Company = val.join_first_company_name;
- }
row.Nama = val.name;
row.Deskripsi = val.description;
dataExport.push(row);
diff --git a/src/views/SimproV2/PanicButton/index.js b/src/views/SimproV2/PanicButton/index.js
index 7f59f31..7f99a1c 100644
--- a/src/views/SimproV2/PanicButton/index.js
+++ b/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
.post(PANIC_BUTTON_SEARCH, payload, config)
.then(res => res)
@@ -285,9 +276,6 @@ class index extends Component {
this.handleMap(n)}>
- {this.state.role_name === 'Super Admin' &&
- {n.join_second_company_name ? n.join_second_company_name : "-"} |
- }
{n.created_at !== null ? moment(n.created_at).format("DD-MM-YYYY HH:mm:ss") : "-"} |
{n.join_first_name !== null ? n.join_first_name : "-"} |
{n.status_response !== null ? n.status_response : "-"} |
@@ -334,7 +322,6 @@ class index extends Component {
render() {
const column = [
{ 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('nameHR') },
{ name: this.props.t('statusResponse') },
diff --git a/src/views/SimproV2/PlanningHarian/index.js b/src/views/SimproV2/PlanningHarian/index.js
index 2dc9e31..970cdd1 100644
--- a/src/views/SimproV2/PlanningHarian/index.js
+++ b/src/views/SimproV2/PlanningHarian/index.js
@@ -1,357 +1,355 @@
-import React, { useState, useEffect, useMemo } from 'react';
-import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
-import { DownloadOutlined } from '@ant-design/icons';
-import axios from "../../../const/interceptorApi"
-import * as XLSX from 'xlsx';
-import SweetAlert from 'react-bootstrap-sweetalert';
-import DialogForm from './DialogForm';
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import { Pagination, Table, Button, Tooltip } from 'antd';
-import {
- BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH, PROYEK_EDIT, PROYEK_DELETE,
- USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE,
- USERROLE_SEARCH, ROLE_SEARCH
-} from '../../../const/ApiConst';
-import moment from 'moment'
-
-const url = "";
-const proyek_id = localStorage.getItem('proyek_id');
-const role_id = localStorage.getItem('role_id');
-const format = "DD-MM-YYYY";
-const token = window.localStorage.getItem('token');
-const config = {
- headers:
- {
- Authorization: `Bearer ${token}`,
- "Content-type": `application/json`
- }
-};
-
-const PlanningHarian = ({ params }) => {
- const token = localStorage.getItem("token")
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
- }
- const pageName = params.name;
- const [search, setSearch] = useState('')
- const [currentPage, setCurrentPage] = useState(1)
- const [openDialog, setOpenDialog] = useState(false)
- const [typeDialog, setTypeDialog] = useState('Save')
- const [dataExport, setDataExport] = useState([])
- const [rowsPerPage, setRowsPerPage] = useState(10)
- const [dataEdit, setDataEdit] = useState([])
- const [alertDelete, setAlertDelete] = useState(false)
- const [idDelete, setIdDelete] = useState(0)
- const [dataTable, setDatatable] = useState([])
- const [clickOpenModal, setClickOpenModal] = useState(false)
- const [totalPage, setTotalPage] = useState(0)
- const [roleList, setRoleList] = useState([])
-
- useEffect(() => {
- getDataUser()
- getRoleList()
- }, [])
-
- const getRoleList = async () => {
- const formData = {
- "paging": { "start": 0, "length": -1 },
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- const result = await axios
- .post(ROLE_SEARCH, formData, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- setRoleList(result.data.data);
- } else {
- NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
- }
- }
-
- const getDataUser = async () => {
-
- let start = 0;
-
- if (currentPage !== 1 && currentPage > 1) {
- start = (currentPage * rowsPerPage) - rowsPerPage
- }
-
- const payload = {
- "paging": {
- "start": start,
- "length": rowsPerPage
- },
- "columns": [
- {
- "name": "name",
- "logic_operator": "ilike",
- "value": search,
- "operator": "AND"
- }
- ],
- "joins": [
- {
- "name": "m_roles",
- "column_join": "role_id",
- "column_results": [
- "name",
- "description"
- ]
- }
- ],
- "orders": {
- "columns": [
- "id"
- ],
- "ascending": false
- }
- }
-
- const result = await axios
- .post(USER_SEARCH, payload, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code == 200) {
- setDatatable(result.data.data);
- setTotalPage(result.data.totalRecord);
- } else {
- NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
- }
- }
-
- const handleSearch = e => {
- const value = e.target.value
- setSearch(value);
- setCurrentPage(1)
- };
-
- const handleOpenDialog = (type) => {
- setOpenDialog(true)
- setTypeDialog(type)
- }
-
- const handleExportExcel = async () => {
-
- const payload = {
- "paging": { "start": 0, "length": -1 },
- "joins": [],
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- if (parseInt(role_id) !== 1) {
- payload["columns"] = [
- { "name": "id", "logic_operator": "=", "value": proyek_id, "operator": "AND" }
- ]
- }
-
- const result = await axios
- .post(PROYEK_SEARCH, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- let resData = result.data.data;
- const excelData = [];
- resData.map((n, index) => {
- let dataRow = {
- "Nama Proyek": n.nama,
- "Biaya": n.biaya,
- "Color Progress": n.color_progress,
- "Jumlah Pekerja": n.jumlah_pekerja,
- "Tanggal Mulai": n.mulai_proyek ? moment(n.mulai_proyek).format(format) : "-",
- "Tanggal Selesai": n.akhir_proyek ? moment(n.akhir_proyek).format(format) : "-",
- }
- excelData.push(dataRow)
- })
- await setDataExport(excelData);
- } else {
- NotificationManager.error('Gagal Export Data!!', 'Failed');
- }
- }
-
- const handleEdit = (data) => {
- setDataEdit(data)
- handleOpenDialog('Edit');
- }
-
- const handleDelete = async (id) => {
- await setAlertDelete(true)
- await setIdDelete(id)
- }
-
- const handleCloseDialog = (type, data) => {
- if (type === "save") {
- saveUser(data);
- } else if (type === "edit") {
- editUser(data);
- }
- setDataEdit([])
- setOpenDialog(false)
- }
-
- const saveUser = async (data) => {
- const formData = data
- const result = await axios.post(USER_ADD, formData, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataUser();
- NotificationManager.success(`Data resource berhasil ditambah`, 'Success!!');
- } else {
- NotificationManager.error(`${result.data.message}`, 'Failed!!');
- }
- }
-
- const editUser = async (data) => {
-
- let urlEdit = USER_EDIT(data.id)
- const formData = data
-
- const result = await axios.put(urlEdit, formData, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataUser();
- NotificationManager.success(`Data resource berhasil diedit`, 'Success!!');
- } else {
- NotificationManager.error(`Data resource gagal di edit`, `Failed!!`);
- }
- }
-
- const toggleAddDialog = () => {
- setOpenDialog(!openDialog)
- }
-
- const onConfirmDelete = async () => {
- let url = USER_DELETE(idDelete);
-
- const result = await axios.delete(url, config)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- getDataUser()
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.success(`Data user berhasil dihapus!`, 'Success!!');
- } else {
- setIdDelete(0)
- setAlertDelete(false)
- NotificationManager.error(`Data user gagal dihapus!}`, 'Failed!!');
- }
- }
-
- const cancelDelete = () => {
- setAlertDelete(false)
- setIdDelete(0)
- }
-
- const RenderTable = useMemo(() => {
- const columns = [
-
- { title: 'Subproject Name', dataIndex: 'name', key: 'name' },
- { title: 'Activity', dataIndex: 'name', key: 'name' },
- { title: 'Target', dataIndex: 'name', key: 'name' },
- { title: 'Unit', dataIndex: 'name', key: 'name' },
- { title: 'Resource Name', dataIndex: 'name', key: 'name' },
- {
- title: 'Planning Start Date',
- dataIndex: 'name',
- key: 'name',
- render: (text, record) => <>{text}>,
- },
- {
- title: 'Planning End Date',
- dataIndex: 'name',
- key: 'name',
- render: (text, record) => <>{text}>,
- },
- { title: 'Address', dataIndex: 'name', key: 'name' },
- {
- title: 'Action',
- dataIndex: '',
- key: 'x',
- render: (text, record) => <>
- {/*
-
- */}
-
-
-
-
-
-
- >,
- },
- ];
-
- return (
-
- )
- }, [dataTable])
-
- return (
-
-
- cancelDelete()}
- focusCancelBtn
- >
- Delete this data
-
- toggleAddDialog}
- typeDialog={typeDialog}
- dataEdit={dataEdit}
- clickOpenModal={clickOpenModal}
- roleList={roleList}
- />
-
-
- {pageName}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {RenderTable}
-
-
-
- )
-}
-
-export default PlanningHarian;
\ No newline at end of file
+import React, { useState, useEffect, useMemo } from 'react';
+import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
+import { DownloadOutlined } from '@ant-design/icons';
+import axios from "../../../const/interceptorApi"
+import * as XLSX from 'xlsx';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import DialogForm from './DialogForm';
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import { Pagination, Table, Button, Tooltip } from 'antd';
+import {
+ PROYEK_SEARCH,USER_ADD, USER_SEARCH, USER_EDIT, USER_DELETE,ROLE_SEARCH
+} from '../../../const/ApiConst';
+import moment from 'moment'
+
+const url = "";
+const proyek_id = localStorage.getItem('proyek_id');
+const role_id = localStorage.getItem('role_id');
+const format = "DD-MM-YYYY";
+const token = window.localStorage.getItem('token');
+const config = {
+ headers:
+ {
+ Authorization: `Bearer ${token}`,
+ "Content-type": `application/json`
+ }
+};
+
+const PlanningHarian = ({ params }) => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const pageName = params.name;
+ const [search, setSearch] = useState('')
+ const [currentPage, setCurrentPage] = useState(1)
+ const [openDialog, setOpenDialog] = useState(false)
+ const [typeDialog, setTypeDialog] = useState('Save')
+ const [dataExport, setDataExport] = useState([])
+ const [rowsPerPage, setRowsPerPage] = useState(10)
+ const [dataEdit, setDataEdit] = useState([])
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [idDelete, setIdDelete] = useState(0)
+ const [dataTable, setDatatable] = useState([])
+ const [clickOpenModal, setClickOpenModal] = useState(false)
+ const [totalPage, setTotalPage] = useState(0)
+ const [roleList, setRoleList] = useState([])
+
+ useEffect(() => {
+ getDataUser()
+ getRoleList()
+ }, [])
+
+ const getRoleList = async () => {
+ const formData = {
+ "paging": { "start": 0, "length": -1 },
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ const result = await axios
+ .post(ROLE_SEARCH, formData, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ setRoleList(result.data.data);
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ }
+ }
+
+ const getDataUser = async () => {
+
+ let start = 0;
+
+ if (currentPage !== 1 && currentPage > 1) {
+ start = (currentPage * rowsPerPage) - rowsPerPage
+ }
+
+ const payload = {
+ "paging": {
+ "start": start,
+ "length": rowsPerPage
+ },
+ "columns": [
+ {
+ "name": "name",
+ "logic_operator": "ilike",
+ "value": search,
+ "operator": "AND"
+ }
+ ],
+ "joins": [
+ {
+ "name": "m_roles",
+ "column_join": "role_id",
+ "column_results": [
+ "name",
+ "description"
+ ]
+ }
+ ],
+ "orders": {
+ "columns": [
+ "id"
+ ],
+ "ascending": false
+ }
+ }
+
+ const result = await axios
+ .post(USER_SEARCH, payload, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ setDatatable(result.data.data);
+ setTotalPage(result.data.totalRecord);
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ }
+ }
+
+ const handleSearch = e => {
+ const value = e.target.value
+ setSearch(value);
+ setCurrentPage(1)
+ };
+
+ const handleOpenDialog = (type) => {
+ setOpenDialog(true)
+ setTypeDialog(type)
+ }
+
+ const handleExportExcel = async () => {
+
+ const payload = {
+ "paging": { "start": 0, "length": -1 },
+ "joins": [],
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ if (parseInt(role_id) !== 1) {
+ payload["columns"] = [
+ { "name": "id", "logic_operator": "=", "value": proyek_id, "operator": "AND" }
+ ]
+ }
+
+ const result = await axios
+ .post(PROYEK_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ let resData = result.data.data;
+ const excelData = [];
+ resData.map((n, index) => {
+ let dataRow = {
+ "Nama Proyek": n.nama,
+ "Biaya": n.biaya,
+ "Color Progress": n.color_progress,
+ "Jumlah Pekerja": n.jumlah_pekerja,
+ "Tanggal Mulai": n.mulai_proyek ? moment(n.mulai_proyek).format(format) : "-",
+ "Tanggal Selesai": n.akhir_proyek ? moment(n.akhir_proyek).format(format) : "-",
+ }
+ excelData.push(dataRow)
+ })
+ await setDataExport(excelData);
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ const handleEdit = (data) => {
+ setDataEdit(data)
+ handleOpenDialog('Edit');
+ }
+
+ const handleDelete = async (id) => {
+ await setAlertDelete(true)
+ await setIdDelete(id)
+ }
+
+ const handleCloseDialog = (type, data) => {
+ if (type === "save") {
+ saveUser(data);
+ } else if (type === "edit") {
+ editUser(data);
+ }
+ setDataEdit([])
+ setOpenDialog(false)
+ }
+
+ const saveUser = async (data) => {
+ const formData = data
+ const result = await axios.post(USER_ADD, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataUser();
+ NotificationManager.success(`Data resource berhasil ditambah`, 'Success!!');
+ } else {
+ NotificationManager.error(`${result.data.message}`, 'Failed!!');
+ }
+ }
+
+ const editUser = async (data) => {
+
+ let urlEdit = USER_EDIT(data.id)
+ const formData = data
+
+ const result = await axios.put(urlEdit, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataUser();
+ NotificationManager.success(`Data resource berhasil diedit`, 'Success!!');
+ } else {
+ NotificationManager.error(`Data resource gagal di edit`, `Failed!!`);
+ }
+ }
+
+ const toggleAddDialog = () => {
+ setOpenDialog(!openDialog)
+ }
+
+ const onConfirmDelete = async () => {
+ let url = USER_DELETE(idDelete);
+
+ const result = await axios.delete(url, config)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataUser()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data user berhasil dihapus!`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data user gagal dihapus!}`, 'Failed!!');
+ }
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const RenderTable = useMemo(() => {
+ const columns = [
+
+ { title: 'Subproject Name', dataIndex: 'name', key: 'name' },
+ { title: 'Activity', dataIndex: 'name', key: 'name' },
+ { title: 'Target', dataIndex: 'name', key: 'name' },
+ { title: 'Unit', dataIndex: 'name', key: 'name' },
+ { title: 'Resource Name', dataIndex: 'name', key: 'name' },
+ {
+ title: 'Planning Start Date',
+ dataIndex: 'name',
+ key: 'name',
+ render: (text, record) => <>{text}>,
+ },
+ {
+ title: 'Planning End Date',
+ dataIndex: 'name',
+ key: 'name',
+ render: (text, record) => <>{text}>,
+ },
+ { title: 'Address', dataIndex: 'name', key: 'name' },
+ {
+ title: 'Action',
+ dataIndex: '',
+ key: 'x',
+ render: (text, record) => <>
+ {/*
+
+ */}
+
+
+
+
+
+
+ >,
+ },
+ ];
+
+ return (
+
+ )
+ }, [dataTable])
+
+ return (
+
+
+ cancelDelete()}
+ focusCancelBtn
+ >
+ Delete this data
+
+ toggleAddDialog}
+ typeDialog={typeDialog}
+ dataEdit={dataEdit}
+ clickOpenModal={clickOpenModal}
+ roleList={roleList}
+ />
+
+
+ {pageName}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {RenderTable}
+
+
+
+ )
+}
+
+export default PlanningHarian;
diff --git a/src/views/SimproV2/Presence/index.js b/src/views/SimproV2/Presence/index.js
index 93bb6fe..067bdde 100644
--- a/src/views/SimproV2/Presence/index.js
+++ b/src/views/SimproV2/Presence/index.js
@@ -12,13 +12,12 @@ import { useTranslation } from 'react-i18next';
const { RangePicker } = DatePicker;
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -93,17 +92,6 @@ const Index = ({ params, ...props }) => {
"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
.post(PRESENCE_SEARCH, payload, config)
.then(res => res)
@@ -255,18 +243,6 @@ const Index = ({ params, ...props }) => {
>,
},
- ...(role_name === 'Super Admin'
- ? [
- {
- title: t('company'),
- dataIndex: "join_second_company_name",
- key: "join_second_company_name",
- render: (text, record) => (
- {record.join_second_company_name}
- )
- },
- ]
- : []),
{ 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('presenceIn'), dataIndex: 'clock_in', key: 'clock_in', render: (text, record) => ({text ? moment(text).format("D-M-YYYY HH:mm:ss") : "-"}
) },
diff --git a/src/views/SimproV2/Profile/index.js b/src/views/SimproV2/Profile/index.js
index 268af88..f089e54 100644
--- a/src/views/SimproV2/Profile/index.js
+++ b/src/views/SimproV2/Profile/index.js
@@ -1,11 +1,9 @@
import * as XLSX from 'xlsx';
-import React, { useState, useEffect, useMemo } from 'react';
-import SweetAlert from 'react-bootstrap-sweetalert';
+import React, { useState, useEffect } from 'react';
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 { Pagination, Tooltip } from 'antd';
-import { USER_EDIT, SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../const/ApiConst';
+import { USER_EDIT } from '../../../const/ApiConst';
import profile from '../../../assets/img/profile.png'
import DialogForm from './DialogForm'
import { ROLE_SEARCH, USER_GET_ID } from '../../../const/ApiConst'
diff --git a/src/views/SimproV2/ProjectType/DialogForm.js b/src/views/SimproV2/ProjectType/DialogForm.js
index 0238082..e230728 100644
--- a/src/views/SimproV2/ProjectType/DialogForm.js
+++ b/src/views/SimproV2/ProjectType/DialogForm.js
@@ -9,13 +9,12 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next';
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 [projectType, setProjectType] = useState('')
const [uom, setUom] = useState('')
const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState()
- const [selectedCompany, setSelectedCompany] = useState(null)
const [isMultiLocation, setIsMultiLocation] = useState(false);
const { t } = useTranslation();
@@ -30,7 +29,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setUnitPrice(dataEdit.unit_price)
setUom(dataEdit.uom)
setProjectType(dataEdit.name)
- setSelectedCompany(dataEdit.company_id)
setIsMultiLocation(dataEdit.is_multiLocation)
} else {
handleClear()
@@ -39,14 +37,10 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => {
let data = '';
- if (role_name === 'Super Admin') {
- company_id = selectedCompany
- }
if (typeDialog === "Save") {
data = {
name: projectType,
description,
- company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
}
@@ -56,7 +50,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
id,
name: projectType,
description,
- company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
}
closeDialog('edit', data);
@@ -68,7 +61,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(0)
setProjectType('')
setDescription('')
- setSelectedCompany(null)
setIsMultiLocation(false)
}
@@ -78,10 +70,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
handleClear();
}
- const onChangeCompany = (val) => {
- setSelectedCompany(val);
- };
-
const renderForm = () => {
return (
- {
- role_name === 'Super Admin' && (
-
-
-
-
-
-
- )
- }
)
diff --git a/src/views/SimproV2/ProjectType/index.js b/src/views/SimproV2/ProjectType/index.js
index 0e23258..26955d8 100644
--- a/src/views/SimproV2/ProjectType/index.js
+++ b/src/views/SimproV2/ProjectType/index.js
@@ -8,7 +8,7 @@ import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { DownloadOutlined } from '@ant-design/icons';
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 { useTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc.js';
@@ -16,13 +16,12 @@ import { useLocation } from "react-router-dom";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -53,7 +52,6 @@ const ProjectType = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
- const [listCompany, setListCompany] = useState([])
const { t } = useTranslation();
useEffect(() => {
getDataProjectType()
@@ -66,29 +64,11 @@ const ProjectType = ({ params, ...props }) => {
}
}, [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 () => {
-
let start = 0;
-
if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage
}
-
const payload = {
group_column: {
"operator": "AND",
@@ -114,21 +94,7 @@ const ProjectType = ({ params, ...props }) => {
},
'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
.post(PROJECT_TYPE_SEARCH, payload, HEADER, HEADER)
.then(res => res)
@@ -185,21 +151,6 @@ const ProjectType = ({ params, ...props }) => {
},
'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
.post(PROJECT_TYPE_SEARCH, payload, HEADER)
@@ -211,9 +162,6 @@ const ProjectType = ({ params, ...props }) => {
const excelData = [];
resData.map((val, index) => {
let dataRow = {};
- if (role_name === 'Super Admin') {
- dataRow.Company = val.join_first_company_name;
- }
dataRow.Nama = val.name;
dataRow.Deskripsi = val.description;
excelData.push(dataRow)
@@ -376,16 +324,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) => (
-
{record.join_first_company_name}
- )
- }] : []),
-
{ title: t('nameProjectType'), dataIndex: 'name', key: 'name', className: "nowrap" },
{ title: t('description'), dataIndex: 'description', key: 'description' },
];
@@ -424,8 +362,6 @@ const ProjectType = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
- listCompany={listCompany}
- company_id={company_id}
role_name={role_name}
/>
{
return array.reduce((result, currentValue) => {
(result[currentValue[key]] = result[currentValue[key]] || []).push(
diff --git a/src/views/SimproV2/ResourceWorker/DialogForm.js b/src/views/SimproV2/ResourceWorker/DialogForm.js
index 1422e2e..119bc8f 100644
--- a/src/views/SimproV2/ResourceWorker/DialogForm.js
+++ b/src/views/SimproV2/ResourceWorker/DialogForm.js
@@ -10,7 +10,7 @@ import { formatNumber } from '../../../const/CustomFunc'
import { useTranslation } from 'react-i18next';
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 [resourceName, setResourceName] = useState('')
const [username, setUsername] = useState('')
@@ -26,7 +26,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const [ktpNumber, setKtpNumber] = useState('')
const [biayaPerJam, setBiayaPerJam] = useState('')
const [roleId, setRoleId] = useState('')
- const [scompany_id, setCompanyId] = useState(null);
const [address, setAddress] = useState('')
const [divisionId, setDivisionId] = useState('')
const [statusResource, setStatusResource] = useState('active')
@@ -45,7 +44,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setPhoneNo(dataEdit.phone_number)
setEmail(dataEdit.email)
setGender(dataEdit.gender)
- setCompanyId(dataEdit.company_id)
setBirthDate(dataEdit.birth_date ? moment(dataEdit.birth_date) : "")
setBirthPlace(dataEdit.birth_place)
setBloodType(dataEdit.blood_type)
@@ -74,7 +72,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setRoleId('')
setDivisionId('')
setAddress('')
- setCompanyId(null)
setStatusResource('active')
setStatusRestriction(false)
setStatusCustomer(false)
@@ -116,8 +113,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
ktp_number: ktpNumber,
address,
status_resource: statusResource,
- status_boundary: statusRestriction,
- company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
+ status_boundary: statusRestriction
}
if(statusCustomer === false) {
@@ -149,8 +145,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
id,
username,
password,
- email,
- company_id: parseInt(company_id)
+ email
}
closeDialog('edit', data);
@@ -170,8 +165,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
biaya_per_jam: biayaPerJam.replace('.', ''),
address,
status_resource: statusResource,
- status_boundary: statusRestriction,
- company_id: role_name != "Super Admin" ? parseInt(company_id) : parseInt(scompany_id)
+ status_boundary: statusRestriction
}
if(statusCustomer === false) {
data.role_id = roleId;
@@ -188,10 +182,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
}
}
- const onChangeCompanyProject = (val) => {
- setCompanyId(val);
- };
-
const handleCancel = () => {
closeDialog('cancel', 'none')
}
@@ -318,31 +308,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
- {
- role_name === 'Super Admin' && (
-
-
-
-
-
-
- )
- }
{
statusCustomer === false && (
<>
diff --git a/src/views/SimproV2/ResourceWorker/index.js b/src/views/SimproV2/ResourceWorker/index.js
index 340d48a..f68ad23 100644
--- a/src/views/SimproV2/ResourceWorker/index.js
+++ b/src/views/SimproV2/ResourceWorker/index.js
@@ -9,7 +9,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { useLocation } from "react-router-dom";
import { Pagination, Table, Button, Tooltip, Spin } from 'antd';
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';
import { useTranslation } from 'react-i18next';
import {
@@ -17,13 +17,12 @@ import {
} from "../../../const/CustomFunc";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -45,7 +44,6 @@ const ResourceWorker = ({ params, ...props }) => {
const [dataExport, setDataExport] = useState([])
const [dataTable, setDatatable] = useState([])
const [divisiList, setDivisiList] = useState([])
- const [companyList, setDataCompany] = useState([]);
const [idDelete, setIdDelete] = useState(0)
const [openDialog, setOpenDialog] = useState(false)
const [openDialogShift, setOpenDialogShift] = useState(false)
@@ -62,9 +60,6 @@ const ResourceWorker = ({ params, ...props }) => {
useEffect(() => {
getRoleList()
getDivisiList()
- if(role_name === 'Super Admin') {
- getDataProyekCompany();
- }
}, [])
useEffect(() => {
@@ -93,15 +88,7 @@ const ResourceWorker = ({ params, ...props }) => {
"orders": { "columns": ["id"], "ascending": false },
"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
.post(ROLE_SEARCH, formData, HEADER)
.then(res => res)
@@ -118,12 +105,6 @@ const ResourceWorker = ({ params, ...props }) => {
"columns": [],
}
- if (role_name !== "Super Admin") {
- formData.columns.push(
- { "name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND" },
- )
- }
-
const result = await axios
.post(DIVISI_SEARCH, formData, HEADER)
.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
.post(USER_SEARCH, payload, HEADER)
.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 value = e.target.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
.post(USER_SEARCH, payload, HEADER)
.then(res => res)
@@ -394,9 +334,6 @@ const ResourceWorker = ({ params, ...props }) => {
const excelData = [];
resData.map((n, index) => {
let dataRow = {};
- if (role_name === 'Super Admin') {
- dataRow.Company = n.join_third_company_name;
- }
dataRow["NIK (Nomor Induk Karyawan)"] = n.ktp_number;
dataRow["Employee Name"] = n.name;
dataRow["Divisi"] = n.join_second_name;
@@ -594,15 +531,6 @@ const ResourceWorker = ({ params, ...props }) => {
>,
},
- ...(role_name === 'Super Admin' ? [
- {
- title: t('company'),
- dataIndex: "join_third_company_name",
- key: "join_third_company_name",
- render: (text, record) => (
- {record.join_third_company_name}
- )
- }] : []),
{ title: t('nik'), dataIndex: 'ktp_number', key: 'ktp_number' },
{ title: t('nameHR'), dataIndex: 'name', key: 'name' },
{ title: t('division'), dataIndex: 'join_second_name', key: 'join_second_name' },
@@ -654,8 +582,6 @@ const ResourceWorker = ({ params, ...props }) => {
roleList={roleList}
divisiList={divisiList}
role_name={role_name}
- companyList={companyList}
- company_id={company_id}
/>
{
+const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, role_name }) => {
const [id, setId] = useState(0)
const [name, setName] = useState('')
const [description, setDescription] = useState('')
- const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation()
@@ -21,7 +20,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setId(dataEdit.id)
setDescription(dataEdit.description)
setName(dataEdit.name)
- setSelectedCompany(dataEdit.company_id);
} else {
setId(0)
}
@@ -30,32 +28,22 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const handleSave = () => {
let data = '';
if (typeDialog === "Save") {
- if (role_name === 'Super Admin') {
- company_id = parseInt(selectedCompany)
- }
data = {
name: name,
- description: description,
- company_id: parseInt(company_id)
+ description: description
}
closeDialog('save', data);
} else {
-
- if (role_name === 'Super Admin') {
- company_id = parseInt(selectedCompany)
- }
data = {
id,
name: name,
- description: description,
- company_id: parseInt(company_id)
+ description: description
}
closeDialog('edit', data);
}
- setId(0)
- setDescription('')
- setSelectedCompany(null)
+ setId(0);
+ setDescription('');
}
@@ -63,13 +51,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
closeDialog('cancel', 'none')
setId(0)
setDescription('')
- setSelectedCompany(null)
}
- const onChangeCompany = (val) => {
- setSelectedCompany(val);
- };
-
const renderForm = () => {
return (
- {role_name === 'Super Admin' &&
-
-
-
-
-
-
-
-
- }
)
}
diff --git a/src/views/SimproV2/Satuan/index.js b/src/views/SimproV2/Satuan/index.js
index 84c227f..4acd147 100644
--- a/src/views/SimproV2/Satuan/index.js
+++ b/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 { NotificationContainer, NotificationManager } from 'react-notifications';
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 { useLocation } from "react-router-dom";
import {
- formatNumber,
- formatRupiah,
- formatThousand,
- renderFormatRupiah,
checkActMenup,
} from "../../../const/CustomFunc";
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) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
- company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
@@ -54,7 +49,6 @@ const Satuan = ({ params, ...props }) => {
const [search, setSearch] = useState('')
const [totalPage, setTotalPage] = useState(0)
const [typeDialog, setTypeDialog] = useState('Save')
- const [listCompany, setListCompany] = useState([])
const { t } = useTranslation()
useEffect(() => {
getDataSatuan()
@@ -67,35 +61,16 @@ const Satuan = ({ params, ...props }) => {
}
}, [dataExport])
- useEffect(() => {
- getDataCompany()
- }, [])
-
const column = [
- role_name === 'Super Admin' ? { name: t('company') } : null,
{ name: t('name') },
{ name: t('description') },
].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 () => {
-
let start = 0;
-
if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage
}
-
const payload = {
group_column: {
"operator": "AND",
@@ -122,20 +97,6 @@ const Satuan = ({ params, ...props }) => {
'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
.post(SATUAN_SEARCH, payload, HEADER)
.then(res => res)
@@ -177,21 +138,7 @@ const Satuan = ({ params, ...props }) => {
"orders": { "columns": ["id"], "ascending": false },
'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
.post(SATUAN_SEARCH, payload, HEADER)
.then(res => res)
@@ -201,9 +148,6 @@ const Satuan = ({ params, ...props }) => {
const excelData = [];
resData.map((val, index) => {
let dataRow = {};
- if (role_name === 'Super Admin') {
- dataRow.Company = val.join_first_company_name;
- }
dataRow.Nama = val.name;
dataRow.Deskripsi = val.description;
excelData.push(dataRow)
@@ -344,9 +288,7 @@ const Satuan = ({ params, ...props }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
- listCompany={listCompany}
role_name={role_name}
- company_id={company_id}
/>
@@ -407,11 +349,6 @@ const Satuan = ({ params, ...props }) => {
}
- {role_name === 'Super Admin' &&
- (
- {n.join_first_company_name} |
- )
- }
{n.name} |
{n.description} |
diff --git a/src/views/SimproV2/Settings/components/MyProfile/Index.js b/src/views/SimproV2/Settings/components/MyProfile/Index.js
index e2d3c6f..eb6d565 100644
--- a/src/views/SimproV2/Settings/components/MyProfile/Index.js
+++ b/src/views/SimproV2/Settings/components/MyProfile/Index.js
@@ -14,10 +14,9 @@ import { Modal, ModalBody, ModalFooter, Button } from 'reactstrap';
const Index = () => {
const token = localStorage.getItem("token")
const user_id = localStorage.getItem("user_id")
- let company_id = '', configApp = '';
+ let configApp = '';
const role = window.localStorage.getItem('role_name');
if(role !== 'Super Admin') {
- company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
const config = {
@@ -132,9 +131,6 @@ const Index = () => {
formData.append('ref_id', id);
formData.append('category', 'profile_picture');
formData.append('files', data);
- if(role !== 'Super Admin') {
- formData.append('company_name', configApp.company_name);
- }
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
.then(res => res)
@@ -143,7 +139,7 @@ const Index = () => {
// Delete Image Function
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
.delete(URL, config)
.then(res => res)
@@ -254,7 +250,7 @@ const Index = () => {
handleImageClick() : ''}>
@@ -416,7 +412,7 @@ const Index = () => {
{
const [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]);
const [storage, setLimitInformation] = useState(0)
- const currentDate = new Date(); // Now date
- const givenDate = new Date(transaction.exp_ospro); // Parse exp ospro to date format
- const differenceInMillis = givenDate.getTime() - currentDate.getTime(); // Get time difference
+ const currentDate = new Date();
+ const givenDate = new Date(transaction.exp_ospro);
+ const differenceInMillis = givenDate.getTime() - currentDate.getTime();
const differenceInDays = role !== 'Super Admin' ? Math.ceil(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
- let company_id = '', configApp = '';
+ let configApp = '';
if(role !== 'Super Admin') {
- company_id = localStorage.getItem("company_id");
configApp = JSON.parse(window.localStorage.getItem('configApp'));
}
const config = {
@@ -39,14 +38,10 @@ const Container1 = () => {
const getDataProyek = async () => {
const payload = {
- "columns": [
- {"name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND"}
- ],
"select": [
"nama",
"mulai_proyek",
- "akhir_proyek",
- "company_id"
+ "akhir_proyek"
],
};
const result = await axios
@@ -63,11 +58,7 @@ const Container1 = () => {
const getDataTransaction = async () => {
const formData = {
"paging": {"start": 0, "length": 1},
- "columns": [
- {"name": "company_id", "logic_operator": "=", "value": parseInt(company_id), "operator": "AND"}
- ],
"select": [
- "company_id",
"type_paket",
"amount",
"exp_ospro",
@@ -88,7 +79,7 @@ const Container1 = () => {
}
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
.get(url, config)
.then((res) => res)
diff --git a/src/views/testgantt/index.js b/src/views/testgantt/index.js
index 784d148..04efab7 100644
--- a/src/views/testgantt/index.js
+++ b/src/views/testgantt/index.js
@@ -1,243 +1,243 @@
-import React, { useEffect, useMemo, useState } from 'react';
-import Timeline from 'react-calendar-timeline'
-import 'react-calendar-timeline/lib/Timeline.css'
-import moment from 'moment';
-import { BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH_DETAIL, PROYEK_EDIT, PROYEK_DELETE } from '../../const/ApiConst';
-import axios from 'axios';
-import { NotificationContainer, NotificationManager } from 'react-notifications';
-import { Button } from 'antd';
-import {
- Container, Col, Row, UncontrolledTooltip,
- Card,
- CardBody,
- CardHeader,
- Table,
- Modal, ModalHeader, ModalBody, ModalFooter
-} from 'reactstrap';
-import GanttFull from './GanttDhtmlx2';
-import DialogForm from '../Master/Proyek/DialogForm';
-import DialogFormSub from '../Master/Proyek/DialogFormSub';
-import Iframe from "@nicholasadamou/react-iframe";
-
-const GanttTimeLine = () => {
- const token = localStorage.getItem("token")
- const HEADER = {
- headers: {
- "Content-Type": "application/json",
- "Authorization": `Bearer ${token}`
- }
- }
-
- const [dataGantt, setDataGantt] = useState([]);
- const [prevProyekId, setPrevProyekId] = useState(0);
- const [dataGroupGantt, setDataGroupGantt] = useState([]);
- const [maxDateGantt, setMaxDateGantt] = useState(null);
- const [minDateGantt, setMinDateGantt] = useState(null);
- const [dataAllTimeLine, setDataAllTimeLine] = useState([]);
- const [prevDataAllTimeLine, setPrevDataAllTimeLine] = useState(null);
-
- const [idTask, setidTask] = useState(0);
- const [dataTable, setDatatable] = useState([])
- const [search, setSearch] = useState('')
- const [currentPage, setCurrentPage] = useState(1)
- const [totalPage, setTotalPage] = useState(0)
- const [openDialog, setOpenDialog] = useState(false)
- const [openDialogSub, setOpenDialogSub] = useState(false)
- const [typeDialog, setTypeDialog] = useState('Save');
- const [typeDialogSub, setTypeDialogSub] = useState('Save')
- const [idDelete, setIdDelete] = useState(0)
- const [alertDelete, setAlertDelete] = useState(false)
- const [dataEdit, setDataEdit] = useState([])
- const [dataEditSub, setDataEditSub] = useState([])
- const [rowsPerPage, setRowsPerPage] = useState(10)
- const [clickOpenModal, setClickOpenModal] = useState(false)
- const [dataExport, setDataExport] = useState([])
- const [allDataMenu, setAllDataMenu] = useState([])
- const [idSubtask, setIdSubtask] = useState(0);
-
- const handleMappingDataGantt = (data) => {
- const minDates = data.map(res => moment(res.mulai_proyek)),
- minDate = moment.min(minDates)
- const maxDates = data.map(res => moment(res.akhir_proyek)),
- maxDate = moment.max(maxDates)
-
- let groups = []
- let items = []
- data.map((res, idx) => {
- let group = {
- id: res.id,
- title: res.nama,
- stackItems: true,
- height: 50
- }
- let item = {
- id: res.id,
- group: res.id,
- title: res.pic,
- start_time: moment(res.mulai_proyek),
- end_time: moment(res.akhir_proyek),
- }
- groups.push(group)
- items.push(item)
- })
- setDataGantt(items)
- setDataGroupGantt(groups)
- setMaxDateGantt(maxDate)
- setMinDateGantt(minDate)
- }
-
- const handleGetDataProyek = async () => {
-
- const payload = {
- "paging": { "start": 0, "length": -1 },
- "joins": [
- { "name": "subproyeks.m_proyek", "column_join": "proyek_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual", "lat", "lon", "buffer_radius", "geom"] },
- { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual", "lat", "lon", "buffer_radius", "geom"] }
- ],
- "orders": { "columns": ["id"], "ascending": false }
- }
-
- const result = await axios
- .post(PROYEK_SEARCH_DETAIL, payload, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
-
- if (result && result.data && result.data.code == 200) {
- const { data } = result.data
- setDataAllTimeLine(data)
- setPrevDataAllTimeLine(data)
- handleMappingDataGantt(data)
-
- } else {
- NotificationManager.error('Gagal Export Data!!', 'Failed');
- }
- }
-
- useEffect(() => {
-
- handleGetDataProyek()
- }, []);
-
- const handleClickGroupGantt = param => {
- const row = prevDataAllTimeLine.filter(res => res.id === param)
- if (row.length > 0) {
- const { subproyeks, proyek_id, parent_id } = row[0]
- setPrevProyekId(parent_id || proyek_id)
- handleMappingDataGantt(subproyeks)
- setDataAllTimeLine(subproyeks)
- }
-
- }
-
- const handleOpenDialog = (type) => {
- setOpenDialog(true)
- setTypeDialog(type)
- }
-
- const handleOpenDialogSub = (type, param) => {
- const { id, parent_id, proyek_id, parent } = param
- const idParent = parent == 0 ? 0 : parent == proyek_id ? id : parent_id
- setidTask(proyek_id)
- setIdSubtask(idParent)
- setOpenDialogSub(true)
- setTypeDialogSub(type)
- }
-
- const handleCloseDialog = (type, data) => {
- if (type === "save") {
- saveProyek(data);
- }
-
- setDataEdit([])
- setOpenDialog(false)
- }
-
- const handleCloseDialogSub = (type, data) => {
- setDataEditSub([])
- setOpenDialogSub(false)
- if (type !== "cancel") {
- handleGetDataProyek()
- }
-
- }
-
- const toggleAddDialog = () => {
- setOpenDialog(!openDialog)
- }
-
- const toggleAddDialogSub = () => {
- setOpenDialogSub(!openDialogSub)
- }
-
- const saveProyek = async (data) => {
- const formData = data
-
- const result = await axios.post(PROYEK_ADD, formData, HEADER)
- .then(res => res)
- .catch((error) => error.response);
-
- if (result && result.data && result.data.code === 200) {
- handleGetDataProyek()
- NotificationManager.success(`Data proyek berhasil ditambah`, 'Success!!');
- } else {
- NotificationManager.error(`${result.data.message}`, 'Failed!!');
- }
-
- }
-
- const RenderGantt = useMemo(() => (
-
- ), [dataAllTimeLine, maxDateGantt, minDateGantt])
-
- return (
-
-
- {/* time line gantt */}
- toggleAddDialog}
- typeDialog={typeDialog}
- dataEdit={dataEdit}
- clickOpenModal={clickOpenModal}
- dataParent={allDataMenu}
- />
- toggleAddDialogSub}
- typeDialog={typeDialogSub}
- dataEdit={dataEditSub}
- idTask={idTask}
- idSubtask={idSubtask}
- />
- {/*
-
-
-
-
-
*/}
- {/* {RenderGantt} */}
-
-
-
- );
-}
-
-export default GanttTimeLine;
\ No newline at end of file
+import React, { useEffect, useMemo, useState } from 'react';
+import Timeline from 'react-calendar-timeline'
+import 'react-calendar-timeline/lib/Timeline.css'
+import moment from 'moment';
+import { BASE_SIMPRO, PROYEK_ADD, PROYEK_SEARCH_DETAIL } from '../../const/ApiConst';
+import axios from 'axios';
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import { Button } from 'antd';
+import {
+ Container, Col, Row, UncontrolledTooltip,
+ Card,
+ CardBody,
+ CardHeader,
+ Table,
+ Modal, ModalHeader, ModalBody, ModalFooter
+} from 'reactstrap';
+import GanttFull from './GanttDhtmlx2';
+import DialogForm from '../Master/Proyek/DialogForm';
+import DialogFormSub from '../Master/Proyek/DialogFormSub';
+import Iframe from "@nicholasadamou/react-iframe";
+
+const GanttTimeLine = () => {
+ const token = localStorage.getItem("token")
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+
+ const [dataGantt, setDataGantt] = useState([]);
+ const [prevProyekId, setPrevProyekId] = useState(0);
+ const [dataGroupGantt, setDataGroupGantt] = useState([]);
+ const [maxDateGantt, setMaxDateGantt] = useState(null);
+ const [minDateGantt, setMinDateGantt] = useState(null);
+ const [dataAllTimeLine, setDataAllTimeLine] = useState([]);
+ const [prevDataAllTimeLine, setPrevDataAllTimeLine] = useState(null);
+
+ const [idTask, setidTask] = useState(0);
+ const [dataTable, setDatatable] = useState([])
+ const [search, setSearch] = useState('')
+ const [currentPage, setCurrentPage] = useState(1)
+ const [totalPage, setTotalPage] = useState(0)
+ const [openDialog, setOpenDialog] = useState(false)
+ const [openDialogSub, setOpenDialogSub] = useState(false)
+ const [typeDialog, setTypeDialog] = useState('Save');
+ const [typeDialogSub, setTypeDialogSub] = useState('Save')
+ const [idDelete, setIdDelete] = useState(0)
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [dataEdit, setDataEdit] = useState([])
+ const [dataEditSub, setDataEditSub] = useState([])
+ const [rowsPerPage, setRowsPerPage] = useState(10)
+ const [clickOpenModal, setClickOpenModal] = useState(false)
+ const [dataExport, setDataExport] = useState([])
+ const [allDataMenu, setAllDataMenu] = useState([])
+ const [idSubtask, setIdSubtask] = useState(0);
+
+ const handleMappingDataGantt = (data) => {
+ const minDates = data.map(res => moment(res.mulai_proyek)),
+ minDate = moment.min(minDates)
+ const maxDates = data.map(res => moment(res.akhir_proyek)),
+ maxDate = moment.max(maxDates)
+
+ let groups = []
+ let items = []
+ data.map((res, idx) => {
+ let group = {
+ id: res.id,
+ title: res.nama,
+ stackItems: true,
+ height: 50
+ }
+ let item = {
+ id: res.id,
+ group: res.id,
+ title: res.pic,
+ start_time: moment(res.mulai_proyek),
+ end_time: moment(res.akhir_proyek),
+ }
+ groups.push(group)
+ items.push(item)
+ })
+ setDataGantt(items)
+ setDataGroupGantt(groups)
+ setMaxDateGantt(maxDate)
+ setMinDateGantt(minDate)
+ }
+
+ const handleGetDataProyek = async () => {
+
+ const payload = {
+ "paging": { "start": 0, "length": -1 },
+ "joins": [
+ { "name": "subproyeks.m_proyek", "column_join": "proyek_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual", "lat", "lon", "buffer_radius", "geom"] },
+ { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual", "lat", "lon", "buffer_radius", "geom"] }
+ ],
+ "orders": { "columns": ["id"], "ascending": false }
+ }
+
+ const result = await axios
+ .post(PROYEK_SEARCH_DETAIL, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+
+ if (result && result.data && result.data.code == 200) {
+ const { data } = result.data
+ setDataAllTimeLine(data)
+ setPrevDataAllTimeLine(data)
+ handleMappingDataGantt(data)
+
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ useEffect(() => {
+
+ handleGetDataProyek()
+ }, []);
+
+ const handleClickGroupGantt = param => {
+ const row = prevDataAllTimeLine.filter(res => res.id === param)
+ if (row.length > 0) {
+ const { subproyeks, proyek_id, parent_id } = row[0]
+ setPrevProyekId(parent_id || proyek_id)
+ handleMappingDataGantt(subproyeks)
+ setDataAllTimeLine(subproyeks)
+ }
+
+ }
+
+ const handleOpenDialog = (type) => {
+ setOpenDialog(true)
+ setTypeDialog(type)
+ }
+
+ const handleOpenDialogSub = (type, param) => {
+ const { id, parent_id, proyek_id, parent } = param
+ const idParent = parent == 0 ? 0 : parent == proyek_id ? id : parent_id
+ setidTask(proyek_id)
+ setIdSubtask(idParent)
+ setOpenDialogSub(true)
+ setTypeDialogSub(type)
+ }
+
+ const handleCloseDialog = (type, data) => {
+ if (type === "save") {
+ saveProyek(data);
+ }
+
+ setDataEdit([])
+ setOpenDialog(false)
+ }
+
+ const handleCloseDialogSub = (type, data) => {
+ setDataEditSub([])
+ setOpenDialogSub(false)
+ if (type !== "cancel") {
+ handleGetDataProyek()
+ }
+
+ }
+
+ const toggleAddDialog = () => {
+ setOpenDialog(!openDialog)
+ }
+
+ const toggleAddDialogSub = () => {
+ setOpenDialogSub(!openDialogSub)
+ }
+
+ const saveProyek = async (data) => {
+ const formData = data
+
+ const result = await axios.post(PROYEK_ADD, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ handleGetDataProyek()
+ NotificationManager.success(`Data proyek berhasil ditambah`, 'Success!!');
+ } else {
+ NotificationManager.error(`${result.data.message}`, 'Failed!!');
+ }
+
+ }
+
+ const RenderGantt = useMemo(() => (
+
+ ), [dataAllTimeLine, maxDateGantt, minDateGantt])
+
+ return (
+
+
+ {/* time line gantt */}
+ toggleAddDialog}
+ typeDialog={typeDialog}
+ dataEdit={dataEdit}
+ clickOpenModal={clickOpenModal}
+ dataParent={allDataMenu}
+ />
+ toggleAddDialogSub}
+ typeDialog={typeDialogSub}
+ dataEdit={dataEditSub}
+ idTask={idTask}
+ idSubtask={idSubtask}
+ />
+ {/*
+
+
+
+
+
*/}
+ {/* {RenderGantt} */}
+
+
+
+ );
+}
+
+export default GanttTimeLine;