|
@@ -1,4 +1,4 @@
|
|
|
-initPharmacySearch: function () {
|
|
|
+{{$category}}InitPharmacySearch: function () {
|
|
|
let self = this;
|
|
|
const debounce = (func, wait) => {
|
|
|
let timeout;
|
|
@@ -13,30 +13,30 @@ initPharmacySearch: function () {
|
|
|
};
|
|
|
var lastTerm = '';
|
|
|
var returnedFunction = debounce(function () {
|
|
|
- var term = $('#pharmacy-search').val();
|
|
|
+ var term = $('#{{$category}}-pharmacy-search').val();
|
|
|
if (!!term && lastTerm !== term) {
|
|
|
$.get('/pharmacy-suggest?term=' + $.trim(term), function (_data) {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').html(_data).removeClass('d-none');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').html(_data).removeClass('d-none');
|
|
|
});
|
|
|
lastTerm = term;
|
|
|
} else {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').addClass('d-none');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').addClass('d-none');
|
|
|
}
|
|
|
}, 250);
|
|
|
- $('#pharmacy-search')
|
|
|
+ $('#{{$category}}-pharmacy-search')
|
|
|
.on('keydown', function (e) {
|
|
|
- var term = $.trim($('#pharmacy-search').val());
|
|
|
- var activeItem = $('.suggestions-outer.pharmacy-suggestions .suggest-item.active');
|
|
|
+ var term = $.trim($('#{{$category}}-pharmacy-search').val());
|
|
|
+ var activeItem = $('.suggestions-outer.{{$category}}-pharmacy-suggestions .suggest-item.active');
|
|
|
switch (e.which) {
|
|
|
case 27:
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').addClass('d-none');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').addClass('d-none');
|
|
|
return false;
|
|
|
case 38:
|
|
|
if (activeItem.prev().length) {
|
|
|
activeItem.prev()
|
|
|
.addClass('active')
|
|
|
.siblings().removeClass('active');
|
|
|
- activeItem = $('.suggestions-outer.pharmacy-suggestions .suggest-item.active');
|
|
|
+ activeItem = $('.suggestions-outer.{{$category}}-pharmacy-suggestions .suggest-item.active');
|
|
|
if (activeItem.length) {
|
|
|
activeItem[0].scrollIntoView();
|
|
|
}
|
|
@@ -47,7 +47,7 @@ initPharmacySearch: function () {
|
|
|
activeItem.next()
|
|
|
.addClass('active')
|
|
|
.siblings().removeClass('active');
|
|
|
- activeItem = $('.suggestions-outer.pharmacy-suggestions .suggest-item.active');
|
|
|
+ activeItem = $('.suggestions-outer.{{$category}}-pharmacy-suggestions .suggest-item.active');
|
|
|
if (activeItem.length) {
|
|
|
activeItem[0].scrollIntoView();
|
|
|
}
|
|
@@ -60,39 +60,39 @@ initPharmacySearch: function () {
|
|
|
return false;
|
|
|
default:
|
|
|
if (!!term) {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions')
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions')
|
|
|
.html('<span class="d-block no-suggest-items">Searching...</span>')
|
|
|
.removeClass('d-none');
|
|
|
returnedFunction();
|
|
|
} else {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').addClass('d-none');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').addClass('d-none');
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
})
|
|
|
.on('keypress', function (e) {
|
|
|
- var term = $.trim($('#pharmacy-search').val());
|
|
|
+ var term = $.trim($('#{{$category}}-pharmacy-search').val());
|
|
|
if (!!term) {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions')
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions')
|
|
|
.html('<span class="d-block no-suggest-items">Searching...</span>')
|
|
|
.removeClass('d-none');
|
|
|
returnedFunction();
|
|
|
} else {
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').addClass('d-none');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').addClass('d-none');
|
|
|
}
|
|
|
});
|
|
|
- $(document).on('click', '.suggest-item.pharmacy-suggest[data-target-uid]', function () {
|
|
|
- $('#pharmacy-search').val('');
|
|
|
- $('.suggestions-outer.pharmacy-suggestions').addClass('d-none');
|
|
|
- self.applySuggestion(this);
|
|
|
+ $(document).on('click', '.suggestions-outer.{{$category}}-pharmacy-suggestions .suggest-item.pharmacy-suggest[data-target-uid]', function () {
|
|
|
+ $('#{{$category}}-pharmacy-search').val('');
|
|
|
+ $('.suggestions-outer.{{$category}}-pharmacy-suggestions').addClass('d-none');
|
|
|
+ self.{{$category}}ApplySuggestion(this);
|
|
|
return false;
|
|
|
});
|
|
|
},
|
|
|
-applySuggestion: function(_elem) {
|
|
|
- this.erxPopupItem.data.pharmacyName = $(_elem).attr('data-pharmacyName');
|
|
|
- this.erxPopupItem.data.pharmacyCity = $(_elem).attr('data-pharmacyCity');
|
|
|
- this.erxPopupItem.data.pharmacyState = $(_elem).attr('data-pharmacyState');
|
|
|
- this.erxPopupItem.data.pharmacyAddressMemo = $(_elem).attr('data-pharmacyAddressMemo');
|
|
|
- this.erxPopupItem.data.pharmacyPhone = $(_elem).attr('data-pharmacyPhone');
|
|
|
- this.erxPopupItem.data.pharmacyFax = $(_elem).attr('data-pharmacyFax');
|
|
|
+{{$category}}ApplySuggestion: function(_elem) {
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyName = $(_elem).attr('data-pharmacyName');
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyCity = $(_elem).attr('data-pharmacyCity');
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyState = $(_elem).attr('data-pharmacyState');
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyAddressMemo = $(_elem).attr('data-pharmacyAddressMemo');
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyPhone = $(_elem).attr('data-pharmacyPhone');
|
|
|
+ this.{{$category}}PopupItem.data.pharmacyFax = $(_elem).attr('data-pharmacyFax');
|
|
|
},
|