Subversion Repositories SmartDukaan

Rev

Rev 30723 | Rev 31190 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30723 Rev 30753
Line 184... Line 184...
184
});
184
});
185
 
185
 
186
$(document).on('click', 'select.criteria-catalogids+div > button', function() {
186
$(document).on('click', 'select.criteria-catalogids+div > button', function() {
187
	if (changed) {
187
	if (changed) {
188
		let brands = $(this).closest('.item-criteria').find('select').val();
188
		let brands = $(this).closest('.item-criteria').find('select').val();
-
 
189
		let led = $(this).closest('.item-criteria').find('input[name=led]').is(":checked");
189
		$brandsContainer = $(this);
190
		$brandsContainer = $(this);
-
 
191
		let categoryId = 3;
-
 
192
		if (led) {
-
 
193
			categoryId = 14202;
-
 
194
		}
190
		var url = `${context}/entity?brands=${brands.join(",")}&categoryId=3&limit=0`;
195
		var url = `${context}/entity?brands=${brands.join(",")}&categoryId=${categoryId}&limit=0`;
191
		$select = $brandsContainer.closest('.item-criteria').find('.criteria-catalogids');
196
		$select = $brandsContainer.closest('.item-criteria').find('.criteria-catalogids');
192
		$select.html('');
197
		$select.html('');
193
		if (brands.length > 0) {
198
		if (brands.length > 0) {
194
			doGetAjaxRequestHandler(url, function(response) {
199
			doGetAjaxRequestHandler(url, function (response) {
195
				data = JSON.parse(response);
200
				data = JSON.parse(response);
196
				for (i = 0; i < data.length; i++) {
201
				for (i = 0; i < data.length; i++) {
197
					$select.append(`<option value="${data[i].catalogId_i}">${data[i].title_s}</option>`);
202
					$select.append(`<option value="${data[i].catalogId_i}">${data[i].title_s}</option>`);
198
				}
203
				}
199
				$select.multiselect('rebuild');
204
				$select.multiselect('rebuild');
Line 317... Line 322...
317
}
322
}
318
 
323
 
319
function itemCriteria($container) {
324
function itemCriteria($container) {
320
	let smartPhone = $container.find("input[name=smartphone]").is(":checked");
325
	let smartPhone = $container.find("input[name=smartphone]").is(":checked");
321
	let featuredPhone = $container.find("input[name=featuredphone]").is(":checked");
326
	let featuredPhone = $container.find("input[name=featuredphone]").is(":checked");
-
 
327
	let led = $container.find("input[name=led]").is(":checked");
322
	let catalogIds = $container.find('.criteria-catalogids').val() || [];
328
	let catalogIds = $container.find('.criteria-catalogids').val() || [];
323
	let excludeCatalogIds = [];
329
	let excludeCatalogIds = [];
324
	let excludeChecked = $container.find('input.exclude').is(':checked');
330
	let excludeChecked = $container.find('input.exclude').is(':checked');
325
	if (excludeChecked) {
331
	if (excludeChecked) {
326
		excludeCatalogIds = catalogIds;
332
		excludeCatalogIds = catalogIds;
Line 332... Line 338...
332
		endPrice: Number($container.find('.endValue').val()),
338
		endPrice: Number($container.find('.endValue').val()),
333
		catalogIds: catalogIds.map(Number),
339
		catalogIds: catalogIds.map(Number),
334
		excludeCatalogIds: excludeCatalogIds.map(Number),
340
		excludeCatalogIds: excludeCatalogIds.map(Number),
335
		brands: brands,
341
		brands: brands,
336
		smartPhone: smartPhone,
342
		smartPhone: smartPhone,
337
		featuredPhone: featuredPhone
343
		featuredPhone: featuredPhone,
-
 
344
		led: led
338
	};
345
	};
339
}
346
}
340
 
347
 
341
function loadOffer(domId) {
348
function loadOffer(domId) {
342
	console.log(domId);
349
	console.log(domId);