|
@@ -87,7 +87,7 @@ var draggableVisitTemplateSegmentTemplates = null;
|
|
|
|
|
|
recalculateRowsPositionIndexes: function(table, leftRightPosition){
|
|
|
var self = this;
|
|
|
- showMask();
|
|
|
+ self.forceShowMask();
|
|
|
var currentRowsData = [];
|
|
|
var rows = $(table).find('tbody tr');
|
|
|
$.each(rows, function(i, row){
|
|
@@ -137,7 +137,11 @@ var draggableVisitTemplateSegmentTemplates = null;
|
|
|
toastr.error(response.message);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
fastReload();
|
|
|
+ setTimeout(function(){
|
|
|
+ self.forceHideMask();
|
|
|
+ },1000);
|
|
|
},
|
|
|
initDraggableTable: function(){
|
|
|
var self = this;
|
|
@@ -173,19 +177,26 @@ var draggableVisitTemplateSegmentTemplates = null;
|
|
|
},
|
|
|
updateDraggedDeactivatedRecord: function(position){
|
|
|
var self = this;
|
|
|
- showMask();
|
|
|
+ self.forceShowMask();
|
|
|
var positionUrl = position == 'LEFT' ? 'moveToLeft':'moveToRight';
|
|
|
- $.post('/api/visitTemplateSegmentTemplate/reactivate', {uid: self.draggedDeactivatedRecordUid, memo:'Restored by drag & drop'}, function(response){
|
|
|
+ $.post('/api/visitTemplateSegmentTemplate/reactivate', {uid: self.draggedDeactivatedRecordUid, memo:''}, function(response){
|
|
|
if(response.success){
|
|
|
$.post('/api/visitTemplateSegmentTemplate/'+positionUrl, {uid:self.draggedDeactivatedRecordUid}, function(res){
|
|
|
if(res.success){
|
|
|
self.draggedDeactivatedRecordUid = null;
|
|
|
fastReload();
|
|
|
+ self.forceHideMask();
|
|
|
}
|
|
|
},'json');
|
|
|
}
|
|
|
},'json');
|
|
|
},
|
|
|
+ forceShowMask: function(){
|
|
|
+ $('body').addClass('forced-masking');
|
|
|
+ },
|
|
|
+ forceHideMask: function(){
|
|
|
+ $('body').removeClass('forced-masking');
|
|
|
+ },
|
|
|
init: function(){
|
|
|
this.initDraggableTable();
|
|
|
this.initOnDroppableSection();
|
|
@@ -199,6 +210,17 @@ var draggableVisitTemplateSegmentTemplates = null;
|
|
|
(function() {
|
|
|
function init() {
|
|
|
draggableVisitTemplateSegmentTemplates.init();
|
|
|
+ addMCHook('reArrangePositionIndexes', function() {
|
|
|
+ draggableVisitTemplateSegmentTemplates.forceShowMask();
|
|
|
+ fastReload();
|
|
|
+ setTimeout(function(){
|
|
|
+ var tables = $('.table-dnd');
|
|
|
+ $.each(tables, function(i, table){
|
|
|
+ var tableLeftRightPosition = $(table).data('position');
|
|
|
+ draggableVisitTemplateSegmentTemplates.recalculateRowsPositionIndexes(table, tableLeftRightPosition);
|
|
|
+ });
|
|
|
+ },500);
|
|
|
+ });
|
|
|
}
|
|
|
addMCInitializer('visitTemplateSegmentTemplates', init, '#visitTemplateSegmentTemplates')
|
|
|
|