diff --git a/src/components/App/ConceptSection.vue b/src/components/App/ConceptSection.vue index 7d620a9..0269f14 100644 --- a/src/components/App/ConceptSection.vue +++ b/src/components/App/ConceptSection.vue @@ -1,5 +1,5 @@ @@ -123,7 +167,18 @@ const handleSubmit = () => { :onError="form.errors.content" required /> -
+ +
+ +
+
{ :onError="form.errors.max_amount_uma" />
-
+
{ :onError="form.errors.max_amount_peso" />
-
-

- {{ $t('concept.tabulator') }} -

-
- - - + +
+
+

+ {{ $t('concept.tabulator') }} +

+
+ + +
diff --git a/src/components/App/FineSection.vue b/src/components/App/FineSection.vue index 1d79de7..1ff99ed 100644 --- a/src/components/App/FineSection.vue +++ b/src/components/App/FineSection.vue @@ -32,34 +32,31 @@ const handleSearch = async () => { await api.get(apiURL(`fines/search`), { params: { - id: fineNumber.value.trim(), + qr_token: fineNumber.value.trim(), }, onSuccess: (data) => { const model = data.model; - if (model.payments && model.payments.length > 0) { - const payment = model.payments[0]; + if (model.status === "paid") { + window.Notify.info("La multa ya ha sido pagada previamente"); - if (payment.status === "paid") { - window.Notify.info("La multa ya ha sido pagada previamente"); + fineData.value = { + id: model.id, + fecha: new Date(model.created_at).toLocaleDateString("es-MX"), + placa: model.plate || "", + vin: model.vin || "", + licencia: model.license || "", + tarjeta: model.circulation || "", + rfc: model.rfc || "", + nombre: model.name || "", + monto: `$${data.total_to_pay.toFixed(2)}`, + isPaid: true, + }; - fineData.value = { - id: model.id, - fecha: new Date(model.created_at).toLocaleDateString("es-MX"), - placa: model.plate || "", - vin: model.vin || "", - licencia: model.license || "", - tarjeta: model.circulation || "", - rfc: model.rfc || "", - nombre: model.name || "", - monto: `$${data.total_to_pay.toFixed(2)}`, - isPaid: true, - }; - - return; - } + return; } + // Multa pendiente fineData.value = { id: model.id, fecha: new Date(model.created_at).toLocaleDateString("es-MX"), @@ -104,24 +101,18 @@ const handlePayment = async () => { return; } + if (fineData.value.isPaid) { + window.Notify.warning("Esta multa ya ha sido pagada previamente"); + return; + } + await api.post(apiURL(`fines/${fineData.value.id}/mark-as-paid`), { onSuccess: (data) => { window.Notify.success("Multa cobrada exitosamente"); emit("payment-processed", { ...fineData.value, paymentData: data }); - fineData.value = { - id: null, - fecha: "", - placa: "", - vin: "", - licencia: "", - tarjeta: "", - rfc: "", - nombre: "", - monto: "", - }; - fineNumber.value = ""; + fineData.value.isPaid = true; }, onFail: (error) => { window.Notify.error( diff --git a/src/lang/es.js b/src/lang/es.js index f86e9eb..e9dd58f 100644 --- a/src/lang/es.js +++ b/src/lang/es.js @@ -116,6 +116,7 @@ export default { legal: 'Instrumento Legal', article: 'Articulado', description: 'Contenido', + chargeType: 'Tipo de Cobro', minimumAmountUma: 'Monto Mínimo (UMAs)', maximumAmountUma: 'Monto Máximo (UMAs)', minimumAmountPeso: 'Monto Mínimo (Pesos)', diff --git a/src/pages/App/Concept/Index.vue b/src/pages/App/Concept/Index.vue index 786d7d9..b653d2a 100644 --- a/src/pages/App/Concept/Index.vue +++ b/src/pages/App/Concept/Index.vue @@ -9,10 +9,7 @@ import PageHeader from "@Holos/PageHeader.vue"; import ConceptForm from "@App/ConceptSection.vue"; import DestroyView from "@Holos/Modal/Template/Destroy.vue"; import ModalController from "@Controllers/ModalController.js"; -import Editview from "@Holos/Modal/Edit.vue"; -import Input from "@Holos/Form/Input.vue"; -import Textarea from "@Holos/Form/Textarea.vue"; -import Selectable from "@Holos/Form/Selectable.vue"; +import EditModal from "./Modal/Edit.vue"; /** Controladores */ const Modal = new ModalController(); @@ -71,35 +68,9 @@ const handleConceptCreated = async (conceptData) => { }); }; -const handleConceptUpdated = async () => { - const transformedData = { - direction_id: typeof modelModal.value.direction === 'object' ? modelModal.value.direction.id : Number(modelModal.value.direction_id), - unit_id: modelModal.value.unit ? (typeof modelModal.value.unit === 'object' ? modelModal.value.unit.id : Number(modelModal.value.unit)) : null, - short_name: modelModal.value.short_name, - name: modelModal.value.name, - legal_instrument: modelModal.value.legal_instrument, - article: modelModal.value.article, - content: modelModal.value.content, - min_amount_uma: modelModal.value.min_amount_uma ? Number(modelModal.value.min_amount_uma) : null, - max_amount_uma: modelModal.value.max_amount_uma ? Number(modelModal.value.max_amount_uma) : null, - min_amount_peso: modelModal.value.min_amount_peso ? Number(modelModal.value.min_amount_peso) : null, - max_amount_peso: modelModal.value.max_amount_peso ? Number(modelModal.value.max_amount_peso) : null, - unit_cost_uma: modelModal.value.unit_cost_uma ? Number(modelModal.value.unit_cost_uma) : null, - unit_cost_peso: modelModal.value.unit_cost_peso ? Number(modelModal.value.unit_cost_peso) : null, - }; - - const form = useForm(transformedData); - - form.put(apiTo("update", { charge_concept: modelModal.value.id }), { - onSuccess: () => { - Notify.success(transl("edit.onSuccess")); - searcher.refresh(); - Modal.switchEditModal(); - }, - onError: () => { - Notify.error(transl("edit.onError")); - }, - }); +const handleConceptUpdated = () => { + searcher.refresh(); + Modal.switchEditModal(); };