Subversion Repositories SmartDukaan

Rev

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

Rev 30017 Rev 33910
Line 1... Line 1...
1
$(function () {
1
$(function () {
2
	$(document).on('click', "a.allocation_po", function () {
2
    $(document).on('click', "a.allocation_po", function () {
3
		currentFofoId = 0;
3
        currentFofoId = 0;
4
		counterSize = '';
4
        counterSize = '';
5
		loadIndent('main-content');
5
        loadIndent('main-content');
6
	});
6
    });
7
 
7
 
8
	$(document).on('click', ".partners_allocation",
8
    $(document).on('click', ".partners_allocation",
9
		function () {
9
        function () {
10
 
10
 
11
			doGetAjaxRequestHandler(context + "/getPartnerAllocation", function (response) {
11
            doGetAjaxRequestHandler(context + "/getPartnerAllocation", function (response) {
12
				$('#' + 'main-content').html(response);
12
                $('#' + 'main-content').html(response);
13
 
13
 
14
			});
14
            });
15
 
15
 
16
		});
16
        });
17
 
17
 
18
	$(document).on('click', ".partnerAllocation",
18
    $(document).on('click', ".partnerAllocation",
19
		function () {
19
        function () {
20
 
20
 
21
			var fofoId = $('#fofo-users').val()
21
            var fofoId = $('#fofo-users').val()
22
			console.log(fofoId)
22
            console.log(fofoId)
23
			var url = "/indent/loadIndent?fofoId=" + fofoId + "&counterSize="
23
            var url = "/indent/loadIndent?fofoId=" + fofoId + "&counterSize="
24
				+ "TEN_LAC";
24
                + "TEN_LAC";
25
			doAjaxRequestHandler(context + url, "GET", function (response) {
25
            doAjaxRequestHandler(context + url, "GET", function (response) {
26
				{
26
                {
27
				}
27
                }
28
 
28
 
29
 
29
 
30
				$('.partner-indent-container').html(response);
30
                $('.partner-indent-container').html(response);
31
			});
31
            });
32
		});
32
        });
33
 
33
 
34
 
34
 
35
	$(document).on('click', "button.mk_pause_button",
35
    $(document).on('click', "button.mk_pause_button",
36
		function () {
36
        function () {
37
			var clickedButton = $(this);
37
            var clickedButton = $(this);
38
 
38
 
39
			var description = clickedButton.data("description");
39
            var description = clickedButton.data("description");
40
			var catalogId = clickedButton.data("id");
40
            var catalogId = clickedButton.data("id");
41
			getColorsForItems(
41
            getColorsForItems(
42
				catalogId,
42
                catalogId,
43
				0,
43
                0,
44
				"Active/pause " + description,
44
                "Active/pause " + description,
45
				function (itemIds) {
45
                function (itemIds) {
46
					console.log(itemIds);
46
                    console.log(itemIds);
47
					if (itemIds != null) {
47
                    if (itemIds != null) {
48
						bootbox
48
                        bootbox
49
							.confirm(
49
                            .confirm(
50
								"Confirm Update "
50
                                "Confirm Update "
51
								+ clickedButton
51
                                + clickedButton
52
									.data("description")
52
                                    .data("description")
53
								+ "?",
53
                                + "?",
54
								function (result) {
54
                                function (result) {
55
									console.log(result)
55
                                    console.log(result)
56
									if (result) {
56
                                    if (result) {
57
										coloredItems
57
                                        coloredItems
58
											.forEach(function (
58
                                            .forEach(function (
59
												item) {
59
                                                item) {
60
												item.active = itemIds
60
                                                item.active = itemIds
61
													.indexOf(item.id
61
                                                    .indexOf(item.id
62
														+ "") >= 0;
62
                                                        + "") >= 0;
63
												console
63
                                                console
64
													.log(coloredItems)
64
                                                    .log(coloredItems)
65
											});
65
                                            });
66
 
66
 
67
										doPostAjaxRequestWithJsonHandler(
67
                                        doPostAjaxRequestWithJsonHandler(
68
											context
68
                                            context
69
											+ "/indent/confirm-pause/",
69
                                            + "/indent/confirm-pause/",
70
											JSON
70
                                            JSON
71
												.stringify(coloredItems),
71
                                                .stringify(coloredItems),
72
											function (
72
                                            function (
73
												response) {
73
                                                response) {
74
												if (response) {
74
                                                if (response) {
75
													bootbox
75
                                                    bootbox
76
														.alert("Item/s  Updated Successfully");
76
                                                        .alert("Item/s  Updated Successfully");
77
												} else {
77
                                                } else {
78
													bootbox
78
                                                    bootbox
79
														.alert("Could not pause item");
79
                                                        .alert("Could not pause item");
80
												}
80
                                                }
81
 
81
 
82
											});
82
                                            });
83
									}
83
                                    }
84
								});
84
                                });
85
					}
85
                    }
86
				});
86
                });
87
		});
87
        });
88
	$(document).on('click', "button.raise_po", function () {
88
 
89
		if (confirm("Please confirm the PO")) {
89
 
90
			raisePO();
90
    $(document).on('click', "li.mk_counter_size", function () {
91
		} else {
91
        if ($(this).hasClass('active')) {
92
			return;
92
            return;
93
		}
93
        }
94
	});
94
        currentFofoId = 0;
95
 
95
        counterSize = $(this).find('a').html();
96
	$(document).on('click', "li.mk_counter_size", function () {
96
        loadIndent('main-content');
97
		if ($(this).hasClass('active')) {
97
    });
98
			return;
98
    $(document).on('click', "li.brandLi", function () {
99
		}
99
        if (!$(this).hasClass('active')) {
100
		currentFofoId = 0;
100
            $("table.brandPerformance").toggle();
101
		counterSize = $(this).find('a').html();
101
            $("li.brandLi").removeClass('active');
102
		loadIndent('main-content');
102
            $(this).addClass('active');
103
	});
103
        }
104
	$(document).on('click', "li.brandLi", function () {
104
    });
105
		if (!$(this).hasClass('active')) {
105
 
106
			$("table.brandPerformance").toggle();
106
    $(document).on('click', ".previous-month", function () {
107
			$("li.brandLi").removeClass('active');
107
        currentFofoId = 0;
108
			$(this).addClass('active');
108
        counterSize = '';
109
		}
109
        loadPreviousMonthIndent('main-content');
110
	});
110
    });
111
 
111
 
112
	$(document).on('click', ".previous-month", function () {
112
    $(document).on('click', ".current-month", function () {
113
		currentFofoId = 0;
113
        currentFofoId = 0;
114
		counterSize = '';
114
        counterSize = '';
115
		loadPreviousMonthIndent('main-content');
115
        loadIndent('main-content');
116
	});
116
    });
117
 
117
    $(document).on('click', 'a.create_indent', function () {
118
	$(document).on('click', ".current-month", function () {
118
        currentFofoId = 0;
119
		currentFofoId = 0;
119
        counterSize = '';
120
		counterSize = '';
120
        loadIndent("main-content");
121
		loadIndent('main-content');
121
    });
122
	});
122
    $(document).on('click', "button.create_indent", function () {
123
	$(document).on('click', 'a.create_indent', function () {
123
        loadIndent("main-content");
124
		currentFofoId = 0;
124
    });
125
		counterSize = '';
125
 
126
		loadIndent("main-content");
126
    $(document).on('click', "button.download_indent", function () {
127
	});
127
        downloadIndent();
128
	$(document).on('click', "button.create_indent", function () {
128
    });
129
		loadIndent("main-content");
129
 
130
	});
130
    $(document).on('change', "#entire-catalog-table input",
131
 
131
        function () {
132
	$(document).on('click', "button.download_indent", function () {
132
            var catalogId = parseInt($(this).data("catalog-id"));
133
		downloadIndent();
133
            var sellingPrice = parseInt($(this).data(
134
	})
134
                "selling-price"));
135
 
135
            var quantity = parseInt($(this).val());
136
	$(document).on('change', "#entire-catalog-table input",
136
            if (quantity > 40) {
137
		function () {
137
                alert("Quantity should not be above 40");
138
			var catalogId = parseInt($(this).data("catalog-id"));
138
                if (catalogId in indentMap) {
139
			var sellingPrice = parseInt($(this).data(
139
                    $(this).val(indentMap[catalogId].quantity);
140
				"selling-price"));
140
                } else {
141
			var quantity = parseInt($(this).val());
141
                    $(this).val(0);
142
			if (quantity > 40) {
142
                }
143
				alert("Quantity should not be above 40");
143
                return;
144
				if (catalogId in indentMap) {
144
            }
145
					$(this).val(indentMap[catalogId].quantity);
145
            brandName = $(this).data("brand-name");
146
				} else {
146
            description = $(this).data("description");
147
					$(this).val(0);
147
            if (!(brandName in indentMap)) {
148
				}
148
                indentMap[brandName] = {};
149
				return;
149
            }
150
			}
150
            if (catalogId in indentMap[brandName]) {
151
			brandName = $(this).data("brand-name");
151
                indentMap[brandName][catalogId]["quantity"] = quantity;
152
			description = $(this).data("description");
152
                indentMap[brandName][catalogId]["sellingPrice"] = sellingPrice;
153
			if (!(brandName in indentMap)) {
153
                indentMap[brandName][catalogId]["description"] = description;
154
				indentMap[brandName] = {};
154
                indentMap[brandName][catalogId]["catalogId"] = catalogId;
155
			}
155
                indentMap[brandName][catalogId]["diff"] = quantity
156
			if (catalogId in indentMap[brandName]) {
156
                    - indentMap[brandName][catalogId]["initialQuantity"];
157
				indentMap[brandName][catalogId]["quantity"] = quantity;
157
            } else {
158
				indentMap[brandName][catalogId]["sellingPrice"] = sellingPrice;
158
                indentMap[brandName][catalogId] = {
159
				indentMap[brandName][catalogId]["description"] = description;
159
                    "quantity": quantity,
160
				indentMap[brandName][catalogId]["catalogId"] = catalogId;
160
                    "sellingPrice": sellingPrice,
161
				indentMap[brandName][catalogId]["diff"] = quantity
161
                    "description": description,
162
					- indentMap[brandName][catalogId]["initialQuantity"];
162
                    "catalogId": catalogId,
163
			} else {
163
                    "initialQuantity": 0,
164
				indentMap[brandName][catalogId] = {
164
                    "diff": quantity
165
					"quantity": quantity,
165
                };
166
					"sellingPrice": sellingPrice,
166
            }
167
					"description": description,
167
 
168
					"catalogId": catalogId,
168
            console.log(indentMap);
169
					"initialQuantity": 0,
169
            console.log(currentFofoId)
170
					"diff": quantity
170
            doPostAjaxRequestHandler(context
171
				};
171
                + "/open-indent/save?catalogId=" + catalogId + "&itemQty=" + quantity + "&fofoId=" + currentFofoId
172
			}
172
                , function (response) {
173
 
173
                    console.log(response);
174
			console.log(indentMap);
174
                    if (response == 'true') {
175
			console.log(currentFofoId)
175
                    }
176
			doPostAjaxRequestHandler(context
176
                });
177
				+ "/open-indent/save?catalogId=" + catalogId + "&itemQty=" + quantity + "&fofoId=" + currentFofoId
177
            populateIndentSummary();
178
				, function (response) {
178
        });
179
					console.log(response);
179
 
180
					if (response == 'true') {
180
 
181
					}
181
    /*
182
				});
182
        * $(document).on('click', "button.mk_submit_indent", function() {
183
			populateIndentSummary();
183
        * confirmString =[]; confirmString .push('<table class="table
184
		});
184
        * table-striped table-condensed table-bordered"
185
 
185
        * id="entire-catalog-table">'); confirmString.push('<tr>');
186
 
186
        * confirmString .push('<th style="width:100px">Catalog Id</th>');
187
	/*
187
        * confirmString .push('<th style="width:250px">Description</th>');
188
		* $(document).on('click', "button.mk_submit_indent", function() {
188
        * confirmString .push('<th style="width:150px">Unit Price</th>');
189
		* confirmString =[]; confirmString .push('<table class="table
189
        * confirmString .push('<th style="width:150px">Quantity</th>');
190
		* table-striped table-condensed table-bordered"
190
        * confirmString .push('<th style="width:200px">Item total</th>');
191
		* id="entire-catalog-table">'); confirmString.push('<tr>');
191
        * confirmString.push('</tr>'); changedItemIds
192
		* confirmString .push('<th style="width:100px">Catalog Id</th>');
192
        * .forEach(function(itemId) {
193
		* confirmString .push('<th style="width:250px">Description</th>');
193
        *
194
		* confirmString .push('<th style="width:150px">Unit Price</th>');
194
        * confirmString .push('<tr style="background-color:#9C7D7E">');
195
		* confirmString .push('<th style="width:150px">Quantity</th>');
195
        * confirmString.push('<td>' + itemId + '</td>');
196
		* confirmString .push('<th style="width:200px">Item total</th>');
196
        * confirmString.push('<td>' +indentMap[itemId].description + '</td>');
197
		* confirmString.push('</tr>'); changedItemIds
197
        * confirmString .push('<td style="text-align:left">' +
198
		* .forEach(function(itemId) {
198
        * numberToComma(indentMap[itemId].sellingPrice) + '</td>');
199
		*
199
        * confirmString.push('<td style="text-align:left">' +
200
		* confirmString .push('<tr style="background-color:#9C7D7E">');
200
        * indentMap[itemId].quantity + '(' +(indentMap[itemId].diff > 0 ? '+' :
201
		* confirmString.push('<td>' + itemId + '</td>');
201
        * '-') + Math.abs(indentMap[itemId].diff) + ' pcs)</td>');
202
		* confirmString.push('<td>' +indentMap[itemId].description + '</td>');
202
        * confirmString .push('<td style="text-align:left">'
203
		* confirmString .push('<td style="text-align:left">' +
203
        * +numberToComma(indentMap[itemId].quantity,
204
		* numberToComma(indentMap[itemId].sellingPrice) + '</td>');
204
        * indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>');
205
		* confirmString.push('<td style="text-align:left">' +
205
        * });
206
		* indentMap[itemId].quantity + '(' +(indentMap[itemId].diff > 0 ? '+' :
206
        *
207
		* '-') + Math.abs(indentMap[itemId].diff) + ' pcs)</td>');
207
        *
208
		* confirmString .push('<td style="text-align:left">'
208
        *
209
		* +numberToComma(indentMap[itemId].quantity,
209
        * for ( var itemId in indentMap) { if(itemId.indexOf(changedItemIds) >
210
		* indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>');
210
        * 0) { continue; } if(indentMap[itemId].quantity > 0) {
211
		* });
211
        * confirmString.push('<tr>'); confirmString.push('<td>' + itemId + '</td>');
212
		*
212
        * confirmString.push('<td>' +indentMap[itemId].description + '</td>');
213
		*
213
        * confirmString .push('<td style="text-align:left">' +
214
		*
214
        * numberToComma(indentMap[itemId].sellingPrice) + '</td>');
215
		* for ( var itemId in indentMap) { if(itemId.indexOf(changedItemIds) >
215
        * confirmString.push('<td style="text-align:left">' +
216
		* 0) { continue; } if(indentMap[itemId].quantity > 0) {
216
        * indentMap[itemId].quantity + '</td>'); confirmString .push('<td style="text-align:left">' +
217
		* confirmString.push('<tr>'); confirmString.push('<td>' + itemId + '</td>');
217
        * numberToComma(indentMap[itemId].quantity
218
		* confirmString.push('<td>' +indentMap[itemId].description + '</td>');
218
        * ,indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>'); } }
219
		* confirmString .push('<td style="text-align:left">' +
219
        * confirmString.push('</table>');
220
		* numberToComma(indentMap[itemId].sellingPrice) + '</td>');
220
        * $('#indent-container1').html(confirmString.join('')) .show();
221
		* confirmString.push('<td style="text-align:left">' +
221
        * $('#indent-container').hide(); $('button.mk_submit_indent').hide();
222
		* indentMap[itemId].quantity + '</td>'); confirmString .push('<td style="text-align:left">' +
222
        * $('button.bk_toedit_indent').show();
223
		* numberToComma(indentMap[itemId].quantity
223
        * $('button.confirm_indent').show();
224
		* ,indentMap[itemId].sellingPrice) + '</td>'); confirmString.push('</tr>'); } }
224
        */
225
		* confirmString.push('</table>');
225
    /*
226
		* $('#indent-container1').html(confirmString.join('')) .show();
226
       * $(document).on('click', "button.confirm_indent", function() { var
227
		* $('#indent-container').hide(); $('button.mk_submit_indent').hide();
227
       * itemQtyList = []; for (catalogId in indentMap) { diff =
228
		* $('button.bk_toedit_indent').show();
228
       * indentMap[catalogId]["quantity"] -
229
		* $('button.confirm_indent').show();
229
       * indentMap[catalogId]["initialQuantity"]; if (diff != 0) {
230
		*/
230
       * itemQtyList.push({ "quantity" : indentMap[catalogId]["quantity"],
231
	/*
231
       * "catalogId" : indentMap[catalogId]["catalogId"] }); } }
232
	   * $(document).on('click', "button.confirm_indent", function() { var
232
       * doPostAjaxRequestWithJsonHandler(context +
233
	   * itemQtyList = []; for (catalogId in indentMap) { diff =
233
       * "/open-indent/save?fofoId=" + currentFofoId + "&counxterSize=" +
234
	   * indentMap[catalogId]["quantity"] -
234
       * counterSize, JSON .stringify(itemQtyList), function(data) {
235
	   * indentMap[catalogId]["initialQuantity"]; if (diff != 0) {
235
       * alert('Indent has been created Successfully!'); indentMap = {};
236
	   * itemQtyList.push({ "quantity" : indentMap[catalogId]["quantity"],
236
       * loadIndent('main-content'); }); });
237
	   * "catalogId" : indentMap[catalogId]["catalogId"] }); } }
237
       */
238
	   * doPostAjaxRequestWithJsonHandler(context +
238
 
239
	   * "/open-indent/save?fofoId=" + currentFofoId + "&counxterSize=" +
239
    $(document).on('click', ".confirm_indent",
240
	   * counterSize, JSON .stringify(itemQtyList), function(data) {
240
        function () {
241
	   * alert('Indent has been created Successfully!'); indentMap = {};
241
            if (confirm("Are you sure to confirm the indent") == true) {
242
	   * loadIndent('main-content'); }); });
242
                doPostAjaxRequestHandler(context + "/open-indent/confirm?fofoId=" + currentFofoId,
243
	   */
243
                    function (response) {
244
 
244
 
245
	$(document).on('click', ".confirm_indent",
245
                        console.log(response);
246
		function () {
246
                        if (response == 'true') {
247
			if (confirm("Are you sure to confirm the indent") == true) {
247
                            alert("successfully confirm");
248
				doPostAjaxRequestHandler(context + "/open-indent/confirm?fofoId=" + currentFofoId,
248
                            // loadIndent('main-content');
249
					function (response) {
249
                        }
250
 
250
                    });
251
						console.log(response);
251
 
252
						if (response == 'true') {
252
 
253
							alert("successfully confirm");
253
            }
254
							// loadIndent('main-content');
254
        });
255
						}
255
 
256
					});
256
    /*
257
 
257
     * $(document).on('click', "button.bk_toedit_indent", function() {
258
 
258
     * $('button.bk_toedit_indent').hide(); $('button.confirm_indent').hide();
259
			}
259
     * $('button.mk_submit_indent').show(); $('#indent-container1').hide();
260
		});
260
     * $('#indent-container').show();
261
 
261
     *
262
	/*
262
     * });
263
	 * $(document).on('click', "button.bk_toedit_indent", function() {
263
     */
264
	 * $('button.bk_toedit_indent').hide(); $('button.confirm_indent').hide();
-
 
265
	 * $('button.mk_submit_indent').show(); $('#indent-container1').hide();
-
 
266
	 * $('#indent-container').show();
-
 
267
	 *
-
 
268
	 * });
-
 
269
	 */
-
 
270
 
264
 
271
});
265
});
272
 
266
 
273
function populateIndentSummary() {
267
function populateIndentSummary() {
274
	$planSummary = $("#plansummary");
268
    $planSummary = $("#plansummary");
275
 
269
 
276
	$planSummary.html('');
270
    $planSummary.html('');
277
	changedItemIds = [];
271
    changedItemIds = [];
278
	htmArr = [];
272
    htmArr = [];
279
	$('button.confirm_indent').hide();
273
    $('button.confirm_indent').hide();
280
	for (var brandName in indentMap) {
274
    for (var brandName in indentMap) {
281
 
275
 
282
 
276
 
283
		allZero = true;
277
        allZero = true;
284
		trArray = [];
278
        trArray = [];
285
 
279
 
286
		for (var itemId in indentMap[brandName]) {
280
        for (var itemId in indentMap[brandName]) {
287
			var description = indentMap[brandName][itemId]['description'];
281
            var description = indentMap[brandName][itemId]['description'];
288
 
282
 
289
			var itemQty = indentMap[brandName][itemId]['quantity'];
283
            var itemQty = indentMap[brandName][itemId]['quantity'];
290
 
284
 
291
 
285
 
292
			var sellingPrice = indentMap [brandName][itemId]['sellingPrice'];
286
            var sellingPrice = indentMap [brandName][itemId]['sellingPrice'];
293
			var sellPrice = itemQty * sellingPrice;
287
            var sellPrice = itemQty * sellingPrice;
294
 
288
 
295
			if (itemQty != 0) {
289
            if (itemQty != 0) {
296
				allZero = false;
290
                allZero = false;
297
 
291
 
298
				trString = `<tr>
292
                trString = `<tr>
299
							<td style = "width:80%">${description}</td>
293
							<td style = "width:80%">${description}</td>
300
							<td>${itemQty}</td>
294
							<td>${itemQty}</td>
301
							<td class ="currency" >${sellPrice}</td>
295
							<td class ="currency" >${sellPrice}</td>
302
						</tr>`
296
						</tr>`
303
				trArray.push(trString);
297
                trArray.push(trString);
304
 
298
 
305
			}
299
            }
306
 
300
 
307
 
301
 
308
		}
302
        }
309
		if (!allZero) {
303
        if (!allZero) {
310
			$('button.confirm_indent').show();
304
            $('button.confirm_indent').show();
311
			htmArr.push('<div>');
305
            htmArr.push('<div>');
312
			htmArr.push('<h4>' + brandName + '</h4>');
306
            htmArr.push('<h4>' + brandName + '</h4>');
313
			htmArr.push('<table class="table table-condensed" id = "planning-table">');
307
            htmArr.push('<table class="table table-condensed" id = "planning-table">');
314
			htmArr.push(trArray.join(' '));
308
            htmArr.push(trArray.join(' '));
315
			htmArr.push('</table>');
309
            htmArr.push('</table>');
316
			htmArr.push('</div>');
310
            htmArr.push('</div>');
317
 
311
 
318
 
312
 
319
		}
313
        }
320
 
314
 
321
	}
315
    }
322
 
316
 
323
 
317
 
324
	$planSummary.html(htmArr.join(""));
318
    $planSummary.html(htmArr.join(""));
325
	var total = 0;
319
    var total = 0;
326
	$('#planning-table tr').each(function () {
320
    $('#planning-table tr').each(function () {
327
 
321
 
328
 
322
 
329
		var value = parseInt($('td', this).eq(2).text());
323
        var value = parseInt($('td', this).eq(2).text());
330
		if (!isNaN(value)) {
324
        if (!isNaN(value)) {
331
			total += value;
325
            total += value;
332
		}
326
        }
333
 
327
 
334
		console.log(total);
328
        console.log(total);
335
 
329
 
336
	});
330
    });
337
 
331
 
338
	divString = `<div style ="float:right"><b>Total:-</b><span class="currency">${total}</span></div>`
332
    divString = `<div style ="float:right"><b>Total:-</b><span class="currency">${total}</span></div>`
339
	htmArr.push(divString);
333
    htmArr.push(divString);
340
	$planSummary.html(htmArr.join(""));
334
    $planSummary.html(htmArr.join(""));
341
 
335
 
342
 
336
 
343
	// $('#planning-table tfoot td').eq(2).text('Total: ' + total);
337
    // $('#planning-table tfoot td').eq(2).text('Total: ' + total);
344
 
338
 
345
}
339
}
346
 
340
 
347
function loadIndent(domId) {
341
function loadIndent(domId) {
348
	var url = "/indent/loadIndent?fofoId=" + currentFofoId + "&counterSize="
342
    var url = "/indent/loadIndent?fofoId=" + currentFofoId + "&counterSize="
349
		+ counterSize;
343
        + counterSize;
350
	doAjaxRequestHandler(context + url, "GET", function (response) {
344
    doAjaxRequestHandler(context + url, "GET", function (response) {
351
		{
345
        {
352
		}
346
        }
353
		$('#' + domId).html(response);
347
        $('#' + domId).html(response);
354
	});
348
    });
355
}
349
}
356
 
350
 
357
function loadPreviousMonthIndent(domId) {
351
function loadPreviousMonthIndent(domId) {
358
	var url = "/indent/loadIndentPreviousMonth?fofoId=" + currentFofoId + "&counterSize="
352
    let url = `${context}/indent/loadIndentPreviousMonth?fofoId=${currentFofoId}&counterSize=${counterSize}`;
359
		+ counterSize;
-
 
360
	doAjaxRequestHandler(context + url, "GET", function (response) {
353
    doAjaxRequestHandler(context + url, "GET", function (response) {
361
		{
-
 
362
		}
-
 
363
		$('#' + domId).html(response);
354
        $('#' + domId).html(response);
364
	});
355
    });
365
}
356
}
366
 
357
 
367
function downloadIndent() {
358
function downloadIndent() {
368
	var url = "/indent/download?fofoId=" + currentFofoId + "&counterSize="
359
    let url = `${context}/indent/download?fofoId=${currentFofoId}&counterSize=${counterSize}`;
369
		+ counterSize;
-
 
370
	doAjaxGetDownload(url, "indent.csv")
360
    doAjaxGetDownload(url, "indent.csv");
371
}
-
 
372
 
-
 
373
function raisePO() {
-
 
374
	doPostAjaxRequestWithJsonHandler(context + "/indent/create-po", {},
-
 
375
		function (response) {
-
 
376
			if (response) {
-
 
377
				alert("PO Created Successfully");
-
 
378
				$('a.allocation_po').click();
-
 
379
			} else {
-
 
380
				alert("Problem while creating PO");
-
 
381
			}
-
 
382
		});
-
 
383
 
-
 
384
}
361
}
385
362