Working on time tracker

This commit is contained in:
Hillel Coren 2017-09-26 11:54:56 +03:00
parent 4ff0a075ca
commit 16679e9973
2 changed files with 12 additions and 8 deletions

View File

@ -210,7 +210,7 @@
->large()
->appendIcon(Icon::create('floppy-disk'))
->withAttributes([
'data-bind' => 'click: onSaveClick, css: { disabled: ! formChanged() }',
'data-bind' => 'click: onSaveClick, css: { disabled: ! formChanged() || ! isStartEnabled() }',
]) !!}
</center>
</form>
@ -465,7 +465,7 @@
if (isMobile) {
toastr.warning("{{ trans('texts.time_tracker_mobile_help')}}", false, {
timeOut: 10000,
closeButton: true,
closeButton: true,
});
if (isIPhone) {
link = '{{ NINJA_IOS_APP_URL }}';

View File

@ -55,6 +55,7 @@
id: task.public_id(),
action: action,
}
self.isStartEnabled(false);
$.ajax({
dataType: 'json',
type: 'post',
@ -79,8 +80,11 @@
},
error: function(error) {
toastr.error("{{ trans('texts.error_refresh_page') }}");
swal('failed to bulk save');
}
}).always(function() {
setTimeout(function() {
model.isStartEnabled(true);
}, 1000);
});
}
@ -438,7 +442,6 @@
self.save = function(data, isSelected) {
if (self.isValid() !== true) {
toastr.error("{{ trans('texts.error_refresh_page') }}");
swal('not valid on save');
throw self.isValid();
return;
}
@ -453,6 +456,7 @@
} else {
data += '&is_running=0';
}
model.isStartEnabled(false);
$.ajax({
dataType: 'json',
type: method,
@ -502,14 +506,14 @@
}
}
model.refreshTitle();
setTimeout(function() {
model.isStartEnabled(true);
}, 1000);
},
error: function(error) {
toastr.error("{{ trans('texts.error_refresh_page') }}");
swal('failed to save');
},
}).always(function() {
setTimeout(function() {
model.isStartEnabled(true);
}, 1000);
});
}