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:
@@ -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>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<template>
|
||||
<Purchase />
|
||||
<Purchase :isAdmin="false" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Purchase from '@/components/Purchase.vue';
|
||||
|
||||
definePage({
|
||||
meta: {
|
||||
requiresAuth: true
|
||||
|
||||
Reference in New Issue
Block a user