active === 0)class="text-disabled"@endif>
- {{ $actions[$task->action] }} |
+ {{-- {{ $actions[$task->action] }} | --}}
+ {{ $actions[$task->action] }} |
{{ $task->data }} |
{{ Carbon::parse($task->last_run)->toDayDateTimeString() }} ({{ Carbon::parse($task->last_run)->diffForHumans() }}) |
@@ -70,82 +71,85 @@ $(document).ready(function () {
$('.server-tasks').addClass('active');
$('[data-toggle="tooltip"]').tooltip();
- $('[data-action="delete-task"]').click(function (event) {
- var self = $(this);
- swal({
- type: 'error',
- title: 'Delete Task?',
- text: 'Are you sure you want to delete this task? There is no undo.',
- showCancelButton: true,
- allowOutsideClick: true,
- closeOnConfirm: false,
- confirmButtonText: 'Delete Task',
- confirmButtonColor: '#d9534f',
- showLoaderOnConfirm: true
- }, function () {
- $.ajax({
- method: 'DELETE',
- url: '{{ route('server.tasks', $server->uuidShort) }}/delete/' + self.data('id'),
- headers: {
- 'X-CSRF-TOKEN': '{{ csrf_token() }}'
- }
- }).done(function (data) {
- swal({
- type: 'success',
- title: '',
- text: 'Task has been deleted.'
- });
- self.parent().parent().slideUp();
- }).fail(function (jqXHR) {
- console.error(jqXHR);
- swal({
- type: 'error',
- title: 'Whoops!',
- text: 'An error occured while attempting to delete this task.'
+ @can('delete-task', $server)
+ $('[data-action="delete-task"]').click(function (event) {
+ var self = $(this);
+ swal({
+ type: 'error',
+ title: 'Delete Task?',
+ text: 'Are you sure you want to delete this task? There is no undo.',
+ showCancelButton: true,
+ allowOutsideClick: true,
+ closeOnConfirm: false,
+ confirmButtonText: 'Delete Task',
+ confirmButtonColor: '#d9534f',
+ showLoaderOnConfirm: true
+ }, function () {
+ $.ajax({
+ method: 'DELETE',
+ url: '{{ route('server.tasks', $server->uuidShort) }}/delete/' + self.data('id'),
+ headers: {
+ 'X-CSRF-TOKEN': '{{ csrf_token() }}'
+ }
+ }).done(function (data) {
+ swal({
+ type: 'success',
+ title: '',
+ text: 'Task has been deleted.'
+ });
+ self.parent().parent().slideUp();
+ }).fail(function (jqXHR) {
+ console.error(jqXHR);
+ swal({
+ type: 'error',
+ title: 'Whoops!',
+ text: 'An error occured while attempting to delete this task.'
+ });
});
});
});
- });
-
- $('[data-action="toggle-task"]').click(function (event) {
- var self = $(this);
- swal({
- type: 'info',
- title: 'Toggle Task',
- text: 'This will toggle the selected task.',
- showCancelButton: true,
- allowOutsideClick: true,
- closeOnConfirm: false,
- confirmButtonText: 'Continue',
- showLoaderOnConfirm: true
- }, function () {
- $.ajax({
- method: 'POST',
- url: '{{ route('server.tasks', $server->uuidShort) }}/toggle/' + self.data('id'),
- headers: {
- 'X-CSRF-TOKEN': '{{ csrf_token() }}'
- }
- }).done(function (data) {
- swal({
- type: 'success',
- title: '',
- text: 'Task has been toggled.'
- });
- if (data.status !== 1) {
- self.parent().parent().addClass('text-disabled');
- } else {
- self.parent().parent().removeClass('text-disabled');
- }
- }).fail(function (jqXHR) {
- console.error(jqXHR);
- swal({
- type: 'error',
- title: 'Whoops!',
- text: 'An error occured while attempting to toggle this task.'
+ @endcan
+ @can('toggle-task', $server)
+ $('[data-action="toggle-task"]').click(function (event) {
+ var self = $(this);
+ swal({
+ type: 'info',
+ title: 'Toggle Task',
+ text: 'This will toggle the selected task.',
+ showCancelButton: true,
+ allowOutsideClick: true,
+ closeOnConfirm: false,
+ confirmButtonText: 'Continue',
+ showLoaderOnConfirm: true
+ }, function () {
+ $.ajax({
+ method: 'POST',
+ url: '{{ route('server.tasks', $server->uuidShort) }}/toggle/' + self.data('id'),
+ headers: {
+ 'X-CSRF-TOKEN': '{{ csrf_token() }}'
+ }
+ }).done(function (data) {
+ swal({
+ type: 'success',
+ title: '',
+ text: 'Task has been toggled.'
+ });
+ if (data.status !== 1) {
+ self.parent().parent().addClass('text-disabled');
+ } else {
+ self.parent().parent().removeClass('text-disabled');
+ }
+ }).fail(function (jqXHR) {
+ console.error(jqXHR);
+ swal({
+ type: 'error',
+ title: 'Whoops!',
+ text: 'An error occured while attempting to toggle this task.'
+ });
});
});
});
- });
+ @endcan
});
diff --git a/resources/views/server/users/new.blade.php b/resources/views/server/users/new.blade.php
index c809f7bed..44f35671f 100644
--- a/resources/views/server/users/new.blade.php
+++ b/resources/views/server/users/new.blade.php
@@ -214,6 +214,49 @@
+
+
+ Task Management
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@can('edit-subuser', $server)
diff --git a/resources/views/server/users/view.blade.php b/resources/views/server/users/view.blade.php
index 50e49f6f3..f9851934f 100644
--- a/resources/views/server/users/view.blade.php
+++ b/resources/views/server/users/view.blade.php
@@ -203,6 +203,49 @@
+
+
+ Task Management
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@can('edit-subuser', $server)
|