12085: fix customer search autofill issue

This commit is contained in:
Ahmed Ejaz
2024-02-02 01:52:31 +05:00
parent 1550f1356d
commit a6431bdec6
2 changed files with 2 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ export const useSearchCustomer = (controller) => {
fetch("/admin/search/customers.json?" + new URLSearchParams(params))
.then((response) => response.json())
.then((json) => {
this.items = json;
this.items = [...this.items, ...json];
callback(json);
})
.catch((error) => {

View File

@@ -6,6 +6,7 @@ export default class extends TomSelectController {
static values = { options: Object, distributor: Number };
connect() {
this.items = [];
useSearchCustomer(this);
useRenderCustomer(this);
const options = {
@@ -20,7 +21,6 @@ export default class extends TomSelectController {
};
super.connect(options);
this.control.on("item_add", this.onItemSelect.bind(this));
this.items = [];
}
onItemSelect(id, item) {