Browse Source

add function to show report image

pull/1/head
ardhi 2 years ago
parent
commit
c026fa4514
  1. 4
      assets/css/custom.css
  2. 3
      edit-mode/function/ganttConfig.js
  3. 26
      edit-mode/function/reportActivity.js
  4. 19
      edit-mode/index.html

4
assets/css/custom.css

@ -256,3 +256,7 @@ table.dataTable th {
color: #303030 !important; color: #303030 !important;
font-weight: 500; font-weight: 500;
} }
#report-image {
text-align: center;
}

3
edit-mode/function/ganttConfig.js

@ -2,6 +2,7 @@ const ganttId = getUrlParameter("gantt_id");
const readOnly = getUrlParameter("ro"); const readOnly = getUrlParameter("ro");
const proyekId = getUrlParameter("proyek_id"); const proyekId = getUrlParameter("proyek_id");
let base_url = getUrlParameter("base_url"); 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"; const adwIntegrationUrl = "https://adw-api.ospro.id/api";
let userToVersionGanttId = 0 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) { { 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){ if(text.bobot_planning > 100){
gantt.alert("Bobot tidak boleh lebih dari 100%!"); gantt.alert("Bobot tidak boleh lebih dari 100%!");
return;
} }
if(!text.bobot_planning){ if(!text.bobot_planning){
return return
@ -367,6 +369,7 @@ var allColumns = [
progress = progress*100 progress = progress*100
if(progress > 100){ if(progress > 100){
gantt.alert("Bobot tidak boleh lebih dari 100%!"); gantt.alert("Bobot tidak boleh lebih dari 100%!");
return;
} }
let bobot = text.bobot_planning let bobot = text.bobot_planning
let actual = (progress*bobot) / 100 let actual = (progress*bobot) / 100

26
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(`<img src="${base_url_image}${data.image}" class="img-responsive" style="height: 75vh;" />`);
$('#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 () { $("#btn-close-material").on("click", function () {
// setTimeout(() => { // setTimeout(() => {
@ -579,7 +603,7 @@ $(document).ready(function () {
url: `${base_url}report-activity/edit/${id}`, url: `${base_url}report-activity/edit/${id}`,
type: "get", type: "get",
success: function (data) { success: function (data) {
console.log("data", data); // console.log("data report-activity edit", data);
if (data && data.code == 200) { if (data && data.code == 200) {
let dataRes = data.data let dataRes = data.data
// console.log("dataRes", dataRes); // console.log("dataRes", dataRes);

19
edit-mode/index.html

@ -804,6 +804,25 @@
</div> </div>
</div> </div>
</div> </div>
<!-- modal gantt image report activity -->
<div class="modal fade" id="modal-report-image" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header d-flex flex-row justify-content-between" style="width: 100%;">
<h5 class="modal-title" id="report_activity_location">Report Image</h5>
</div>
<div class="modal-body">
<div id="report-image"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal" aria-label="Close">Close</button>
<!-- <button type="button" class="btn btn-primary" id="btn_save_location">Save Location</button> -->
</div>
</div>
</div>
</div>
</body> </body>

Loading…
Cancel
Save