From 6254fed1fc1efb9dee19daef1ae5ede13ac26cd0 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Fri, 11 Aug 2023 16:42:55 +0700 Subject: [PATCH] Show hide save button --- edit-mode/function/function.js | 1 + edit-mode/function/restActivityLink.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/edit-mode/function/function.js b/edit-mode/function/function.js index 19c3e0f..1847960 100644 --- a/edit-mode/function/function.js +++ b/edit-mode/function/function.js @@ -677,6 +677,7 @@ function batchUpdate(){ }).then(function (response) { $("body").removeClass("loading"); localStorage.setItem('batchEntity', ''); + $("#save-activity").hide(); sendStorage(); refresData(); }).catch(function (error) { diff --git a/edit-mode/function/restActivityLink.js b/edit-mode/function/restActivityLink.js index 6e6600c..269062b 100644 --- a/edit-mode/function/restActivityLink.js +++ b/edit-mode/function/restActivityLink.js @@ -10,6 +10,12 @@ gantt.ajax.get({ } }).then(function (xhr) { $("body").removeClass("loading"); + let batchEntity = localStorage.getItem('batchEntity'); + if (!batchEntity || batchEntity == '') { + $("#save-activity").hide(); + } else { + $("#save-activity").show(); + } let data = {}; let response = xhr.responseText; let obj = JSON.parse(response); @@ -64,6 +70,12 @@ function refresData(id) { } }).then(function (xhr) { $("body").removeClass("loading"); + let batchEntity = localStorage.getItem('batchEntity'); + if (!batchEntity || batchEntity == '') { + $("#save-activity").hide(); + } else { + $("#save-activity").show(); + } gantt.clearAll(); let data = {}; let response = xhr.responseText; @@ -198,6 +210,7 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) { toBeSet = [batchEntity] } localStorage.setItem('batchEntity', JSON.stringify(toBeSet)); + $("#save-activity").show(); sendStorage(); // $("body").addClass("loading"); // return gantt.ajax.put({