Просмотр исходного кода

refactor: nome fantasia da unidade

Gustavo Mantovani 21 часов назад
Родитель
Сommit
33ac28b018
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/components/layout/DefaultHeaderPage.vue

+ 3 - 1
src/components/layout/DefaultHeaderPage.vue

@@ -53,7 +53,7 @@
               :model-value="store.selectedUnit"
               :model-value="store.selectedUnit"
               :options="userUnits"
               :options="userUnits"
               option-value="id"
               option-value="id"
-              option-label="fantasy_name"
+              :option-label="getUnitLabel"
               label="Unidade"
               label="Unidade"
               outlined
               outlined
               style="width: 280px; flex-shrink: 0"
               style="width: 280px; flex-shrink: 0"
@@ -328,6 +328,8 @@ const userUnits = computed(() => store.user?.units ?? []);
 const user = computed(() => store.user);
 const user = computed(() => store.user);
 const unitDetails = ref(null);
 const unitDetails = ref(null);
 const unitInfo = computed(() => unitDetails.value || store.selectedUnit || {});
 const unitInfo = computed(() => unitDetails.value || store.selectedUnit || {});
+const getUnitLabel = (unit) =>
+  unit?.fantasy_name || unit?.social_reason || "Unidade sem nome";
 
 
 // ------------------- Notificações (sino) -------------------
 // ------------------- Notificações (sino) -------------------
 const notifications = ref([]);
 const notifications = ref([]);