@@ -11,6 +11,9 @@ import {
1111 faCity ,
1212 faPenToSquare ,
1313 faTrash ,
14+ faCirclePause ,
15+ faCirclePlay ,
16+ faCircleCheck ,
1417} from ' @fortawesome/free-solid-svg-icons'
1518import { FontAwesomeIcon } from ' @fortawesome/vue-fontawesome'
1619import {
@@ -34,6 +37,8 @@ import { computed, ref, watch } from 'vue'
3437import CreateOrEditResellerDrawer from ' ./CreateOrEditResellerDrawer.vue'
3538import { useI18n } from ' vue-i18n'
3639import DeleteResellerModal from ' ./DeleteResellerModal.vue'
40+ import SuspendResellerModal from ' ./SuspendResellerModal.vue'
41+ import ReactivateResellerModal from ' ./ReactivateResellerModal.vue'
3742import { savePageSizeToStorage } from ' @/lib/tablePageSize'
3843import { useResellers } from ' @/queries/resellers'
3944import { canManageResellers } from ' @/lib/permissions'
@@ -59,6 +64,8 @@ const {
5964const currentReseller = ref <Reseller | undefined >()
6065const isShownCreateOrEditResellerDrawer = ref (false )
6166const isShownDeleteResellerDrawer = ref (false )
67+ const isShownSuspendResellerModal = ref (false )
68+ const isShownReactivateResellerModal = ref (false )
6269
6370const resellersPage = computed (() => {
6471 return state .value .data ?.resellers
@@ -111,22 +118,53 @@ function showDeleteResellerDrawer(reseller: Reseller) {
111118 isShownDeleteResellerDrawer .value = true
112119}
113120
121+ function showSuspendResellerModal(reseller : Reseller ) {
122+ currentReseller .value = reseller
123+ isShownSuspendResellerModal .value = true
124+ }
125+
126+ function showReactivateResellerModal(reseller : Reseller ) {
127+ currentReseller .value = reseller
128+ isShownReactivateResellerModal .value = true
129+ }
130+
114131function onCloseDrawer() {
115132 isShownCreateOrEditResellerDrawer .value = false
116133 emit (' close-drawer' )
117134}
118135
119136function getKebabMenuItems(reseller : Reseller ) {
120- return [
121- {
137+ const items = []
138+
139+ if (canManageResellers ()) {
140+ if (reseller .suspended_at ) {
141+ items .push ({
142+ id: ' reactivateReseller' ,
143+ label: t (' common.reactivate' ),
144+ icon: faCirclePlay ,
145+ action : () => showReactivateResellerModal (reseller ),
146+ disabled: asyncStatus .value === ' loading' ,
147+ })
148+ } else {
149+ items .push ({
150+ id: ' suspendReseller' ,
151+ label: t (' common.suspend' ),
152+ icon: faCirclePause ,
153+ action : () => showSuspendResellerModal (reseller ),
154+ disabled: asyncStatus .value === ' loading' ,
155+ })
156+ }
157+
158+ items .push ({
122159 id: ' deleteReseller' ,
123160 label: t (' common.delete' ),
124161 icon: faTrash ,
125162 danger: true ,
126163 action : () => showDeleteResellerDrawer (reseller ),
127164 disabled: asyncStatus .value === ' loading' ,
128- },
129- ]
165+ })
166+ }
167+ return items
130168}
131169
132170const onSort = (payload : SortEvent ) => {
@@ -186,6 +224,7 @@ const onSort = (payload: SortEvent) => {
186224 :options =" [
187225 { id: 'name', label: t('organizations.name') },
188226 { id: 'description', label: t('organizations.description') },
227+ { id: 'suspended_at', label: t('common.status') },
189228 ]"
190229 :open-menu-aria-label =" t('ne_dropdown.open_menu')"
191230 :sort-by-label =" t('sort.sort_by')"
@@ -233,6 +272,9 @@ const onSort = (payload: SortEvent) => {
233272 <NeTableHeadCell sortable column-key =" description" @sort =" onSort" >{{
234273 $t('organizations.description')
235274 }}</NeTableHeadCell >
275+ <NeTableHeadCell sortable column-key =" suspended_at" @sort =" onSort" >{{
276+ $t('common.status')
277+ }}</NeTableHeadCell >
236278 <NeTableHeadCell >
237279 <!-- no header for actions -->
238280 </NeTableHeadCell >
@@ -245,6 +287,30 @@ const onSort = (payload: SortEvent) => {
245287 <NeTableCell :data-label =" $t('organizations.description')" >
246288 {{ item.description || '-' }}
247289 </NeTableCell >
290+ <NeTableCell :data-label =" $t('common.status')" >
291+ <div class =" flex items-center gap-2" >
292+ <template v-if =" item .suspended_at " >
293+ <FontAwesomeIcon
294+ :icon =" faCirclePause"
295+ class =" size-4 text-gray-700 dark:text-gray-400"
296+ aria-hidden =" true"
297+ />
298+ <span >
299+ {{ t('common.suspended') }}
300+ </span >
301+ </template >
302+ <template v-else >
303+ <FontAwesomeIcon
304+ :icon =" faCircleCheck"
305+ class =" size-4 text-green-600 dark:text-green-400"
306+ aria-hidden =" true"
307+ />
308+ <span >
309+ {{ t('common.enabled') }}
310+ </span >
311+ </template >
312+ </div >
313+ </NeTableCell >
248314 <NeTableCell :data-label =" $t('common.actions')" >
249315 <div v-if =" canManageResellers()" class =" -ml-2.5 flex gap-2 xl:ml-0 xl:justify-end" >
250316 <NeButton
@@ -301,5 +367,17 @@ const onSort = (payload: SortEvent) => {
301367 :reseller =" currentReseller"
302368 @close =" isShownDeleteResellerDrawer = false"
303369 />
370+ <!-- suspend reseller modal -->
371+ <SuspendResellerModal
372+ :visible =" isShownSuspendResellerModal"
373+ :reseller =" currentReseller"
374+ @close =" isShownSuspendResellerModal = false"
375+ />
376+ <!-- reactivate reseller modal -->
377+ <ReactivateResellerModal
378+ :visible =" isShownReactivateResellerModal"
379+ :reseller =" currentReseller"
380+ @close =" isShownReactivateResellerModal = false"
381+ />
304382 </div >
305383</template >
0 commit comments