Search on all fields, remove search in

This commit is contained in:
2024-03-21 08:47:30 +01:00
parent 673cd019f9
commit ea241bc5dc
2 changed files with 11 additions and 21 deletions

View File

@@ -33,8 +33,15 @@ class IkeaProducts extends Model
$result->where('country', $country); $result->where('country', $country);
} }
return $result->get(); return $result->get();
} else if ($field == "all") {
if (preg_match("/0[0-9]+/", $text)) {
$result = $this->where("code", '=',$text);
} else
$result = $this->where("name", 'LIKE', '%'. $text . '%')->orWhere("typeName", 'LIKE', '%'. $text . '%');
return $result->get();
} }
return []; return [];
} }

View File

@@ -316,8 +316,8 @@ const async_search = async () => {
if (settingsStore.country.code !== undefined) country = settingsStore.country.code; if (settingsStore.country.code !== undefined) country = settingsStore.country.code;
console.log('SETTINGS',settingsStore.country); console.log('SETTINGS',settingsStore.country);
console.log('URL',route("products.search", [settingsStore.field.value, settingsStore.text, country])); console.log('URL',route("products.search", ['all', settingsStore.text, country]));
const response = await axios.get(route("products.search", [settingsStore.field.value, settingsStore.text, country, settingsStore.online])); const response = await axios.get(route("products.search", ['all', settingsStore.text, country, settingsStore.online]));
options_items.value = response.data.map((i) => { options_items.value = response.data.map((i) => {
return { return {
@@ -505,23 +505,6 @@ const selectedRowClassNameFunction = (item) => {
/> />
</div> </div>
</div> </div>
<div class="">
<div>
<span class="font-extrabold font-mono">Search in:</span>
</div>
<div>
<multiselect
v-model="settingsStore.field"
:multiple="false"
:searchable="false"
:allow-empty="false"
:options="sdropdown"
track-by="value"
label="text"
@select="onSelectCode"
></multiselect>
</div>
</div>
</div> </div>