@@ -96,8 +96,7 @@ const hydrateFromUser = (user: UserData | null) => {
|
||||
isHydrating.value = true
|
||||
form.username = user.username ?? ''
|
||||
const roles = user.roles ?? []
|
||||
const hasAdmin = roles.includes('ROLE_ADMIN')
|
||||
form.role = hasAdmin ? 'ROLE_ADMIN' : 'ROLE_USER'
|
||||
form.role = ROLE.find((role) => roles.includes(role.value))?.value ?? 'ROLE_USER'
|
||||
form.password = ''
|
||||
isHydrating.value = false
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
const auth = useAuthStore()
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex flex-wrap justify-center pb-16 gap-12">
|
||||
<card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
||||
<card-link label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
||||
<card-link label="PLAN DE SITE" link="/infrastructure/building" iconName="material-symbols:warehouse-outline-rounded" />
|
||||
<card-link v-if="auth.canUseWorkflow" label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
||||
<card-link v-if="auth.canUseWorkflow" label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
||||
<card-link v-if="auth.canUseWorkflow" label="PLAN DE SITE" link="/infrastructure/building" iconName="material-symbols:warehouse-outline-rounded" />
|
||||
<card-link link="/reception/waiting-reception" iconName="mdi:truck-remove-outline">
|
||||
<template #label>
|
||||
Réceptions<br>EN ATTENTE
|
||||
@@ -15,10 +18,10 @@
|
||||
EXPÉDITIONS<br>EN ATTENTE
|
||||
</template>
|
||||
</card-link>
|
||||
<card-link label="CASES" link="/infrastructure/case" iconName="material-symbols:bottom-sheets-outline" />
|
||||
<card-link v-if="auth.canUseWorkflow" label="CASES" link="/infrastructure/case" iconName="material-symbols:bottom-sheets-outline" />
|
||||
<card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
|
||||
<card-link label="EXPÉDITIONS FINIES" link="/shipment/finish-shipment" iconName="mdi:truck-delivery-outline" />
|
||||
<card-link link="/" iconName="mdi:cow">
|
||||
<card-link v-if="auth.canUseWorkflow" link="/" iconName="mdi:cow">
|
||||
<template #label>
|
||||
PASSEPORT<br>DU BOVIN
|
||||
</template>
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
<div
|
||||
v-for="reception in receptionList"
|
||||
:key="reception.id"
|
||||
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
|
||||
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm border-t border-slate-200"
|
||||
:class="auth.canUseWorkflow ? 'hover:bg-slate-50 cursor-pointer' : ''"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click="goToReception(reception.id)"
|
||||
@@ -36,10 +37,11 @@
|
||||
<script setup lang="ts">
|
||||
import type {ReceptionData} from "~/services/dto/reception-data";
|
||||
import {getReceptionList} from "~/services/reception";
|
||||
import type {ShipmentData} from "~/services/dto/shipment-data";
|
||||
import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
const receptionList = ref<ReceptionData[]>()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
|
||||
const formatDate = (date: string | null) => {
|
||||
if (!date) return '—'
|
||||
@@ -66,6 +68,7 @@ const formatWeighing = (reception: ReceptionData) => {
|
||||
}
|
||||
|
||||
const goToReception = (id: number) => {
|
||||
if (!auth.canUseWorkflow) return
|
||||
router.push(`/reception/update/${id}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
:columns="columns"
|
||||
:items="receptionList ?? []"
|
||||
route-prefix="/reception"
|
||||
show-actions
|
||||
:show-actions="auth.canUseWorkflow"
|
||||
:can-open-items="auth.canUseWorkflow"
|
||||
>
|
||||
<template #cell-receptionDate="{ item }">
|
||||
{{ formatDate(item.receptionDate) }}
|
||||
@@ -23,6 +24,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { ReceptionData } from '~/services/dto/reception-data'
|
||||
import { getReceptionList, deleteReception } from '~/services/reception'
|
||||
import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
const auth = useAuthStore()
|
||||
|
||||
const columns = [
|
||||
{ key: 'receptionDate', label: 'Date et heure' },
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
v-for="shipment in shipmentList"
|
||||
:key="shipment
|
||||
.id"
|
||||
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
|
||||
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm border-t border-slate-200"
|
||||
:class="auth.canUseWorkflow ? 'hover:bg-slate-50 cursor-pointer' : ''"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
@click="goShipment(shipment.id)"
|
||||
@@ -47,9 +48,11 @@
|
||||
<script setup lang="ts">
|
||||
import type {ShipmentData} from "~/services/dto/shipment-data";
|
||||
import {getShipmentList} from "~/services/shipment";
|
||||
import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
const shipmentList = ref<ShipmentData[]>()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
|
||||
const formatWeighing = (shipment: ShipmentData) => {
|
||||
const gross = shipment.weights?.find((weight) => weight.type === 'gross')?.weight
|
||||
@@ -76,6 +79,7 @@ const formatShipmentLines = (shipment: ShipmentData) => {
|
||||
}
|
||||
|
||||
const goShipment = (id: number) => {
|
||||
if (!auth.canUseWorkflow) return
|
||||
router.push(`/shipment/update/${id}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
:columns="columns"
|
||||
:items="shipmentList ?? []"
|
||||
route-prefix="/shipment"
|
||||
show-actions
|
||||
:show-actions="auth.canUseWorkflow"
|
||||
:can-open-items="auth.canUseWorkflow"
|
||||
>
|
||||
<template #cell-shipmentDate="{ item }">
|
||||
{{ formatDate(item.shipmentDate) }}
|
||||
@@ -35,6 +36,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { ShipmentData } from '~/services/dto/shipment-data'
|
||||
import { getShipmentList, deleteShipment } from '~/services/shipment'
|
||||
import { useAuthStore } from '~/stores/auth'
|
||||
|
||||
const auth = useAuthStore()
|
||||
|
||||
const columns = [
|
||||
{ key: 'shipmentDate', label: 'Date et heure' },
|
||||
|
||||
Reference in New Issue
Block a user