Compare commits
2 commits
ddf758f4b6
...
1429f68b9e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1429f68b9e | ||
|
|
6ae6ae6812 |
2 changed files with 28 additions and 5 deletions
|
|
@ -61,10 +61,12 @@ def get_tasks_table_data(filters={}, sortings=[], page=1, page_size=10):
|
||||||
fields=["*"],
|
fields=["*"],
|
||||||
filters=processed_filters,
|
filters=processed_filters,
|
||||||
limit=page_size,
|
limit=page_size,
|
||||||
start=page * page_size,
|
start=(page-1) * page_size,
|
||||||
order_by=processed_sortings
|
order_by=processed_sortings
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print("TASKS?", tasks, page, page_size)
|
||||||
|
|
||||||
tableRows = []
|
tableRows = []
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
tableRow = {}
|
tableRow = {}
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,22 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import DataTable from "../common/DataTable.vue";
|
import DataTable from "../common/DataTable.vue";
|
||||||
import { ref, onMounted, watch, computed } from "vue";
|
import { ref, onMounted, watch, computed } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import Api from "../../api";
|
import Api from "../../api";
|
||||||
import { useLoadingStore } from "../../stores/loading";
|
import { useLoadingStore } from "../../stores/loading";
|
||||||
import { usePaginationStore } from "../../stores/pagination";
|
import { usePaginationStore } from "../../stores/pagination";
|
||||||
import { useFiltersStore } from "../../stores/filters";
|
import { useFiltersStore } from "../../stores/filters";
|
||||||
import { useNotificationStore } from "../../stores/notifications-primevue";
|
import { useNotificationStore } from "../../stores/notifications-primevue";
|
||||||
|
import { FilterMatchMode } from "@primevue/core";
|
||||||
|
|
||||||
const loadingStore = useLoadingStore();
|
const loadingStore = useLoadingStore();
|
||||||
const paginationStore = usePaginationStore();
|
const paginationStore = usePaginationStore();
|
||||||
const filtersStore = useFiltersStore();
|
const filtersStore = useFiltersStore();
|
||||||
const notifications = useNotificationStore();
|
const notifications = useNotificationStore();
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const subject = route.query.subject;
|
||||||
|
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const totalRecords = ref(0);
|
const totalRecords = ref(0);
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
@ -46,13 +50,18 @@ const statusOptions = ref([
|
||||||
"Cancelled",
|
"Cancelled",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const filters = {
|
||||||
|
subject: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
||||||
|
};
|
||||||
|
|
||||||
// Computed property to get current filters for the chart
|
// Computed property to get current filters for the chart
|
||||||
const currentFilters = computed(() => {
|
const currentFilters = computed(() => {
|
||||||
return filtersStore.getTableFilters("tasks");
|
return filtersStore.getTableFilters("tasks");
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ label: "Task", fieldName: "subject", type: "text", sortable: true, filterable: true },
|
{ label: "Task", fieldName: "subject", type: "text", sortable: true, filterable: true,
|
||||||
|
filterInputID: "subjectFilterId" },
|
||||||
{ label: "Job", fieldName: "project", type: "link", sortable: true,
|
{ label: "Job", fieldName: "project", type: "link", sortable: true,
|
||||||
onLinkClick: (link, rowData) => handleProjectClick(link, rowData)
|
onLinkClick: (link, rowData) => handleProjectClick(link, rowData)
|
||||||
},
|
},
|
||||||
|
|
@ -211,6 +220,10 @@ watch(showCompleted, () => {
|
||||||
|
|
||||||
// Load initial data
|
// Load initial data
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
if (subject) {
|
||||||
|
const inputElement = document.getElementById(`filter-subject`);
|
||||||
|
inputElement.text = subject;
|
||||||
|
}
|
||||||
notifications.addWarning("Tasks page coming soon");
|
notifications.addWarning("Tasks page coming soon");
|
||||||
// Initialize pagination and filters
|
// Initialize pagination and filters
|
||||||
paginationStore.initializeTablePagination("tasks", { rows: 10 });
|
paginationStore.initializeTablePagination("tasks", { rows: 10 });
|
||||||
|
|
@ -222,6 +235,14 @@ onMounted(async () => {
|
||||||
const initialFilters = filtersStore.getTableFilters("tasks");
|
const initialFilters = filtersStore.getTableFilters("tasks");
|
||||||
const initialSorting = filtersStore.getTableSorting("tasks");
|
const initialSorting = filtersStore.getTableSorting("tasks");
|
||||||
|
|
||||||
|
if (subject) {
|
||||||
|
console.log(subject);
|
||||||
|
console.log(initialFilters);
|
||||||
|
console.log(initialFilters.subject);
|
||||||
|
initialFilters.subject.value = subject;
|
||||||
|
//initialFilters = {...initialFilters, subject: {value: subject, match_mode: "contains"}};
|
||||||
|
}
|
||||||
|
|
||||||
const optionsResult = await Api.getTaskStatusOptions();
|
const optionsResult = await Api.getTaskStatusOptions();
|
||||||
statusOptions.value = optionsResult;
|
statusOptions.value = optionsResult;
|
||||||
console.log("DEBUG: Loaded Status options: ", statusOptions.value)
|
console.log("DEBUG: Loaded Status options: ", statusOptions.value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue