diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js
index b5df65f..6d9eb70 100644
--- a/src/const/ApiConst.js
+++ b/src/const/ApiConst.js
@@ -120,43 +120,16 @@ export const TOKEN_ADW =
export let BASE_OSPRO = "https://project-api.ospro.id";
// export let BASE_OSPRO = "http://localhost:8444/adw-backend";
+// export let BASE_OSPRO = "https://project-api.ospro.id";
export let BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
export let BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
export let BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name)=>{
+export let BASE_SIMPRO_LUMEN_FILE_COMPANY = (file, company_name) => {
return `${BASE_OSPRO}/assets/${company_name}/file/project/${file}`;
}
-
-// switch (APP_MODE) {
-// case 'KIT':
-// BASE_OSPRO = "https://kit-api.oslogdev.com"
-
-// //for KIT server
-// // BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// // BASE_SIMPRO_LUMEN_IMAGE = `${BASE_SIMPRO_LUMEN}/assets/image`;
-// // BASE_SIMPRO_LUMEN_FILE = `${BASE_SIMPRO_LUMEN}/assets/file/project`;
-
-// break;
-// case 'ADW':
-// // BASE_OSPRO = "https://adw-api.ospro.id"
-// BASE_OSPRO = "http://103.73.125.81:8444";
-
-// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
-// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-
-// break;
-// case 'IU':
-// BASE_OSPRO = "https://api-iu.ospro.id"
-
-// BASE_SIMPRO_LUMEN = `${BASE_OSPRO}/api`;
-// BASE_SIMPRO_LUMEN_IMAGE = `${BASE_OSPRO}/assets/image`;
-// BASE_SIMPRO_LUMEN_FILE = `${BASE_OSPRO}/assets/file/project`;
-
-// break;
-// default:
-// BASE_OSPRO = "https://ospro-api.ospro.id"
-// }
+export let BASE_SIMPRO_LUMEN_IMAGE_COMPANY = (file, company_name) => {
+ return `${BASE_OSPRO}/assets/${company_name}/image/${file}`;
+}
export const USERROLE_ADD = `${BASE_SIMPRO}/user-role/add`;
export const USERROLE_SEARCH = `${BASE_SIMPRO}/user-role/search`;
@@ -301,6 +274,19 @@ export const REFFERAL_EDIT = (id) => {
return `${BASE_SIMPRO_LUMEN}/refferal-code/update/${id}`;
};
+export const TRANSACTION_ADD = `${BASE_SIMPRO_LUMEN}/product-transaction/add`;
+export const TRANSACTION_SEARCH = `${BASE_SIMPRO_LUMEN}/product-transaction/search`;
+export const TRANSACTION_GET_ID = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/product-transaction/edit/${id}`;
+};
+export const TRANSACTION_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/product-transaction/update/${id}`;
+};
+
+export const STORAGE_LIMIT_INFORMATION = (company_name) => {
+ return `${BASE_SIMPRO_LUMEN}/information-storage/${company_name}`;
+};
+
export const ABSENSI_ADD = `${BASE_SIMPRO_LUMEN}/permit/add`;
export const ABSENSI_SEARCH = `${BASE_SIMPRO_LUMEN}/permit/search`;
export const ABSENSI_EDIT = (id) => {
@@ -734,12 +720,6 @@ export const ASSIGN_HR_PROJECT_DELETE = (id, company_id) => {
};
export const ASSIGN_HR_PROJECT_LIST = `${BASE_SIMPRO_LUMEN}/user-to-proyek/list`;
-export const IMAGE_GET_BY_ID = (id, category) => {
- return `${BASE_SIMPRO_LUMEN}/image/${id}/${category}`;
-};
-export const IMAGE_SEARCH = `${BASE_SIMPRO_LUMEN}/image/search`;
-export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`;
-
export const DASHBOARD_COST_PLANNING_ACTUAL = `${BASE_SIMPRO_LUMEN}/dashboard/cost-planning-actual`;
export const DASHBOARD_PERSENTASE_PROGRESS_PROYEK = `${BASE_SIMPRO_LUMEN}/dashboard/percentage-planning-actual`;
export const DASHBOARD_REPORT_POINTS = `${BASE_SIMPRO_LUMEN}/report-activity/search-point`;
@@ -799,6 +779,11 @@ export const HIERARCHY_FTTH_COUNT_TREE = (id) => {
export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search`;
+export const IMAGE_GET_BY_ID = (id, category) => {
+ return `${BASE_SIMPRO_LUMEN}/image/${id}/${category}`;
+};
+export const IMAGE_SEARCH = `${BASE_SIMPRO_LUMEN}/image/search`;
+export const OSPRO_BASE_IMAGE = `${BASE_OSPRO}/api/assets/image`;
export const IMAGE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/upload`;
export const IMAGE_MULTIPLE_UPLOAD = `${BASE_SIMPRO_LUMEN}/image/multiple-upload`;
export const IMAGE_MULTIPLE_DELETE = (id, category, company_id) => {
@@ -836,8 +821,6 @@ export const MENU_COMPANY_DELETE = (id) => {
return `${BASE_SIMPRO_LUMEN}/menu-company/delete/${id}`;
};
-
-
export const DEMO_MANAGEMENT_ADD = `${BASE_SIMPRO_LUMEN}/demo-management/add`;
export const DEMO_MANAGEMENT_SEARCH = `${BASE_SIMPRO_LUMEN}/demo-management/search`;
export const DEMO_MANAGEMENT_EDIT = (id) => {
@@ -850,3 +833,27 @@ export const DEMO_MANAGEMENT_DELETE = (id) => {
return `${BASE_SIMPRO_LUMEN}/demo-management/delete/${id}`;
};
export const DEMO_MANAGEMENT_LIST = `${BASE_SIMPRO_LUMEN}/demo-management/list`;
+
+export const REFERRAL_CODE_ADD = `${BASE_SIMPRO_LUMEN}/refferal-code/add`;
+export const REFERRAL_CODE_SEARCH = `${BASE_SIMPRO_LUMEN}/refferal-code/search`;
+export const REFERRAL_CODE_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/refferal-code/update/${id}`;
+};
+export const REFERRAL_CODE_GET_ID = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/refferal-code/edit/${id}`;
+};
+export const REFERRAL_CODE_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/refferal-code/delete/${id}`;
+};
+
+export const SALES_CONTACT_ADD = `${BASE_SIMPRO_LUMEN}/sales-contact/add`;
+export const SALES_CONTACT_SEARCH = `${BASE_SIMPRO_LUMEN}/sales-contact/search`;
+export const SALES_CONTACT_EDIT = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/sales-contact/update/${id}`;
+};
+export const SALES_CONTACT_GET_ID = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/sales-contact/edit/${id}`;
+};
+export const SALES_CONTACT_DELETE = (id) => {
+ return `${BASE_SIMPRO_LUMEN}/sales-contact/delete/${id}`;
+};
diff --git a/src/const/en.json b/src/const/en.json
index 4a06ec8..59d3603 100644
--- a/src/const/en.json
+++ b/src/const/en.json
@@ -1,6 +1,8 @@
{
"3days": "3 Days Ago",
"7days": "7 Days Ago",
+ "amount": "Amount",
+ "allocation": "Allocation",
"action": "Action",
"add": "Add",
"address": "Address",
@@ -16,6 +18,8 @@
"cancel": "Cancel",
"close": "Close",
"color": "Color",
+ "code": "Code",
+ "discount": "Discount",
"date": "Date",
"dateSend": "Send Date",
"dateAbsent": "Absent Date",
@@ -37,6 +41,7 @@
"demoAdd": "Add Demo",
"employeeType": "Employee Type",
"edit": "Edit",
+ "exp": "Expire",
"export": "Export",
"exportExcel": "Export Excel",
"exportPdf": "Export Pdf",
@@ -54,6 +59,8 @@
"inputDescription": "Input Description",
"inputParentMenu": "Select Parent Menu",
"inputAliasMenu": "Input Menu Alias",
+ "inputAmount": "Input Amount",
+ "inputCode": "Input Code",
"inputOrder": "Input Order",
"inputUrl": "Input URL",
"inputMsg": "Input Message",
diff --git a/src/const/id.json b/src/const/id.json
index 4d25734..e8103b5 100644
--- a/src/const/id.json
+++ b/src/const/id.json
@@ -1,6 +1,8 @@
{
"3days": "3 Hari Yang lalu",
"7days": "7 Hari Yang lalu",
+ "amount": "Jumlah",
+ "allocation": "Kuota",
"action": "Aksi",
"add": "Tambah",
"address": "Alamat",
@@ -16,6 +18,8 @@
"cancel": "Batal",
"close": "Tutup",
"color": "Warna",
+ "code": "Kode",
+ "discount": "Diskon",
"date": "Tanggal",
"dateSend": "Tanggal Kirim",
"dateAbsent": "Tanggal Absen",
@@ -36,6 +40,7 @@
"divisionAdd": "Tambah Divisi",
"demoAdd": "Tambah Demo",
"edit": "Ubah",
+ "exp": "Batas Waktu",
"export": "Ekspor",
"exportExcel": "Ekspor Excel",
"exportPdf": "Ekspor Pdf",
@@ -69,6 +74,8 @@
"inputNik": "Masukan NIK (KTP)",
"inputMessage": "Masukan Pesan",
"inputRole": "Masukan Peran",
+ "inputAmount": "Masukan Jumlah",
+ "inputCode": "Masukan Kode",
"image": "Gambar",
"imageCheck": "Lihat Selfie Presensi",
"locIn": "Lokasi Masuk",
diff --git a/src/containers/DefaultLayout/DefaultHeader.js b/src/containers/DefaultLayout/DefaultHeader.js
index b04fb21..de15875 100644
--- a/src/containers/DefaultLayout/DefaultHeader.js
+++ b/src/containers/DefaultLayout/DefaultHeader.js
@@ -1,296 +1,296 @@
-import React, { Component } from 'react';
-import { NavLink } from 'react-router-dom';
-import { Badge, Nav, NavItem } from 'reactstrap';
-import PropTypes from 'prop-types';
-import { Menu, Dropdown } from 'antd'
-import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE, BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst';
-import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react';
-import logo_ospro from '../../assets/img/OSPRO.png'
-import axios from 'axios';
-import './Default.css'
-
-const propTypes = {
- children: PropTypes.node,
-};
-
-
-
-const defaultProps = {};
-
-
-class DefaultHeader extends Component {
-
- constructor(props) {
- super(props);
- this.state = {
- fullname: localStorage.getItem('fullname'),
- u_group: localStorage.getItem('u_group'),
- dataAlert: [],
- totalAlert: 0,
- listReadNotif: []
- }
- this.callAlert = "";
- }
-
-
-
- componentDidMount() {
- this.getHeaderMenu();
- const token = window.localStorage.getItem('token');
- const role = window.localStorage.getItem('role_name');
-
- if (role !== 'Super Admin') {
- this.setState({
- configApp: JSON.parse(window.localStorage.getItem('configApp')),
- });
- }
- this.setState({
- config: {
- headers: {
- Authorization: `Bearer ${token}`,
- 'Content-type': `application/json`,
- },
- },
- });
- }
-
- getLogoHeaderContent = () => {
- const { configApp } = this.state;
- const logoHeaderContent = configApp && configApp.logo_header ? configApp.logo_header.content : null;
- return logoHeaderContent
- ? `${BASE_SIMPRO_LUMEN_IMAGE}/${logoHeaderContent}`
- : logo_ospro;
- };
-
- componentDidUpdate(prevProps, prevState) {
- if (this.state.listReadNotif !== prevState.listReadNotif) {
- if (this.state.listReadNotif.length > 0) {
- this.markAsRead();
- }
- }
- }
-
- componentWillUnmount() {
- clearInterval(this.callAlert);
- }
-
- getDataAlert = async () => {
- let url = '';
- let payload = '';
- if (parseInt(localStorage.getItem('role_id')) === 1) {
- url = ALERT_SEARCH;
- payload = {
- "paging": { "start": 0, "length": -1 },
- "columns": [
- { "name": "status_view", "logic_operator": "=", "value": "false", "operator": "AND" },
- ],
- "joins": [
- { "name": "config_alert", "column_join": "config_alert_id", "column_results": ["nama", "keterangan"] },
- { "name": "laporan_planning", "column_join": "laporan_planning_id", "column_results": ["deskripsi", "status", "jumlah_pekerjaan"] },
- { "name": "m_satuan", "column_join": "satuan_id", "column_results": ["name", "description"] }
- ],
- "orders": { "columns": ["created_at"], "ascending": false }
- }
- } else {
- url = ALERTUSER_SEARCH;
- payload = {
- "paging": { "start": 0, "length": -1 },
- "columns": [
- { "name": "status_view", "logic_operator": "=", "value": "false", "operator": "AND" },
- { "name": "user_id", "logic_operator": "=", "value": localStorage.getItem('user_id'), "operator": "AND" },
- ],
- "joins": [
- { "name": "alert", "column_join": "alert_id", "column_results": ["nama", "keterangan"] },
- { "name": "config_alert", "column_join": "config_alert_id", "column_results": ["nama", "keterangan"] },
- { "name": "laporan_planning", "column_join": "laporan_planning_id", "column_results": ["deskripsi", "status", "jumlah_pekerjaan"] },
- { "name": "m_satuan", "column_join": "satuan_id", "column_results": ["name", "description"] },
- { "name": "m_users", "column_join": "user_id", "column_results": ["name", "username", "email", "phone_number", "gender"] }
- ],
- "orders": { "columns": ["created_at"], "ascending": false }
- }
- }
-
- if (localStorage.getItem('userConfigAlert')) {
- if (parseInt(localStorage.getItem('role_id')) === 1) {
- payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": localStorage.getItem('userConfigAlert'), "operator": "AND" })
- } else {
- payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": localStorage.getItem('userConfigAlert'), "operator": "AND", "table_name": "alert" })
- }
- } else {
- if (parseInt(localStorage.getItem('role_id')) === 1) {
- payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": "0", "operator": "AND" })
- } else {
- payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": "0", "operator": "AND", "table_name": "alert" })
- }
- }
-
- const result = await axios
- .post(url, payload, this.state.config)
- .then(res => res)
- .catch((error) => error.response);
- if (result && result.data && result.data.code == 200) {
- this.setState({ dataAlert: result.data.data, totalAlert: result.data.totalRecord });
- }
- }
-
- dropDownMenu = () => {
- const { dataAlert, totalAlert } = this.state
- let dataAlertLength = dataAlert.length
- let currentLoop = 0;
- return (
-
- )
- }
-
- gotoReportAlert = () => {
- this.props.history.replace('/laporan-alert')
- }
-
- onReadNotif = (visible) => {
- if (!visible) {
- const { dataAlert } = this.state
- let currentLoop = 0;
- let listId = []
- dataAlert.map((val, index) => {
- currentLoop++;
- if (currentLoop < 6) {
- listId.push(val.id);
- }
- });
-
- this.setState({ listReadNotif: listId });
- }
- }
-
- markAsRead = async () => {
- let data = this.state.listReadNotif
- const payload = {
- "status_view": true
- }
- let promises = []
- let result = []
- if (data.length > 0) {
- if (parseInt(localStorage.getItem('role_id')) === 1) {
- data.map((val, index) => {
- let url = ALERT_STATUSVIEW(val)
- promises.push(axios.put(url, payload, this.state.config)
- .then(res => result.push(res)));
- });
-
- } else {
- data.map((val, index) => {
- let url = ALERTUSER_STATUSVIEW(val)
- promises.push(axios.put(url, payload, this.state.config)
- .then(res => result.push(res)))
- });
- }
- await Promise.all(promises);
- }
- this.setState({ listReadNotif: [] }, () => {
- });
- }
-
-
- getLogo = () => {
- return (
-
-
-
- )
- }
- // logo_ospro
- getHeaderMenu = () => {
- const { fullname, u_group } = this.state;
- if (u_group == 'kominfo') {
- /*return (
-
- )*/
-
-
- return (
-
-
Layanan Telekomunikasi
-
- )
- }
- else {
- return (
-
- )
- }
- }
-
- render() {
-
- const { children, ...attributes } = this.props;
-
- return (
-
-
- {this.getLogo()}
-
-
-
- );
- }
-}
-
-DefaultHeader.propTypes = propTypes;
-DefaultHeader.defaultProps = defaultProps;
-
-export default DefaultHeader;
+import React, { Component } from 'react';
+import { NavLink } from 'react-router-dom';
+import { Badge, Nav, NavItem } from 'reactstrap';
+import PropTypes from 'prop-types';
+import { Menu, Dropdown } from 'antd'
+import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE, BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst';
+import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react';
+import logo_ospro from '../../assets/img/OSPRO.png'
+import axios from 'axios';
+import './Default.css'
+
+const propTypes = {
+ children: PropTypes.node,
+};
+
+
+
+const defaultProps = {};
+
+
+class DefaultHeader extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ fullname: localStorage.getItem('fullname'),
+ u_group: localStorage.getItem('u_group'),
+ dataAlert: [],
+ totalAlert: 0,
+ listReadNotif: []
+ }
+ this.callAlert = "";
+ }
+
+
+
+ componentDidMount() {
+ this.getHeaderMenu();
+ const token = window.localStorage.getItem('token');
+ const role = window.localStorage.getItem('role_name');
+
+ if (role !== 'Super Admin') {
+ this.setState({
+ configApp: JSON.parse(window.localStorage.getItem('configApp')),
+ });
+ }
+ this.setState({
+ config: {
+ headers: {
+ Authorization: `Bearer ${token}`,
+ 'Content-type': `application/json`,
+ },
+ },
+ });
+ }
+
+ getLogoHeaderContent = () => {
+ const { configApp } = this.state;
+ const logoHeaderContent = configApp && configApp.logo_header ? configApp.logo_header.content : null;
+ return logoHeaderContent
+ ? `${BASE_SIMPRO_LUMEN_IMAGE}/${logoHeaderContent}`
+ : logo_ospro;
+ };
+
+ componentDidUpdate(prevProps, prevState) {
+ if (this.state.listReadNotif !== prevState.listReadNotif) {
+ if (this.state.listReadNotif.length > 0) {
+ this.markAsRead();
+ }
+ }
+ }
+
+ componentWillUnmount() {
+ clearInterval(this.callAlert);
+ }
+
+ getDataAlert = async () => {
+ let url = '';
+ let payload = '';
+ if (parseInt(localStorage.getItem('role_id')) === 1) {
+ url = ALERT_SEARCH;
+ payload = {
+ "paging": { "start": 0, "length": -1 },
+ "columns": [
+ { "name": "status_view", "logic_operator": "=", "value": "false", "operator": "AND" },
+ ],
+ "joins": [
+ { "name": "config_alert", "column_join": "config_alert_id", "column_results": ["nama", "keterangan"] },
+ { "name": "laporan_planning", "column_join": "laporan_planning_id", "column_results": ["deskripsi", "status", "jumlah_pekerjaan"] },
+ { "name": "m_satuan", "column_join": "satuan_id", "column_results": ["name", "description"] }
+ ],
+ "orders": { "columns": ["created_at"], "ascending": false }
+ }
+ } else {
+ url = ALERTUSER_SEARCH;
+ payload = {
+ "paging": { "start": 0, "length": -1 },
+ "columns": [
+ { "name": "status_view", "logic_operator": "=", "value": "false", "operator": "AND" },
+ { "name": "user_id", "logic_operator": "=", "value": localStorage.getItem('user_id'), "operator": "AND" },
+ ],
+ "joins": [
+ { "name": "alert", "column_join": "alert_id", "column_results": ["nama", "keterangan"] },
+ { "name": "config_alert", "column_join": "config_alert_id", "column_results": ["nama", "keterangan"] },
+ { "name": "laporan_planning", "column_join": "laporan_planning_id", "column_results": ["deskripsi", "status", "jumlah_pekerjaan"] },
+ { "name": "m_satuan", "column_join": "satuan_id", "column_results": ["name", "description"] },
+ { "name": "m_users", "column_join": "user_id", "column_results": ["name", "username", "email", "phone_number", "gender"] }
+ ],
+ "orders": { "columns": ["created_at"], "ascending": false }
+ }
+ }
+
+ if (localStorage.getItem('userConfigAlert')) {
+ if (parseInt(localStorage.getItem('role_id')) === 1) {
+ payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": localStorage.getItem('userConfigAlert'), "operator": "AND" })
+ } else {
+ payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": localStorage.getItem('userConfigAlert'), "operator": "AND", "table_name": "alert" })
+ }
+ } else {
+ if (parseInt(localStorage.getItem('role_id')) === 1) {
+ payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": "0", "operator": "AND" })
+ } else {
+ payload['columns'].push({ "name": "config_alert_id", "logic_operator": "IN", "value": "0", "operator": "AND", "table_name": "alert" })
+ }
+ }
+
+ const result = await axios
+ .post(url, payload, this.state.config)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code == 200) {
+ this.setState({ dataAlert: result.data.data, totalAlert: result.data.totalRecord });
+ }
+ }
+
+ dropDownMenu = () => {
+ const { dataAlert, totalAlert } = this.state
+ let dataAlertLength = dataAlert.length
+ let currentLoop = 0;
+ return (
+
+ )
+ }
+
+ gotoReportAlert = () => {
+ this.props.history.replace('/laporan-alert')
+ }
+
+ onReadNotif = (visible) => {
+ if (!visible) {
+ const { dataAlert } = this.state
+ let currentLoop = 0;
+ let listId = []
+ dataAlert.map((val, index) => {
+ currentLoop++;
+ if (currentLoop < 6) {
+ listId.push(val.id);
+ }
+ });
+
+ this.setState({ listReadNotif: listId });
+ }
+ }
+
+ markAsRead = async () => {
+ let data = this.state.listReadNotif
+ const payload = {
+ "status_view": true
+ }
+ let promises = []
+ let result = []
+ if (data.length > 0) {
+ if (parseInt(localStorage.getItem('role_id')) === 1) {
+ data.map((val, index) => {
+ let url = ALERT_STATUSVIEW(val)
+ promises.push(axios.put(url, payload, this.state.config)
+ .then(res => result.push(res)));
+ });
+
+ } else {
+ data.map((val, index) => {
+ let url = ALERTUSER_STATUSVIEW(val)
+ promises.push(axios.put(url, payload, this.state.config)
+ .then(res => result.push(res)))
+ });
+ }
+ await Promise.all(promises);
+ }
+ this.setState({ listReadNotif: [] }, () => {
+ });
+ }
+
+
+ getLogo = () => {
+ return (
+
+
+
+ )
+ }
+ // logo_ospro
+ getHeaderMenu = () => {
+ const { fullname, u_group } = this.state;
+ if (u_group == 'kominfo') {
+ /*return (
+
+ )*/
+
+
+ return (
+
+
Layanan Telekomunikasi
+
+ )
+ }
+ else {
+ return (
+
+ )
+ }
+ }
+
+ render() {
+
+ const { children, ...attributes } = this.props;
+
+ return (
+
+
+ {this.getLogo()}
+
+
+
+ );
+ }
+}
+
+DefaultHeader.propTypes = propTypes;
+DefaultHeader.defaultProps = defaultProps;
+
+export default DefaultHeader;
diff --git a/src/containers/DefaultLayout/DefaultLayout.js b/src/containers/DefaultLayout/DefaultLayout.js
index 30e608b..3f2fbbb 100644
--- a/src/containers/DefaultLayout/DefaultLayout.js
+++ b/src/containers/DefaultLayout/DefaultLayout.js
@@ -111,8 +111,6 @@ class DefaultLayout extends Component {
default:
faviconElement.type = 'image/png';
}
- console.log('faviconElement.type', faviconElement.type);
- console.log('faviconContent', faviconContent);
faviconElement.href = faviconContent || `${process.env.PUBLIC_URL}/OSPRO.ico`;
diff --git a/src/routes.js b/src/routes.js
index eb71b0f..ebe60fe 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -54,9 +54,11 @@ const DashboardCustomer = React.lazy(() => import('./views/Dashboard/DashboardCu
const DashboardProject = React.lazy(() => import('./views/Dashboard/DashboardProject'));
const DashboardProjectCarousell = React.lazy(() => import('./views/Dashboard/DashboardProjectCarousell'));
const MapMonitoring = React.lazy(() => import('./views/MapMonitoring'));
-const Settings = React.lazy(() => import('./views/SimproV2/Settings'));
+const Settings = React.lazy(() => import('./views/SimproV2/Settings/Desktop'));
const CompanyManagement = React.lazy(() => import('./views/Master/MasterCompany'))
-const DemoManagement = React.lazy(() => import('./views/SimproV2/Demo'))
+const DemoRequest = React.lazy(() => import('./views/SimproV2/DemoRequest'))
+const ReferralCode = React.lazy(() => import('./views/SimproV2/ReferralCode'))
+const SalesContact = React.lazy(() => import('./views/SimproV2/SalesContact'))
const routes = [
{ path: '/', exact: true, name: 'Home' },
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
@@ -119,8 +121,11 @@ const routes = [
{ path: '/map-monitoring', exact: true, name: 'Map Monitoring', component: MapMonitoring },
// { path: '/dashboard-project/:ID/:GANTTID', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/settings', exact: true, name: 'Settings', component: Settings },
- { path: '/company-management', exact: true, name: 'Company Management', component: CompanyManagement },
- { path: '/demo-management', exact: true, name: 'Demo Management', component: DemoManagement },
+ { path: '/register-management', exact: true, name: 'Register Management', component: CompanyManagement },
+ { path: '/demo-request', exact: true, name: 'Request Demo', component: DemoRequest },
+ { path: '/referral-code-management', exact: true, name: 'Referral Code Management', component: ReferralCode },
+ { path: '/sales-contact', exact: true, name: 'Sales Contact', component: SalesContact },
+
];
export default routes;
diff --git a/src/views/Master/MasterCompany/index.js b/src/views/Master/MasterCompany/index.js
index 9a06900..a7bab4f 100644
--- a/src/views/Master/MasterCompany/index.js
+++ b/src/views/Master/MasterCompany/index.js
@@ -20,7 +20,11 @@ const config = {
const MasterCompany = ({ params }) => {
const token = localStorage.getItem("token")
- const company_id = localStorage.getItem("company_id")
+ let company_id = '';
+ const role = window.localStorage.getItem('role_name');
+ if(role != 'Super Admin') {
+ company_id = localStorage.getItem("company_id");
+ }
const HEADER = {
headers: {
"Content-Type": "application/json",
@@ -53,7 +57,10 @@ const MasterCompany = ({ params }) => {
const [loading, setLoading] = useState(true);
const pageName = params.name;
const { t } = useTranslation();
- const configApp = JSON.parse(window.localStorage.getItem('configApp'));
+ let configApp = '';
+ if (role !== 'Super Admin') {
+ configApp = JSON.parse(window.localStorage.getItem('configApp'));
+ }
useEffect(() => {
setLoading(true)
getDataCompany()
@@ -354,7 +361,9 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id);
formData.append('category', 'company_logo_header');
formData.append('files', data);
- formData.append('company_name',configApp.company_name);
+ if(role != 'Super Admin') {
+ formData.append('company_name',configApp.company_name);
+ }
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@@ -368,7 +377,9 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id);
formData.append('category', 'company_logo_login');
formData.append('files', data);
- formData.append('company_name',configApp.company_name);
+ if(role != 'Super Admin') {
+ formData.append('company_name',configApp.company_name);
+ }
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@@ -382,7 +393,9 @@ const MasterCompany = ({ params }) => {
formData.append('ref_id', id);
formData.append('category', 'company_favicon');
formData.append('files', data);
- formData.append('company_name',configApp.company_name);
+ if(role != 'Super Admin') {
+ formData.append('company_name',configApp.company_name);
+ }
await axios
.post(IMAGE_UPLOAD, formData, HEADER_MULTIPART)
@@ -402,7 +415,7 @@ const MasterCompany = ({ params }) => {
// Delete Image Function
const deleteImageHeader = async (id) => {
- const URL = IMAGE_DELETE(id, 'company_logo_header', company_id);
+ const URL = IMAGE_DELETE(id, 'company_logo_header', company_id != '' ? company_id : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@@ -411,7 +424,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageLogin = async (id) => {
- const URL = IMAGE_DELETE(id, 'company_logo_login', company_id);
+ const URL = IMAGE_DELETE(id, 'company_logo_login', company_id != '' ? company_id : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@@ -420,7 +433,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageFavicon = async (id) => {
- const URL = IMAGE_DELETE(id, 'company_favicon', company_id);
+ const URL = IMAGE_DELETE(id, 'company_favicon', company_id != '' ? company_id : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
@@ -429,7 +442,7 @@ const MasterCompany = ({ params }) => {
};
const deleteImageSlider = async (id) => {
- const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id);
+ const URL = IMAGE_MULTIPLE_DELETE(id, 'company_slider_login', company_id != '' ? company_id : 'undifined');
await axios
.delete(URL, HEADER)
.then(res => res)
diff --git a/src/views/Master/MasterRoles/DialogMenuRoles.js b/src/views/Master/MasterRoles/DialogMenuRoles.js
index 348f614..a00128e 100644
--- a/src/views/Master/MasterRoles/DialogMenuRoles.js
+++ b/src/views/Master/MasterRoles/DialogMenuRoles.js
@@ -3,11 +3,8 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'rea
import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import 'antd/dist/antd.css';
import axios from 'axios';
-import { MENU_SEARCH } from '../../../const/ApiConst.js';
-
+import { MENU_COMPANY_SEARCH } from '../../../const/ApiConst.js';
const token = window.localStorage.getItem('token');
-
-
const config = {
headers:
{
@@ -15,7 +12,6 @@ const config = {
"Content-type": `application/json`
}
};
-
export default class DialogMenuRoles extends Component {
constructor(props) {
super(props)
@@ -36,13 +32,13 @@ export default class DialogMenuRoles extends Component {
stateUpdateAll: false,
stateDeleteAll: false,
allChecked: true,
+ company_id: props.company_id || null,
}
}
async componentDidMount() {
this.props.showDialog(this.showDialog);
this.getAllMenu();
}
-
async componentDidUpdate() {
if (this.state.isParentClick === true) {
const { idRoles } = this.props
@@ -54,43 +50,32 @@ export default class DialogMenuRoles extends Component {
this.setState({ isParentClick: false, id: idRoles });
}
}
-
-
showDialog = () => {
this.setState({ isParentClick: true });
}
-
getAllMenu = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
- { "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
+ { "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }
],
"joins": [
- { "name": "t_roles_menu", "column_join": "id", "column_results": ["create", "update", "delete", "read"] }
+ { "name": "t_roles_menu", "column_join": "menu_id", "column_results": ["create", "update", "delete", "read"] },
+ { "name": "m_menu", "column_join": "menu_id", "column_results": ["name"] }
],
"orders": { "columns": ["id"], "ascending": false }
}
-
-
-
const result = await axios
- .post(MENU_SEARCH, payload, config)
+ .post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
-
- // console.log('78', result);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data }, () => {
this.setStateMenu(false);
});
} else {
}
-
}
-
-
-
setStateMenu = edit => {
const stateMenu = [];
this.state.menu.map((val) => {
@@ -104,7 +89,6 @@ export default class DialogMenuRoles extends Component {
})
})
}
-
setStateRead = edit => {
const stateRead = [];
this.state.menu.map((val) => {
@@ -118,7 +102,6 @@ export default class DialogMenuRoles extends Component {
})
})
}
-
setStateCreate = edit => {
const stateCreate = [];
this.state.menu.map((val) => {
@@ -132,7 +115,6 @@ export default class DialogMenuRoles extends Component {
})
})
}
-
setStateUpdate = edit => {
const stateUpdate = [];
this.state.menu.map((val) => {
@@ -146,7 +128,6 @@ export default class DialogMenuRoles extends Component {
})
})
}
-
setStateDelete = edit => {
const stateDelete = [];
this.state.menu.map((val) => {
@@ -160,13 +141,10 @@ export default class DialogMenuRoles extends Component {
})
})
}
-
checkMenuRoles = () => {
let copyStateMenu = [...this.state.stateMenu];
-
this.props.menuRoles.map((val, indexMenu) => {
let index = this.getIndexDataMenu(val.menu_id);
-
if (index >= 0 || val.read === true || val.create === true || val.update === true || val.delete === true) {
copyStateMenu[index] = true;
}
@@ -180,7 +158,6 @@ export default class DialogMenuRoles extends Component {
}
})
}
-
checkReadRoles = () => {
let copyStateRead = [...this.state.stateRead];
this.props.menuRoles.map((val) => {
@@ -191,7 +168,6 @@ export default class DialogMenuRoles extends Component {
copyStateRead[index] = false;
}
})
-
this.setState({ stateRead: [] }, () => {
let check = copyStateRead.some(this.checkArray);
if (check === false) {
@@ -201,10 +177,8 @@ export default class DialogMenuRoles extends Component {
}
})
}
-
checkCreateRoles = () => {
let copyStateCreate = [...this.state.stateCreate];
-
this.props.menuRoles.map((val) => {
let index = this.getIndexDataMenu(val.menu_id);
if (val.create === true) {
@@ -213,7 +187,6 @@ export default class DialogMenuRoles extends Component {
copyStateCreate[index] = false;
}
})
-
this.setState({ stateCreate: [] }, () => {
let check = copyStateCreate.some(this.checkArray);
if (check === false) {
@@ -223,10 +196,8 @@ export default class DialogMenuRoles extends Component {
}
})
}
-
checkUpdateRoles = () => {
let copyStateUpdate = [...this.state.stateUpdate];
-
this.props.menuRoles.map((val) => {
let index = this.getIndexDataMenu(val.menu_id);
if (val.update === true) {
@@ -235,7 +206,6 @@ export default class DialogMenuRoles extends Component {
copyStateUpdate[index] = false;
}
})
-
this.setState({ stateUpdate: [] }, () => {
let check = copyStateUpdate.some(this.checkArray);
if (check === false) {
@@ -245,10 +215,8 @@ export default class DialogMenuRoles extends Component {
}
})
}
-
checkDeleteRoles = () => {
let copyStateDelete = [...this.state.stateDelete];
-
this.props.menuRoles.map((val) => {
let index = this.getIndexDataMenu(val.menu_id);
if (val.delete === true) {
@@ -257,7 +225,6 @@ export default class DialogMenuRoles extends Component {
copyStateDelete[index] = false;
}
})
-
this.setState({ stateDelete: [] }, () => {
let check = copyStateDelete.some(this.checkArray);
if (check === false) {
@@ -267,32 +234,26 @@ export default class DialogMenuRoles extends Component {
}
})
}
-
getIndexDataMenu = (id) => {
let index = this.state.menu.findIndex(obj => obj.id === id);
return index
}
-
getIndexDataCreate = (id) => {
let index = this.state.stateCreate.findIndex(obj => obj.id === id);
return index
}
-
getIndexDataDelete = (id) => {
let index = this.state.stateDelete.findIndex(obj => obj.id === id);
return index
}
-
getIndexDataRead = (id) => {
let index = this.state.stateRead.findIndex(obj => obj.id === id);
return index
}
-
getIndexDataUpdate = (id) => {
let index = this.state.stateUpdate.findIndex(obj => obj.id === id);
return index
}
-
handleSave = () => {
const {
stateMenu,
@@ -303,9 +264,7 @@ export default class DialogMenuRoles extends Component {
menu,
id
} = this.state
-
const arrayData = [];
-
menu.map((val, index) => {
let data = {
roles_id: id,
@@ -315,35 +274,27 @@ export default class DialogMenuRoles extends Component {
update: stateUpdate[index],
delete: stateDelete[index],
checked: stateMenu[index],
-
}
arrayData.push(data);
-
-
})
- console.log('arrayData', arrayData);
- // this.props.closeDialog('save', arrayData);
+ this.props.closeDialog('save', arrayData);
this.setState({ id: 0 });
}
-
handleCancel = () => {
this.props.closeDialog('cancel', 'none')
}
-
handleChangeCheckbox = (checked, index) => {
let copyStateMenu = [...this.state.stateMenu];
copyStateMenu[index] = checked;
-
this.setState({ stateMenu: copyStateMenu })
}
-
handleChangeCheckboxRead = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateRead = [...this.state.stateRead];
copyStateRead[index] = checked;
let menu = this.state.menu;
let checkMenuParent = menu.map((state, index) => {
- if (state.parent_id === menuItem.id) {
- return state.id
+ if (state.parent_menu_id === menuItem.menu_id) {
+ return state.menu_id
} else {
return null
}
@@ -359,17 +310,15 @@ export default class DialogMenuRoles extends Component {
stateReadIdx.map((stateRead) => {
copyStateRead[stateRead] = checked
})
-
this.setState({ stateRead: copyStateRead })
}
-
handleChangeCheckboxCreate = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateCreate = [...this.state.stateCreate];
copyStateCreate[index] = checked;
let menu = this.state.menu;
let checkMenuParent = menu.map((state, index) => {
- if (state.parent_id === menuItem.id) {
- return state.id
+ if (state.parent_menu_id === menuItem.menu_id) {
+ return state.menu_id
} else {
return null
}
@@ -387,14 +336,13 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateCreate: copyStateCreate })
}
-
handleChangeCheckboxEdit = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateEdit = [...this.state.stateUpdate];
copyStateEdit[index] = checked;
let menu = this.state.menu;
let checkMenuParent = menu.map((state, index) => {
- if (state.parent_id === menuItem.id) {
- return state.id
+ if (state.parent_menu_id === menuItem.menu_id) {
+ return state.menu_id
} else {
return null
}
@@ -412,14 +360,13 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateUpdate: copyStateEdit })
}
-
handleChangeCheckboxDelete = (checked, index, menuItem = null, menuIdxList = []) => {
let copyStateDelete = [...this.state.stateDelete];
copyStateDelete[index] = checked;
let menu = this.state.menu;
let checkMenuParent = menu.map((state, index) => {
- if (state.parent_id === menuItem.id) {
- return state.id
+ if (state.parent_menu_id === menuItem.menu_id) {
+ return state.menu_id
} else {
return null
}
@@ -437,7 +384,6 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateDelete: copyStateDelete })
}
-
handleChangeCheckboxReadAll = (checked) => {
let copyStateRead = [...this.state.stateRead];
copyStateRead.map((val, index) => {
@@ -445,7 +391,6 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateRead: copyStateRead })
}
-
handleChangeCheckboxCreateAll = (checked, index) => {
let copyStateCreate = [...this.state.stateCreate];
copyStateCreate.map((val, index) => {
@@ -453,7 +398,6 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateCreate: copyStateCreate })
}
-
handleChangeCheckboxEditAll = (checked, index) => {
let copyStateEdit = [...this.state.stateUpdate];
copyStateEdit.map((val, index) => {
@@ -461,7 +405,6 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateUpdate: copyStateEdit })
}
-
handleChangeCheckboxDeleteAll = (checked, index) => {
let copyStateDelete = [...this.state.stateDelete];
copyStateDelete.map((val, index) => {
@@ -469,74 +412,44 @@ export default class DialogMenuRoles extends Component {
})
this.setState({ stateDelete: copyStateDelete })
}
-
- // renderForm = () => {
- // const { menu, stateRead, stateCreate, stateUpdate, stateDelete } = this.state
- // console.log('menu', menu);
- // return (
- // menu.map((val, index) => {
-
- // return (
- //
- // {val.name} |
- // this.handleChangeCheckboxRead(e.target.checked, index)} defaultChecked={stateRead[index]} /> |
- // this.handleChangeCheckboxCreate(e.target.checked, index)} defaultChecked={stateCreate[index]} /> |
- // this.handleChangeCheckboxEdit(e.target.checked, index)} defaultChecked={stateUpdate[index]} /> |
- // this.handleChangeCheckboxDelete(e.target.checked, index)} defaultChecked={stateDelete[index]} /> |
- //
- // )
- // })
- // )
-
- // }
-
renderForm = () => {
const { menu, stateRead, stateCreate, stateUpdate, stateDelete } = this.state;
let menuIdxList = []
let menuIdx = 0
const getChildren = (parentId) => {
- return menu.filter(item => item.parent_id === parentId);
+ return menu.filter(item => item.parent_menu_id === parentId);
};
-
- // Function to render menu items
const renderMenu = (parentId, depth = 0) => {
const children = getChildren(parentId);
-
return children.map((menuItem, index) => {
- const currentIndex = menuIdx; // Capture current index
- menuIdxList[currentIndex] = menuItem.id;
+ const currentIndex = menuIdx;
+ menuIdxList[currentIndex] = menuItem.menu_id;
menuIdx++
- const paddingLeft = depth * 20;
- const fontWeight = menuItem.parent_id === null ? 'bold' : 'normal';
-
+ const paddingLeft = depth * 30;
return (
-
+
- {menuItem.name} |
+ {menuItem.join_second_name} |
this.handleChangeCheckboxRead(e.target.checked, currentIndex, menuItem, menuIdxList)} defaultChecked={stateRead[currentIndex]} /> |
this.handleChangeCheckboxCreate(e.target.checked, currentIndex, menuItem, menuIdxList)} defaultChecked={stateCreate[currentIndex]} /> |
this.handleChangeCheckboxEdit(e.target.checked, currentIndex, menuItem, menuIdxList)} defaultChecked={stateUpdate[currentIndex]} /> |
this.handleChangeCheckboxDelete(e.target.checked, currentIndex, menuItem, menuIdxList)} defaultChecked={stateDelete[currentIndex]} /> |
- {renderMenu(menuItem.id, depth + 1)} {/* Recursively render children */}
+ {renderMenu(menuItem.menu_id, depth + 1)}
);
});
};
menuIdxList = []
menuIdx = 0
- // Render top-level menu items (parents)
return (
- {this.renderAll()} {/* Render the "All" row */}
- {renderMenu(null)} {/* Render the menu items */}
+ {this.renderAll()}
+ {renderMenu(null)}
);
};
-
-
renderAll = () => {
-
return (
All |
@@ -547,45 +460,32 @@ export default class DialogMenuRoles extends Component {
)
}
-
-
-
-
checkArray = (val) => {
return val === false;
}
-
handleAllChecked = (checked) => {
this.setState({ allChecked: !this.state.allChecked });
if (checked === true) {
-
let check = this.state.stateMenu.some(this.checkArray);
-
if (check) {
const stateMenu = [];
this.state.menu.map((val) => {
stateMenu.push(true);
})
-
this.setState({ stateMenu: [] }, () => {
this.setState({ stateMenu: stateMenu });
})
}
-
-
} else {
-
const stateMenu = [];
this.state.menu.map((val) => {
stateMenu.push(false);
})
-
this.setState({ stateMenu: [] }, () => {
this.setState({ stateMenu: stateMenu });
})
}
}
-
render() {
return (
@@ -603,12 +503,11 @@ export default class DialogMenuRoles extends Component {
Create
- Edite
+ Edit
|
Delete
|
-
@@ -624,4 +523,4 @@ export default class DialogMenuRoles extends Component {
)
}
-}
+}
\ No newline at end of file
diff --git a/src/views/Master/MasterRoles/index.js b/src/views/Master/MasterRoles/index.js
index 7b45a97..3ff0663 100644
--- a/src/views/Master/MasterRoles/index.js
+++ b/src/views/Master/MasterRoles/index.js
@@ -331,10 +331,15 @@ class index extends Component {
let promises = []
let result = []
dataArray.map((val, index) => {
- if (val.checked === true) {
+ if (val.read === true) {
const formData = {
menu_id: val.menu_id,
- role_id: val.roles_id
+ role_id: val.roles_id,
+ create: val.create,
+ read: val.read,
+ update: val.update,
+ delete: val.delete
+
}
promises.push(axios.post(ROLEMENU_ADD, formData, this.state.config)
.then(res => result.push(res)))
diff --git a/src/views/Pages/Login/Login.js b/src/views/Pages/Login/Login.js
index aab6055..a8bac3b 100644
--- a/src/views/Pages/Login/Login.js
+++ b/src/views/Pages/Login/Login.js
@@ -35,7 +35,7 @@ const settings = {
arrows: false,
autoplay: true,
slidesToShow: 1,
- slidesToScroll: 1
+ slidesToScroll: 1,
};
class Login extends Component {
@@ -320,22 +320,22 @@ class Login extends Component {
}
getLoginLogo = () => {
- return
+ return
}
getLoginSlider = () => {
return
-
+
-
+
-
+
-
+
}
@@ -362,16 +362,20 @@ class Login extends Component {
{this.getLoginSlider()}
-
+
-
-
+
+
diff --git a/src/views/SimproV2/CreatedProyek/DialogDocument.js b/src/views/SimproV2/CreatedProyek/DialogDocument.js
index 69830d0..8dded7e 100644
--- a/src/views/SimproV2/CreatedProyek/DialogDocument.js
+++ b/src/views/SimproV2/CreatedProyek/DialogDocument.js
@@ -12,6 +12,7 @@ import DialogRequest from './FormDocument';
import DialogRequestFolder from './FormFolderDocument';
const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => {
const token = localStorage.getItem("token")
+ const role = window.localStorage.getItem('role_name');
const HEADER = {
headers: {
"Content-Type": "application/json",
@@ -99,8 +100,11 @@ const DialogDocument = ({ openDialog, closeDialog, toggleDialog, idTask, proyekN
}
const handleShow = (file) => {
- const configApp = JSON.parse(window.localStorage.getItem('configApp'));
- const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, configApp.company_name)}`
+ let configApp = '';
+ if (role !== 'Super Admin') {
+ configApp = JSON.parse(window.localStorage.getItem('configApp'));
+ }
+ const urlShow = `${BASE_SIMPRO_LUMEN_FILE_COMPANY(file, configApp != '' ? configApp.company_name : 'undifined')}`
window.open(urlShow);
}
diff --git a/src/views/SimproV2/CreatedProyek/FormDocument.js b/src/views/SimproV2/CreatedProyek/FormDocument.js
index 71edd49..f333717 100644
--- a/src/views/SimproV2/CreatedProyek/FormDocument.js
+++ b/src/views/SimproV2/CreatedProyek/FormDocument.js
@@ -7,7 +7,8 @@ import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications';
const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentIdNewFolder }) => {
- const token = localStorage.getItem("token")
+ const token = localStorage.getItem("token");
+ const role = window.localStorage.getItem('role_name');
const HEADER = {
headers: {
"Content-Type": "application/json",
@@ -33,12 +34,13 @@ const DialogRequest = ({ openDialog, closeDialog, toggleDialog, idTask, parentId
}
const uploadDokumen = async () => {
- const configApp = JSON.parse(window.localStorage.getItem('configApp'));
-
+ let configApp = '';
const formData = new FormData;
+ if (role !== 'Super Admin') {
+ configApp = JSON.parse(window.localStorage.getItem('configApp'));
+ formData.append('company_name',configApp.company_name);
+ }
formData.append('dokumen', file, file.name);
- formData.append('company_name',configApp.company_name);
-
if (parentIdNewFolder > 0) {
formData.append('ref_id', parentIdNewFolder); // folder_id
formData.append('type_dokumen', 'project-document-in-folder');
diff --git a/src/views/SimproV2/Demo/DialogForm.js b/src/views/SimproV2/DemoRequest/DialogForm.js
similarity index 100%
rename from src/views/SimproV2/Demo/DialogForm.js
rename to src/views/SimproV2/DemoRequest/DialogForm.js
diff --git a/src/views/SimproV2/Demo/index.js b/src/views/SimproV2/DemoRequest/index.js
similarity index 99%
rename from src/views/SimproV2/Demo/index.js
rename to src/views/SimproV2/DemoRequest/index.js
index a3fc1fa..6ad5b0a 100644
--- a/src/views/SimproV2/Demo/index.js
+++ b/src/views/SimproV2/DemoRequest/index.js
@@ -202,7 +202,7 @@ const ProjectType = ({ params, ...props }) => {
if (type === "save") {
saveDemo(data);
} else if (type === "edit") {
- editMaterialR(data);
+ editDemo(data);
}
setDataEdit([])
setOpenDialog(false)
@@ -221,7 +221,7 @@ const ProjectType = ({ params, ...props }) => {
}
}
- const editMaterialR = async (data) => {
+ const editDemo = async (data) => {
let urlEdit = DEMO_MANAGEMENT_EDIT(data.id)
const formData = data
const result = await axios.put(urlEdit, formData, HEADER)
diff --git a/src/views/SimproV2/ReferralCode/DialogForm.js b/src/views/SimproV2/ReferralCode/DialogForm.js
new file mode 100644
index 0000000..6e5a46c
--- /dev/null
+++ b/src/views/SimproV2/ReferralCode/DialogForm.js
@@ -0,0 +1,190 @@
+import React, { useEffect, useState } from 'react'
+import {
+ Modal, ModalHeader, ModalBody, ModalFooter,
+ Button, Form, FormGroup, Label, Input, Col, Row
+} from 'reactstrap';
+import { Select, DatePicker } from 'antd';
+import 'antd/dist/antd.css';
+import { useTranslation } from 'react-i18next';
+import "rc-color-picker/assets/index.css";
+import moment from 'moment';
+import { formatNumber } from "../../../const/CustomFunc";
+const { Option } = Select
+const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
+ const [id, setId] = useState(0)
+ const [code, setCode] = useState('')
+ const [amount, setAmount] = useState(0)
+ const [description, setDescription] = useState('')
+ const [exp, setExp] = useState('')
+ const [type, setType] = useState('')
+ const [allocation, setAllocation] = useState(0)
+ const { t } = useTranslation()
+
+ useEffect(() => {
+ console.log('dataEdit', dataEdit);
+ if (typeDialog === "Edit") {
+ setId(dataEdit.id)
+ setCode(dataEdit.code)
+ setAmount(dataEdit.amount)
+ setDescription(dataEdit.description)
+ setExp(dataEdit.exp)
+ setType(dataEdit.type)
+ } else {
+ handleClear()
+ }
+ }, [dataEdit, openDialog])
+
+ const validation = () => {
+ if (!code || code === "") {
+ alert("Code cannot be empty!");
+ return true;
+ }
+ }
+ const handleSave = () => {
+ let data = '';
+ const err = validation();
+
+ if (!err) {
+ if (typeDialog === "Save") {
+ data = {
+ code,
+ amount,
+ description,
+ exp,
+ type,
+ allocation
+ }
+ console.log('data', data);
+ closeDialog('save', data);
+ } else {
+ data = {
+ id,
+ code,
+ amount,
+ description,
+ exp,
+ type,
+ allocation
+ }
+ console.log('data', data);
+ closeDialog('edit', data);
+ }
+ handleClear()
+
+ }
+ }
+ const handleCancel = () => {
+ closeDialog('cancel', 'none')
+ handleClear()
+ }
+ const handleClear = () => {
+ setId(0)
+ setCode('')
+ setAmount('')
+ setDescription('')
+ setExp('')
+ }
+
+
+ const renderForm = () => {
+ return (
+
+ )
+ }
+
+
+ return (
+ <>
+
+ {typeDialog == "Save" ? `Add` : "Edit"} {t('Demo')}
+
+ {renderForm()}
+
+
+ {' '}
+
+
+
+ >
+ )
+
+}
+
+export default DialogForm;
diff --git a/src/views/SimproV2/ReferralCode/index.js b/src/views/SimproV2/ReferralCode/index.js
new file mode 100644
index 0000000..d340325
--- /dev/null
+++ b/src/views/SimproV2/ReferralCode/index.js
@@ -0,0 +1,372 @@
+import * as XLSX from 'xlsx';
+import DialogForm from './DialogForm';
+import React, { useState, useEffect } from 'react';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import axios from "../../../const/interceptorApi"
+import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
+import { REFERRAL_CODE_EDIT, REFERRAL_CODE_SEARCH, REFERRAL_CODE_ADD, REFERRAL_CODE_DELETE } from '../../../const/ApiConst';
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import { Spin, Button, Tooltip } from 'antd';
+import { useTranslation } from 'react-i18next';
+import moment from 'moment';
+import toRupiah from '@develoka/angka-rupiah-js';
+
+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 = '';
+ 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;
+ hierarchy = props.hierarchy;
+ user_name = props.user_name;
+ }
+
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const pageName = params.name;
+
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [allDataMenu, setAllDataMenu] = useState([])
+ const [clickOpenModal, setClickOpenModal] = useState(false)
+ const [currentPage, setCurrentPage] = useState(1)
+ const [dataEdit, setDataEdit] = useState([])
+ const [dataExport, setDataExport] = useState([])
+ const [dataTable, setDatatable] = useState([])
+ const [idDelete, setIdDelete] = useState(0)
+ const [openDialog, setOpenDialog] = useState(false)
+ const [rowsPerPage, setRowsPerPage] = useState(10)
+ const [search, setSearch] = useState("")
+ const [totalPage, setTotalPage] = useState(0)
+ const [typeDialog, setTypeDialog] = useState('Save')
+ const [dataDemo, setDataDemo] = useState([])
+ const [listCompany, setListCompany] = useState([])
+ const [loading, setLoading] = useState(true);
+ const { t } = useTranslation()
+ const column = [
+ { name: t('code') },
+ { name: t('type') },
+ { name: t('amount') },
+ { name: t('exp') },
+ { name: t('allocation') },
+ { name: t('description') },
+ ].filter(column => column && column.name);
+ useEffect(() => {
+ getReferralCode();
+ }, [currentPage, rowsPerPage, search])
+
+ useEffect(() => {
+ const cekData = dataExport || []
+ if (cekData.length > 0) {
+ exportExcel()
+ }
+ }, [dataExport])
+
+ const getReferralCode = async () => {
+ let start = 0;
+ if (currentPage !== 1 && currentPage > 1) {
+ start = currentPage * rowsPerPage - rowsPerPage;
+ }
+ const payload = {
+ group_column: {
+ "operator": "AND",
+ "group_operator": "OR",
+ "where": [
+ {
+ "name": "name",
+ "logic_operator": "~*",
+ "value": search,
+ }
+ ]
+ },
+ columns: [],
+ "orders": {
+ "ascending": true,
+ "columns": [
+ 'id'
+ ]
+ },
+ "paging": {
+ "length": rowsPerPage,
+ "start": start
+ },
+ 'joins': []
+ }
+
+ const result = await axios
+ .post(REFERRAL_CODE_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ setDatatable(result.data.data);
+ setTotalPage(result.data.totalRecord);
+ setLoading(false)
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ setLoading(false)
+ }
+ }
+ const handleExportExcel = async () => {
+ let start = 0;
+
+ if (currentPage !== 1 && currentPage > 1) {
+ start = (currentPage * rowsPerPage) - rowsPerPage
+ }
+
+ const payload = {
+ group_column: {
+ "operator": "AND",
+ "group_operator": "OR",
+ "where": [
+ {
+ "name": "name",
+ "logic_operator": "~*",
+ "value": search,
+ }
+ ]
+ },
+ "columns": [],
+ "orders": {
+ "ascending": true,
+ "columns": [
+ 'id'
+ ]
+ },
+ "paging": {
+ "length": rowsPerPage,
+ "start": start
+ },
+ 'joins': []
+ }
+
+ const result = await axios
+ .post(REFERRAL_CODE_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((val, index) => {
+ let dataRow = {};
+ dataRow["Kode"] = val.code;
+ dataRow["Jumlah"] = val.amount;
+ dataRow["Kuota"] = val.allocation;
+ dataRow["Kadaluarsa"] = val.exp;
+ dataRow["Deskripsi"] = val.deskription;
+ excelData.push(dataRow)
+ })
+ await setDataExport(excelData)
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ const exportExcel = () => {
+ const dataExcel = dataExport || [];
+ const fileName = `Data ${pageName}.xlsx`;
+ const ws = XLSX.utils.json_to_sheet(dataExcel);
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
+ XLSX.writeFile(wb, fileName);
+ setDataExport([])
+ }
+
+ const handleSearch = e => {
+ const value = e.target.value
+ setSearch(value);
+ setCurrentPage(1)
+ };
+
+ const handleOpenDialog = (type) => {
+ setOpenDialog(true)
+ setTypeDialog(type)
+ }
+
+ const handleEdit = (data) => {
+ setDataEdit(data)
+ handleOpenDialog('Edit');
+ }
+
+ const handleDelete = async (id) => {
+ await setAlertDelete(true)
+ await setIdDelete(id)
+ }
+
+ const handleCloseDialog = (type, data) => {
+ if (type === "save") {
+ saveReferralCode(data);
+ } else if (type === "edit") {
+ editReferralCode(data);
+ }
+ setDataEdit([])
+ setOpenDialog(false)
+ }
+
+ const saveReferralCode = async (data) => {
+ const formData = data
+ const result = await axios.post(REFERRAL_CODE_ADD, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code === 200) {
+ getReferralCode()
+ NotificationManager.success(`Data berhasil ditambahkan`, 'Success!!');
+ } else {
+ NotificationManager.error(`Data gagal ditambahkan`, 'Failed!!');
+ }
+ }
+
+ const editReferralCode = async (data) => {
+ let urlEdit = REFERRAL_CODE_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) {
+ getReferralCode();
+ NotificationManager.success(`Data berhasil diubah`, 'Success!!');
+ } else {
+ NotificationManager.error(`Data gagal diubah`, `Failed!!`);
+ }
+ }
+
+ const toggleAddDialog = () => {
+ setOpenDialog(!openDialog)
+ }
+
+ const onConfirmDelete = async () => {
+ let url = REFERRAL_CODE_DELETE(idDelete);
+ const result = await axios.delete(url, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getReferralCode()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data berhasil dihapus!`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data gagal dihapus!}`, 'Failed!!');
+ }
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onShowSizeChange = (current, pageSize) => {
+ setRowsPerPage(pageSize)
+ }
+
+ const onPagination = (current, pageSize) => {
+ setCurrentPage(current)
+ }
+
+ const dataNotAvailable = () => {
+ if (dataTable.length === 0) {
+ return (
+
+ {t('noData')} |
+
+ )
+ }
+ }
+
+ return (
+
+
+
+ {t('deleteMsg')}
+
+
toggleAddDialog}
+ typeDialog={typeDialog}
+ dataEdit={dataEdit}
+ clickOpenModal={clickOpenModal}
+ dataParent={allDataMenu}
+ />
+
+
+ {pageName}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Aksi |
+ {column.map((i, index) => {
+ return (
+ {i.name} |
+ )
+ })}
+
+
+
+ {dataNotAvailable()}
+ {dataTable.map((n, index) => {
+ return (
+
+
+
+ handleDelete(n.id)}>
+
+
+ handleEdit(n)}>
+
+ |
+ {n.code} |
+ {n.type} |
+ {toRupiah(n.amount)} |
+ {n?.exp ? moment(n.exp).format('DD-MM-YYYY HH:mm') : "-"} |
+ {n.allocation ? n.allocation : "-"} |
+ {n.description ? n.description : "-"} |
+
+ )
+ })}
+
+
+
+
+
+
+ )
+}
+
+export default ProjectType;
diff --git a/src/views/SimproV2/SalesContact/DialogForm.js b/src/views/SimproV2/SalesContact/DialogForm.js
new file mode 100644
index 0000000..da508d4
--- /dev/null
+++ b/src/views/SimproV2/SalesContact/DialogForm.js
@@ -0,0 +1,201 @@
+import React, { useEffect, useState } from 'react'
+import {
+ Modal, ModalHeader, ModalBody, ModalFooter,
+ Button, Form, FormGroup, Label, Input, Col, Row
+} from 'reactstrap';
+import { Select } from 'antd';
+import 'antd/dist/antd.css';
+import { useTranslation } from 'react-i18next';
+import "rc-color-picker/assets/index.css";
+const { Option } = Select
+const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
+ const [id, setId] = useState(0)
+ const [name, setName] = useState('')
+ const [email, setEmail] = useState('')
+ const [message, setMessage] = useState('')
+ const [phoneNumber, setPhoneNumber] = useState('')
+ const [role, setRole] = useState(null)
+ const [status, setStatus] = useState('')
+ const { t } = useTranslation()
+
+ useEffect(() => {
+ if (typeDialog === "Edit") {
+ setId(dataEdit.id)
+ setName(dataEdit.name)
+ setEmail(dataEdit.email)
+ setMessage(dataEdit.message)
+ setPhoneNumber(dataEdit.number_phone)
+ setStatus(dataEdit.status)
+ setRole(dataEdit.role)
+ } else {
+ setId(0)
+ setName('')
+ setEmail('')
+ setMessage('')
+ setStatus('')
+ setRole('')
+ setPhoneNumber('')
+ }
+ }, [dataEdit, openDialog])
+
+ const validation = () => {
+ if (!name || name === "") {
+ alert("Name cannot be empty!");
+ return true;
+ }
+ }
+ const handleSave = () => {
+ let data = '';
+ const err = validation();
+
+ if (!err) {
+ if (typeDialog === "Save") {
+ data = {
+ name,
+ email,
+ message,
+ number_phone: phoneNumber,
+ role,
+ status
+ }
+ closeDialog('save', data);
+ } else {
+ data = {
+ id,
+ name,
+ email,
+ message,
+ number_phone: phoneNumber,
+ role,
+ status
+ }
+ closeDialog('edit', data);
+ }
+ setId(0)
+ setName('')
+ }
+ }
+ const handleCancel = () => {
+ closeDialog('cancel', 'none')
+ setId(0)
+ setName('')
+ }
+ const onChangeStatus = (val) => {
+ setStatus(val)
+ }
+
+
+ const renderForm = () => {
+ return (
+
+ )
+ }
+
+
+ return (
+ <>
+
+ {typeDialog == "Save" ? `Add` : "Edit"} {t('Demo')}
+
+ {renderForm()}
+
+
+ {' '}
+
+
+
+ >
+ )
+
+}
+
+export default DialogForm;
diff --git a/src/views/SimproV2/SalesContact/index.js b/src/views/SimproV2/SalesContact/index.js
new file mode 100644
index 0000000..a1a3754
--- /dev/null
+++ b/src/views/SimproV2/SalesContact/index.js
@@ -0,0 +1,374 @@
+import * as XLSX from 'xlsx';
+import DialogForm from './DialogForm';
+import React, { useState, useEffect } from 'react';
+import SweetAlert from 'react-bootstrap-sweetalert';
+import axios from "../../../const/interceptorApi"
+import { Card, CardBody, CardHeader, Col, Row, Input, Table } from 'reactstrap';
+import { SALES_CONTACT_EDIT, SALES_CONTACT_SEARCH, SALES_CONTACT_LIST, SALES_CONTACT_GET_ID, SALES_CONTACT_ADD, SALES_CONTACT_DELETE } from '../../../const/ApiConst';
+import { NotificationContainer, NotificationManager } from 'react-notifications';
+import { Spin, Button, Tooltip } from 'antd';
+import { useTranslation } from 'react-i18next';
+
+
+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 = '';
+ 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;
+ hierarchy = props.hierarchy;
+ user_name = props.user_name;
+ }
+
+ const HEADER = {
+ headers: {
+ "Content-Type": "application/json",
+ "Authorization": `Bearer ${token}`
+ }
+ }
+ const pageName = params.name;
+
+ const [alertDelete, setAlertDelete] = useState(false)
+ const [allDataMenu, setAllDataMenu] = useState([])
+ const [clickOpenModal, setClickOpenModal] = useState(false)
+ const [currentPage, setCurrentPage] = useState(1)
+ const [dataEdit, setDataEdit] = useState([])
+ const [dataExport, setDataExport] = useState([])
+ const [dataTable, setDatatable] = useState([])
+ const [idDelete, setIdDelete] = useState(0)
+ const [openDialog, setOpenDialog] = useState(false)
+ const [rowsPerPage, setRowsPerPage] = useState(10)
+ const [search, setSearch] = useState("")
+ const [totalPage, setTotalPage] = useState(0)
+ const [typeDialog, setTypeDialog] = useState('Save')
+ const [dataDemo, setDataDemo] = useState([])
+ const [listCompany, setListCompany] = useState([])
+ const [loading, setLoading] = useState(true);
+ const { t } = useTranslation()
+ const column = [
+ { name: t('name') },
+ { name: t('company') },
+ { name: t('email') },
+ { name: t('roles') },
+ { name: t('phoneNumber') },
+ { name: t('status') },
+ { name: t('description') },
+ ].filter(column => column && column.name);
+ useEffect(() => {
+ getDataContactSales();
+ }, [currentPage, rowsPerPage, search])
+
+ useEffect(() => {
+ const cekData = dataExport || []
+ if (cekData.length > 0) {
+ exportExcel()
+ }
+ }, [dataExport])
+
+ const getDataContactSales = async () => {
+ let start = 0;
+ if (currentPage !== 1 && currentPage > 1) {
+ start = currentPage * rowsPerPage - rowsPerPage;
+ }
+ const payload = {
+ group_column: {
+ "operator": "AND",
+ "group_operator": "OR",
+ "where": [
+ {
+ "name": "name",
+ "logic_operator": "~*",
+ "value": search,
+ }
+ ]
+ },
+ columns: [],
+ "orders": {
+ "ascending": true,
+ "columns": [
+ 'id'
+ ]
+ },
+ "paging": {
+ "length": rowsPerPage,
+ "start": start
+ },
+ 'joins': []
+ }
+
+ const result = await axios
+ .post(SALES_CONTACT_SEARCH, payload, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code == 200) {
+ setDatatable(result.data.data);
+ setTotalPage(result.data.totalRecord);
+ setLoading(false)
+ } else {
+ NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
+ setLoading(false)
+ }
+ }
+ const handleExportExcel = async () => {
+ let start = 0;
+
+ if (currentPage !== 1 && currentPage > 1) {
+ start = (currentPage * rowsPerPage) - rowsPerPage
+ }
+
+ const payload = {
+ group_column: {
+ "operator": "AND",
+ "group_operator": "OR",
+ "where": [
+ {
+ "name": "name",
+ "logic_operator": "~*",
+ "value": search,
+ }
+ ]
+ },
+ "columns": [],
+ "orders": {
+ "ascending": true,
+ "columns": [
+ 'id'
+ ]
+ },
+ "paging": {
+ "length": rowsPerPage,
+ "start": start
+ },
+ 'joins': []
+ }
+
+ const result = await axios
+ .post(SALES_CONTACT_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((val, index) => {
+ let dataRow = {};
+ dataRow["Nama"] = val.name;
+ dataRow["Email"] = val.email;
+ dataRow["Role"] = val.role;
+ dataRow["No Telepon"] = val.number_phone;
+ dataRow["Status"] = val.message;
+ dataRow["Message"] = val.message;
+ excelData.push(dataRow)
+ })
+ await setDataExport(excelData)
+ } else {
+ NotificationManager.error('Gagal Export Data!!', 'Failed');
+ }
+ }
+
+ const exportExcel = () => {
+ const dataExcel = dataExport || [];
+ const fileName = `Data ${pageName}.xlsx`;
+ const ws = XLSX.utils.json_to_sheet(dataExcel);
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
+ XLSX.writeFile(wb, fileName);
+ setDataExport([])
+ }
+
+ const handleSearch = e => {
+ const value = e.target.value
+ setSearch(value);
+ setCurrentPage(1)
+ };
+
+ const handleOpenDialog = (type) => {
+ setOpenDialog(true)
+ setTypeDialog(type)
+ }
+
+ const handleEdit = (data) => {
+ setDataEdit(data)
+ handleOpenDialog('Edit');
+ }
+
+ const handleDelete = async (id) => {
+ await setAlertDelete(true)
+ await setIdDelete(id)
+ }
+
+ const handleCloseDialog = (type, data) => {
+ if (type === "save") {
+ saveContactSales(data);
+ } else if (type === "edit") {
+ editContactSales(data);
+ }
+ setDataEdit([])
+ setOpenDialog(false)
+ }
+
+ const saveContactSales = async (data) => {
+ const formData = data
+ const result = await axios.post(SALES_CONTACT_ADD, formData, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+ if (result && result.data && result.data.code === 200) {
+ getDataContactSales()
+ NotificationManager.success(`Data berhasil ditambahkan`, 'Success!!');
+ } else {
+ NotificationManager.error(`Data gagal ditambahkan`, 'Failed!!');
+ }
+ }
+
+ const editContactSales = async (data) => {
+ let urlEdit = SALES_CONTACT_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) {
+ getDataContactSales();
+ NotificationManager.success(`Data berhasil diubah`, 'Success!!');
+ } else {
+ NotificationManager.error(`Data gagal diubah`, `Failed!!`);
+ }
+ }
+
+ const toggleAddDialog = () => {
+ setOpenDialog(!openDialog)
+ }
+
+ const onConfirmDelete = async () => {
+ let url = SALES_CONTACT_DELETE(idDelete);
+ const result = await axios.delete(url, HEADER)
+ .then(res => res)
+ .catch((error) => error.response);
+
+ if (result && result.data && result.data.code === 200) {
+ getDataContactSales()
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.success(`Data berhasil dihapus!`, 'Success!!');
+ } else {
+ setIdDelete(0)
+ setAlertDelete(false)
+ NotificationManager.error(`Data gagal dihapus!}`, 'Failed!!');
+ }
+ }
+
+ const cancelDelete = () => {
+ setAlertDelete(false)
+ setIdDelete(0)
+ }
+
+ const onShowSizeChange = (current, pageSize) => {
+ setRowsPerPage(pageSize)
+ }
+
+ const onPagination = (current, pageSize) => {
+ setCurrentPage(current)
+ }
+
+ const dataNotAvailable = () => {
+ if (dataTable.length === 0) {
+ return (
+
+ {t('noData')} |
+
+ )
+ }
+ }
+
+ return (
+
+
+
+ {t('deleteMsg')}
+
+
toggleAddDialog}
+ typeDialog={typeDialog}
+ dataEdit={dataEdit}
+ clickOpenModal={clickOpenModal}
+ dataParent={allDataMenu}
+ />
+
+
+ {pageName}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Aksi |
+ {column.map((i, index) => {
+ return (
+ {i.name} |
+ )
+ })}
+
+
+
+ {dataNotAvailable()}
+ {dataTable.map((n, index) => {
+ return (
+
+
+
+ handleDelete(n.id)}>
+
+
+ handleEdit(n)}>
+
+ |
+ {n.name} |
+ {n.company_name} |
+ {n.email} |
+ {n.role} |
+ {n.number_phone} |
+ {n.status} |
+ {n.message} |
+
+ )
+ })}
+
+
+
+
+
+
+ )
+}
+
+export default ProjectType;
diff --git a/src/views/SimproV2/Settings/Desktop.js b/src/views/SimproV2/Settings/Desktop.js
new file mode 100644
index 0000000..d3feacb
--- /dev/null
+++ b/src/views/SimproV2/Settings/Desktop.js
@@ -0,0 +1,53 @@
+import Index from "./components/MyProfile/Index";
+import styles from "./Desktop.module.css";
+import Plan from "./components/Plan/Container1";
+import React, { useState, useEffect } from 'react';
+import { Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
+
+const Desktop = () => {
+ const [activeTab, setActiveTab] = useState('tab1')
+ const [typeTab, setTypeTab] = useState('myprofile')
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default Desktop;
diff --git a/src/views/SimproV2/Settings/Desktop.module.css b/src/views/SimproV2/Settings/Desktop.module.css
new file mode 100644
index 0000000..bdb39c7
--- /dev/null
+++ b/src/views/SimproV2/Settings/Desktop.module.css
@@ -0,0 +1,23 @@
+.myProfile,
+.profile {
+ max-width: 100%;
+}
+.profile {
+ align-self: stretch;
+ padding: 15px 30px 30px;
+ box-sizing: border-box;
+ gap: 15px 0;
+
+}
+.myProfile {
+ width: 1300px;
+ border-radius: 30px;
+ background-color: #fff;
+}
+@media screen and (max-width: 1050px) {
+ .profile {
+ padding-top: 20px;
+ padding-bottom: 20px;
+ box-sizing: border-box;
+ }
+}
diff --git a/src/views/SimproV2/Settings/DialogForm.js b/src/views/SimproV2/Settings/DialogForm.js
index 0f36cc1..d968fc7 100644
--- a/src/views/SimproV2/Settings/DialogForm.js
+++ b/src/views/SimproV2/Settings/DialogForm.js
@@ -1,16 +1,15 @@
import React, { useEffect, useState } from 'react'
import {
Modal, ModalHeader, ModalBody, ModalFooter,
- Button, Form, FormGroup, Label, Input, Col, Row,
- Nav, NavItem, NavLink, TabContent, TabPane
+ Button, Form, FormGroup, Label, Input, Col, Row,TabContent, TabPane
} from 'reactstrap';
-
import { Select, DatePicker } from 'antd';
+import moment from "moment";
+import { BASE_SIMPRO_LUMEN_IMAGE_COMPANY } from '../../../const/ApiConst';
+import profile from '../../../assets/img/profile.png'
const { Option } = Select
-
-
const DialogForm = ({
openDialog,
closeDialog,
@@ -27,28 +26,34 @@ const DialogForm = ({
emailProp,
userNameProp,
refferalCode,
- userProfile
+ userProfile,
+ imageProfile
}) => {
- const token = window.localStorage.getItem('token');
- const [typeDialog, setTypeDialog] = useState(typeDialogProp)
const [userName, setUserName] = useState(userNameProp)
const [name, setName] = useState(nameProp)
const [noHp, setNohp] = useState(noHpProp)
const [gender, setGender] = useState(genderProp)
const [address, setAddres] = useState(addressProp)
const [birthdayPlace, setBirthdayplace] = useState(birthdayPlaceProp)
- const [birthdayDate, setBirthdaydate] = useState(birthdayDateProp)
+ const [birthdayDate, setBirthdaydate] = useState(birthdayDateProp && birthdayDateProp != null ? moment(birthdayDateProp) : moment())
const [idNumber, setIdnumber] = useState(idNumberProp)
const [email, setEmail] = useState(emailProp)
const [refferal, setRefferalCode] = useState('')
const [oldPassword, setOldPassword] = useState('')
const [newPassword, setNewPassword] = useState('')
const [newPasswordConfirm, setNewPasswordConfirm] = useState('')
- const [activeTab, setActiveTab] = useState('tab1')
- console.log('typeDialogProp',typeDialogProp)
+ const [profileImage, setImageProfile] = useState(null)
+ const [modalOpen, setModalOpen] = useState(false)
+
+ const role = window.localStorage.getItem('role_name');
+ let configApp = '';
+ if (role !== 'Super Admin') {
+ configApp = JSON.parse(window.localStorage.getItem('configApp'));
+ }
+
const handleSave = () => {
let data = '';
- if (typeDialog === "Personal" && typeDialogProp !== "Refferal") {
+ if (typeDialogProp === "Personal" && typeDialogProp !== "Refferal") {
data = {
name: name,
phone_number: noHp,
@@ -61,11 +66,14 @@ const DialogForm = ({
data.birth_date = birthdayDate;
}
closeDialog('profile', data)
- } else if (typeDialog === "Account" && typeDialogProp !== "Refferal") {
+ } else if (typeDialogProp === "Account" || typeDialogProp === "Settings" && typeDialogProp !== "Refferal") {
data = {
username: userName,
- email: email,
- password: newPassword,
+ email: email
+ }
+ data.profilePicture = profileImage ? profileImage : null;
+ if(typeDialogProp === "Settings" && newPassword && oldPassword && newPasswordConfirm) {
+ data.password = newPassword;
}
closeDialog('profile', data)
} else {
@@ -95,6 +103,10 @@ const DialogForm = ({
)
}
+ const handleDatePickerEnd = (date, dateString) => {
+ setBirthdaydate(date);
+ };
+
function generateRandomString(length) {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
let result = '';
@@ -109,30 +121,38 @@ const DialogForm = ({
setRefferalCode(newReferralCode);
}
+ const toggleModal = () => {
+ setModalOpen(!modalOpen);
+ };
+
+ const handleImageClick = async () => {
+ toggleModal();
+ };
+
const renderForm = () => {
return (