Compare commits
No commits in common. "c65a208e34e7afd269d491c948da6cc82f56ddc3" and "e1e8669beb710aa5a4f61753bc25fe6b11ef010a" have entirely different histories.
c65a208e34
...
e1e8669beb
|
@ -1,34 +0,0 @@
|
||||||
<template>
|
|
||||||
<th @click="$emit('update:model-value')">
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<span v-text="label"></span>
|
|
||||||
<ui-sprite v-if="value.by === column && value.direction === false" src="chevron" class="rotate-180 w-3 h-3 text-primaryfg ml-2">ASC</ui-sprite>
|
|
||||||
<ui-sprite v-if="value.by === column && value.direction === true" src="chevron" class="w-3 h-3 text-primaryfg ml-2">DESC</ui-sprite>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
defineEmits(['update:model-value']);
|
|
||||||
|
|
||||||
defineProps({
|
|
||||||
column: {
|
|
||||||
type: String,
|
|
||||||
default: () => '',
|
|
||||||
},
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
default: () => '',
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {
|
|
||||||
return {by: '', direction: false};
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sortable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -30,7 +30,7 @@ export function useApiIndex(firstUrl, siteName = null) {
|
||||||
|
|
||||||
async function reloadPage(page, p = {}) {
|
async function reloadPage(page, p = {}) {
|
||||||
inner.meta.value.current_page = page;
|
inner.meta.value.current_page = page;
|
||||||
await reload(false, p);
|
await reload(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function create() {
|
function create() {
|
||||||
|
|
|
@ -69,15 +69,7 @@
|
||||||
</page-filter>
|
</page-filter>
|
||||||
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
<ui-th
|
<th v-for="column in activeColumns" :key="column.id" v-text="column.name"></th>
|
||||||
v-for="column in activeColumns"
|
|
||||||
:key="column.id"
|
|
||||||
:column="column.id"
|
|
||||||
:label="column.name"
|
|
||||||
:value="getSort"
|
|
||||||
sortable
|
|
||||||
@update:model-value="setSort(column.id, {filter: toFilterString(innerFilter)})"
|
|
||||||
></ui-th>
|
|
||||||
<th></th>
|
<th></th>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -182,12 +174,6 @@ var { meta, data, reload, reloadPage, axios, remove, toFilterString, url, update
|
||||||
|
|
||||||
const activeColumns = computed(() => meta.value.columns.filter((c) => meta.value.form_meta.active_columns.includes(c.id)));
|
const activeColumns = computed(() => meta.value.columns.filter((c) => meta.value.form_meta.active_columns.includes(c.id)));
|
||||||
|
|
||||||
const getSort = computed(() => innerFilter.value.sort);
|
|
||||||
|
|
||||||
async function setSort(column) {
|
|
||||||
innerFilter.value.sort = getSort.value.by === column ? {by: column, direction: !getSort.value.direction} : {by: column, direction: false};
|
|
||||||
}
|
|
||||||
|
|
||||||
const activeColumnsConfig = computed({
|
const activeColumnsConfig = computed({
|
||||||
get: () => meta.value.form_meta.active_columns,
|
get: () => meta.value.form_meta.active_columns,
|
||||||
set: async (v) => {
|
set: async (v) => {
|
||||||
|
|
|
@ -255,8 +255,6 @@ it('test it orders participants by value', function (array $values, array $sorti
|
||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
$response = $this->callFilter('form.participant.index', ['sort' => ['by' => $key, 'direction' => $direction]], ['form' => $form]);
|
$response = $this->callFilter('form.participant.index', ['sort' => ['by' => $key, 'direction' => $direction]], ['form' => $form]);
|
||||||
$response->assertJsonPath('meta.filter.sort.by', $key);
|
|
||||||
$response->assertJsonPath('meta.filter.sort.direction', $direction);
|
|
||||||
|
|
||||||
foreach ($expected as $index => $value) {
|
foreach ($expected as $index => $value) {
|
||||||
$response->assertJsonPath("data.{$index}.{$key}", $value);
|
$response->assertJsonPath("data.{$index}.{$key}", $value);
|
||||||
|
|
Loading…
Reference in New Issue