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. 800
      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. 314
      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. 53
      src/views/SimproV2/Kanban/DialogFormActivity.js
  14. 7
      src/views/SimproV2/Kanban/DialogFormReport.js
  15. 43
      src/views/SimproV2/LimitasiUser/index.js
  16. 326
      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

800
src/const/CustomFunc.js

@ -1,402 +1,398 @@
export const hideAttr = [ export const hideAttr = [
"geom", "geom",
"password", "password",
"id", "id",
"username", "username",
"created_date", "created_date",
"created_by", "created_by",
"modified_date", "modified_date",
"modified_by", "modified_by",
"updated_by", "updated_by",
"updated_date", "updated_date",
"updated_at", "updated_at",
"session_login", "session_login",
"company", "company",
"buffer_radius", "buffer_radius",
"group_sales", "group_sales",
"OBJECTID", "OBJECTID",
"fcm_token", "fcm_token",
"key", "key",
"planning_id", "planning_id",
"subproyek_id", "subproyek_id",
"user_id", "user_id",
"created_at", "created_at",
"_type", // waspang "_type", // waspang
"satuan_id", "satuan_id",
"m_planning_nama", "m_planning_nama",
"m_planning_target", "m_planning_target",
"m_satuan_description", "m_satuan_description",
"m_subproyek_akhir_proyek", "m_subproyek_akhir_proyek",
"m_subproyek_area_kerja", "m_subproyek_area_kerja",
"m_subproyek_biaya", "m_subproyek_biaya",
"m_subproyek_biaya_actual", "m_subproyek_biaya_actual",
"m_subproyek_color_progress", "m_subproyek_color_progress",
"m_subproyek_jumlah_pekerja", "m_subproyek_jumlah_pekerja",
"m_subproyek_ket_progress", "m_subproyek_ket_progress",
"m_subproyek_lokasi_kantor", "m_subproyek_lokasi_kantor",
"m_subproyek_mulai_proyek", "m_subproyek_mulai_proyek",
"m_subproyek_nama", "m_subproyek_nama",
"m_subproyek_persentase_progress_actual", "m_subproyek_persentase_progress_actual",
"m_subproyek_persentase_progress_plan", "m_subproyek_persentase_progress_plan",
"m_users_email", "m_users_email",
"m_users_username", "m_users_username",
"m_planning_address", "m_planning_address",
"m_planning_jumlah_titik", "m_planning_jumlah_titik",
"m_planning_target_planning", "m_planning_target_planning",
"m_satuan_name", "m_satuan_name",
"m_subproyek_pic", "m_subproyek_pic",
"m_users_gender", "m_users_gender",
"m_users_name", "m_users_name",
"m_users_phone_number", "m_users_phone_number",
]; ];
export const salesAttrShow = [ export const salesAttrShow = [
"id", "id",
"group_sales_name", "group_sales_name",
"name", "name",
"phone_number", "phone_number",
"email", "email",
"address" "address"
]; ];
export const dateColumns = [ export const dateColumns = [
"created_date", "created_date",
"modified_date", "modified_date",
"birth_date", "birth_date",
"datesend", // last_waypoint_employee "datesend", // last_waypoint_employee
"wptime", // last_waypoint_employee "wptime", // last_waypoint_employee
"tanggal", "tanggal",
"mulai_tugas", "mulai_tugas",
"akhir_tugas" "akhir_tugas"
]; ];
export const DATE_TIME_FORMAT = "DD-MM-YYYY"; export const DATE_TIME_FORMAT = "DD-MM-YYYY";
export const COLUMN_DAILY_INFO_TABLE = [ export const COLUMN_DAILY_INFO_TABLE = [
{ {
dataField: 'id', dataField: 'id',
text: 'ID', text: 'ID',
hidden: true hidden: true
}, },
{ {
dataField: 'join.group_employee_name', dataField: 'join.group_employee_name',
text: 'Group Employee' text: 'Group Employee'
}, },
{ {
dataField: 'name', dataField: 'name',
text: 'Name' text: 'Name'
}, },
{ {
dataField: 'phone_number', dataField: 'phone_number',
text: 'Phone Number' text: 'Phone Number'
}, },
{ {
dataField: 'email', dataField: 'email',
text: 'Email' text: 'Email'
}, },
{ {
dataField: 'address', dataField: 'address',
text: 'Address' text: 'Address'
}, },
{ {
dataField: 'clock_in', dataField: 'clock_in',
text: 'Clock In' text: 'Clock In'
}, },
{ {
dataField: 'clock_out', dataField: 'clock_out',
text: 'Clock Out' text: 'Clock Out'
} }
] ]
export const formatLabel = (label) => { export const formatLabel = (label) => {
let output = ""; let output = "";
if (label.includes("_")) { if (label.includes("_")) {
let words = label.split("_"); let words = label.split("_");
for (let i=0; i < words.length; i++) { for (let i=0; i < words.length; i++) {
words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1); words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1);
} }
output = words.join(' '); output = words.join(' ');
} }
else { else {
output = label.charAt(0).toUpperCase() + label.slice(1); output = label.charAt(0).toUpperCase() + label.slice(1);
} }
return output; return output;
} }
export const QUERY_BUILDER_FIELD_SALES = export const QUERY_BUILDER_FIELD_SALES =
{ {
"properties->username": { "properties->username": {
label: 'Username', label: 'Username',
type: 'text', type: 'text',
valueSources: ['value'], valueSources: ['value'],
}, },
"properties->name": { "properties->name": {
label: 'Name', label: 'Name',
type: 'text', type: 'text',
valueSources: ['value'], valueSources: ['value'],
}, },
"properties->email": { "properties->email": {
label: 'Email', label: 'Email',
type: 'text', type: 'text',
valueSources: ['value'], valueSources: ['value'],
}, },
"properties->address": { "properties->address": {
label: 'Address', label: 'Address',
type: 'text', type: 'text',
valueSources: ['value'], valueSources: ['value'],
}, },
"properties->phone_number": { "properties->phone_number": {
label: 'Phone Number', label: 'Phone Number',
type: 'number', type: 'number',
valueSources: ['value'], valueSources: ['value'],
}, },
"properties->type_sales": { "properties->type_sales": {
label: 'Type Sales', label: 'Type Sales',
type: 'select', type: 'select',
valueSources: ['value'], valueSources: ['value'],
fieldSettings: { fieldSettings: {
listValues: [ listValues: [
{ value: 'B2B', title: 'B2B' }, { value: 'B2B', title: 'B2B' },
{ value: 'B2C', title: 'B2C' }, { value: 'B2C', title: 'B2C' },
], ],
} }
}, },
} }
export const checkActMenup = (menuPath, actProp) => { export const checkActMenup = (menuPath, actProp) => {
let foundObj; let foundObj;
let entireObj = JSON.parse(localStorage.getItem("menu_login")); let entireObj = JSON.parse(localStorage.getItem("menu_login"));
JSON.stringify(entireObj, (_, nestedValue) => { JSON.stringify(entireObj, (_, nestedValue) => {
if (nestedValue && nestedValue.url === menuPath) { if (nestedValue && nestedValue.url === menuPath) {
foundObj = nestedValue; foundObj = nestedValue;
} }
return nestedValue; return nestedValue;
}); });
let output = false; let output = false;
let actValue = actProp.trim().toLowerCase() let actValue = actProp.trim().toLowerCase()
switch (actValue) { switch (actValue) {
case "create": case "create":
if (foundObj[actValue] === true) { if (foundObj[actValue] === true) {
output = true; output = true;
} else { } else {
output = false; output = false;
} }
case "read": case "read":
if (foundObj[actValue] === true) { if (foundObj[actValue] === true) {
output = true; output = true;
} }
case "update": case "update":
if (foundObj[actValue] === true) { if (foundObj[actValue] === true) {
output = true; output = true;
} }
case "delete": case "delete":
if (foundObj[actValue] === true) { if (foundObj[actValue] === true) {
output = true; output = true;
} }
// default: }
// output = false return output;
} };
return output; export const QUERY_BUILDER_FIELD_CUSTOMER =
// return foundObj[actProp]; {
}; "properties->name": {
label: 'Name',
export const QUERY_BUILDER_FIELD_CUSTOMER = type: 'text',
{ valueSources: ['value'],
"properties->name": { },
label: 'Name', "properties->buffer_radius": {
type: 'text', label: 'Buffer Radius',
valueSources: ['value'], type: 'number',
}, fieldSettings: {
"properties->buffer_radius": { min: 1,
label: 'Buffer Radius', },
type: 'number', valueSources: ['value'],
fieldSettings: { },
min: 1, "properties->address": {
}, label: 'Address',
valueSources: ['value'], type: 'text',
}, valueSources: ['value'],
"properties->address": { },
label: 'Address', "properties->income": {
type: 'text', label: 'Income',
valueSources: ['value'], type: 'number',
}, valueSources: ['value'],
"properties->income": { },
label: 'Income', "properties->store_manager": {
type: 'number', label: 'Store Manager',
valueSources: ['value'], type: 'text',
}, valueSources: ['value'],
"properties->store_manager": { },
label: 'Store Manager', }
type: 'text',
valueSources: ['value'], export const QUERY_BUILDER_FIELD_OFFICE =
}, {
} "properties->company": {
label: 'Company',
export const QUERY_BUILDER_FIELD_OFFICE = type: 'text',
{ valueSources: ['value'],
"properties->company": { },
label: 'Company', "properties->name": {
type: 'text', label: 'Name',
valueSources: ['value'], type: 'text',
}, valueSources: ['value'],
"properties->name": { },
label: 'Name', "properties->employes": {
type: 'text', label: 'Employe',
valueSources: ['value'], type: 'text',
}, valueSources: ['value'],
"properties->employes": { },
label: 'Employe', "properties->address": {
type: 'text', label: 'Alamat',
valueSources: ['value'], type: 'text',
}, valueSources: ['value'],
"properties->address": { },
label: 'Alamat', }
type: 'text',
valueSources: ['value'],
}, export const getChildrenTree = (data) =>
} data.map((item, index) => {
if (item.subproyeks && item.subproyeks.length > 0) {
return {
export const getChildrenTree = (data) => "children": getChildrenTree(item.subproyeks),
data.map((item, index) => { "title": item.nama,
if (item.subproyeks && item.subproyeks.length > 0) { "key": Math.random(),
return { "id": item.id,
"children": getChildrenTree(item.subproyeks), ...item
"title": item.nama, }
"key": Math.random(), }
"id": item.id, return {
...item "title": item.nama,
} "key": Math.random(),
} ...item
return { }
"title": item.nama, })
"key": Math.random(),
...item export const formatRupiah = (angka, prefix) => {
} var number_string = angka.replace(/[^,\d]/g, '').toString(),
}) split = number_string.split(','),
sisa = split[0].length % 3,
export const formatRupiah = (angka, prefix) => { rupiah = split[0].substr(0, sisa),
var number_string = angka.replace(/[^,\d]/g, '').toString(), ribuan = split[0].substr(sisa).match(/\d{3}/gi);
split = number_string.split(','), var separator = "";
sisa = split[0].length % 3, if(ribuan){
rupiah = split[0].substr(0, sisa), separator = sisa ? '.' : '';
ribuan = split[0].substr(sisa).match(/\d{3}/gi); rupiah += separator + ribuan.join('.');
var separator = ""; }
if(ribuan){
separator = sisa ? '.' : ''; rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
rupiah += separator + ribuan.join('.'); return prefix == undefined ? rupiah : (rupiah ? 'Rp. ' + rupiah : '');
} }
rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah; export const renderFormatRupiah = (text, prefix) => {
return prefix == undefined ? rupiah : (rupiah ? 'Rp. ' + rupiah : ''); text = text.split('.')[0];
} if (text) {
return formatRupiah(text, prefix)
export const renderFormatRupiah = (text, prefix) => { } else {
text = text.split('.')[0]; return "-"
if (text) { }
return formatRupiah(text, prefix) }
} else {
return "-" export const formatNumber = (angka) => {
} var number_string = angka.replace(/[^,\d]/g, '').toString(),
} split = number_string.split(','),
sisa = split[0].length % 3,
export const formatNumber = (angka) => { rupiah = split[0].substr(0, sisa),
var number_string = angka.replace(/[^,\d]/g, '').toString(), ribuan = split[0].substr(sisa).match(/\d{3}/gi);
split = number_string.split(','), var separator = "";
sisa = split[0].length % 3, if(ribuan){
rupiah = split[0].substr(0, sisa), separator = sisa ? '.' : '';
ribuan = split[0].substr(sisa).match(/\d{3}/gi); rupiah += separator + ribuan.join('.');
var separator = ""; }
if(ribuan){
separator = sisa ? '.' : ''; rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
rupiah += separator + ribuan.join('.'); return rupiah
} }
rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
return rupiah export const formatThousand = (x) => {
} return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
export const formatThousand = (x) => { export const formatLargeNumber = (num) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); const formattedNum = formatThousand(num);
} if (num >= 1000000000000) {
return `${(num / 1000000000000).toFixed(1)}T`;
export const formatLargeNumber = (num) => { } else if (num >= 1000000000) {
const formattedNum = formatThousand(num); return `${(num / 1000000000).toFixed(1)}M`;
if (num >= 1000000000000) { } else if (num >= 1000000) {
return `${(num / 1000000000000).toFixed(1)}T`; return `${(num / 1000000).toFixed(1)}Jt`;
} else if (num >= 1000000000) { }
return `${(num / 1000000000).toFixed(1)}M`; return formattedNum;
} else if (num >= 1000000) { };
return `${(num / 1000000).toFixed(1)}Jt`; /*
} Using it:
return formattedNum; sortBy(data, {
}; prop: "date",
/* desc: true,
Using it: parser: function (item) {
sortBy(data, { return item.toUpperCase();
prop: "date", }
desc: true, });
parser: function (item) { */
return item.toUpperCase(); export const sortBy = (function () {
} var toString = Object.prototype.toString,
}); parse = function (x) { return x; },
*/ getItem = function (x) {
export const sortBy = (function () { var isObject = x != null && typeof x === "object";
var toString = Object.prototype.toString, var isProp = isObject && this.prop in x;
parse = function (x) { return x; }, return this.parser(isProp ? x[this.prop] : x);
getItem = function (x) { };
var isObject = x != null && typeof x === "object";
var isProp = isObject && this.prop in x; /**
return this.parser(isProp ? x[this.prop] : x); * Sorts an array of elements.
}; *
* @param {Array} array: the collection to sort
/** * @param {Object} cfg: the configuration options
* Sorts an array of elements. * @property {String} cfg.prop: property name (if it is an Array of objects)
* * @property {Boolean} cfg.desc: determines whether the sort is descending
* @param {Array} array: the collection to sort * @property {Function} cfg.parser: function to parse the items to expected type
* @param {Object} cfg: the configuration options * @return {Array}
* @property {String} cfg.prop: property name (if it is an Array of objects) */
* @property {Boolean} cfg.desc: determines whether the sort is descending return function sortby (array, cfg) {
* @property {Function} cfg.parser: function to parse the items to expected type if (!(array instanceof Array && array.length)) return [];
* @return {Array} if (toString.call(cfg) !== "[object Object]") cfg = {};
*/ if (typeof cfg.parser !== "function") cfg.parser = parse;
return function sortby (array, cfg) { cfg.desc = !!cfg.desc ? -1 : 1;
if (!(array instanceof Array && array.length)) return []; return array.sort(function (a, b) {
if (toString.call(cfg) !== "[object Object]") cfg = {}; a = getItem.call(cfg, a);
if (typeof cfg.parser !== "function") cfg.parser = parse; b = getItem.call(cfg, b);
cfg.desc = !!cfg.desc ? -1 : 1; return cfg.desc * (a < b ? -1 : +(a > b));
return array.sort(function (a, b) { });
a = getItem.call(cfg, a); };
b = getItem.call(cfg, b);
return cfg.desc * (a < b ? -1 : +(a > b)); }());
});
};
export const uniqueKeyValues = (arr, key) => {
}()); return [... new Set(arr.map((obj) => {return obj[key]}))];
}
export const uniqueKeyValues = (arr, key) => { export const renderLabelStatus = (text) => {
return [... new Set(arr.map((obj) => {return obj[key]}))]; let label = text;
} if (text === 'fom' || text === 'fot' || text === 'po') {
label = text.toUpperCase();
export const renderLabelStatus = (text) => { }
let label = text; return label;
if (text === 'fom' || text === 'fot' || text === 'po') { }
label = text.toUpperCase();
} export const formatRibuanDecimal = (n) => {
return label; let parts=n.toString().split(".");
} return "Rp. " + parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".") + (parts[1] ? "," + parts[1] : "");
}
export const formatRibuanDecimal = (n) => {
let parts=n.toString().split("."); export const capitalizeFirstLetter = (string) => {
return "Rp. " + parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ".") + (parts[1] ? "," + parts[1] : ""); return string.charAt(0).toUpperCase() + string.slice(1);
} }
export const capitalizeFirstLetter = (string) => {
return string.charAt(0).toUpperCase() + string.slice(1);
}

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>

314
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 || ''}`,
@ -58,7 +42,7 @@ class index extends Component {
} }
}; };
this.columns = [ this.columns = [
{ {
title: this.props.t('action'), title: this.props.t('action'),
@ -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 = {
name: data.name,
description: data.description,
company_id: data.company_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 = { const formData = {
name: data.name, type_paket: data.type_paket,
description: data.description, exp_ospro : data.ExpiredDateOspro,
company_id : data.company_id
} }
const url = PROJECT_ROLE_EDIT(data.id) const url = TRANSACTION_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]

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

@ -6,7 +6,7 @@ import {
import { DatePicker, Tooltip, Drawer, Divider, Layout, Button, Space, Progress } from 'antd'; import { DatePicker, Tooltip, Drawer, Divider, Layout, Button, Space, Progress } from 'antd';
import { import {
CloseOutlined, CloseOutlined,
MinusOutlined, MinusOutlined,
PlusOutlined PlusOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { formatRupiah, formatNumber } from '../../../const/CustomFunc' import { formatRupiah, formatNumber } from '../../../const/CustomFunc'
@ -20,17 +20,17 @@ import {
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
// const { Option } = Select // const { Option } = Select
const DialogFormActivity = ({ const DialogFormActivity = ({
activityProject, activityProject,
openDialogActivity, openDialogActivity,
closeDialogActivity, closeDialogActivity,
handleOpenDialogReport, handleOpenDialogReport,
toggleDialogActivity, toggleDialogActivity,
typeDialogActivity, typeDialogActivity,
proyek_id, proyek_id,
version_gantt_id, version_gantt_id,
idBoard, idBoard,
dataHr, dataHr,
dataEditCard, dataEditCard,
userToActivityDelete, userToActivityDelete,
userToActivityAdd userToActivityAdd
@ -63,9 +63,9 @@ const DialogFormActivity = ({
setId(dataEditCard.id) setId(dataEditCard.id)
setText(dataEditCard.activity) setText(dataEditCard.activity)
setProgress(dataEditCard.persentase_progress) setProgress(dataEditCard.persentase_progress)
setStartDate(moment(dataEditCard.start_date)) setStartDate(moment(dataEditCard.start_date))
setEndDate(moment(dataEditCard.end_date)) setEndDate(moment(dataEditCard.end_date))
dataEditCard.assign_hr.map((item) => { dataEditCard.assign_hr.map((item) => {
item.value = item.id_hr item.value = item.id_hr
item.label = item.name item.label = item.name
@ -91,7 +91,7 @@ const DialogFormActivity = ({
closeDialogActivity('cancel', 'none') closeDialogActivity('cancel', 'none')
setVolumePlan(0) setVolumePlan(0)
} }
const handleSave = () => { const handleSave = () => {
let data = ''; let data = '';
@ -112,7 +112,7 @@ const DialogFormActivity = ({
alert("hr cannot be empty!"); alert("hr cannot be empty!");
return false; return false;
} }
if (typeDialogActivity === "Save") { if (typeDialogActivity === "Save") {
data = { data = {
@ -138,7 +138,7 @@ const DialogFormActivity = ({
} }
userToActivityAdd(dataSaveHr) userToActivityAdd(dataSaveHr)
}) })
IdDeleteHrTemporary.map((item)=>{ IdDeleteHrTemporary.map((item)=>{
@ -149,7 +149,7 @@ const DialogFormActivity = ({
setHrTemporaryAdd([]) setHrTemporaryAdd([])
setIdDeleteHrTemporary([]) setIdDeleteHrTemporary([])
setHrTemporary([]) setHrTemporary([])
progress == 100 ? progress == 100 ?
data = { data = {
"text": text, "text": text,
@ -179,11 +179,10 @@ const DialogFormActivity = ({
} }
const onChangeHr = (newValue, actionMeta) => { const onChangeHr = (newValue, actionMeta) => {
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,
@ -196,18 +195,18 @@ const DialogFormActivity = ({
} else if (actionMeta.action === 'remove-value') { } else if (actionMeta.action === 'remove-value') {
const id = actionMeta.removedValue.id const id = actionMeta.removedValue.id
// userToActivityDelete(id) // userToActivityDelete(id)
for (let k in hrTemporary) { for (let k in hrTemporary) {
if (hrTemporary[k].id == id) { if (hrTemporary[k].id == id) {
setIdDeleteHrTemporary([...IdDeleteHrTemporary, id]) setIdDeleteHrTemporary([...IdDeleteHrTemporary, id])
} }
} }
} }
} }
setHr(newValue) setHr(newValue)
}; };
const increase = () => { const increase = () => {
let newPercent = progress + 10; let newPercent = progress + 10;
if (newPercent > 100) { if (newPercent > 100) {
@ -216,7 +215,7 @@ const DialogFormActivity = ({
setProgress(newPercent); setProgress(newPercent);
}; };
const decline = () => { const decline = () => {
let newPercent = progress - 10; let newPercent = progress - 10;
if (newPercent < 0) { if (newPercent < 0) {
@ -240,13 +239,13 @@ const DialogFormActivity = ({
<Label className="capitalize">Start Date</Label> <Label className="capitalize">Start Date</Label>
<DatePicker style={{ width: "100%" }} value={startDate} onChange={(dateItem, dateString) => { <DatePicker style={{ width: "100%" }} value={startDate} onChange={(dateItem, dateString) => {
dateItem.set({hour:0,minute:0,second:0}) dateItem.set({hour:0,minute:0,second:0})
setStartDate(dateItem)}} setStartDate(dateItem)}}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={12}> <Col md={12}>
<FormGroup> <FormGroup>
<Label className="capitalize">End date</Label> <Label className="capitalize">End date</Label>
<DatePicker style={{ width: "100%" }} value={endDate} onChange={(dateItem, dateString) => { <DatePicker style={{ width: "100%" }} value={endDate} onChange={(dateItem, dateString) => {
dateItem.set({hour:23,minute:59,second:59}) dateItem.set({hour:23,minute:59,second:59})
setEndDate(dateItem)}} setEndDate(dateItem)}}

7
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,
@ -378,7 +373,7 @@ const DialogFormReport = ({
onChange={onChangeHr} onChange={onChangeHr}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col md={12}> <Col md={12}>
<FormGroup> <FormGroup>
<Label className="capitalize">Description</Label> <Label className="capitalize">Description</Label>

43
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)
@ -105,7 +92,7 @@ class index extends Component {
} }
} }
onConfirmDelete = async () => { onConfirmDelete = async () => {
const { idDelete } = this.state const { idDelete } = this.state
@ -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();
}) })
} }
@ -317,7 +304,7 @@ 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('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>
</Tooltip> </Tooltip>

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

@ -1,154 +1,172 @@
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';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, company_id, listCompany, role_name }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
const [uom, setUom] = useState('') const [uom, setUom] = useState('')
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const [unitPrice, setUnitPrice] = useState() const [unitPrice, setUnitPrice] = useState()
const [selectedCompany, setSelectedCompany] = useState(null) const [selectedCompany, setSelectedCompany] = useState(null)
const { t } = useTranslation(); const [isMultiLocation, setIsMultiLocation] = useState(false);
const { t } = useTranslation();
const handleIsMultiLocationChange = () => {
useEffect(() => { setIsMultiLocation(!isMultiLocation);
if (typeDialog === "Edit") { };
setId(dataEdit.id)
setDescription(dataEdit.description) useEffect(() => {
setUnitPrice(dataEdit.unit_price) if (typeDialog === "Edit") {
setUom(dataEdit.uom) setId(dataEdit.id)
setProjectType(dataEdit.name) setDescription(dataEdit.description)
setSelectedCompany(dataEdit.company_id) setUnitPrice(dataEdit.unit_price)
} else { setUom(dataEdit.uom)
setId(0) setProjectType(dataEdit.name)
} setSelectedCompany(dataEdit.company_id)
}, [dataEdit, openDialog]) setIsMultiLocation(dataEdit.is_multiLocation)
} else {
const handleSave = () => { handleClear()
let data = ''; }
if (typeDialog === "Save") { }, [dataEdit, openDialog])
if (role_name === 'Super Admin') {
company_id = selectedCompany const handleSave = () => {
} let data = '';
data = { if (role_name === 'Super Admin') {
name: projectType, company_id = selectedCompany
description, }
company_id: company_id if (typeDialog === "Save") {
} data = {
name: projectType,
closeDialog('save', data); description,
} else { company_id: parseInt(company_id),
if (role_name === 'Super Admin') { is_multiLocation: isMultiLocation
company_id = selectedCompany }
}
data = { closeDialog('save', data);
id, } else {
name: projectType, data = {
description, id,
company_id: company_id name: projectType,
} description,
closeDialog('edit', data); company_id: parseInt(company_id),
} is_multiLocation: isMultiLocation
setId(0) }
setDescription('') closeDialog('edit', data);
setSelectedCompany(null) }
} handleClear();
}
const handleCancel = () => {
closeDialog('cancel', 'none') const handleClear = () => {
setId(0) setId(0)
setDescription('') setProjectType('')
setSelectedCompany(null) setDescription('')
} setSelectedCompany(null)
setIsMultiLocation(false)
const onChangeCompany = (val) => {
setSelectedCompany(val); }
};
const handleCancel = () => {
const renderForm = () => { closeDialog('cancel', 'none');
return ( handleClear();
<Form> }
<Row>
<Col md={6}> const onChangeCompany = (val) => {
<FormGroup> setSelectedCompany(val);
<Label className="capitalize">{t('nameProjectType')}</Label> };
<Input type="text" value={projectType} onChange={(e) => setProjectType(e.target.value)} placeholder={t('inputName')} />
</FormGroup> const renderForm = () => {
</Col> return (
<Col md={6}> <Form>
<FormGroup> <Row>
<Label className="capitalize">{t('description')}</Label> <Col md={6}>
<Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} /> <FormGroup>
</FormGroup> <Label className="capitalize">{t('nameProjectType')}</Label>
</Col> <Input type="text" value={projectType} onChange={(e) => setProjectType(e.target.value)} placeholder={t('inputName')} />
</Row> </FormGroup>
{role_name === 'Super Admin' && </Col>
<Row> <Col md={6}>
<Col md={6}> <FormGroup>
<FormGroup> <Label className="capitalize">{t('description')}</Label>
<Label className="capitalize"> <Input row="4" type="textarea" value={description} onChange={(e) => setDescription(e.target.value)} placeholder={t('inputDescription')} />
{t('company')}<span style={{ color: "red" }}>*</span> </FormGroup>
</Label> </Col>
<Select </Row>
showSearch <Row>
filterOption={(inputValue, option) => <Col md={6}>
option.children.toLowerCase().includes(inputValue.toLowerCase()) <FormGroup>
} <Label className="capitalize">Is Multi Location</Label>
value={selectedCompany} <div>
defaultValue={selectedCompany} <CustomInput type="switch" id="isMultiLocationSwitch" name="isMultiLocationSwitch" checked={isMultiLocation} onChange={handleIsMultiLocationChange} />
onChange={onChangeCompany} </div>
style={{ width: "100%" }} </FormGroup>
> </Col>
{listCompany.map((res) => ( {
<Option key={res.id} value={res.id}> role_name === 'Super Admin' && (
{res.company_name} <Col md={6}>
</Option> <FormGroup>
))} <Label className="capitalize">
</Select> {t('company')}<span style={{ color: "red" }}>*</span>
</FormGroup> </Label>
</Col> <Select
</Row> showSearch
} filterOption={(inputValue, option) =>
</Form> option.children.toLowerCase().includes(inputValue.toLowerCase())
) }
} value={selectedCompany}
defaultValue={selectedCompany}
onChange={onChangeCompany}
return ( style={{ width: "100%" }}
<> >
<Modal size="lg" isOpen={openDialog} toggle={toggleDialog}> {listCompany.map((res) => (
<ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Save" ? `Add` : "Edit"} Resource</ModalHeader> <Option key={res.id} value={res.id}>
<ModalBody> {res.company_name}
{renderForm()} </Option>
</ModalBody> ))}
<ModalFooter> </Select>
<Button color="primary" onClick={() => handleSave()}>{typeDialog}</Button>{' '} </FormGroup>
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>{t('cancel')}</Button> </Col>
</ModalFooter> )
</Modal> }
</Row>
{/* <DialogMap </Form>
openDialog={openDialogMap} )
closeDialog={handleCloseDialogMap} }
toggleDialog={() => toggleMapDialog}
dataEdit={dataEdit}
workArea_={workArea} return (
lat_={lat} <>
lon_={lon} <Modal size="lg" isOpen={openDialog} toggle={toggleDialog}>
radius_={radius} <ModalHeader className="capitalize" toggle={closeDialog}>{typeDialog == "Save" ? `Add` : "Edit"} Resource</ModalHeader>
/> */} <ModalBody>
</> {renderForm()}
) </ModalBody>
<ModalFooter>
} <Button color="primary" onClick={() => handleSave()}>{typeDialog}</Button>{' '}
<Button className="capitalize" color="secondary" onClick={() => handleCancel()}>{t('cancel')}</Button>
export default DialogForm; </ModalFooter>
</Modal>
{/* <DialogMap
openDialog={openDialogMap}
closeDialog={handleCloseDialogMap}
toggleDialog={() => toggleMapDialog}
dataEdit={dataEdit}
workArea_={workArea}
lat_={lat}
lon_={lon}
radius_={radius}
/> */}
</>
)
}
export default DialogForm;

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