diff --git a/src/components/App/ConceptSection.vue b/src/components/App/ConceptSection.vue index 51b07b0..9ccb000 100644 --- a/src/components/App/ConceptSection.vue +++ b/src/components/App/ConceptSection.vue @@ -24,6 +24,7 @@ const form = useForm({ unit_cost_uma: "", unit_cost_peso: "", charge_type: null, + concept_type: null, }); const resetForm = () => { @@ -41,6 +42,7 @@ const resetForm = () => { form.unit_cost_uma = ""; form.unit_cost_peso = ""; form.charge_type = null; + form.concept_type = null; }; const isFormOpen = ref(false); @@ -54,10 +56,15 @@ const chargeTypeId = computed(() => { }); const chargeTypesOptions = ref([ - { 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" }, + { id: "uma_range", name: "Rango por UMA" }, + { id: "peso_range", name: "Rango en pesos (MXN$)" }, + { id: "uma_fixed", name: "Tabulador en UMA" }, + { id: "peso_fixed", name: "Tabulador en pesos (MXN$)" }, +]); + +const conceptTypesOptions = ref([ + { id: "membership", name: "Membresía" }, + { id: "fine", name: "Multa" } ]); const showUmaFields = computed(() => { @@ -108,6 +115,10 @@ const handleSubmit = () => { : Number(form.direction_id), unit_id: typeof form.unit_id === "object" ? form.unit_id.id : Number(form.unit_id), + concept_type: + typeof form.concept_type === "object" + ? form.concept_type.id + : String(form.concept_type), short_name: form.short_name, name: form.name, legal_instrument: form.legal_instrument, @@ -174,6 +185,14 @@ const handleSubmit = () => {
+ { :onError="form.errors.short_name" required /> +
-
{ required /> -
- +
+
+

+ {{ $t("concept.defineChargeType") }} +

+
+ +
+ {
+ { :onError="form.errors.max_amount_peso" />
-

{{ $t("concept.tabulator") }}

+ opt.id === props.model.charge_type) || null; + return typeof props.model.charge_type === 'object' && props.model.charge_type?.id + ? props.model.charge_type.id + : chargeTypesOptions.find(opt => opt.id === props.model.charge_type) || null; }, set(value) { props.model.charge_type = value; } }); +const conceptTypeObject = computed({ + get() { + if (!props.model.concept_type) return null; + const conceptTypeId = typeof props.model.concept_type === 'object' && props.model.concept_type?.id + ? props.model.concept_type.id + : props.model.concept_type; + return conceptTypesOptions.find(opt => opt.id === conceptTypeId) || null; + }, + set(value) { + if (value && typeof value === 'object' && value.id) { + props.model.concept_type = value.id; + } else if (value) { + props.model.concept_type = value; + } else { + props.model.concept_type = null; + } + } +}); + const editChargeTypeId = computed(() => { if (!props.model.charge_type) return null; return typeof props.model.charge_type === 'object' && props.model.charge_type?.id @@ -69,6 +91,7 @@ const handleUpdate = async () => { direction_id: typeof props.model.direction === 'object' ? props.model.direction.id : Number(props.model.direction_id), unit_id: props.model.unit ? (typeof props.model.unit === 'object' ? props.model.unit.id : Number(props.model.unit)) : null, short_name: props.model.short_name, + concept_type: props.model.concept_type, name: props.model.name, legal_instrument: props.model.legal_instrument, article: props.model.article, @@ -107,6 +130,13 @@ const handleUpdate = async () => { @update="handleUpdate" >
+