fix: Nummernkreise beim Öffnen aktualisieren
All checks were successful
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-docs (push) Successful in 21s
Build and Push Docker Images / build-backend (push) Successful in 23s
Build and Push Docker Images / build-frontend (push) Successful in 1m12s
Build and Push Docker Images / build-central-services-api (push) Successful in 21s
Build and Push Docker Images / build-central-services-admin (push) Successful in 21s
All checks were successful
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-docs (push) Successful in 21s
Build and Push Docker Images / build-backend (push) Successful in 23s
Build and Push Docker Images / build-frontend (push) Successful in 1m12s
Build and Push Docker Images / build-central-services-api (push) Successful in 21s
Build and Push Docker Images / build-central-services-admin (push) Successful in 21s
This commit is contained in:
@@ -49,29 +49,54 @@ const resources = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberRanges = ref(auth.activeTenantData.numberRanges || {})
|
const createNumberRanges = (ranges = {}) => {
|
||||||
|
const freshRanges = structuredClone(ranges)
|
||||||
|
|
||||||
Object.keys(resources).forEach((key) => {
|
Object.keys(resources).forEach((key) => {
|
||||||
if (!numberRanges.value[key]) {
|
if (!freshRanges[key]) {
|
||||||
numberRanges.value[key] = {
|
freshRanges[key] = {
|
||||||
prefix: "",
|
prefix: "",
|
||||||
suffix: "",
|
suffix: "",
|
||||||
nextNumber: 1000
|
nextNumber: 1000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return freshRanges
|
||||||
|
}
|
||||||
|
|
||||||
|
const numberRanges = ref({})
|
||||||
|
const loading = ref(true)
|
||||||
|
|
||||||
|
const loadNumberRanges = async () => {
|
||||||
|
loading.value = true
|
||||||
|
|
||||||
|
try {
|
||||||
|
const tenant = await useNuxtApp().$api("/api/tenant")
|
||||||
|
numberRanges.value = createNumberRanges(tenant?.numberRanges || {})
|
||||||
|
|
||||||
|
if (tenant?.id) {
|
||||||
|
auth.activeTenantData = tenant
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
onMounted(loadNumberRanges)
|
||||||
|
|
||||||
const updateNumberRanges = async (range) => {
|
const updateNumberRanges = async (range) => {
|
||||||
|
const tenant = await useNuxtApp().$api(`/api/tenant/numberrange/${range}`,{
|
||||||
const res = await useNuxtApp().$api(`/api/tenant/numberrange/${range}`,{
|
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
body: {
|
body: {
|
||||||
numberRange: numberRanges.value[range]
|
numberRange: numberRanges.value[range]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(res)
|
if (tenant?.id) {
|
||||||
|
auth.activeTenantData = tenant
|
||||||
|
numberRanges.value = createNumberRanges(tenant.numberRanges || {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +117,13 @@ const updateNumberRanges = async (range) => {
|
|||||||
/>
|
/>
|
||||||
</UDashboardToolbar>
|
</UDashboardToolbar>
|
||||||
|
|
||||||
|
<UProgress
|
||||||
|
v-if="loading"
|
||||||
|
animation="carousel"
|
||||||
|
class="m-5 w-1/2"
|
||||||
|
/>
|
||||||
<table
|
<table
|
||||||
|
v-else
|
||||||
class="m-3"
|
class="m-3"
|
||||||
>
|
>
|
||||||
<tr class="text-left">
|
<tr class="text-left">
|
||||||
@@ -103,6 +134,7 @@ const updateNumberRanges = async (range) => {
|
|||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
v-for="key in Object.keys(resources)"
|
v-for="key in Object.keys(resources)"
|
||||||
|
:key="key"
|
||||||
>
|
>
|
||||||
<td>{{resources[key].label}}</td>
|
<td>{{resources[key].label}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user