diff --git a/src/components/POS/CheckoutModal.vue b/src/components/POS/CheckoutModal.vue
index 7e6755e..7921bc5 100644
--- a/src/components/POS/CheckoutModal.vue
+++ b/src/components/POS/CheckoutModal.vue
@@ -25,12 +25,15 @@ const props = defineProps({
const emit = defineEmits(['close', 'confirm']);
/** Estado */
+let debounceTimer = null;
const selectedMethod = ref('cash');
const cashReceived = ref(0);
const clientNumber = ref('');
const selectedClient = ref(null);
const searchingClient = ref(false);
const clientNotFound = ref(false);
+const clientSuggestions = ref([]);
+const showClientSuggestions = ref(false);
/** Computados */
const formattedSubtotal = computed(() => {
@@ -116,10 +119,25 @@ const paymentMethods = [
];
/** Métodos de búsqueda de cliente */
+const onClientInput = () =>{
+ clientNotFound.value = false;
+
+ if(!clientNumber.value || clientNumber.value.trim().length < 2) {
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
+ return;
+ }
+
+ clearTimeout(debounceTimer);
+ debounceTimer = setTimeout(() => {
+ showClientSuggestions.value = true;
+ searchClient();
+ }, 300);
+}
const searchClient = () => {
if (!clientNumber.value || clientNumber.value.trim() === '') {
- selectedClient.value = null;
- clientNotFound.value = false;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
return;
}
@@ -131,22 +149,23 @@ const searchClient = () => {
api.get(apiURL(`clients?${urlParams}`), {
onSuccess: (data) => {
if (data.clients && data.clients.data.length > 0) {
- const client = data.clients.data[0];
- selectedClient.value = client;
- clientNotFound.value = false;
- window.Notify.success(`Cliente ${client.name} encontrado`);
+ clientSuggestions.value = data.clients.data;
+ showClientSuggestions.value = true;
} else {
- selectedClient.value = null;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
clientNotFound.value = true;
}
},
onFail: (data) => {
- selectedClient.value = null;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
clientNotFound.value = true;
window.Notify.error(data.message || 'Error al buscar cliente');
},
onError: () => {
- selectedClient.value = null;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
clientNotFound.value = true;
},
onFinish: () => {
@@ -155,10 +174,22 @@ const searchClient = () => {
});
};
+const selectClient = (client) => {
+ selectedClient.value = client;
+ clientNumber.value = '';
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
+ clientNotFound.value = false;
+ window.Notify.success(`Cliente ${client.name} seleccionado`);
+};
+
+
const clearClient = () => {
clientNumber.value = '';
selectedClient.value = null;
clientNotFound.value = false;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
};
@@ -178,6 +209,8 @@ watch(() => props.show, (isShown) => {
clientNumber.value = '';
selectedClient.value = null;
clientNotFound.value = false;
+ clientSuggestions.value = [];
+ showClientSuggestions.value = false;
}
});
@@ -358,22 +391,51 @@ const formattedEstimatedTotal = computed(() => {
0 && (showClientSuggestions = true)"
type="text"
- placeholder="Ingresa el código de cliente (ej: CLI-0001)"
+ placeholder="Ingresa el código de cliente (ej: MOGF780404S36)"
class="w-full px-4 py-3 pr-24 border-2 border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"
:class="{
'border-red-500 focus:ring-red-500 focus:border-red-500': clientNotFound
}"
:disabled="searchingClient"
/>
-
+
+
+
+
+
- {{ searchingClient ? 'Buscando...' : 'Buscar' }}
-
+
+
diff --git a/src/components/POS/ExcelSale.vue b/src/components/POS/ExcelSale.vue
new file mode 100644
index 0000000..021af3d
--- /dev/null
+++ b/src/components/POS/ExcelSale.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+ Reporte de Ventas
+
+
+ Genera un archivo Excel con las ventas realizadas
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ downloading ? 'Generando...' : 'Descargar Excel' }}
+
+
+
+
+
+
+
+
+
+
+
Información del reporte:
+
+ - Incluye ventas realizadas en el rango seleccionado
+ - Muestra los detalles de venta y cliente si tiene asociado uno
+
+
+
+
+
+
+
+
diff --git a/src/pages/POS/Clients/Create.vue b/src/pages/POS/Clients/Create.vue
index aa91512..4fd1578 100644
--- a/src/pages/POS/Clients/Create.vue
+++ b/src/pages/POS/Clients/Create.vue
@@ -20,6 +20,10 @@ const form = useForm({
phone: '',
address: '',
rfc: '',
+ razon_social: '',
+ regimen_fiscal: '',
+ cp_fiscal: '',
+ uso_cfdi: ''
});
/** Métodos */
@@ -132,6 +136,62 @@ const closeModal = () => {
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/POS/Clients/Edit.vue b/src/pages/POS/Clients/Edit.vue
index 6b7f38e..b7e1846 100644
--- a/src/pages/POS/Clients/Edit.vue
+++ b/src/pages/POS/Clients/Edit.vue
@@ -22,6 +22,10 @@ const form = useForm({
phone: '',
address: '',
rfc: '',
+ razon_social: '',
+ regimen_fiscal: '',
+ cp_fiscal: '',
+ uso_cfdi: ''
});
/** Métodos */
@@ -51,6 +55,10 @@ watch(() => props.client, (newClient) => {
form.phone = newClient.phone || '';
form.address = newClient.address || '';
form.rfc = newClient.rfc || '';
+ form.razon_social = newClient.razon_social || '';
+ form.regimen_fiscal = newClient.regimen_fiscal || '';
+ form.cp_fiscal = newClient.cp_fiscal || '';
+ form.uso_cfdi = newClient.uso_cfdi || '';
}
}, { immediate: true });
@@ -146,6 +154,62 @@ watch(() => props.client, (newClient) => {
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/POS/Clients/Index.vue b/src/pages/POS/Clients/Index.vue
index 6ab5cbd..d55b016 100644
--- a/src/pages/POS/Clients/Index.vue
+++ b/src/pages/POS/Clients/Index.vue
@@ -164,6 +164,10 @@ onMounted(() => {
TELEFONO |
DIRECCIÓN |
RFC |
+ RAZÓN SOCIAL |
+ REGIMEN FISCAL |
+ CP FISCAL |
+ USO CFDI |
ACCIONES |
@@ -190,6 +194,18 @@ onMounted(() => {
{{ client.rfc }}
|
+
+ {{ client.razon_social }}
+ |
+
+ {{ client.regimen_fiscal }}
+ |
+
+ {{ client.cp_fiscal }}
+ |
+
+ {{ client.uso_cfdi }}
+ |
|