Browse Source

remove comments

pull/2/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
436a2255e5
  1. 51
      src/const/CustomFunc.js

51
src/const/CustomFunc.js

@ -48,7 +48,6 @@ export const hideAttr = [
"m_users_gender", "m_users_gender",
"m_users_name", "m_users_name",
"m_users_phone_number", "m_users_phone_number",
// "jumlah_pekerjaan"
]; ];
export const salesAttrShow = [ export const salesAttrShow = [
@ -114,7 +113,6 @@ export const formatLabel = (label) => {
let output = ""; let output = "";
if (label.includes("_")) { if (label.includes("_")) {
// if sentences
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);
@ -127,7 +125,7 @@ export const formatLabel = (label) => {
return output; return output;
} }
export const QUERY_BUILDER_FIELD_SALES = export const QUERY_BUILDER_FIELD_SALES =
{ {
"properties->username": { "properties->username": {
label: 'Username', label: 'Username',
@ -167,7 +165,7 @@ export const QUERY_BUILDER_FIELD_SALES =
}, },
} }
export const QUERY_BUILDER_FIELD_CUSTOMER = export const QUERY_BUILDER_FIELD_CUSTOMER =
{ {
"properties->name": { "properties->name": {
label: 'Name', label: 'Name',
@ -199,7 +197,7 @@ export const QUERY_BUILDER_FIELD_CUSTOMER =
}, },
} }
export const QUERY_BUILDER_FIELD_OFFICE = export const QUERY_BUILDER_FIELD_OFFICE =
{ {
"properties->company": { "properties->company": {
label: 'Company', label: 'Company',
@ -224,7 +222,7 @@ export const QUERY_BUILDER_FIELD_OFFICE =
} }
export const getChildrenTree = (data) => export const getChildrenTree = (data) =>
data.map((item, index) => { data.map((item, index) => {
if (item.subproyeks && item.subproyeks.length > 0) { if (item.subproyeks && item.subproyeks.length > 0) {
return { return {
@ -235,32 +233,6 @@ export const getChildrenTree = (data) =>
...item ...item
} }
} }
// else if (item.plannings && item.plannings.length > 0) {
// return {
// "children": getChildrenTree(item.plannings),
// "title": item.nama,
// "key": Math.random(),
// ...item
// }
// }
// OSPRO V2
// else if (item.laporan_plannings && item.laporan_plannings.length > 0) {
// let lp = item.laporan_plannings.map(lp_item => {
// return {
// "nama_subproyek": item.join.m_subproyek_nama,
// "nama_planning": item.nama,
// "nama_user": item.join.m_users_name,
// ...lp_item
// }
// });
// return {
// "key": Math.random(),
// "title": item.nama,
// ...item,
// "laporan_plannings": lp // modify the laporan_plannings
// }
// }
return { return {
"title": item.nama, "title": item.nama,
"key": Math.random(), "key": Math.random(),
@ -275,7 +247,6 @@ export const formatRupiah = (angka, prefix) => {
rupiah = split[0].substr(0, sisa), rupiah = split[0].substr(0, sisa),
ribuan = split[0].substr(sisa).match(/\d{3}/gi); ribuan = split[0].substr(sisa).match(/\d{3}/gi);
var separator = ""; var separator = "";
// tambahkan titik jika yang di input sudah menjadi angka ribuan
if(ribuan){ if(ribuan){
separator = sisa ? '.' : ''; separator = sisa ? '.' : '';
rupiah += separator + ribuan.join('.'); rupiah += separator + ribuan.join('.');
@ -300,15 +271,14 @@ export const formatNumber = (angka) => {
rupiah = split[0].substr(0, sisa), rupiah = split[0].substr(0, sisa),
ribuan = split[0].substr(sisa).match(/\d{3}/gi); ribuan = split[0].substr(sisa).match(/\d{3}/gi);
var separator = ""; var separator = "";
// tambahkan titik jika yang di input sudah menjadi angka ribuan
if(ribuan){ if(ribuan){
separator = sisa ? '.' : ''; separator = sisa ? '.' : '';
rupiah += separator + ribuan.join('.'); rupiah += separator + ribuan.join('.');
} }
rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah; rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;
return rupiah return rupiah
} }
export const formatThousand = (x) => { export const formatThousand = (x) => {
@ -322,22 +292,19 @@ sortBy(data, {
prop: "date", prop: "date",
desc: true, desc: true,
parser: function (item) { parser: function (item) {
//ignore case sensitive
return item.toUpperCase(); return item.toUpperCase();
} }
}); });
*/ */
export const sortBy = (function () { export const sortBy = (function () {
var toString = Object.prototype.toString, var toString = Object.prototype.toString,
// default parser function
parse = function (x) { return x; }, parse = function (x) { return x; },
// gets the item to be sorted
getItem = function (x) { getItem = function (x) {
var isObject = x != null && typeof x === "object"; var isObject = x != null && typeof x === "object";
var isProp = isObject && this.prop in x; var isProp = isObject && this.prop in x;
return this.parser(isProp ? x[this.prop] : x); return this.parser(isProp ? x[this.prop] : x);
}; };
/** /**
* Sorts an array of elements. * Sorts an array of elements.
* *
@ -359,7 +326,7 @@ export const sortBy = (function () {
return cfg.desc * (a < b ? -1 : +(a > b)); return cfg.desc * (a < b ? -1 : +(a > b));
}); });
}; };
}()); }());
@ -373,4 +340,4 @@ export const renderLabelStatus = (text) => {
label = text.toUpperCase(); label = text.toUpperCase();
} }
return label; return label;
} }

Loading…
Cancel
Save