Subversion Repositories SmartDukaan

Rev

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

Rev 34449 Rev 34490
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(document).on('click', ".partner-brandwise-detail", function() {
2
	$(document).on('click', ".partner-brandwise-detail", function() {
3
		loadDetails("main-content");
3
		loadDetails("main-content");
4
	});
4
	});
5
 
5
 
6
 
-
 
7
	$(document).on('change', "#activationType", function() {
6
	$(document).on('change', "#activationType", function() {
8
		var row = $(this).closest("tr");
7
		var row = $(this).closest("tr");
9
		var code = $(row).find("td:eq(1)").text();
8
		var code = $(row).find("td:eq(1)").text();
10
		var activationType = $(row).find("td:eq(24) option:selected").val();
9
		var activationType = $(row).find("td:eq(24) option:selected").val();
11
 
10
 
Line 129... Line 128...
129
		$('#poItemsDetail .modal-content').html(response);
128
		$('#poItemsDetail .modal-content').html(response);
130
 
129
 
131
	});
130
	});
132
});
131
});
133
 
132
 
-
 
133
$(document).on('click', '.get-stock-info', function () {
-
 
134
	var $clickedTd = $(this);
-
 
135
	var $clickedTr = $clickedTd.closest('tr');
-
 
136
 
-
 
137
	var catalogId = $clickedTd.data('catalogid');
-
 
138
	var fofoId = $clickedTd.data('fofoid');
-
 
139
 
-
 
140
	// If already expanded, remove it
-
 
141
	if ($clickedTr.next().hasClass('expanded-row')) {
-
 
142
		$clickedTr.next().remove();
-
 
143
		return;
-
 
144
	}
-
 
145
 
-
 
146
	doGetAjaxRequestHandler(context + "/getItemsByCatalog?fofoId=" + fofoId + "&catalogId=" + catalogId, function (response) {
-
 
147
		console.log('response', response);
-
 
148
 
-
 
149
		// Remove old expanded rows
-
 
150
		$('.expanded-row').remove();
-
 
151
 
-
 
152
		var expandHtml = '<tr class="expanded-row"><td colspan="10">' + buildStockInfoHtml(response) + '</td></tr>';
-
 
153
 
-
 
154
		$clickedTr.after(expandHtml);
-
 
155
	});
-
 
156
});
-
 
157
 
-
 
158
function buildStockInfoHtml(response) {
-
 
159
	if (!response) {
-
 
160
		return '<div>No stock info available.</div>';
-
 
161
	}
-
 
162
 
-
 
163
	// if it's a single object
-
 
164
	var html = '<div style="padding:10px; background:#f1f1f1; border:1px solid #ccc;">';
-
 
165
	html += '<strong>Stock Info:</strong><br>';
-
 
166
	html += '<ul>';
-
 
167
	html += '<li><strong>Item ID:</strong> ' + response.itemId + '</li>';
-
 
168
	html += '<li><strong>Availability:</strong> ' + response.availability + '</li>';
-
 
169
 
-
 
170
	if (response.itemDescription && response.itemDescription !== 0) {
-
 
171
		html += '<li><strong>Description:</strong> ' + response.itemDescription + '</li>';
-
 
172
	} else {
-
 
173
		html += '<li><strong>Description:</strong> Not available</li>';
-
 
174
	}
-
 
175
 
-
 
176
	html += '</ul></div>';
-
 
177
 
-
 
178
	return html;
-
 
179
}
-
 
180
 
-
 
181
 
-
 
182
 
134
$(document).on('click', '#save-po-btn', function () {
183
$(document).on('click', '#save-po-btn', function () {
135
	console.log("Save PO button clicked!");
184
	console.log("Save PO button clicked!");
136
	const fofoId = parseInt($('#fofo-id').val());
185
	const fofoId = parseInt($('#fofo-id').val());
137
	console.log('fofoId:', fofoId);
186
	console.log('fofoId:', fofoId);
138
	saveSuggestedPo(fofoId);
187
	saveSuggestedPo(fofoId);