Browse Source

Merge pull request 'upload 2024-05-06' (#82) from staging into master

Reviewed-on: ibnu/generic-ospro-frontend#82
pull/1/head
farhantock 8 months ago
parent
commit
cc23b82d3d
  1. 4
      src/const/CustomFunc.js
  2. 2
      src/routes.js
  3. 24
      src/views/Dashboard/DashboardBOD.js
  4. 143
      src/views/Master/MasterTransaction/DialogForm.js
  5. 264
      src/views/Master/MasterTransaction/index.js
  6. 2
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  7. 6
      src/views/SimproV2/CreatedProyek/AssignK3Project.js
  8. 6
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  9. 5
      src/views/SimproV2/CreatedProyek/DialogFormAnalysis.js
  10. 6
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  11. 57
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js
  12. 27
      src/views/SimproV2/CreatedProyek/index.js
  13. 1
      src/views/SimproV2/Kanban/DialogFormActivity.js
  14. 5
      src/views/SimproV2/Kanban/DialogFormReport.js
  15. 33
      src/views/SimproV2/LimitasiUser/index.js
  16. 48
      src/views/SimproV2/ProjectType/DialogForm.js
  17. 3
      src/views/SimproV2/ReferralCode/DialogForm.js
  18. 2
      src/views/SimproV2/ReferralCode/index.js
  19. 52
      src/views/SimproV2/ResourceWorker/DialogForm.js
  20. 49
      src/views/SimproV2/Settings/components/Plan/Container1.js

4
src/const/CustomFunc.js

@ -196,12 +196,8 @@ export const checkActMenup = (menuPath, actProp) => {
if (foundObj[actValue] === true) {
output = true;
}
// default:
// output = false
}
return output;
// return foundObj[actProp];
};
export const QUERY_BUILDER_FIELD_CUSTOMER =

2
src/routes.js

@ -128,7 +128,7 @@ 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: '/transaction-management', exact: true, name: 'Transaksi Management', component: TransactionManagement },
{ path: '/transaction-management', exact: true, name: 'Transaction Management', component: TransactionManagement },
{ 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 },

24
src/views/Dashboard/DashboardBOD.js

@ -521,7 +521,6 @@ const DashboardBOD = (props) => {
datasets: [
{
label: '',
// data: [COMPANY_CASHFLOW_TOTAL_BUDGET, COMPANY_CASHFLOW_EXPENDITURE, COMPANY_CASHFLOW_INVOICE, COMPANY_CASHFLOW_CASH_IN],
data: [
PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_budget ? PROJECT_EXPENDITURE.total_budget : 0,
PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_expenditure ? PROJECT_EXPENDITURE.total_expenditure : 0,
@ -557,10 +556,6 @@ const DashboardBOD = (props) => {
backgroundColor="#f3f3f3"
foregroundColor="#ecebeb"
>
{/* <rect x="0" y="0" rx="5" ry="5" width="25%" height="18" />
<rect x="0" y="23" rx="5" ry="5" width="75%" height="18" />
<rect x="0" y="47" rx="5" ry="5" width="100%" height="18" />
<rect x="0" y="70" rx="5" ry="5" width="45%" height="18" /> */}
<rect x="7" y="12" rx="5" ry="5" width="414" height="20" />
<rect x="7" y="41" rx="5" ry="5" width="220" height="20" />
<rect x="7" y="69" rx="5" ry="5" width="319" height="20" />
@ -584,7 +579,6 @@ const DashboardBOD = (props) => {
datasets: [
{
label: "",
// data: [2, 4, 10],
data: [
PROJECT_BY_FINANCIAL_HEALTH && PROJECT_BY_FINANCIAL_HEALTH.overrun ? PROJECT_BY_FINANCIAL_HEALTH.overrun : '',
PROJECT_BY_FINANCIAL_HEALTH && PROJECT_BY_FINANCIAL_HEALTH.warning ? PROJECT_BY_FINANCIAL_HEALTH.warning : '',
@ -618,7 +612,6 @@ const DashboardBOD = (props) => {
datasets: [
{
label: "",
// data: [1, 3, 11],
data: [
PROJECT_BY_SCHEDULE_HEALTH && PROJECT_BY_SCHEDULE_HEALTH['behind-schedule'] ? PROJECT_BY_SCHEDULE_HEALTH['behind-schedule'] : '',
PROJECT_BY_SCHEDULE_HEALTH && PROJECT_BY_SCHEDULE_HEALTH.warning ? PROJECT_BY_SCHEDULE_HEALTH.warning : '',
@ -664,7 +657,6 @@ const DashboardBOD = (props) => {
position: 'right',
labels: {
boxWidth: 10,
// padding: 15,
font: {
size: 10
}
@ -674,7 +666,6 @@ const DashboardBOD = (props) => {
datalabels: {
color: '#FFFFFF',
formatter: function (value, context) {
// return value ? value : null
if (value && value > 0) {
return value;
}
@ -684,12 +675,10 @@ const DashboardBOD = (props) => {
}
}}
chartData={PROJECT_PER_DIVISION ? {
// labels: [['Telecommunication', 'Solution Service'], ['Telecommunication', 'Solution Product'], 'Energy Solution', 'Constructions'],
labels: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.name) : [],
datasets: [
{
label: "",
// data: [7, 2, 4, 3],
data: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.total) : [],
borderColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [],
backgroundColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [],
@ -720,7 +709,6 @@ const DashboardBOD = (props) => {
position: 'right',
labels: {
boxWidth: 10,
// padding: 15,
font: {
size: 10
}
@ -730,19 +718,16 @@ const DashboardBOD = (props) => {
datalabels: {
color: '#FFFFFF',
formatter: function (value, context) {
// return value ? toRupiah(value, { useUnit: 'jt' }) : 0
return null;
}
}
}
}}
chartData={PROJECT_VALUE_PER_DIVISION ? {
// labels: [['Telecommunication', 'Solution Service'], ['Telecommunication', 'Solution Product'], 'Energy Solution', 'Constructions'],
labels: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.name) : [],
datasets: [
{
label: "",
// data: [50, 120, 72, 60],
data: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.total).filter(value => value !== 0) : [],
borderColor: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.color) : [],
backgroundColor: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.color) : [],
@ -788,7 +773,6 @@ const DashboardBOD = (props) => {
}
}}
data={{
// labels: ["Initiation", "Planning", "Execution", "Control Monitoring", "Close"],
labels: PROJECT_BY_PHASE ? PROJECT_BY_PHASE.map((item, idx) => item.name) : [],
datasets: [
{
@ -814,10 +798,6 @@ const DashboardBOD = (props) => {
backgroundColor="#f3f3f3"
foregroundColor="#ecebeb"
>
{/* <rect x="0" y="0" rx="5" ry="5" width="25%" height="18" />
<rect x="0" y="23" rx="5" ry="5" width="75%" height="18" />
<rect x="0" y="47" rx="5" ry="5" width="100%" height="18" />
<rect x="0" y="70" rx="5" ry="5" width="45%" height="18" /> */}
<rect x="7" y="12" rx="5" ry="5" width="414" height="20" />
<rect x="7" y="41" rx="5" ry="5" width="220" height="20" />
<rect x="7" y="69" rx="5" ry="5" width="319" height="20" />
@ -876,9 +856,7 @@ const DashboardBOD = (props) => {
},
datalabels: {
color: '#FFFFFF',
// rotation: -90
formatter: function (value, context) {
// return value ? toRupiah(value, { useUnit: 'jt' }) : 0
return null;
}
}
@ -925,8 +903,6 @@ const DashboardBOD = (props) => {
changeMode={(mode) => setHealthPerDivisionMode(mode)}
chartType="vertical-bar"
chartData={PROJECT_SCHEDULE_HEALTH_PER_DIVISION || PROJECT_BUDGET_HEALTH_PER_DIVISION ? {
// labels: ['Telecommunication Solution Service', 'Telecommunication Solution Product', 'Energy Solution', 'Constructions'],
// labels: [['Telecommunication', 'Solution Service'], ['Telecommunication', 'Solution Product'], 'Energy Solution', 'Constructions'],
labels:
healthPerDivisionMode === 'schedule' ?
PROJECT_SCHEDULE_HEALTH_PER_DIVISION ? PROJECT_SCHEDULE_HEALTH_PER_DIVISION.map((item, idx) => item.name) : []

143
src/views/Master/MasterTransaction/DialogForm.js

@ -1,12 +1,12 @@
import React, { Component } from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label, Input } from 'reactstrap';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label } 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, DatePicker } from 'antd';
import axios from 'axios';
import { NotificationManager } from 'react-notifications';
import moment from "moment";
import { COMPANY_MANAGEMENT_LIST } from '../../../const/ApiConst';
const { Option } = Select
class DialogForm extends Component {
@ -14,16 +14,12 @@ class DialogForm extends Component {
super(props)
this.state = {
id: 0,
name: "",
ExpiredDateOspro: moment(),
description: "",
ExpiredDateOspro:moment(moment().format("YYYY-MM-DD")),
openDialog: false,
companyList: [],
scompany_id:null,
isParentClick: false,
company_id: props.company_id || null,
role_name: props.role_name || '',
token: props.token || '',
isParentClick: false,
type_paket: '',
companyList: [],
config: {
headers: {
Authorization: `Bearer ${props.token || ''}`,
@ -34,38 +30,31 @@ class DialogForm extends Component {
}
async componentDidMount() {
this.getCompanyList();
this.props.showDialog(this.showDialog);
this.getDataProyekCompany();
}
async componentDidUpdate() {
if (this.state.isParentClick === true) {
if (this.props.typeDialog === "Edit") {
const { dataEdit } = this.props
if (dataEdit && this.props.typeDialog === "Edit") {
this.setState({
id: dataEdit.id,
name: dataEdit.name,
description: dataEdit.description,
scompany_id : dataEdit.company_id
type_paket: dataEdit.type_paket,
ExpiredDateOspro: dataEdit.exp_ospro ? moment(moment(dataEdit.exp_ospro).format("YYYY-MM-DD")) : moment(moment().format("YYYY-MM-DD")),
})
} else {
this.setState({
id: 0,
name: "",
description: "",
scompany_id:null
type_paket: "",
ExpiredDateOspro: moment(moment().format("YYYY-MM-DD"))
})
}
this.setState({ isParentClick: false });
}
}
showDialog = () => {
this.setState({ isParentClick: true });
}
getDataProyekCompany = async () => {
getCompanyList = async () => {
const result = await axios
.get(COMPANY_MANAGEMENT_LIST, this.state.config)
.then((res) => res)
@ -79,13 +68,19 @@ class DialogForm extends Component {
}
};
handleDatePicker = (date, dateString) => {
this.setState({ ExpiredDateOspro: date })
};
showDialog = () => {
this.setState({ isParentClick: true });
}
validation = () => {
if (this.state.role_name === 'Super Admin' && !this.state.scompany_id || this.state.scompany_id === "") {
alert("Company data cannot be empty!");
const {type_paket, ExpiredDateOspro} = this.state;
if (!type_paket || type_paket === "") {
alert("Type paket cannot be empty!");
return true;
}
if(!ExpiredDateOspro || ExpiredDateOspro === "") {
alert("Expired date cannot be empty!");
return true;
}
}
@ -93,30 +88,18 @@ class DialogForm extends Component {
handleSave = () => {
const {
id,
name,
description,
role_name,
company_id,
scompany_id
type_paket,
ExpiredDateOspro
} = 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,
}
this.props.closeDialog('save', data);
} else {
if (this.props.typeDialog === "Edit") {
data = {
id,
name,
description,
company_id : role_name !== 'Super Admin' ? company_id : scompany_id,
type_paket,
ExpiredDateOspro
}
this.props.closeDialog('edit',data);
}
@ -128,58 +111,42 @@ class DialogForm extends Component {
this.props.closeDialog('cancel','none')
}
onChangeCompanyProject = (val) => {
this.setState({scompany_id : val});
onChangeTypePaket = (val) => {
this.setState({type_paket : val});
};
handleDatePicker = (date) => {
this.setState({ ExpiredDateOspro: date })
};
renderForm = () => {
const { t } = this.props;
const {type_paket, ExpiredDateOspro} = this.state;
return (
<Form>
{
this.state.role_name === 'Super Admin' && (
<FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<FormGroup>
<Label className="capitalize">Type Paket<span style={{ color: "red" }}>*</span></Label>
<Select
showSearch
filterOption={(inputValue, option) =>
option.children.toLowerCase().includes(inputValue.toLowerCase())
}
value={this.state.scompany_id}
defaultValue={this.state.scompany_id}
onChange={this.onChangeCompanyProject}
style={{ width: "100%" }}
>
{this.state.companyList.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
value={type_paket === "" ? "Enterprise" : type_paket}
defaultValue={type_paket}
onChange={this.onChangeTypePaket}
style={{ width: "100%" }}>
<Option key={1} value="Free">Free</Option>
<Option key={2} value="Basic">Basic</Option>
<Option key={3} value="">Enterprise</Option>
</Select>
</FormGroup>
)
}
<FormGroup>
<Label>{this.props.t('Type Paket')}</Label>
<Input type="text" value={this.state.name} onChange={(e) => this.setState({ name: e.target.value })} placeholder={this.props.t('inputName')} />
</FormGroup>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>
Expired Date<span style={{ color: "red" }}>*</span>
</Label>
{/* <DatePicker
// disabledDate={(current) => {
// let currentDate = moment(current).format("YYYY-MM-DD");
// let customDate = moment(this.state.ExpiredDateOspro)
// .add(1, "days")
// .format("YYYY-MM-DD");
// return current && currentDate < customDate;
// }}
<Label className="capitalize">Expired Date<span style={{ color: "red" }}>*</span></Label>
<DatePicker
disabledDate={(current) => {
return current && current < moment().startOf('day');
}}
format={"DD-MM-YYYY"}
style={{ width: "100%" }}
value={this.state.ExpiredDateOspro}
onChange={this.handleDatePicker()}
/> */}
value={ExpiredDateOspro}
onChange={this.handleDatePicker}
/>
</FormGroup>
</Form>
)
@ -188,7 +155,7 @@ class DialogForm extends Component {
render() {
return (
<Modal isOpen={this.props.openDialog} toggle={this.props.toggleDialog}>
<ModalHeader toggle={this.props.closeDialog}>{this.props.typeDialog == "Save" ? "Tambah" : "Edit"} {this.props.t('Transaksi')}</ModalHeader>
<ModalHeader toggle={this.props.closeDialog}>{this.props.typeDialog} Transaction</ModalHeader>
<ModalBody>
{this.renderForm()}
</ModalBody>

264
src/views/Master/MasterTransaction/index.js

@ -1,15 +1,13 @@
import * as XLSX from 'xlsx';
import DialogForm from './DialogForm';
import React, { Component } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert';
import axios from 'axios';
import { Button } from 'reactstrap';
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications';
import { PROJECT_ROLE_ADD, TRANSACTION_SEARCH, PROJECT_ROLE_EDIT, PROJECT_ROLE_DELETE } from '../../../const/ApiConst.js';
import { TRANSACTION_EDIT, TRANSACTION_SEARCH, STORAGE_LIMIT_INFORMATION_ALL_COMPANY, TRANSACTION_ADD } from '../../../const/ApiConst.js';
import { Pagination, Tooltip, Table } from 'antd';
import { withTranslation } from 'react-i18next';
import { checkActMenup } from '../../../const/CustomFunc';
import moment from "moment";
const LENGTH_DATA = 10
@ -17,17 +15,11 @@ class index extends Component {
constructor(props) {
super(props);
this.state = {
alertDelete: false,
alertNotDelete: false,
currentPage: 1,
dataEdit: null,
dataEdit: [],
dataExport: [],
dataGs: [],
dataIdHo: [],
dataTable: [],
dialogMenuForm: false,
idDelete: 0,
idRoles: 0,
typeDialog: 'Save',
menuRoles: [],
openDialog: false,
page: 0,
@ -40,16 +32,8 @@ class index extends Component {
tooltipMenu: false,
tooltipTambah: false,
totalPage: 0,
typeDialog: 'Save',
company_id: props.company_id || 0,
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 || '',
config: {
headers: {
Authorization: `Bearer ${props.token || ''}`,
@ -66,27 +50,11 @@ class index extends Component {
key: 'x',
className: 'nowrap',
render: (text, record) => <>
<Tooltip title={this.props.t('delete')}>
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
{/* {
checkActMenup('/product-transaction', 'delete') ?
<i className="fa fa-trash" style={{ color: 'red', marginRight: 10, cursor: "pointer" }} onClick={() => this.handleDelete(text.id)}></i>
:
null
} */}
</Tooltip>
<Tooltip title={this.props.t('edit')}>
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
{/* {
checkActMenup('/product-transaction', 'update') ?
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => this.handleEdit(text)}></i>
:
null
} */}
</Tooltip>
</>,
},
...(this.state.role_name === 'Super Admin' ? [
{
title: "Company Name",
dataIndex: "join_first_company_name",
@ -94,8 +62,7 @@ class index extends Component {
render: (text, record) => {
return <span>{ record.join_first_company_name }</span>;
}
}] : [])
,
},
{ title: 'Type Paket', dataIndex: 'type_paket', key: 'type_paket', className: "nowrap",
render: (text,record) => {
return <span>{ !["Basic","Free"].includes(record.type_paket) ? 'Enterprise' : record.type_paket}</span>
@ -107,16 +74,26 @@ class index extends Component {
return <span>{ moment(record.exp_ospro).format('DD MMMM, YYYY') }</span>;
}
},
{ title: "Storage", dataIndex: 'size', key: 'size',
render: (text, record) => {
return <span>{ record.size } MB</span>;
}
},
{ title: "Total Project", dataIndex: 'project_total', key: 'project_total',
render: (text, record) => {
return <span>{ record.project_total } Project</span>;
}
},
];
}
async componentDidMount() {
this.getDataTransaction();
this.getDataLimitasi();
}
async componentDidUpdate(prevProps, prevState) {
const { search } = this.state
if (search !== prevState.search) this.getDataTransaction()
if (search !== prevState.search) this.getDataLimitasi()
}
handleSearch = e => {
@ -124,6 +101,20 @@ class index extends Component {
this.setState({ search: value, currentPage: 1 })
};
getDataLimitasi = async () => {
const result = await axios
.get(STORAGE_LIMIT_INFORMATION_ALL_COMPANY, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result) {
this.setState({dataLimit: result.data});
this.getDataTransaction();
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
}
getDataTransaction = async () => {
let start = 0;
if (this.state.currentPage !== 1 && this.state.currentPage > 1) {
@ -147,11 +138,7 @@ 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": parseInt(this.state.company_id), "operator": "AND" },
)
} else {
if (this.state.role_name === "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
@ -168,7 +155,8 @@ class index extends Component {
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ dataTable: result.data.data, totalPage: result.data.totalRecord });
this.filterDataLimitasi(result.data.data);
this.setState({ totalPage: result.data.totalRecord });
} else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
}
@ -181,109 +169,68 @@ class index extends Component {
handleCloseDialog = (type, data) => {
if (type === "save") {
this.saveRole(data);
this.saveTransaction(data);
} else if (type === "edit") {
this.editRole(data);
this.editTransaction(data);
}
this.setState({ openDialog: false })
}
handleOpenDialogMr = () => {
this.setState({ dialogMenuForm: true })
this.showMenuRolesDialog();
}
handleCloseDialogMr = (type, data) => {
if (type === "save") {
this.saveMenuRoles(data)
}
this.setState({ dialogMenuForm: false })
}
toggleAddDialog = () => {
this.setState({ openDialog: !this.state.openDialog })
}
onConfirmDelete = async () => {
const { idDelete } = this.state
const url = PROJECT_ROLE_DELETE(idDelete)
const result = await axios.delete(url, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataTransaction()
this.setState({ idDelete: 0, alertDelete: false })
NotificationManager.success(`Data project role berhasil dihapus`, 'Success!!');
} else {
this.setState({ idDelete: 0, alertDelete: false })
NotificationManager.error(`Data project role gagal dihapus`, 'Failed!!');
}
}
saveRole = async (data) => {
saveTransaction = async (data) => {
const formData = {
name: data.name,
description: data.description,
type_paket: data.type_paket,
exp_ospro : data.ExpiredDateOspro,
company_id: data.company_id
}
const result = await axios.post(PROJECT_ROLE_ADD, formData, this.state.config)
const result = await axios.post(TRANSACTION_ADD, formData, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataTransaction();
NotificationManager.success(`Data project role berhasil ditambah`, 'Success!!');
this.getDataRoles();
NotificationManager.success(`Data role berhasil ditambahkan`, 'Success!!');
} else {
NotificationManager.error(`${result.data.message}`, 'Failed!!');
NotificationManager.error(`Data role gagal ditambahkan`, 'Failed!!');
}
}
editRole = async (data) => {
editTransaction = async (data) => {
const formData = {
name: data.name,
description: data.description,
company_id : data.company_id
type_paket: data.type_paket,
exp_ospro : data.ExpiredDateOspro,
}
const url = PROJECT_ROLE_EDIT(data.id)
const url = TRANSACTION_EDIT(data.id)
const result = await axios.put(url, formData, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataTransaction();
NotificationManager.success(`Data project role berhasil diedit`, 'Success!!');
this.getDataLimitasi();
NotificationManager.success(`Data transaksi berhasil diedit`, 'Success!!');
} else {
NotificationManager.error(`Data project role gagal di edit`, `Failed!!`);
NotificationManager.error(`Data transaksi gagal di edit`, `Failed!!`);
}
}
handleEdit = (data) => {
this.setState({ dataEdit: data});
this.handleOpenDialog('Edit');
}
handleDelete = (id) => {
id == '1' ? this.setState({ alertNotDelete: true }) :
this.setState({ alertDelete: true, idDelete: id });
}
onShowSizeChange = (current, pageSize) => {
this.setState({ rowsPerPage: pageSize }, () => {
this.getDataTransaction();
this.getDataLimitasi();
})
}
onPagination = (current, pageSize) => {
this.setState({ currentPage: current, page: (current - 1) * pageSize }, () => {
this.getDataTransaction();
this.getDataLimitasi();
})
}
@ -312,52 +259,17 @@ class index extends Component {
}
handleExportExcel = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [],
"group_column": {
"operator": "AND",
"group_operator": "OR",
"where": [
{
"name": "name",
"logic_operator": "~*",
"value": this.state.search,
}
]
},
"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(TRANSACTION_SEARCH, payload, this.state.config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.statusText == "OK") {
const dataRes = result.data.data || [];
const {filteredDataTransaction} = this.state;
if(filteredDataTransaction) {
const dataRes = filteredDataTransaction || [];
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;
row["Type Paket"] = val.type_paket === "" ? "Enterprise" : val.type_paket;
row["Expired Date"] = moment(val.exp_ospro).format("DD-MM-YYYY");
row.Storage = parseFloat(val.size) + " MB";
row["Total Project"] = val.project_total + " Project";
dataExport.push(row);
})
this.setState({ dataExport: dataExport }, () => {
@ -370,52 +282,38 @@ class index extends Component {
exportExcel = () => {
const dataExcel = this.state.dataExport || [];
const fileName = "Data Project Role.xlsx";
const fileName = "Data Transaksi.xlsx";
const ws = XLSX.utils.json_to_sheet(dataExcel);
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Data Project Role');
XLSX.utils.book_append_sheet(wb, ws, 'Data Transaksi');
XLSX.writeFile(wb, fileName);
}
filterDataLimitasi = (transaction) => {
const { dataLimit } = this.state;
const filteredTransaction = transaction.map(dataParam => {
const matchingData = dataLimit.find(data => dataParam.join_first_company_name === data.company_name);
return {
...dataParam,
...matchingData || {}
};
});
this.setState({ filteredDataTransaction: filteredTransaction });
}
render() {
const { t } = this.props;
const { dataTable, openDialog, currentPage, rowsPerPage, totalPage, search, tooltipEdit, tooltipDelete, tooltipMenu } = this.state
let noSeq = 0;
const { filteredDataTransaction, openDialog, currentPage, rowsPerPage, totalPage, search } = this.state
return (
<div>
<NotificationContainer />
<SweetAlert
show={this.state.alertDelete}
warning
showCancel
confirmBtnText="Delete"
confirmBtnBsStyle="danger"
title={this.props.t('deleteConfirm')}
onConfirm={this.onConfirmDelete}
onCancel={() => this.setState({ alertDelete: false, idDelete: 0 })}
focusCancelBtn
>
{this.props.t('deleteMsg')}
</SweetAlert>
<SweetAlert
show={this.state.alertNotDelete}
warning
confirmBtnText="Can't Delete"
confirmBtnBsStyle="danger"
title="Data can't be delete!"
onConfirm={() => this.setState({ alertNotDelete: false })}
>
Data project role tidak dapat di hapus!!
</SweetAlert>
<DialogForm
openDialog={openDialog}
closeDialog={this.handleCloseDialog}
toggleDialog={() => this.toggleAddDialog}
typeDialog={this.state.typeDialog}
dataEdit={this.state.dataEdit}
showDialog={showDialog => this.showChildDialog = showDialog}
dataHs={this.state.dataIdHo}
company_id={this.state.company_id}
typeDialog={this.state.typeDialog}
role_name={this.state.role_name}
token={this.state.token}
/>
@ -427,14 +325,8 @@ class index extends Component {
<Input onChange={this.handleSearch} value={search} type="text" name="search" id="search" placeholder={this.props.t('search')} />
</Col>
<Col>
<Tooltip title={this.props.t('rolesAdd')}>
{
checkActMenup('/roles', 'create') ?
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i>
</Button>
:
null
}
<Tooltip title="Transaction Add">
<Button Button id="TooltipTambah" color="success" onClick={() => this.handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
</Tooltip>
<Tooltip title={this.props.t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} id="TooltipExport" color="primary" onClick={() => this.handleExportExcel()}><i className="fa fa-print"></i></Button>
@ -447,7 +339,7 @@ class index extends Component {
rowKey="id"
size="small"
columns={this.columns}
dataSource={dataTable}
dataSource={filteredDataTransaction}
pagination={false}
bordered={false}
/>

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

@ -185,7 +185,6 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
</SweetAlert>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize withBtn" toggle={closeDialog}>
<div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader>
<ModalBody>
@ -200,6 +199,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
toggleDialog={toogleDialogFormTools}
idTask={idTask}
company_id={company_id}
token={token}
/>
</>
)

6
src/views/SimproV2/CreatedProyek/AssignK3Project.js

@ -7,8 +7,7 @@ import { Transfer, Spin } from 'antd';
import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications';
const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName }) => {
const token = localStorage.getItem("token")
const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName, token }) => {
const [loading, setLoading] = useState(true);
const HEADER = {
@ -111,6 +110,9 @@ const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3
}}>
<Transfer
showSearch
filterOption={(inputValue, option) =>
option.title.toLowerCase().includes(inputValue.toLowerCase())
}
titles={['Available K3', 'Assigned to Project']}
dataSource={dataK3}
targetKeys={targetKeys}

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

@ -12,8 +12,7 @@ import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications';
const role_id = localStorage.getItem('role_id');
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, company_id }) => {
const token = localStorage.getItem("token")
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, company_id, token }) => {
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -159,6 +158,9 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, compa
}}>
<Transfer
showSearch
filterOption={(inputValue, option) =>
option.title.toLowerCase().includes(inputValue.toLowerCase())
}
titles={['Available Customer', 'Granted to']}
dataSource={assignCustomer}
targetKeys={targetKeys}

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

@ -14,7 +14,8 @@ const DialogFormAnalysis = ({
openDialog,
closeDialog,
toggleDialog,
dataDetail
dataDetail,
typeDialogName
}) => {
const token = localStorage.getItem("token");
const [dataTable, setDatatable] = useState([]);
@ -99,7 +100,7 @@ const DialogFormAnalysis = ({
<>
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>
Detail Report Analysis
Detail Report Analysis - {typeDialogName}
</ModalHeader>
<ModalBody>
<Card>

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

@ -810,7 +810,7 @@ const DialogFormProyek = ({
<Row>
<Col md={4}>
<Select
value={currencySymbol}
value={currencySymbol || "IDR|Rp|Indonesian rupiah"}
onChange={onChangeCurrency}
defaultValue="IDR|Rp|Indonesian rupiah"
style={{ width: "100%" }}
@ -840,8 +840,6 @@ const DialogFormProyek = ({
/>
</FormGroup>
</Col>
</Row>
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>
@ -876,8 +874,6 @@ const DialogFormProyek = ({
/>
</FormGroup>
</Col>
</Row>
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize" style={{ fontWeight: "bold" }}>Organizational Structure</Label>

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

@ -28,7 +28,7 @@ import DialogFormAnalysis from './DialogFormAnalysis';
import moment from "moment";
const { Option } = Select
const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => {
const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId, proyekName }) => {
const token = localStorage.getItem("token");
const [activeTab, setActiveTab] = useState('1');
const [search, setSearch] = useState('');
@ -44,6 +44,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
const [groupedActivity, setGroupedActivity] = useState([]);
const [selectedHr, setSelectedHr] = useState(null);
const [loading, setLoading] = useState(false);
const [typeDialogName, setTypeDialogName] = useState('');
const toggle = (tab) => {
if (activeTab !== tab) {
@ -136,10 +137,17 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
title: "Volume Plan", dataIndex: "qty_planning", key: "qty_planning",
render: (text, record) =>
<>
{text ? text : 0}
{text ? Math.round(text).toFixed(0) : 0}
</>
},
{ title: "Volume Actual", dataIndex: "qty", key: "qty" },
{
title: "Volume Actual", dataIndex: "qty", key: "qty",
render: (text, record)=> {
return (
<span>{Math.round(record.qty).toFixed(0)}</span>
)
}
},
{
title: "Progress Plan (%)", dataIndex: "persentase_progress", key: "persentase_progress",
render: (text, record) => {
@ -157,7 +165,14 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
);
},
},
{ title: "Progress Actual (%)", dataIndex: "persentase_progress", key: "persentase_progress", width: "8%" },
{
title: "Progress Actual (%)", dataIndex: "persentase_progress", key: "persentase_progress", width: "8%",
render: (text, record)=>{
return (
<span>{Math.round(record?.persentase_progress).toFixed(0)}</span>
)
}
},
{
title: 'Action',
dataIndex: '',
@ -166,7 +181,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) =>
<>
<Tooltip title="Detail Activity">
<Button size={"sm"} color='primary' onClick={() => handleDetail(text)}><i className="fa fa-eye"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleDetail(text,'activity')}><i className="fa fa-eye"></i></Button>
</Tooltip>{" "}
</>
,
@ -228,10 +243,15 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
title: "Volume Plan", dataIndex: "join_third_qty_planning", key: "join_third_qty_planning",
render: (text, record) =>
<>
{text ? text : 0}
{text ? Math.round(text).toFixed(0) : 0}
</>
},
{ title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual",
render: (text, record) =>
<>
{text ? Math.round(record.volume_actual).toFixed(0) : 0}
</>
},
{ title: "Volume Actual", dataIndex: "volume_actual", key: "volume_actual" },
{
title: "Progress Plan (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress",
render: (text, record) => {
@ -249,7 +269,13 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
);
},
},
{ title: "Progress Actual (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress" },
{title: "Progress Actual (%)", dataIndex: "join_second_persentase_progress", key: "persentase_progress", width: "8%",
render: (text, record)=>{
return (
<span>{Math.round(record?.join_second_persentase_progress).toFixed(0)}</span>
)
}
},
{
title: 'Action',
dataIndex: '',
@ -258,7 +284,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
render: (text, record) =>
<>
<Tooltip title="Detail Activity">
<Button size={"sm"} color='primary' onClick={() => handleDetail(text)}><i className="fa fa-eye"></i></Button>
<Button size={"sm"} color='primary' onClick={() => handleDetail(text,'hr')}><i className="fa fa-eye"></i></Button>
</Tooltip>{" "}
</>
,
@ -287,8 +313,11 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
if (projectId) {
getGroupedActivity()
getDataHr()
setSearch('')
setDatatable([])
setDataTableActivityToHr([])
}
}, [projectId]);
}, [openDialog]);
const handleClose = () => {
setAvgActivityHr(0);
@ -305,8 +334,9 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
setSearch(value);
};
const handleDetail = (data) => {
const handleDetail = (data, type) => {
setOpenDialogFormAnalysis(true);
setTypeDialogName(type === 'activity' ? data.name_version : data.join_second_name);
setDataDetail(data);
}
@ -414,7 +444,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
name: "assign_material_to_activity",
column_join: "id",
column_self: "activity_id",
column_results: ["qty_planning"]
column_results: ["id","qty_planning"]
},
{
name1: "m_activity",
@ -533,7 +563,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
return (
<>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={handleClose}>Report Analysis</ModalHeader>
<ModalHeader className="capitalize" toggle={handleClose}>Report Analysis - {proyekName}</ModalHeader>
<ModalBody>
<div>
<Nav tabs>
@ -638,6 +668,7 @@ const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) =>
toggleDialog={toggleDialogForm}
closeDialog={closeDialogForm}
dataDetail={dataDetail}
typeDialogName={typeDialogName}
/>
</>
)

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

@ -415,6 +415,7 @@ const CreatedProyek = ({ params, ...props }) => {
"akhir_proyek",
"company_id",
"deleted_at",
"value_proyek",
"deleted_by_id"
],
joins: [
@ -712,6 +713,7 @@ const CreatedProyek = ({ params, ...props }) => {
const handleOpenReport = async (data) => {
setOpenDialogRA(true);
setProyekName(data.nama);
setProjectId(data.id);
}
const handleCloseReport = async (data) => {
@ -1420,13 +1422,12 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["id"], ascending: false },
};
if (all_project !== null && all_project === true) {
if (role_name !== 'Super Admin' && all_project === 'true') {
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
);
}
if (role_name !== 'Super Admin') {
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
@ -1536,12 +1537,12 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["nama"], ascending: true },
};
if (all_project !== null && all_project === true) {
if (role_name !== 'Super Admin' && all_project === 'true') {
payload.columns.push(
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
{ name: "company_id", logic_operator: "like", value: parseInt(company_id), operator: "AND" }
);
}
if (role_name !== 'Super Admin') {
if (role_name !== 'Super Admin' && all_project === 'false' || role_name !== 'Super Admin' && all_project === 'null') {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: [JSON.parse(hierarchy)], operator: "AND" }
);
@ -1828,7 +1829,15 @@ const CreatedProyek = ({ params, ...props }) => {
}] : []),
{ title: "Project Name", dataIndex: "nama", key: "nama" },
{
title: "Budget",
title: "Nilai Kontrak",
dataIndex: "value_proyek",
key: "value_proyek",
render: (text, record) => {
return "Rp " + (record.value_proyek == null ? 0 : record.value_proyek);
},
},
{
title: "Anggaran Biaya",
dataIndex: "rencana_biaya",
key: "rencana_biaya",
render: (text, record) => {
@ -2039,6 +2048,7 @@ const CreatedProyek = ({ params, ...props }) => {
idTask={idTask}
proyekName={proyekName}
dataK3={dataK3}
token={token}
/>
),
[openDialogAssignK3, dataK3]
@ -2091,6 +2101,7 @@ const CreatedProyek = ({ params, ...props }) => {
closeDialog={handleCloseReport}
toggleDialog={toggleAddDialogRA}
projectId={projectId}
proyekName={proyekName}
/>
),
[openDialogRA]

1
src/views/SimproV2/Kanban/DialogFormActivity.js

@ -183,7 +183,6 @@ const DialogFormActivity = ({
if (typeDialogActivity === "Edit") {
if (actionMeta.action === 'select-option') {
const item = actionMeta.option
// console.log("actionMeta", item);
// let dataSaveHr = {
// "user_id": item.id,
// "role_proyek_id": item.proyek_role,

5
src/views/SimproV2/Kanban/DialogFormReport.js

@ -110,10 +110,6 @@ const DialogFormReport = ({
closeDialogReport('cancel', 'none')
}
const handleReport = () => {
console.log('Button Triggered')
}
const handleGetReportActivity = async (id) => {
const payload = {
columns: [
@ -249,7 +245,6 @@ const DialogFormReport = ({
if (typeDialogReport === "Edit") {
if (actionMeta.action === 'select-option') {
const item = actionMeta.option
// console.log("actionMeta", item);
// let dataSaveHr = {
// "user_id": item.id,
// "role_proyek_id": item.proyek_role,

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

@ -53,24 +53,11 @@ class index extends Component {
};
this.columns = [
{
title: this.state.role_name === 'Super Admin' ? "Company Name" : null,
dataIndex: "join_first_company_name",
key: "join_first_company_name",
render: (text, record) => {
return this.state.role_name === 'Super Admin' ? (
<span>{record.join_first_company_name}</span>
) : null;
}
},
{ title: this.props.t('Company'), dataIndex: 'company_name', key: 'company_name', className: "nowrap" },
{
title: this.props.t('Expired'),
dataIndex: 'exp_ospro',
key: 'exp_ospro',
title: this.props.t('Expired Date'), dataIndex: 'exp_ospro', key: 'exp_ospro',
render: (text,record) => {
return text ? moment(text).format("D-M-YYYY HH:mm:ss") : '-';
return <span>{ moment(record.exp_ospro).format('DD MMMM, YYYY') }</span>;
}
},
{ title: this.props.t('Storage'), dataIndex: 'size', key: 'size' },
@ -79,12 +66,12 @@ class index extends Component {
}
async componentDidMount() {
this.getDataRoles();
this.getDataLimitasi();
}
async componentDidUpdate(prevProps, prevState) {
const { search } = this.state
if (search !== prevState.search) this.getDataRoles()
if (search !== prevState.search) this.getDataLimitasi()
}
handleSearch = e => {
@ -92,7 +79,7 @@ class index extends Component {
this.setState({ search: value, currentPage: 1 })
};
getDataRoles = async () => {
getDataLimitasi = async () => {
const result = await axios
.get(STORAGE_LIMIT_INFORMATION_ALL_COMPANY, this.state.config)
.then(res => res)
@ -116,7 +103,7 @@ class index extends Component {
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataRoles()
this.getDataLimitasi()
this.setState({ idDelete: 0, alertDelete: false })
NotificationManager.success(`Data project role berhasil dihapus`, 'Success!!');
} else {
@ -138,7 +125,7 @@ class index extends Component {
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataRoles();
this.getDataLimitasi();
NotificationManager.success(`Data project role berhasil ditambah`, 'Success!!');
} else {
NotificationManager.error(`${result.data.message}`, 'Failed!!');
@ -159,7 +146,7 @@ class index extends Component {
.catch((error) => error.response);
if (result && result.data && result.data.code === 200) {
this.getDataRoles();
this.getDataLimitasi();
NotificationManager.success(`Data project role berhasil diedit`, 'Success!!');
} else {
NotificationManager.error(`Data project role gagal di edit`, `Failed!!`);
@ -179,13 +166,13 @@ class index extends Component {
onShowSizeChange = (current, pageSize) => {
this.setState({ rowsPerPage: pageSize }, () => {
this.getDataRoles();
this.getDataLimitasi();
})
}
onPagination = (current, pageSize) => {
this.setState({ currentPage: current, page: (current - 1) * pageSize }, () => {
this.getDataRoles();
this.getDataLimitasi();
})
}

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

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import {
Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row
Button, Form, FormGroup, Label, Input, Col, Row, CustomInput
} from 'reactstrap';
import { Select } from 'antd';
import moment from 'moment';
@ -16,9 +16,12 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState()
const [selectedCompany, setSelectedCompany] = useState(null)
const [isMultiLocation, setIsMultiLocation] = useState(false);
const { t } = useTranslation();
const handleIsMultiLocationChange = () => {
setIsMultiLocation(!isMultiLocation);
};
useEffect(() => {
if (typeDialog === "Edit") {
@ -28,46 +31,51 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setUom(dataEdit.uom)
setProjectType(dataEdit.name)
setSelectedCompany(dataEdit.company_id)
setIsMultiLocation(dataEdit.is_multiLocation)
} else {
setId(0)
handleClear()
}
}, [dataEdit, openDialog])
const handleSave = () => {
let data = '';
if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") {
data = {
name: projectType,
description,
company_id: company_id
company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
}
closeDialog('save', data);
} else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = {
id,
name: projectType,
description,
company_id: company_id
company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
}
closeDialog('edit', data);
}
handleClear();
}
const handleClear = () => {
setId(0)
setProjectType('')
setDescription('')
setSelectedCompany(null)
setIsMultiLocation(false)
}
const handleCancel = () => {
closeDialog('cancel', 'none')
setId(0)
setDescription('')
setSelectedCompany(null)
closeDialog('cancel', 'none');
handleClear();
}
const onChangeCompany = (val) => {
@ -91,8 +99,17 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup>
</Col>
</Row>
{role_name === 'Super Admin' &&
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">Is Multi Location</Label>
<div>
<CustomInput type="switch" id="isMultiLocationSwitch" name="isMultiLocationSwitch" checked={isMultiLocation} onChange={handleIsMultiLocationChange} />
</div>
</FormGroup>
</Col>
{
role_name === 'Super Admin' && (
<Col md={6}>
<FormGroup>
<Label className="capitalize">
@ -116,8 +133,9 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Select>
</FormGroup>
</Col>
</Row>
)
}
</Row>
</Form>
)
}

3
src/views/SimproV2/ReferralCode/DialogForm.js

@ -21,7 +21,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const { t } = useTranslation()
useEffect(() => {
console.log('dataEdit', dataEdit);
if (typeDialog === "Edit") {
setId(dataEdit.id)
setCode(dataEdit.code)
@ -54,7 +53,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
type,
allocation
}
console.log('data', data);
closeDialog('save', data);
} else {
data = {
@ -66,7 +64,6 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
type,
allocation
}
console.log('data', data);
closeDialog('edit', data);
}
handleClear()

2
src/views/SimproV2/ReferralCode/index.js

@ -354,7 +354,7 @@ const ProjectType = ({ params, ...props }) => {
<td>{n.code}</td>
<td>{n.type}</td>
<td>{toRupiah(n.amount)}</td>
<td>{n?.exp ? moment(n.exp).format('DD-MM-YYYY HH:mm') : "-"}</td>
<td>{n?.exp ? moment(n.exp).format('DD MMMM, YYYY') : "-"}</td>
<td>{n.allocation ? n.allocation : "-"}</td>
<td>{n.description ? n.description : "-"}</td>
</tr>

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

@ -293,32 +293,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup>
</Col>
</Row>
{
statusCustomer === false && (
<Row>
<Col md={6}>
<FormGroup>
<Label className="capitalize">{t('roles')} <span style={{ color: "red" }}>*</span></Label>
<Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}>
{setupSelectRole()}
<Label className="capitalize">{t('Customer')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}>
<Option value={true}>Ya</Option>
<Option value={false}>Tidak</Option>
</Select>
</FormGroup>
</Col>
<Col md={6}>
<FormGroup>
<Label className="capitalize">{t('division')} <span style={{ color: "red" }}>*</span></Label>
<Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}>
{setupSelectDivisi()}
<Label className="capitalize">Status</Label>
<Select style={{ width: "100%" }} defaultValue={statusResource} onChange={(e) => setStatusResource(e)}>
<Option value={'active'}>Active</Option>
<Option value={'inactive'}>Inactive</Option>
</Select>
</FormGroup>
</Col>
</Row>
)
}
<Row>
{
role_name === 'Super Admin' && (
<Col md={6}>
<Col md={6} style={{ marginTop:'15px' }}>
<FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select
@ -341,20 +335,28 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col>
)
}
<Col md={6}>
<Label className="capitalize">{t('Customer')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}>
<Option value={true}>Ya</Option>
<Option value={false}>Tidak</Option>
{
statusCustomer === false && (
<>
<Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
<FormGroup>
<Label className="capitalize">{t('roles')}</Label>
<Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}>
{setupSelectRole()}
</Select>
</FormGroup>
</Col>
<Col md={6}>
<Label className="capitalize">Status</Label>
<Select style={{ width: "100%" }} defaultValue={statusResource} onChange={(e) => setStatusResource(e)}>
<Option value={'active'}>Active</Option>
<Option value={'inactive'}>Inactive</Option>
<Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
<FormGroup>
<Label className="capitalize">{t('division')} </Label>
<Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}>
{setupSelectDivisi()}
</Select>
</FormGroup>
</Col>
</>
)
}
<Col md={6} style={{ marginTop:'13px' }}>
<Label className="capitalize">{t('restrictions')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}>

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

@ -12,11 +12,10 @@ const Container1 = () => {
const [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]);
const [storage, setLimitInformation] = useState(0)
const currentDate = new Date();
const givenDate = new Date(transaction.exp_ospro);
const createdDate = new Date(transaction.created_at)
const differenceInMillis = givenDate.getTime() - currentDate.getTime();
const differenceInDays = role !== 'Super Admin' ? Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
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 differenceInDays = role !== 'Super Admin' ? Math.ceil(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
let company_id = '', configApp = '';
if(role !== 'Super Admin') {
@ -153,16 +152,16 @@ const Container1 = () => {
<div className={styles.days}>
<div className={styles.frameYourCurrentPlan}>
<div className={styles.days1}>Days</div>
<div className={styles.of30Days}>{30 - Math.abs(differenceInDays)} of 30 Days</div>
<div className={styles.of30Days}>{ role !== 'Super Admin' ? (30 - Math.abs(differenceInDays)) + ' Days of 30 Days' : <small style={{ fontWeight:'bold' }}>Unlimited</small>}</div>
</div>
<div className={styles.rectangleFrame}>
<div className={styles.rectangleFrameChild} />
<div style={{
width: `${(400 * (30 - Math.abs(differenceInDays))) / 30}px`,
width: `${role !== 'Super Admin' ? ((400 * (30 - Math.abs(differenceInDays))) / 30) : 0}px`,
position: 'relative',
backgroundColor: ((30 - Math.abs(differenceInDays)) >= 0 && (30 - Math.abs(differenceInDays)) <= 10) ? '#59b4c3' :
backgroundColor: role !== 'Super Admin' ? (((30 - Math.abs(differenceInDays)) >= 0 && (30 - Math.abs(differenceInDays)) <= 10) ? '#59b4c3' :
((30 - Math.abs(differenceInDays)) >= 11 && (30 - Math.abs(differenceInDays)) <= 20) ? '#ffa447' :
'#FF4747',
'#FF4747') : '#59b4c3',
zIndex:'1',
padding:'5px',
borderRadius:'15px'
@ -170,22 +169,27 @@ const Container1 = () => {
</div>
</div>
<div className={styles.daysRemainingUntil}>
{ role !== 'Super Admin' ? Math.abs(differenceInDays) : 0} days remaining until your plan requires update
{ role !== 'Super Admin' ? Math.abs(differenceInDays) : <small style={{ fontWeight:'bold' }}>Unlimited</small>} days remaining until your plan requires update
</div>
</div>
<div className={styles.days2}>
<div className={styles.storageParent}>
<div className={styles.storage}>Storage</div>
<div className={styles.of500mb}>{storage} of {transaction?.type_paket === 'Basic' ? 500 : 50}MB</div>
<div className={styles.of500mb}>
{role !== 'Super Admin' ?
(storage + 'MB of ' + (transaction?.type_paket === 'Basic' ? '500' : '50')) + 'MB'
: <small style={{ fontWeight:'bold' }}>Unlimited</small>
}
</div>
</div>
<div className={styles.rectangleParent}>
<div className={styles.frameChild} />
<div style={{
width: `${(400 * storage) / (transaction.type_paket === 'Basic' ? 500 : 50)}px`,
width: `${role !== 'Super Admin' ? (400 * storage) / (transaction.type_paket === 'Basic' ? 500 : 50) : 0}px`,
position: 'relative',
backgroundColor: (storage >= 0 && storage <= (transaction.type_paket === 'Basic' ? 166.67 : 16.67)) ? '#59b4c3' :
backgroundColor: role !== 'Super Admin' ? ((storage >= 0 && storage <= (transaction.type_paket === 'Basic' ? 166.67 : 16.67)) ? '#59b4c3' :
(storage >= (transaction.type_paket === 'Basic' ? 166.68 : 16.68) && storage <= (transaction.type_paket === 'Basic' ? 333.33 : 33.33)) ? '#ffa447' :
'#FF4747',
'#FF4747') : '#59b4c3',
zIndex:'1',
padding:'5px',
borderRadius:'15px'
@ -193,22 +197,27 @@ const Container1 = () => {
</div>
</div>
<div className={styles.storageRemainingUntil}>
{(((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2))}% has been filled until your plan requires an update
{ role !== 'Super Admin' ? (((storage / (transaction.type_paket === 'Basic' ? 500 : 50)) * 100).toFixed(2)) + '%' : <small style={{ fontWeight:'bold' }}>Unlimited</small>} has been filled until your plan requires an update
</div>
</div>
<div className={styles.days3}>
<div className={styles.projectParent}>
<div className={styles.project}>Project</div>
<div className={styles.of10Project}>{parseInt(totalPage)} of {transaction.type_paket === "Basic" ? "10" : "1"} Project</div>
<div className={styles.of10Project}>
{
role !== 'Super Admin' ? (parseInt(totalPage) + ' Project of ' + (transaction.type_paket === "Basic" ? 10 : 1)) + ' Project'
: <small style={{ fontWeight:'bold' }}>Unlimited</small>
}
</div>
</div>
<div className={styles.rectangleGroup}>
<div className={styles.frameInner} />
<div style={{
width: `${(400 * parseInt(totalPage)) / (parseInt(transaction.type_paket === "Basic" ? 10 : 1))}px`,
width: `${role !== 'Super Admin' ? (400 * parseInt(totalPage)) / (parseInt(transaction.type_paket === "Basic" ? 10 : 1)) : 0}px`,
position: 'relative',
backgroundColor: transaction.type_paket === "Basic" ? (parseInt(totalPage) >= 0 && parseInt(totalPage) <= 3) ? '#59b4c3' :
backgroundColor: role !== 'Super Admin' ? (transaction.type_paket === "Basic" ? (parseInt(totalPage) >= 0 && parseInt(totalPage) <= 3) ? '#59b4c3' :
(parseInt(totalPage) >= 4 && parseInt(totalPage) <= 7) ? '#ffa447' :
'#FF4747' : '#FF4747',
'#FF4747' : '#FF4747') : '#59b4c3',
zIndex:'1',
padding:'5px',
borderRadius:'15px'
@ -216,7 +225,7 @@ const Container1 = () => {
</div>
</div>
<div className={styles.projectRemainingUntil}>
{parseInt(transaction.type_paket === "Basic" ? 10 : 1) - (parseInt(totalPage))} Project remaining until your plan requires update
{ role !== 'Super Admin' ? (transaction.type_paket === "Basic" ? 10 : 1) - parseInt(totalPage) : <small style={{ fontWeight:'bold' }}>Unlimited</small> } Project remaining until your plan requires update
</div>
</div>
</div>

Loading…
Cancel
Save