Subversion Repositories SmartDukaan

Rev

Rev 34516 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34516 Rev 34788
Line 252... Line 252...
252
			"offerId": offerId
252
			"offerId": offerId
253
 
253
 
254
 
254
 
255
		}
255
		}
256
 
256
 
-
 
257
		// STEP 1: Check for existing
-
 
258
		doPostAjaxRequestWithJsonHandler(context + "/CheckIfExistCustomerOfferItem", JSON.stringify(json), function (checkResponse) {
257
 
259
 
258
 
-
 
-
 
260
			IdempotencyKey = uuidv4();
259
		if (confirm("Are you sure you want to create offer!") == true) {
261
			if (checkResponse === true || checkResponse === "true") {
260
			doPostAjaxRequestWithJsonHandler(context
262
				// Show alert — item exists
261
				+ "/addCustomerOfferItem", JSON.stringify(json), function(response) {
263
				if (confirm("Are you sure want to upload this offer")) {
262
					if (response = true) {
264
					confirmAndAddOffer(json);
-
 
265
				}
-
 
266
 
-
 
267
			} else {
263
						alert("create  successfully");
268
				// Show alert — item exists
264
						$('#customerOfferItemdetail').modal('hide');
269
				if (confirm("This item already exists under the offer. Do you want to continue and create it anyway?")) {
265
						$('.modal-backdrop').remove();
270
					if (confirm("Are you sure want to upload this offer")) {
266
						loadCustomerOffer("main-content");
271
						confirmAndAddOffer(json);
267
					}
272
					}
268
				});
273
				}
269
		}
274
			}
270
 
275
		});
271
 
276
 
272
	});
277
	});
273
 
278
 
274
});
279
});
275
 
280
 
-
 
281
 
-
 
282
function confirmAndAddOffer(json) {
-
 
283
	doPostAjaxRequestWithJsonHandler(context + "/addCustomerOfferItem", JSON.stringify(json), function (response) {
-
 
284
		if (response === true || response === "true") {
-
 
285
			alert("Created successfully");
-
 
286
			$('#customerOfferItemdetail').modal('hide');
-
 
287
			$('.modal-backdrop').remove();
-
 
288
			loadCustomerOffer("main-content");
-
 
289
		} else {
-
 
290
			alert("Something went wrong while creating the offer.");
-
 
291
		}
-
 
292
	});
-
 
293
}
-
 
294
 
276
function loadCustomerOffer(domId) {
295
function loadCustomerOffer(domId) {
277
 
296
 
278
	doGetAjaxRequestHandler(`${context}/getCustomerOffer`, function(response) {
297
	doGetAjaxRequestHandler(`${context}/getCustomerOffer`, function(response) {
279
		$('#' + domId).html(response);
298
		$('#' + domId).html(response);
280
	});
299
	});