|
@@ -82,11 +82,11 @@
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
<DefaultSelect
|
|
<DefaultSelect
|
|
|
- v-model="contractForm.inhabitant_classification_id"
|
|
|
|
|
|
|
+ v-model="contractForm.municipality_size_id"
|
|
|
label="Faixa de Habitantes"
|
|
label="Faixa de Habitantes"
|
|
|
color="secondary"
|
|
color="secondary"
|
|
|
label-color="secondary"
|
|
label-color="secondary"
|
|
|
- :options="inhabitantOptions"
|
|
|
|
|
|
|
+ :options="municipalitySizeOptions"
|
|
|
emit-value
|
|
emit-value
|
|
|
map-options
|
|
map-options
|
|
|
use-input
|
|
use-input
|
|
@@ -189,7 +189,7 @@ import DefaultCurrencyInput from "src/components/defaults/DefaultCurrencyInput.v
|
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
|
|
|
|
|
|
import { getUnit } from "src/api/unit";
|
|
import { getUnit } from "src/api/unit";
|
|
|
-import { getInhabitantClassificationsForSelect } from "src/api/inhabitant_classification";
|
|
|
|
|
|
|
+import { getMunicipalitySizes } from "src/api/tbr_calculation";
|
|
|
import { getFranchiseeContractTaxHistory } from "src/api/franchisee_contract";
|
|
import { getFranchiseeContractTaxHistory } from "src/api/franchisee_contract";
|
|
|
|
|
|
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
defineEmits([...useDialogPluginComponent.emits]);
|
|
@@ -208,7 +208,7 @@ const props = defineProps({
|
|
|
const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent();
|
|
const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent();
|
|
|
|
|
|
|
|
const loadingHistory = ref(false);
|
|
const loadingHistory = ref(false);
|
|
|
-const inhabitantOptions = ref([]);
|
|
|
|
|
|
|
+const municipalitySizeOptions = ref([]);
|
|
|
const tbrHistory = ref([]);
|
|
const tbrHistory = ref([]);
|
|
|
|
|
|
|
|
const unitData = reactive({
|
|
const unitData = reactive({
|
|
@@ -225,8 +225,8 @@ const contractForm = reactive({
|
|
|
? parseFloat(props.contract.tbr_fixed_value)
|
|
? parseFloat(props.contract.tbr_fixed_value)
|
|
|
: null,
|
|
: null,
|
|
|
invoice_due_date: props.contract.invoice_due_date ?? null,
|
|
invoice_due_date: props.contract.invoice_due_date ?? null,
|
|
|
- inhabitant_classification_id:
|
|
|
|
|
- props.contract.inhabitant_classification_id ?? null,
|
|
|
|
|
|
|
+ municipality_size_id:
|
|
|
|
|
+ props.contract.municipality_size_id ?? null,
|
|
|
tax_base_royalts:
|
|
tax_base_royalts:
|
|
|
props.contract.tbr_fixed_value_percentage != null
|
|
props.contract.tbr_fixed_value_percentage != null
|
|
|
? parseFloat((props.contract.tbr_fixed_value_percentage * 100).toFixed(4))
|
|
? parseFloat((props.contract.tbr_fixed_value_percentage * 100).toFixed(4))
|
|
@@ -250,9 +250,12 @@ const historyColumns = [
|
|
|
align: "left",
|
|
align: "left",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- name: "inhabitant_classification",
|
|
|
|
|
|
|
+ name: "municipality_size",
|
|
|
label: "Faixa de Habitantes",
|
|
label: "Faixa de Habitantes",
|
|
|
- field: "inhabitant_classification",
|
|
|
|
|
|
|
+ field: (row) =>
|
|
|
|
|
+ row.municipality_size?.description ??
|
|
|
|
|
+ row.inhabitant_classification?.description ??
|
|
|
|
|
+ "—",
|
|
|
align: "left",
|
|
align: "left",
|
|
|
},
|
|
},
|
|
|
{ name: "tbr_fixed_value", label: "TBR", field: "tbr_fixed_value", align: "left" },
|
|
{ name: "tbr_fixed_value", label: "TBR", field: "tbr_fixed_value", align: "left" },
|
|
@@ -286,9 +289,9 @@ const historyColumns = [
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
async function loadData() {
|
|
async function loadData() {
|
|
|
- const [unit, classifications] = await Promise.all([
|
|
|
|
|
|
|
+ const [unit, sizes] = await Promise.all([
|
|
|
getUnit(props.unitId),
|
|
getUnit(props.unitId),
|
|
|
- getInhabitantClassificationsForSelect(),
|
|
|
|
|
|
|
+ getMunicipalitySizes(),
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
unitData.id = unit.id;
|
|
unitData.id = unit.id;
|
|
@@ -300,9 +303,9 @@ async function loadData() {
|
|
|
unitData.franchisee_birthday = firstPartner.birth_date;
|
|
unitData.franchisee_birthday = firstPartner.birth_date;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- inhabitantOptions.value = classifications.map((c) => ({
|
|
|
|
|
- label: c.description,
|
|
|
|
|
- value: c.id,
|
|
|
|
|
|
|
+ municipalitySizeOptions.value = (sizes ?? []).map((s) => ({
|
|
|
|
|
+ label: s.description,
|
|
|
|
|
+ value: s.id,
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
loadingHistory.value = true;
|
|
loadingHistory.value = true;
|