File tree Expand file tree Collapse file tree 8 files changed +63
-45
lines changed
crud-vue3/Vue/pages/template
module-vue3/Vue/vaahvue/pinia
settings/Vue/pages/template
taxonomies/Vue/pages/template/components Expand file tree Collapse file tree 8 files changed +63
-45
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ const toggleCreateMenu = (event) => {
6666
6767 <div class =" grid" v-if =" store.assets" >
6868
69- <div :class =" route.params && route.params.id ? 'col-6' : 'col' " >
69+ <div :class =" 'col-'+store.list_view_width " >
7070 <Panel class =" is-small" >
7171
7272 <template class =" p-1" #header >
Original file line number Diff line number Diff line change @@ -120,25 +120,12 @@ export const vaah = defineStore({
120120
121121 //----------------------------------------------------------
122122 processResponse : function ( response , show_success ) {
123- if (
124- response . data . failed || response . data . success === false
125- ) {
126-
127- if ( response . data . messages ) {
128- this . toastErrors ( response . data . messages )
129- }
130-
131- if ( response . data . errors ) {
132- this . toastErrors ( response . data . errors )
133- }
134-
123+ if ( response . data . errors ) {
124+ this . toastErrors ( response . data . errors )
135125 }
136126
137- if (
138- response . data . success
139- && response . data . success === true
140- && response . data . messages
141- && show_success === true
127+ if ( response . data . messages
128+ && show_success === true
142129 ) {
143130 this . toastSuccess ( response . data . messages )
144131 }
Original file line number Diff line number Diff line change @@ -11,14 +11,20 @@ const store = use<%= model_name %>Store();
1111const route = useRoute ();
1212const useVaah = vaah ();
1313
14+ const menu_pt = ref ({
15+ menuitem : ({ props }) => ({
16+ class: route .path === props .item .route ? ' p-focus' : ' '
17+ })
18+ });
19+
1420const sidebar_menu_items = ref ([
1521 {
1622 label: ' <%= controller_name %>' ,
1723 items: [
1824 {
1925 label: ' General' ,
2026 icon: ' pi pi-cog' ,
21- to : { path : ' /<%= controller_name_lower %>/general' }
27+ route : ' /<%= controller_name_lower %>/general'
2228 }
2329 ]},
2430]);
@@ -37,7 +43,21 @@ onMounted(async () => {
3743<template >
3844 <div class =" grid justify-content-center" >
3945 <div class =" col-fixed" >
40- <Menu :model =" sidebar_menu_items" />
46+ <Menu :model =" sidebar_menu_items"
47+ :pt =" menu_pt" >
48+ <template #item =" { item, props }" >
49+ <router-link v-if =" item.route" v-slot =" { href, navigate }" :to =" item.route" custom >
50+ <a v-ripple :href =" href" v-bind =" props.action" @click =" navigate" >
51+ <span :class =" item.icon" />
52+ <span class =" ml-2" >{{ item.label }}</span >
53+ </a >
54+ </router-link >
55+ <a v-else v-ripple :href =" item.url" :target =" item.target" v-bind =" props.action" >
56+ <span :class =" item.icon" />
57+ <span class =" ml-2" >{{ item.label }}</span >
58+ </a >
59+ </template >
60+ </Menu >
4161 </div >
4262 <div class =" col" >
4363 <router-view ></router-view >
Original file line number Diff line number Diff line change @@ -67,9 +67,7 @@ const openTaxonomyTypeModal = () => {
6767
6868
6969 <Column field =" slug" header =" Slug"
70- :sortable =" false"
71- class =" flex align-items-center"
72- >
70+ :sortable =" false" >
7371 <template #body =" prop" >
7472 {{ prop.data.slug }}
7573
@@ -81,13 +79,11 @@ const openTaxonomyTypeModal = () => {
8179 />
8280 </template >
8381 </Column >
84- < column ></ column >
82+
8583 <Column field =" type" header =" Type"
86- :sortable =" false"
87- class =" flex align-items-center"
88- >
84+ :sortable =" false" >
8985 <template #body =" prop" >
90- < p v-if = " prop.data.type " > {{ prop.data.type.name }} </ p >
86+ {{ prop.data.type.name }}
9187
9288 <Button class =" p-button-tiny p-button-text"
9389 data-testid =" <%= controller_name_lower %>-table-to-manage-taxonomy-type-modal"
@@ -104,7 +100,7 @@ const openTaxonomyTypeModal = () => {
104100 :sortable =" true"
105101 >
106102 <template #body =" prop" >
107- {{ useVaah.ago (prop.data.updated_at) }}
103+ {{ useVaah.toLocalTimeShortFormat (prop.data.updated_at) }}
108104 </template >
109105 </Column >
110106
Original file line number Diff line number Diff line change @@ -259,6 +259,16 @@ class <%= controller_name %>Controller extends Controller
259259 {
260260
261261 try {
262+
263+ $is_restricted = <%= model_name %> ::restrictedActions($action, $id);
264+
265+ if(isset($is_restricted['success']) && !$is_restricted['success'])
266+ {
267+ $response = <%= model_name %> ::getItem($id);
268+ $response['errors'] = $is_restricted['errors'];
269+ return response()->json($response);
270+ }
271+
262272 $response = <%= model_name %> ::itemAction($request,$id,$action);
263273 } catch (\Exception $e) {
264274 $response = [];
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ onMounted(async () => {
5050<template >
5151 <div class =" grid" >
5252 <div :class =" 'col-'+store.list_view_width" >
53- <Panel >
53+ <Panel class = " is-small " >
5454 <template class =" p-1" #header >
5555 <div class =" flex flex-row" >
5656 <div >
Original file line number Diff line number Diff line change @@ -53,21 +53,7 @@ const toggleBulkMenuState = (event) => {
5353 :popup =" true"
5454 />
5555 <!-- /selected_menu-->
56-
57- <!-- bulk_menu-->
58- <Button class =" p-button-sm ml-1"
59- icon =" pi pi-ellipsis-h"
60- aria-haspopup =" true"
61- aria-controls =" bulk_menu_state"
62- data-testid =" <%= controller_name_lower %>-action_bulk_menu"
63- @click =" toggleBulkMenuState"
64- />
65-
66- <Menu ref =" bulk_menu_state"
67- :model =" store.list_bulk_menu"
68- :popup =" true"
69- />
70- <!-- /bulk_menu-->
56+
7157 </div >
7258 <!-- /left-->
7359
@@ -109,6 +95,22 @@ const toggleBulkMenuState = (event) => {
10995 data-testid =" <%= controller_name_lower %>-action_reset"
11096 @click =" store.resetQuery()"
11197 />
98+
99+ <!-- bulk_menu-->
100+ <Button
101+ type =" button"
102+ @click =" toggleBulkMenuState"
103+ severity =" danger" outlined
104+ data-testid =" <%= controller_name_lower %>-actions-bulk-menu"
105+ aria-haspopup =" true"
106+ aria-controls =" bulk_menu_state"
107+ class =" ml-1 p-button-sm" >
108+ <i class =" pi pi-ellipsis-v" ></i >
109+ </Button >
110+ <Menu ref =" bulk_menu_state"
111+ :model =" store.list_bulk_menu"
112+ :popup =" true" />
113+ <!-- /bulk_menu-->
112114 </div >
113115 </div >
114116
Original file line number Diff line number Diff line change @@ -591,6 +591,9 @@ export const use<%= model_name %>Store = defineStore({
591591 method: method,
592592 show_success: false
593593 };
594+
595+ options.params.query = vaah().clone(this.query);
596+
594597 await vaah().ajax(
595598 url,
596599 this.updateListAfter,
You can’t perform that action at this time.
0 commit comments