Skip to content

Commit a882ce7

Browse files
committed
fix mail datagrid.
1 parent 7fc913b commit a882ce7

File tree

1 file changed

+76
-2
lines changed

1 file changed

+76
-2
lines changed

packages/Webkul/Admin/src/Resources/views/mail/index.blade.php

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,68 @@ class="primary-button"
4949
{!! view_render_event('krayin.admin.mail.'.request('route').'.datagrid.before') !!}
5050
5151
<!-- DataGrid -->
52-
<x-admin::datagrid
52+
<!-- DataGrid -->
53+
<x-admin::datagrid
5354
ref="datagrid"
5455
src="{{ route('admin.mail.index', request('route')) }}"
55-
/>
56+
>
57+
<template #body="{
58+
isLoading,
59+
available,
60+
applied,
61+
selectAll,
62+
sort,
63+
performAction
64+
}">
65+
<template v-if="isLoading">
66+
<x-admin::shimmer.datagrid.table.body />
67+
</template>
68+
69+
<template v-else>
70+
<div
71+
v-for="record in available.records"
72+
class="row grid items-center gap-2.5 border-b px-4 py-4 text-gray-600 transition-all hover:bg-gray-50 dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-950"
73+
:style="`grid-template-columns: repeat(${gridsCount}, minmax(0, 1fr))`"
74+
>
75+
<!-- Group ID -->
76+
<p>@{{ record.id }}</p>
77+
78+
<!-- Attachments -->
79+
<p :class="record.attachments ? 'icon-attachmetent' : ''">
80+
@{{ record.attachments ?? 'N/A'}}
81+
</p>
82+
83+
<!-- Name -->
84+
<p>@{{ record.name }}</p>
85+
86+
<!-- Subject -->
87+
<p v-html="record.subject"></p>
88+
89+
<!-- Created At -->
90+
<p v-html="record.created_at"></p>
91+
92+
<!-- Actions -->
93+
<div class="flex justify-end">
94+
<a @click="selectedMail=true; editModal(record.actions.find(action => action.index === 'edit'))">
95+
<span
96+
:class="record.actions.find(action => action.index === 'edit')?.icon"
97+
class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center"
98+
>
99+
</span>
100+
</a>
101+
102+
<a @click="performAction(record.actions.find(action => action.index === 'delete'))">
103+
<span
104+
:class="record.actions.find(action => action.index === 'delete')?.icon"
105+
class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200 dark:hover:bg-gray-800 max-sm:place-self-center"
106+
>
107+
</span>
108+
</a>
109+
</div>
110+
</div>
111+
</template>
112+
</template>
113+
</x-admin::datagrid>
56114
57115
{!! view_render_event('krayin.admin.mail.'.request('route').'.datagrid.after') !!}
58116
@@ -268,6 +326,22 @@ class="primary-button"
268326
};
269327
},
270328
329+
computed: {
330+
gridsCount() {
331+
let count = this.$refs.datagrid.available.columns.length;
332+
333+
if (this.$refs.datagrid.available.actions.length) {
334+
++count;
335+
}
336+
337+
if (this.$refs.datagrid.available.massActions.length) {
338+
++count;
339+
}
340+
341+
return count;
342+
},
343+
},
344+
271345
methods: {
272346
toggleModal() {
273347
this.$refs.toggleComposeModal.toggle();

0 commit comments

Comments
 (0)