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 6 months ago
parent
commit
cc23b82d3d
  1. 4
      src/const/CustomFunc.js
  2. 2
      src/routes.js
  3. 24
      src/views/Dashboard/DashboardBOD.js
  4. 155
      src/views/Master/MasterTransaction/DialogForm.js
  5. 312
      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. 10
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  11. 63
      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. 39
      src/views/SimproV2/LimitasiUser/index.js
  16. 102
      src/views/SimproV2/ProjectType/DialogForm.js
  17. 3
      src/views/SimproV2/ReferralCode/DialogForm.js
  18. 2
      src/views/SimproV2/ReferralCode/index.js
  19. 76
      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) { if (foundObj[actValue] === true) {
output = true; output = true;
} }
// default:
// output = false
} }
return output; return output;
// return foundObj[actProp];
}; };
export const QUERY_BUILDER_FIELD_CUSTOMER = 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: '/map-monitoring', exact: true, name: 'Map Monitoring', component: MapMonitoring },
// { path: '/dashboard-project/:ID/:GANTTID', exact: true, name: 'Dashboard Project', component: DashboardProject }, // { path: '/dashboard-project/:ID/:GANTTID', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/settings', exact: true, name: 'Settings', component: Settings }, { 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: '/register-management', exact: true, name: 'Register Management', component: CompanyManagement },
{ path: '/demo-request', exact: true, name: 'Request Demo', component: DemoRequest }, { path: '/demo-request', exact: true, name: 'Request Demo', component: DemoRequest },
{ path: '/referral-code-management', exact: true, name: 'Referral Code Management', component: ReferralCode }, { 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: [ datasets: [
{ {
label: '', label: '',
// data: [COMPANY_CASHFLOW_TOTAL_BUDGET, COMPANY_CASHFLOW_EXPENDITURE, COMPANY_CASHFLOW_INVOICE, COMPANY_CASHFLOW_CASH_IN],
data: [ data: [
PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_budget ? PROJECT_EXPENDITURE.total_budget : 0, PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_budget ? PROJECT_EXPENDITURE.total_budget : 0,
PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_expenditure ? PROJECT_EXPENDITURE.total_expenditure : 0, PROJECT_EXPENDITURE && PROJECT_EXPENDITURE.total_expenditure ? PROJECT_EXPENDITURE.total_expenditure : 0,
@ -557,10 +556,6 @@ const DashboardBOD = (props) => {
backgroundColor="#f3f3f3" backgroundColor="#f3f3f3"
foregroundColor="#ecebeb" 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="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="41" rx="5" ry="5" width="220" height="20" />
<rect x="7" y="69" rx="5" ry="5" width="319" height="20" /> <rect x="7" y="69" rx="5" ry="5" width="319" height="20" />
@ -584,7 +579,6 @@ const DashboardBOD = (props) => {
datasets: [ datasets: [
{ {
label: "", label: "",
// data: [2, 4, 10],
data: [ data: [
PROJECT_BY_FINANCIAL_HEALTH && PROJECT_BY_FINANCIAL_HEALTH.overrun ? PROJECT_BY_FINANCIAL_HEALTH.overrun : '', 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 : '', PROJECT_BY_FINANCIAL_HEALTH && PROJECT_BY_FINANCIAL_HEALTH.warning ? PROJECT_BY_FINANCIAL_HEALTH.warning : '',
@ -618,7 +612,6 @@ const DashboardBOD = (props) => {
datasets: [ datasets: [
{ {
label: "", label: "",
// data: [1, 3, 11],
data: [ 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['behind-schedule'] ? PROJECT_BY_SCHEDULE_HEALTH['behind-schedule'] : '',
PROJECT_BY_SCHEDULE_HEALTH && PROJECT_BY_SCHEDULE_HEALTH.warning ? PROJECT_BY_SCHEDULE_HEALTH.warning : '', PROJECT_BY_SCHEDULE_HEALTH && PROJECT_BY_SCHEDULE_HEALTH.warning ? PROJECT_BY_SCHEDULE_HEALTH.warning : '',
@ -664,7 +657,6 @@ const DashboardBOD = (props) => {
position: 'right', position: 'right',
labels: { labels: {
boxWidth: 10, boxWidth: 10,
// padding: 15,
font: { font: {
size: 10 size: 10
} }
@ -674,7 +666,6 @@ const DashboardBOD = (props) => {
datalabels: { datalabels: {
color: '#FFFFFF', color: '#FFFFFF',
formatter: function (value, context) { formatter: function (value, context) {
// return value ? value : null
if (value && value > 0) { if (value && value > 0) {
return value; return value;
} }
@ -684,12 +675,10 @@ const DashboardBOD = (props) => {
} }
}} }}
chartData={PROJECT_PER_DIVISION ? { 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) : [], labels: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.name) : [],
datasets: [ datasets: [
{ {
label: "", label: "",
// data: [7, 2, 4, 3],
data: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.total) : [], data: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.total) : [],
borderColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [], borderColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [],
backgroundColor: 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', position: 'right',
labels: { labels: {
boxWidth: 10, boxWidth: 10,
// padding: 15,
font: { font: {
size: 10 size: 10
} }
@ -730,19 +718,16 @@ const DashboardBOD = (props) => {
datalabels: { datalabels: {
color: '#FFFFFF', color: '#FFFFFF',
formatter: function (value, context) { formatter: function (value, context) {
// return value ? toRupiah(value, { useUnit: 'jt' }) : 0
return null; return null;
} }
} }
} }
}} }}
chartData={PROJECT_VALUE_PER_DIVISION ? { 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) : [], labels: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.name) : [],
datasets: [ datasets: [
{ {
label: "", label: "",
// data: [50, 120, 72, 60],
data: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.total).filter(value => value !== 0) : [], 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) : [], 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) : [], backgroundColor: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.color) : [],
@ -788,7 +773,6 @@ const DashboardBOD = (props) => {
} }
}} }}
data={{ data={{
// labels: ["Initiation", "Planning", "Execution", "Control Monitoring", "Close"],
labels: PROJECT_BY_PHASE ? PROJECT_BY_PHASE.map((item, idx) => item.name) : [], labels: PROJECT_BY_PHASE ? PROJECT_BY_PHASE.map((item, idx) => item.name) : [],
datasets: [ datasets: [
{ {
@ -814,10 +798,6 @@ const DashboardBOD = (props) => {
backgroundColor="#f3f3f3" backgroundColor="#f3f3f3"
foregroundColor="#ecebeb" 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="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="41" rx="5" ry="5" width="220" height="20" />
<rect x="7" y="69" rx="5" ry="5" width="319" height="20" /> <rect x="7" y="69" rx="5" ry="5" width="319" height="20" />
@ -876,9 +856,7 @@ const DashboardBOD = (props) => {
}, },
datalabels: { datalabels: {
color: '#FFFFFF', color: '#FFFFFF',
// rotation: -90
formatter: function (value, context) { formatter: function (value, context) {
// return value ? toRupiah(value, { useUnit: 'jt' }) : 0
return null; return null;
} }
} }
@ -925,8 +903,6 @@ const DashboardBOD = (props) => {
changeMode={(mode) => setHealthPerDivisionMode(mode)} changeMode={(mode) => setHealthPerDivisionMode(mode)}
chartType="vertical-bar" chartType="vertical-bar"
chartData={PROJECT_SCHEDULE_HEALTH_PER_DIVISION || PROJECT_BUDGET_HEALTH_PER_DIVISION ? { 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: labels:
healthPerDivisionMode === 'schedule' ? healthPerDivisionMode === 'schedule' ?
PROJECT_SCHEDULE_HEALTH_PER_DIVISION ? PROJECT_SCHEDULE_HEALTH_PER_DIVISION.map((item, idx) => item.name) : [] PROJECT_SCHEDULE_HEALTH_PER_DIVISION ? PROJECT_SCHEDULE_HEALTH_PER_DIVISION.map((item, idx) => item.name) : []

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

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

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

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

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

@ -185,7 +185,6 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
</SweetAlert> </SweetAlert>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}> <Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize withBtn" toggle={closeDialog}> <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> <div>Assign Customer - {proyekName}</div> <Button onClick={handleOpenDialogFormTools} size='sm' color="primary"><i className='fa fa-plus'></i></Button>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
@ -200,6 +199,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
toggleDialog={toogleDialogFormTools} toggleDialog={toogleDialogFormTools}
idTask={idTask} idTask={idTask}
company_id={company_id} 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 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications'; import { NotificationManager } from 'react-notifications';
const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName }) => { const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3, proyekName, token }) => {
const token = localStorage.getItem("token")
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const HEADER = { const HEADER = {
@ -111,6 +110,9 @@ const AssignK3Project = ({ openDialog, closeDialog, toggleDialog, idTask, dataK3
}}> }}>
<Transfer <Transfer
showSearch showSearch
filterOption={(inputValue, option) =>
option.title.toLowerCase().includes(inputValue.toLowerCase())
}
titles={['Available K3', 'Assigned to Project']} titles={['Available K3', 'Assigned to Project']}
dataSource={dataK3} dataSource={dataK3}
targetKeys={targetKeys} targetKeys={targetKeys}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { import {
Modal, ModalHeader, ModalBody, ModalFooter, Modal, ModalHeader, ModalBody, ModalFooter,
Button, Form, FormGroup, Label, Input, Col, Row Button, Form, FormGroup, Label, Input, Col, Row, CustomInput
} from 'reactstrap'; } from 'reactstrap';
import { Select } from 'antd'; import { Select } from 'antd';
import moment from 'moment'; import moment from 'moment';
@ -16,9 +16,12 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState() const [unitPrice, setUnitPrice] = useState()
const [selectedCompany, setSelectedCompany] = useState(null) const [selectedCompany, setSelectedCompany] = useState(null)
const [isMultiLocation, setIsMultiLocation] = useState(false);
const { t } = useTranslation(); const { t } = useTranslation();
const handleIsMultiLocationChange = () => {
setIsMultiLocation(!isMultiLocation);
};
useEffect(() => { useEffect(() => {
if (typeDialog === "Edit") { if (typeDialog === "Edit") {
@ -28,46 +31,51 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
setUom(dataEdit.uom) setUom(dataEdit.uom)
setProjectType(dataEdit.name) setProjectType(dataEdit.name)
setSelectedCompany(dataEdit.company_id) setSelectedCompany(dataEdit.company_id)
setIsMultiLocation(dataEdit.is_multiLocation)
} else { } else {
setId(0) handleClear()
} }
}, [dataEdit, openDialog]) }, [dataEdit, openDialog])
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
if (typeDialog === "Save") { if (typeDialog === "Save") {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
name: projectType, name: projectType,
description, description,
company_id: company_id company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
if (role_name === 'Super Admin') {
company_id = selectedCompany
}
data = { data = {
id, id,
name: projectType, name: projectType,
description, description,
company_id: company_id company_id: parseInt(company_id),
is_multiLocation: isMultiLocation
} }
closeDialog('edit', data); closeDialog('edit', data);
} }
handleClear();
}
const handleClear = () => {
setId(0) setId(0)
setProjectType('')
setDescription('') setDescription('')
setSelectedCompany(null) setSelectedCompany(null)
setIsMultiLocation(false)
} }
const handleCancel = () => { const handleCancel = () => {
closeDialog('cancel', 'none') closeDialog('cancel', 'none');
setId(0) handleClear();
setDescription('')
setSelectedCompany(null)
} }
const onChangeCompany = (val) => { const onChangeCompany = (val) => {
@ -91,33 +99,43 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{role_name === 'Super Admin' && <Row>
<Row> <Col md={6}>
<Col md={6}> <FormGroup>
<FormGroup> <Label className="capitalize">Is Multi Location</Label>
<Label className="capitalize"> <div>
{t('company')}<span style={{ color: "red" }}>*</span> <CustomInput type="switch" id="isMultiLocationSwitch" name="isMultiLocationSwitch" checked={isMultiLocation} onChange={handleIsMultiLocationChange} />
</Label> </div>
<Select </FormGroup>
showSearch </Col>
filterOption={(inputValue, option) => {
option.children.toLowerCase().includes(inputValue.toLowerCase()) role_name === 'Super Admin' && (
} <Col md={6}>
value={selectedCompany} <FormGroup>
defaultValue={selectedCompany} <Label className="capitalize">
onChange={onChangeCompany} {t('company')}<span style={{ color: "red" }}>*</span>
style={{ width: "100%" }} </Label>
> <Select
{listCompany.map((res) => ( showSearch
<Option key={res.id} value={res.id}> filterOption={(inputValue, option) =>
{res.company_name} option.children.toLowerCase().includes(inputValue.toLowerCase())
</Option> }
))} value={selectedCompany}
</Select> defaultValue={selectedCompany}
</FormGroup> onChange={onChangeCompany}
</Col> style={{ width: "100%" }}
</Row> >
} {listCompany.map((res) => (
<Option key={res.id} value={res.id}>
{res.company_name}
</Option>
))}
</Select>
</FormGroup>
</Col>
)
}
</Row>
</Form> </Form>
) )
} }

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

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

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

@ -354,7 +354,7 @@ const ProjectType = ({ params, ...props }) => {
<td>{n.code}</td> <td>{n.code}</td>
<td>{n.type}</td> <td>{n.type}</td>
<td>{toRupiah(n.amount)}</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.allocation ? n.allocation : "-"}</td>
<td>{n.description ? n.description : "-"}</td> <td>{n.description ? n.description : "-"}</td>
</tr> </tr>

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

@ -293,32 +293,26 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
{ <Row>
statusCustomer === false && ( <Col md={6}>
<Row> <Label className="capitalize">{t('Customer')}</Label>
<Col md={6}> <Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}>
<FormGroup> <Option value={true}>Ya</Option>
<Label className="capitalize">{t('roles')} <span style={{ color: "red" }}>*</span></Label> <Option value={false}>Tidak</Option>
<Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}> </Select>
{setupSelectRole()} </Col>
</Select> <Col md={6}>
</FormGroup> <Label className="capitalize">Status</Label>
</Col> <Select style={{ width: "100%" }} defaultValue={statusResource} onChange={(e) => setStatusResource(e)}>
<Col md={6}> <Option value={'active'}>Active</Option>
<FormGroup> <Option value={'inactive'}>Inactive</Option>
<Label className="capitalize">{t('division')} <span style={{ color: "red" }}>*</span></Label> </Select>
<Select showSearch defaultValue={divisionId} onChange={(val) => setDivisionId(val)} placeholder={t('selectDivision')} style={{ width: '100%' }}> </Col>
{setupSelectDivisi()} </Row>
</Select>
</FormGroup>
</Col>
</Row>
)
}
<Row> <Row>
{ {
role_name === 'Super Admin' && ( role_name === 'Super Admin' && (
<Col md={6}> <Col md={6} style={{ marginTop:'15px' }}>
<FormGroup> <FormGroup>
<Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label> <Label className="capitalize">Assign Company Project<span style={{ color: "red" }}>*</span></Label>
<Select <Select
@ -341,20 +335,28 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
</Col> </Col>
) )
} }
<Col md={6}> {
<Label className="capitalize">{t('Customer')}</Label> statusCustomer === false && (
<Select style={{ width: "100%" }} defaultValue={statusCustomer} onChange={(e) => setStatusCustomer(e)}> <>
<Option value={true}>Ya</Option> <Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
<Option value={false}>Tidak</Option> <FormGroup>
</Select> <Label className="capitalize">{t('roles')}</Label>
</Col> <Select showSearch defaultValue={roleId} onChange={(val) => setRoleId(val)} placeholder={t('selectRole')} style={{ width: '100%' }}>
<Col md={6}> {setupSelectRole()}
<Label className="capitalize">Status</Label> </Select>
<Select style={{ width: "100%" }} defaultValue={statusResource} onChange={(e) => setStatusResource(e)}> </FormGroup>
<Option value={'active'}>Active</Option> </Col>
<Option value={'inactive'}>Inactive</Option> <Col md={6} style={{ marginTop: statusCustomer === false ? '15px' : '0px' }}>
</Select> <FormGroup>
</Col> <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' }}> <Col md={6} style={{ marginTop:'13px' }}>
<Label className="capitalize">{t('restrictions')}</Label> <Label className="capitalize">{t('restrictions')}</Label>
<Select style={{ width: "100%" }} defaultValue={statusRestriction} onChange={(e) => setStatusRestriction(e)}> <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 [totalPage, setTotalPage] = useState(0);
const [transaction, setTransaction] = useState([]); const [transaction, setTransaction] = useState([]);
const [storage, setLimitInformation] = useState(0) const [storage, setLimitInformation] = useState(0)
const currentDate = new Date(); const currentDate = new Date(); // Now date
const givenDate = new Date(transaction.exp_ospro); const givenDate = new Date(transaction.exp_ospro); // Parse exp ospro to date format
const createdDate = new Date(transaction.created_at) const differenceInMillis = givenDate.getTime() - currentDate.getTime(); // Get time difference
const differenceInMillis = givenDate.getTime() - currentDate.getTime(); const differenceInDays = role !== 'Super Admin' ? Math.ceil(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
const differenceInDays = role !== 'Super Admin' ? Math.floor(differenceInMillis / (1000 * 60 * 60 * 24)) : 30;
let company_id = '', configApp = ''; let company_id = '', configApp = '';
if(role !== 'Super Admin') { if(role !== 'Super Admin') {
@ -153,16 +152,16 @@ const Container1 = () => {
<div className={styles.days}> <div className={styles.days}>
<div className={styles.frameYourCurrentPlan}> <div className={styles.frameYourCurrentPlan}>
<div className={styles.days1}>Days</div> <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>
<div className={styles.rectangleFrame}> <div className={styles.rectangleFrame}>
<div className={styles.rectangleFrameChild} /> <div className={styles.rectangleFrameChild} />
<div style={{ <div style={{
width: `${(400 * (30 - Math.abs(differenceInDays))) / 30}px`, width: `${role !== 'Super Admin' ? ((400 * (30 - Math.abs(differenceInDays))) / 30) : 0}px`,
position: 'relative', 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' : ((30 - Math.abs(differenceInDays)) >= 11 && (30 - Math.abs(differenceInDays)) <= 20) ? '#ffa447' :
'#FF4747', '#FF4747') : '#59b4c3',
zIndex:'1', zIndex:'1',
padding:'5px', padding:'5px',
borderRadius:'15px' borderRadius:'15px'
@ -170,22 +169,27 @@ const Container1 = () => {
</div> </div>
</div> </div>
<div className={styles.daysRemainingUntil}> <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> </div>
<div className={styles.days2}> <div className={styles.days2}>
<div className={styles.storageParent}> <div className={styles.storageParent}>
<div className={styles.storage}>Storage</div> <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>
<div className={styles.rectangleParent}> <div className={styles.rectangleParent}>
<div className={styles.frameChild} /> <div className={styles.frameChild} />
<div style={{ <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', 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' : (storage >= (transaction.type_paket === 'Basic' ? 166.68 : 16.68) && storage <= (transaction.type_paket === 'Basic' ? 333.33 : 33.33)) ? '#ffa447' :
'#FF4747', '#FF4747') : '#59b4c3',
zIndex:'1', zIndex:'1',
padding:'5px', padding:'5px',
borderRadius:'15px' borderRadius:'15px'
@ -193,22 +197,27 @@ const Container1 = () => {
</div> </div>
</div> </div>
<div className={styles.storageRemainingUntil}> <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> </div>
<div className={styles.days3}> <div className={styles.days3}>
<div className={styles.projectParent}> <div className={styles.projectParent}>
<div className={styles.project}>Project</div> <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>
<div className={styles.rectangleGroup}> <div className={styles.rectangleGroup}>
<div className={styles.frameInner} /> <div className={styles.frameInner} />
<div style={{ <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', 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' : (parseInt(totalPage) >= 4 && parseInt(totalPage) <= 7) ? '#ffa447' :
'#FF4747' : '#FF4747', '#FF4747' : '#FF4747') : '#59b4c3',
zIndex:'1', zIndex:'1',
padding:'5px', padding:'5px',
borderRadius:'15px' borderRadius:'15px'
@ -216,7 +225,7 @@ const Container1 = () => {
</div> </div>
</div> </div>
<div className={styles.projectRemainingUntil}> <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> </div>
</div> </div>

Loading…
Cancel
Save