|
|
@@ -81,19 +81,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive, defineAsyncComponent, onMounted } from "vue";
|
|
|
+import { ref, reactive, defineAsyncComponent, onMounted, watch } from "vue";
|
|
|
import { useQuasar } from "quasar";
|
|
|
import draggable from "vuedraggable";
|
|
|
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
import KanbanCard from "./components/KanbanCard.vue";
|
|
|
import { getKanbans, reorderKanbans } from "src/api/kanban";
|
|
|
+import { userStore } from "src/stores/user";
|
|
|
|
|
|
const AddEditKanbanDialog = defineAsyncComponent(
|
|
|
() => import("./components/AddEditKanbanDialog.vue"),
|
|
|
);
|
|
|
|
|
|
const $q = useQuasar();
|
|
|
+const { selectedUnit } = userStore();
|
|
|
const loading = ref(false);
|
|
|
|
|
|
const columns = [
|
|
|
@@ -159,6 +161,11 @@ const openDialog = (card = null, phase = "a_fazer") => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+// Reload whenever the user switches units via the top selector
|
|
|
+watch(() => selectedUnit?.id, (newId, oldId) => {
|
|
|
+ if (newId !== oldId) loadCards();
|
|
|
+});
|
|
|
+
|
|
|
onMounted(loadCards);
|
|
|
</script>
|
|
|
|