refactor: unificar componentes de compra con prop isAdmin

- Agregar prop isAdmin a Purchase.vue para controlar campos editables
- Hacer campo unit_price editable solo en modo admin (:readonly="!isAdmin")
- Actualizar comprar.vue y compra_admin.vue para usar Purchase unificado
- Eliminar componente AdminPurchase.vue duplicado
- Ambas páginas ahora usan interfaz moderna con cards y diseño responsive
- Mantener seguridad con authStore.isAdmin check en compra_admin.vue
This commit is contained in:
2026-05-30 19:55:00 -05:00
parent d049357231
commit 925fadba2d
4 changed files with 24 additions and 357 deletions

View File

@@ -1,14 +1,16 @@
<template>
<AdminPurchase v-if="authStore.isAdmin"/>
<Purchase v-if="authStore.isAdmin" :isAdmin="true" />
</template>
<script >
import { useAuthStore } from '@/stores/auth';
<script setup>
import Purchase from '@/components/Purchase.vue';
import { useAuthStore } from '@/stores/auth';
export default {
setup() {
const authStore = useAuthStore();
return { authStore };
},
const authStore = useAuthStore();
definePage({
meta: {
requiresAuth: true
}
})
</script>

View File

@@ -1,8 +1,10 @@
<template>
<Purchase />
<Purchase :isAdmin="false" />
</template>
<script setup>
import Purchase from '@/components/Purchase.vue';
definePage({
meta: {
requiresAuth: true