Refactor button slots and layouts across Self-Serve and Wash Lanes modules

- Standardized `buttons` slot structure in pagination templates.
- Removed redundant button definitions in `DepartmentWashLane.vue`.
- Updated button styles and layouts for consistency across components.
This commit is contained in:
Jeppe Bundgaard
2026-01-08 12:00:47 +01:00
parent 193915e5f1
commit 67bcbf45f5
5 changed files with 17 additions and 21 deletions
@@ -20,6 +20,9 @@ import SessionUser from "@/components/session/token/SessionUser.vue";
@input="search($event.target.value)"
/>
</div>
<div class="column is-narrow" v-if="$slots.buttons">
<slot name="buttons"></slot>
</div>
<div class="column is-narrow">
<LoadButtonWhileAwait class="is-dark" :isLoading="isLoading" :loadFunction="loadList" icon="fas fa-sync-alt">{{SessionUser.objects.global.language.reload}}</LoadButtonWhileAwait>
</div>
@@ -32,7 +32,11 @@ const isSmall = ref(window.innerWidth < 1024);
<!-- Label -->
<h2 class="title is-4 mb-4">{{ label }}</h2>
<!-- Search & reload -->
<PaginationDisplayGeneralSearchReload/>
<PaginationDisplayGeneralSearchReload>
<template #buttons v-if="$slots.buttons">
<slot name="buttons"></slot>
</template>
</PaginationDisplayGeneralSearchReload>
<!-- Filters -->
<PaginationDisplay :metaItemsPerPage="metaItemsPerPage" :loadFunction="loadList" :isLoading="isLoading" :setMetaItemsPerPage="setMetaItemsPerPage">
<template #paginationColumns>
@@ -98,9 +98,12 @@ defineExpose({
<template>
<TableLabeledPagination :label="SessionUser.objects.self_serve_questions.meta.title">
<template #buttons>
<template #buttons="{ loadList }">
<slot name="buttons" :loadList="loadList">
<button class="button is-primary is-small" @click="SessionUser.objects.self_serve_questions.showCreateObjectForm({}, loadList)">
<button
class="button is-primary is-small"
@click="SessionUser.objects.self_serve_questions.showCreateObjectForm({}, loadList)"
>
<span class="icon is-small">
<i class="fas fa-plus"></i>
</span>
@@ -34,7 +34,7 @@ const selectVehicleType = (vehicleType) => {
>
<template #buttons="{ loadList }">
<button
class="button is-primary is-small"
class="button is-primary"
@click="SessionUser.objects.self_serve_questions.showCreateObjectForm({
department: departmentId,
vehicle_type: selectedVehicleType?.id
@@ -42,7 +42,7 @@ const selectVehicleType = (vehicleType) => {
:disabled="!selectedVehicleType"
:title="!selectedVehicleType ? 'Vælg venligst en køretøjstype først' : ''"
>
<span class="icon is-small">
<span class="icon">
<i class="fas fa-plus"></i>
</span>
<span>Tilføj spørgsmål</span>
@@ -44,20 +44,6 @@ onMounted(() => {
<div v-if="lane">
<PageTitle :title="'Vaskebane: ' + lane.name" :subtitle="'ID: ' + lane.id">
<template #buttons>
<button
v-if="selectedVehicleType"
class="button is-primary"
@click="SessionUser.objects.self_serve_questions.showCreateObjectForm({
department: departmentId,
lane: laneId,
vehicle_type: selectedVehicleType?.id
}, () => selfServeQuestionsPagination?.loadList())"
>
<span class="icon">
<i class="fas fa-plus"></i>
</span>
<span>Opret spørgsmål</span>
</button>
<button class="button is-dark" @click="router.push(`/admin/${departmentId}/modules/wash-lanes`)">
<span class="icon">
<i class="fas fa-arrow-left"></i>
@@ -157,7 +143,7 @@ onMounted(() => {
>
<template #buttons="{ loadList }">
<button
class="button is-primary is-small"
class="button is-primary"
@click="SessionUser.objects.self_serve_questions.showCreateObjectForm({
department: departmentId,
lane: laneId,
@@ -166,7 +152,7 @@ onMounted(() => {
:disabled="!selectedVehicleType"
:title="!selectedVehicleType ? 'Vælg venligst en køretøjstype først' : ''"
>
<span class="icon is-small">
<span class="icon">
<i class="fas fa-plus"></i>
</span>
<span>Tilføj spørgsmål</span>