diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index c91369b..9cd39b6 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -188,9 +188,24 @@ function initializationProject() { } function getSatuan() { + const payload = { + "columns": [], + } + if (role_name !== "Super Admin") { + payload.columns.push( + { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, + ) + } else { + payload.columns.push( + { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, + ) + } $.ajax({ - url: `${base_url}satuan/list`, - type: "GET", + data: JSON.stringify(payload), + url: `${base_url}satuan/search`, + type: "POST", + processData: false, + contentType: false, success: function (result) { let satuanList = []; let resSatuan = result.data || [] @@ -514,7 +529,12 @@ function linkLagEditor() { endPopup(); } - + function truncateText(text, maxLength) { + if (text.length > maxLength) { + return text.substring(0, maxLength) + '...'; + } + return text; + } var modal; var editLinkId; @@ -537,10 +557,10 @@ function linkLagEditor() { break; } - linkTitle += " " + gantt.getTask(link.source).text + " -> " + gantt.getTask(link.target).text; + linkTitle += " " + truncateText(gantt.getTask(link.source).text,15) + " -> " + truncateText(gantt.getTask(link.target).text, 15); modal = gantt.modalbox({ - title: linkTitle, + title: `${linkTitle}`, text: "
" + "" + "
", diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index c410033..400b823 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -3,6 +3,8 @@ const readOnly = getUrlParameter("ro"); const proyekId = getUrlParameter("proyek_id"); const timestamp = getUrlParameter("timestamp"); let base_url = getUrlParameter("base_url"); +const role_name = getUrlParameter("role_name"); +const company_id = getUrlParameter("company_id"); const base_url_image = "https://adw-api.ospro.id/assets/image/"; const adwIntegrationUrl = "https://adw-api.ospro.id/api"; @@ -278,7 +280,24 @@ var allColumns = [ { name: "action", label: colHeader, align: "left", min_width: 115, template: colContent, resize: true }, { name: "kode_sortname", label: "Kode / Sortname", align: "center", min_width: 120, editor: editor.kode_sortname, resize: true }, - { name: "text", label: "Activity", tree: true, min_width: 150, editor: editor.text, resize: true }, + { + name: "text", + label: "Activity", + tree: true, + min_width: 150, + editor: editor.text, + resize: true, + template: function (text) { + function truncateText(text, maxLength) { + if (text.length > maxLength) { + return text.substring(0, maxLength) + '...'; + } + return text; + } + const truncatedText = truncateText(text.text, 30); + return `${truncatedText}`; + } + }, { name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) { if (!text.planned_start) { diff --git a/view-mode/function/function.js b/view-mode/function/function.js index 9fa8536..65f0ba6 100644 --- a/view-mode/function/function.js +++ b/view-mode/function/function.js @@ -361,7 +361,12 @@ function linkLagEditor(){ endPopup(); } - + function truncateText(text, maxLength) { + if (text.length > maxLength) { + return text.substring(0, maxLength) + '...'; + } + return text; + } var modal; var editLinkId; @@ -384,10 +389,10 @@ function linkLagEditor(){ break; } - linkTitle += " " + gantt.getTask(link.source).text + " -> " + gantt.getTask(link.target).text; + linkTitle += " " + truncateText(gantt.getTask(link.source).text,15) + " -> " + truncateText(gantt.getTask(link.target).text, 15); modal = gantt.modalbox({ - title: linkTitle, + title: `${linkTitle}`, text: "
" + "" + "
", diff --git a/view-mode/function/ganttConfig.js b/view-mode/function/ganttConfig.js index 1ce3594..ac37726 100644 --- a/view-mode/function/ganttConfig.js +++ b/view-mode/function/ganttConfig.js @@ -2,6 +2,8 @@ const ganttId = getUrlParameter("gantt_id"); const readOnly = getUrlParameter("ro"); const proyekId = getUrlParameter("proyek_id"); let base_url = getUrlParameter("base_url"); +const role_name = getUrlParameter("role_name"); +const company_id = getUrlParameter("company_id"); const adwIntegrationUrl = "https://adw-api.ospro.id/api"; let userToVersionGanttId = 0 @@ -221,7 +223,23 @@ function createColumnsConfig(selectedColumns){ var allColumns = [ // { name: "kode_sortname", label: "Kode / Sortname",align: "center", min_width: 120, resize: true }, - { name: "text", label: "Activity", tree: true, min_width: 150, resize: true }, + { + name: "text", + label: "Activity", + tree: true, + min_width: 150, + resize: true, + template: function (text) { + function truncateText(text, maxLength) { + if (text.length > maxLength) { + return text.substring(0, maxLength) + '...'; + } + return text; + } + const truncatedText = truncateText(text.text, 30); + return `${truncatedText}`; + } + }, // { name: "start_date", label: "Start Date", align: "center", min_width: 80, resize: true }, // { name: "end_date", label: "Finish Date", align: "center", min_width: 80, resize: true }, // { name: "duration", label: "Duration", align: "center", min_width: 50, resize: true },