| Line 180... |
Line 180... |
| 180 |
let createOfferRequest = {};
|
180 |
let createOfferRequest = {};
|
| 181 |
createOfferRequest['name'] = $("#offer_name").val();
|
181 |
createOfferRequest['name'] = $("#offer_name").val();
|
| 182 |
createOfferRequest['startDate'] = startDate;
|
182 |
createOfferRequest['startDate'] = startDate;
|
| 183 |
createOfferRequest['endDate'] = endDate;
|
183 |
createOfferRequest['endDate'] = endDate;
|
| 184 |
createOfferRequest['offerNotes'] = $("#offer_notes").val();
|
184 |
createOfferRequest['offerNotes'] = $("#offer_notes").val();
|
| - |
|
185 |
createOfferRequest['incrementalTarget'] = $("input[name=incremental_target]").is(":checked");
|
| 185 |
createOfferRequest['terms'] = $("#offer_terms").val();
|
186 |
createOfferRequest['terms'] = $("#offer_terms").val();
|
| 186 |
createOfferRequest['targetType'] = $("input[name=targetType]:checked").val();
|
187 |
createOfferRequest['targetType'] = $("input[name=targetType]:checked").val();
|
| 187 |
createOfferRequest['payoutType'] = $("input[name=payoutType]:checked").val();
|
188 |
createOfferRequest['payoutType'] = $("input[name=payoutType]:checked").val();
|
| 188 |
createOfferRequest['schemeType'] = $("input[name=schemeType]:checked").val();
|
189 |
createOfferRequest['schemeType'] = $("input[name=schemeType]:checked").val();
|
| 189 |
if(createOfferRequest['schemeType']=='ACTIVATION') {
|
190 |
if(createOfferRequest['schemeType']=='ACTIVATION') {
|
| Line 216... |
Line 217... |
| 216 |
let $itemCriteriaPayoutContainer = $(itemCriteriaPayoutContainer);
|
217 |
let $itemCriteriaPayoutContainer = $(itemCriteriaPayoutContainer);
|
| 217 |
let amountType = $itemCriteriaPayoutContainer.find('input[name^=amountType]:checked').val();
|
218 |
let amountType = $itemCriteriaPayoutContainer.find('input[name^=amountType]:checked').val();
|
| 218 |
let payoutSlabs = [];
|
219 |
let payoutSlabs = [];
|
| 219 |
let itemCriteria1 = itemCriteria($itemCriteriaPayoutContainer);
|
220 |
let itemCriteria1 = itemCriteria($itemCriteriaPayoutContainer);
|
| 220 |
let $payoutSlabContainers = $itemCriteriaPayoutContainer.find('.slab');
|
221 |
let $payoutSlabContainers = $itemCriteriaPayoutContainer.find('.slab');
|
| 221 |
let itemCriteriaChanged = itemCriteria1['isSmartPhone'] || itemCriteria1['isFeaturedPhone']
|
222 |
let itemCriteriaChanged = itemCriteria1['smartPhone'] || itemCriteria1['featuredPhone']
|
| 222 |
|| itemCriteria1['catalogIds'].length > 0 || itemCriteria1['brands'].length > 0
|
223 |
|| itemCriteria1['catalogIds'].length > 0 || itemCriteria1['brands'].length > 0
|
| 223 |
|| itemCriteria1['excludeCatalogIds'].length > 0
|
224 |
|| itemCriteria1['excludeCatalogIds'].length > 0
|
| 224 |
|| itemCriteria1['startPrice'] > 0 || itemCriteria1['endPrice'] > itemCriteria1['startPrice'] > 0;
|
225 |
|| itemCriteria1['startPrice'] > 0 || itemCriteria1['endPrice'] > itemCriteria1['startPrice'] > 0;
|
| 225 |
if (itemCriteriaChanged || index == 0) {
|
226 |
if (itemCriteriaChanged || index == 0) {
|
| 226 |
$payoutSlabContainers.each(function (slabContainerIndex, slabContainer) {
|
227 |
$payoutSlabContainers.each(function (slabContainerIndex, slabContainer) {
|
| Line 274... |
Line 275... |
| 274 |
console.log("Invalid Offer");
|
275 |
console.log("Invalid Offer");
|
| 275 |
}
|
276 |
}
|
| 276 |
}
|
277 |
}
|
| 277 |
|
278 |
|
| 278 |
function itemCriteria($container) {
|
279 |
function itemCriteria($container) {
|
| 279 |
let isSmartPhone = $container.find("input[name=smartphone]").is(":checked");
|
280 |
let smartPhone = $container.find("input[name=smartphone]").is(":checked");
|
| 280 |
let isFeaturedPhone = $container.find("input[name=featuredphones]").is(":checked");
|
281 |
let featuredPhone = $container.find("input[name=featuredphone]").is(":checked");
|
| 281 |
let catalogIds = $container.find('.criteria-catalogids').val() || [];
|
282 |
let catalogIds = $container.find('.criteria-catalogids').val() || [];
|
| 282 |
let excludeCatalogIds = [];
|
283 |
let excludeCatalogIds = [];
|
| 283 |
let excludeChecked = $container.find('input.exclude').is(':checked');
|
284 |
let excludeChecked = $container.find('input.exclude').is(':checked');
|
| 284 |
if(excludeChecked) {
|
285 |
if(excludeChecked) {
|
| 285 |
excludeCatalogIds = catalogIds;
|
286 |
excludeCatalogIds = catalogIds;
|
| Line 290... |
Line 291... |
| 290 |
startPrice: Number($container.find('.startValue').val()),
|
291 |
startPrice: Number($container.find('.startValue').val()),
|
| 291 |
endPrice: Number($container.find('.endValue').val()),
|
292 |
endPrice: Number($container.find('.endValue').val()),
|
| 292 |
catalogIds: catalogIds.map(Number),
|
293 |
catalogIds: catalogIds.map(Number),
|
| 293 |
excludeCatalogIds : excludeCatalogIds.map(Number),
|
294 |
excludeCatalogIds : excludeCatalogIds.map(Number),
|
| 294 |
brands: brands,
|
295 |
brands: brands,
|
| 295 |
isSmartPhone: isSmartPhone,
|
296 |
smartPhone: smartPhone,
|
| 296 |
isFeaturedPhone: isFeaturedPhone
|
297 |
featuredPhone: featuredPhone
|
| 297 |
};
|
298 |
};
|
| 298 |
}
|
299 |
}
|
| 299 |
|
300 |
|
| 300 |
function loadOffer(domId) {
|
301 |
function loadOffer(domId) {
|
| 301 |
console.log(domId);
|
302 |
console.log(domId);
|