From c026fa45149a21b255be8166aee1d9a8fddc9063 Mon Sep 17 00:00:00 2001 From: ardhi Date: Mon, 13 Feb 2023 20:28:46 +0700 Subject: [PATCH] add function to show report image --- assets/css/custom.css | 4 ++++ edit-mode/function/ganttConfig.js | 3 +++ edit-mode/function/reportActivity.js | 26 +++++++++++++++++++++++++- edit-mode/index.html | 19 +++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/assets/css/custom.css b/assets/css/custom.css index ac37af5..5fda87e 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -256,3 +256,7 @@ table.dataTable th { color: #303030 !important; font-weight: 500; } + +#report-image { + text-align: center; +} diff --git a/edit-mode/function/ganttConfig.js b/edit-mode/function/ganttConfig.js index 76704fd..24d8460 100644 --- a/edit-mode/function/ganttConfig.js +++ b/edit-mode/function/ganttConfig.js @@ -2,6 +2,7 @@ const ganttId = getUrlParameter("gantt_id"); const readOnly = getUrlParameter("ro"); const proyekId = getUrlParameter("proyek_id"); let base_url = getUrlParameter("base_url"); +const base_url_image = "https://adw-api.ospro.id/assets/image/"; const adwIntegrationUrl = "https://adw-api.ospro.id/api"; let userToVersionGanttId = 0 @@ -350,6 +351,7 @@ var allColumns = [ { name: "bobot_planning", label: "Bobot Activity (%)", align: "center", editor: editor.bobot_planning, resize: true, min_width: 115, template: function (text) { if(text.bobot_planning > 100){ gantt.alert("Bobot tidak boleh lebih dari 100%!"); + return; } if(!text.bobot_planning){ return @@ -367,6 +369,7 @@ var allColumns = [ progress = progress*100 if(progress > 100){ gantt.alert("Bobot tidak boleh lebih dari 100%!"); + return; } let bobot = text.bobot_planning let actual = (progress*bobot) / 100 diff --git a/edit-mode/function/reportActivity.js b/edit-mode/function/reportActivity.js index 005dc69..ad7cf81 100644 --- a/edit-mode/function/reportActivity.js +++ b/edit-mode/function/reportActivity.js @@ -470,6 +470,30 @@ $(document).ready(function () { }); }); + $("#table_activity_material_actual").on("click", ".btn-ram-image", function () { + let id = $(this).data('id'); + $.ajax({ + url: `${base_url}image/${id}/report_activity`, + type:"GET", + success: function (result) { + let data = result.data; + if (!data) { + gantt.alert({type: "error", text: "Failed to get report image"}); + return false; + } + + if (data && data.image) { + $("#report-image").html(``); + $('#modal-report-image').modal('show'); + } + // kalo gambarnya banyak belum di handle... + }, + error: function (data) { + gantt.alert({type: "error", text: "Failed to get report image"}); + } + }); + }); + $("#btn-close-material").on("click", function () { // setTimeout(() => { @@ -579,7 +603,7 @@ $(document).ready(function () { url: `${base_url}report-activity/edit/${id}`, type: "get", success: function (data) { - console.log("data", data); + // console.log("data report-activity edit", data); if (data && data.code == 200) { let dataRes = data.data // console.log("dataRes", dataRes); diff --git a/edit-mode/index.html b/edit-mode/index.html index 29860a5..232c758 100644 --- a/edit-mode/index.html +++ b/edit-mode/index.html @@ -804,6 +804,25 @@ + + + +