diff --git a/src/components/App/ConceptSection.vue b/src/components/App/ConceptSection.vue index 0269f14..2f7ede8 100644 --- a/src/components/App/ConceptSection.vue +++ b/src/components/App/ConceptSection.vue @@ -26,6 +26,23 @@ const form = useForm({ charge_type: null, }); +const resetForm = () => { + form.direction_id = null; + form.unit_id = null; + form.short_name = ""; + form.name = ""; + form.legal_instrument = ""; + form.article = ""; + form.content = ""; + form.min_amount_uma = ""; + form.max_amount_uma = ""; + form.min_amount_peso = ""; + form.max_amount_peso = ""; + form.unit_cost_uma = ""; + form.unit_cost_peso = ""; + form.charge_type = null; +}; + const addresses = ref([]); const units = ref([]); @@ -36,8 +53,8 @@ const chargeTypeId = computed(() => { }); const chargeTypesOptions = ref([ - { id: 'uma_range', name: 'UMA Range' }, - { id: 'peso_range', name: 'Peso Range' }, + { id: 'uma_range', name: 'Rango en UMA' }, + { id: 'peso_range', name: 'Rango en Peso' }, { id: 'uma_fixed', name: 'UMA unitario' }, { id: 'peso_fixed', name: 'Peso unitario' }, ]); @@ -76,8 +93,8 @@ onMounted(async () => { /** Métodos */ const handleSubmit = () => { const baseData = { - direction_id: typeof form.direction === 'object' ? form.direction.id : Number(form.direction_id), - unit_id: form.unit ? (typeof form.unit === 'object' ? form.unit.id : Number(form.unit)) : null, + direction_id: typeof form.direction_id === 'object' ? form.direction_id.id : Number(form.direction_id), + unit_id: typeof form.unit_id === 'object' ? form.unit_id.id : Number(form.unit_id), short_name: form.short_name, name: form.name, legal_instrument: form.legal_instrument, @@ -106,6 +123,7 @@ const handleSubmit = () => { } emit('concept-created', baseData); + resetForm(); }; @@ -118,7 +136,7 @@ const handleSubmit = () => {