First test
This commit is contained in:
@@ -7,59 +7,43 @@ import SecondaryButton from '@/Components/SecondaryButton.vue';
|
||||
import TextInput from '@/Components/TextInput.vue';
|
||||
import Multiselect from '@/Components/MultiSelect.vue';
|
||||
import { Head, Link, useForm } from '@inertiajs/inertia-vue3';
|
||||
import rpoFields from './Data/MultiSelectOptionsRPO';
|
||||
import rpoFields from '../Data/MultiSelectOptionsRPO';
|
||||
import ConditionDisplay from '@/Components/ConditionStatement.vue';
|
||||
import QueryBuilder from '@phongthien/vue3-query-builder';
|
||||
import Input from '@/Components/Input.vue';
|
||||
import Number from '@/Components/Number.vue';
|
||||
import JsonQueryBuilder from '@/Components/JsonQueryBuilder.vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { defineEmits } from 'vue'
|
||||
import { Inertia } from '@inertiajs/inertia';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const preoperator_val1 = ref(['-', 'NOT']);
|
||||
const preoperator_val2 = ref(['AND', 'AND NOT', 'OR', 'OR NOT']);
|
||||
|
||||
const level = ref(0);
|
||||
const podmienka = ref([]);
|
||||
const count = ref(0);
|
||||
|
||||
const criteria_val = ref([
|
||||
{ name: "Obsahuje", operator: 'LIKE'},
|
||||
{ name: "Začína", operator: 'LIKE START'},
|
||||
{ name: "Rovná sa", operator: '='}
|
||||
]);
|
||||
|
||||
const form = useForm({
|
||||
groupoperator: '',
|
||||
preoperator: '',
|
||||
field: '',
|
||||
value: '',
|
||||
criteria: '',
|
||||
});
|
||||
const query = ref({
|
||||
condition: 'and',
|
||||
rules: [{
|
||||
id: 'addresses.street',
|
||||
operator: '=',
|
||||
value: 'V. Clementisa'
|
||||
}, {
|
||||
condition: 'and',
|
||||
rules: [{
|
||||
id: 'fullNames.value',
|
||||
operator: '(',
|
||||
value: 'Cobra s.r.o.'
|
||||
}, {
|
||||
id: 'equities.valuePaid',
|
||||
operator: '<=',
|
||||
value: 80000
|
||||
}]
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
const submit = () => {
|
||||
console.log('Post data');
|
||||
Inertia.post(`/search`, podmienka.value);
|
||||
console.log(query.value);
|
||||
Inertia.post(`/search`, query.value);
|
||||
};
|
||||
|
||||
const AddContition = () => {
|
||||
podmienka.value.push({groupop: form.groupoperator,pre: form.preoperator, field: form.field, value: form.value, criteria: form.criteria, level: level.value, count: count.value});
|
||||
for (var i = count.value; i >= 0; i--) {
|
||||
podmienka.value[podmienka.value.length - i - 1]["groupop"] = form.groupoperator;
|
||||
}
|
||||
count.value++;
|
||||
ConstructCondition();
|
||||
}
|
||||
|
||||
const AddLevel = () => {
|
||||
level.value++;
|
||||
count.value=0;
|
||||
}
|
||||
|
||||
const RemLevel = () => {
|
||||
level.value--;
|
||||
count.value=0;
|
||||
}
|
||||
|
||||
const ConstructCondition = () => {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -67,71 +51,7 @@ const ConstructCondition = () => {
|
||||
|
||||
<Head title="Register" />
|
||||
|
||||
<ConditionDisplay :conditions="podmienka"></ConditionDisplay>
|
||||
|
||||
<div class="min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100">
|
||||
<div class="w-full sm:max-w-md mt-6 px-6 py-4 bg-white shadow-md sm:rounded-lg">
|
||||
<form @submit.prevent="submit">
|
||||
<template v-if="level > 0">
|
||||
<InputLabel for="Operator" value="Skupinový operátor" />
|
||||
<Multiselect v-model="form.groupoperator" :options="preoperator_val2">
|
||||
</Multiselect>
|
||||
</template>
|
||||
|
||||
|
||||
<InputLabel for="Operator" value="Operator" />
|
||||
<Multiselect v-model="form.preoperator" :options="count == 0 ? preoperator_val1 : preoperator_val2">
|
||||
</Multiselect>
|
||||
|
||||
<InputLabel for="field" value="Pole" />
|
||||
<Multiselect v-model="form.field" label="desc" trackby="desc" :options="rpoFields"></Multiselect>
|
||||
|
||||
<InputLabel for="Kriteria" value="Kriteria" />
|
||||
<Multiselect v-model="form.criteria" label="name" trackby="name" :options="criteria_val">
|
||||
</Multiselect>
|
||||
|
||||
<div class="mt-4">
|
||||
<InputLabel for="Hodnota" value="Hodnota" />
|
||||
<TextInput id="value" type="text" class="mt-1 block w-full" v-model="form.value" required />
|
||||
<InputError class="mt-2" :message="form.errors.email" />
|
||||
</div>
|
||||
|
||||
<pre>podmienka = {{ podmienka }} </pre>
|
||||
<pre>level = {{ level }}</pre>
|
||||
<pre>count = {{ count }}</pre>
|
||||
|
||||
|
||||
<div class="flex items-center justify-end mt-4">
|
||||
|
||||
<PrimaryButton class="ml-4" :class="{ 'opacity-25': form.processing }"
|
||||
:disabled="form.processing">
|
||||
Hľadaj
|
||||
</PrimaryButton>
|
||||
|
||||
|
||||
|
||||
|
||||
<SecondaryButton class="ml-4" @click="AddLevel">
|
||||
<font-awesome-icon icon="fa-solid fa-right-from-bracket" />
|
||||
</SecondaryButton>
|
||||
|
||||
<SecondaryButton class="ml-4" @click="RemLevel">
|
||||
<font-awesome-icon icon="fa-solid fa-right-to-bracket" />
|
||||
</SecondaryButton>
|
||||
|
||||
<SecondaryButton class="ml-4" @click="AddContition">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-plus" />
|
||||
</SecondaryButton>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<JsonQueryBuilder :query="query" :queryOptions="rpoFields" @run-query="submit" ></JsonQueryBuilder>
|
||||
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user