alpha version
This commit is contained in:
@@ -9,6 +9,7 @@ import Multiselect from '@/Components/MultiSelect.vue';
|
||||
import { Head, Link, useForm } from '@inertiajs/inertia-vue3';
|
||||
import rpoFields from './Data/MultiSelectOptionsRPO';
|
||||
import ConditionDisplay from '@/Components/ConditionStatement.vue';
|
||||
import { Inertia } from '@inertiajs/inertia';
|
||||
import { ref } from 'vue';
|
||||
|
||||
const preoperator_val1 = ref(['-', 'NOT']);
|
||||
@@ -19,12 +20,13 @@ const podmienka = ref([]);
|
||||
const count = ref(0);
|
||||
|
||||
const criteria_val = ref([
|
||||
{ name: "Obsahuje", operator: '%%%s%%'},
|
||||
{ name: "Začína", operator: '%s%%'},
|
||||
{ name: "Rovná sa", operator: '%s'}
|
||||
{ name: "Obsahuje", operator: 'LIKE'},
|
||||
{ name: "Začína", operator: 'LIKE START'},
|
||||
{ name: "Rovná sa", operator: '='}
|
||||
]);
|
||||
|
||||
const form = useForm({
|
||||
groupoperator: '',
|
||||
preoperator: '',
|
||||
field: '',
|
||||
value: '',
|
||||
@@ -32,11 +34,15 @@ const form = useForm({
|
||||
});
|
||||
|
||||
const submit = () => {
|
||||
form.post(route('search'), { });
|
||||
console.log('Post data');
|
||||
Inertia.post(`/search`, podmienka.value);
|
||||
};
|
||||
|
||||
const AddContition = () => {
|
||||
podmienka.value.push({pre: form.preoperator, field: form.field, value: form.value, criteria: form.criteria, level: level.value});
|
||||
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();
|
||||
}
|
||||
@@ -58,62 +64,74 @@ const ConstructCondition = () => {
|
||||
|
||||
<template>
|
||||
<GuestLayout>
|
||||
<ConditionDisplay :conditions="podmienka"></ConditionDisplay>
|
||||
|
||||
<Head title="Register" />
|
||||
|
||||
|
||||
<ConditionDisplay :conditions="podmienka"></ConditionDisplay>
|
||||
|
||||
<form @submit.prevent="submit">
|
||||
<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>
|
||||
<InputLabel for="Operator" value="Operator" />
|
||||
<Multiselect v-model="form.preoperator" :options="count == 0 ? preoperator_val1 : preoperator_val2">
|
||||
</Multiselect>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
||||
<SecondaryButton class="ml-4" @click="AddLevel">
|
||||
<font-awesome-icon icon="fa-solid fa-right-from-bracket"/>
|
||||
</SecondaryButton>
|
||||
<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>
|
||||
|
||||
<SecondaryButton class="ml-4" @click="RemLevel">
|
||||
<font-awesome-icon icon="fa-solid fa-right-to-bracket" />
|
||||
</SecondaryButton>
|
||||
<pre>podmienka = {{ podmienka }} </pre>
|
||||
<pre>level = {{ level }}</pre>
|
||||
<pre>count = {{ count }}</pre>
|
||||
|
||||
<SecondaryButton class="ml-4" @click="AddContition">
|
||||
<font-awesome-icon icon="fa-solid fa-circle-plus" />
|
||||
</SecondaryButton>
|
||||
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</GuestLayout>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user