From 636057266d9d82ba35526ddc872db0df42ae6e00 Mon Sep 17 00:00:00 2001 From: Vikram Chand Date: Sat, 22 Jun 2024 15:52:56 +0530 Subject: [PATCH 1/7] Added: restricted action to user --- .../module-vue3/Vue/vaahvue/pinia/vaah.js | 21 ++++--------------- .../users/Http/Controllers/Controller.php.ejs | 10 +++++++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/skeletons/vaahcms/module-vue3/Vue/vaahvue/pinia/vaah.js b/skeletons/vaahcms/module-vue3/Vue/vaahvue/pinia/vaah.js index 8b869dd..97bcc8c 100644 --- a/skeletons/vaahcms/module-vue3/Vue/vaahvue/pinia/vaah.js +++ b/skeletons/vaahcms/module-vue3/Vue/vaahvue/pinia/vaah.js @@ -120,25 +120,12 @@ export const vaah = defineStore({ //---------------------------------------------------------- processResponse: function (response, show_success) { - if ( - response.data.failed || response.data.success === false - ) { - - if (response.data.messages) { - this.toastErrors(response.data.messages) - } - - if (response.data.errors) { - this.toastErrors(response.data.errors) - } - + if (response.data.errors) { + this.toastErrors(response.data.errors) } - if ( - response.data.success - && response.data.success === true - && response.data.messages - && show_success === true + if (response.data.messages + && show_success === true ) { this.toastSuccess(response.data.messages) } diff --git a/skeletons/vaahcms/users/Http/Controllers/Controller.php.ejs b/skeletons/vaahcms/users/Http/Controllers/Controller.php.ejs index 80c8864..5994475 100644 --- a/skeletons/vaahcms/users/Http/Controllers/Controller.php.ejs +++ b/skeletons/vaahcms/users/Http/Controllers/Controller.php.ejs @@ -259,6 +259,16 @@ class <%= controller_name %>Controller extends Controller { try { + + $is_restricted = <%= model_name %>::restrictedActions($action, $id); + + if(isset($is_restricted['success']) && !$is_restricted['success']) + { + $response = <%= model_name %>::getItem($id); + $response['errors'] = $is_restricted['errors']; + return response()->json($response); + } + $response = <%= model_name %>::itemAction($request,$id,$action); } catch (\Exception $e) { $response = []; From b751851e049502058ba3164f2655ed585190a0bb Mon Sep 17 00:00:00 2001 From: Vikram Chand Date: Sat, 22 Jun 2024 16:04:39 +0530 Subject: [PATCH 2/7] Updated: user panel size --- skeletons/vaahcms/crud-vue3/Vue/pages/template/List.vue.ejs | 2 +- skeletons/vaahcms/users/Vue/pages/template/List.vue.ejs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/skeletons/vaahcms/crud-vue3/Vue/pages/template/List.vue.ejs b/skeletons/vaahcms/crud-vue3/Vue/pages/template/List.vue.ejs index cf12e3b..29dd6ea 100644 --- a/skeletons/vaahcms/crud-vue3/Vue/pages/template/List.vue.ejs +++ b/skeletons/vaahcms/crud-vue3/Vue/pages/template/List.vue.ejs @@ -66,7 +66,7 @@ const toggleCreateMenu = (event) => {
-
+