Browse Source

add url param role_name & company_id, truncate text in leging & activity

pull/1/head
wahyun 10 months ago
parent
commit
279437d600
  1. 30
      edit-mode/function/function.js
  2. 21
      edit-mode/function/ganttConfig.js
  3. 11
      view-mode/function/function.js
  4. 20
      view-mode/function/ganttConfig.js

30
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: `<span title="${gantt.getTask(link.source).text} -> ${gantt.getTask(link.target).text}">${linkTitle}</span>`,
text: "<div>" +
"<label>Lag <input type='number' class='lag-input' /></label>" +
"</div>",

21
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 `<span title="${text.text}">${truncatedText}</span>`;
}
},
{
name: "planned_start", label: "Baseline Start", align: "center", min_width: 80, editor: editor.planned_start, resize: true, template: function (text) {
if (!text.planned_start) {

11
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: `<span title="${gantt.getTask(link.source).text} -> ${gantt.getTask(link.target).text}">${linkTitle}</span>`,
text: "<div>" +
"<label>Lag <input type='number' class='lag-input' /></label>" +
"</div>",

20
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 `<span title="${text.text}">${truncatedText}</span>`;
}
},
// { 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 },

Loading…
Cancel
Save