Subversion Repositories SmartDukaan

Rev

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

Rev 27618 Rev 28055
Line 1... Line 1...
1
<style>
1
<style>
2
	
-
 
3
	.btn:hover{
2
.btn:hover {
4
  		color: grey;
3
	color: grey;
5
  		text-decoration: none;
4
	text-decoration: none;
6
	}
5
}
-
 
6
 
7
	.btn-info:hover{
7
.btn-info:hover {
8
  		color: grey;
8
	color: grey;
9
  		text-decoration: none;
9
	text-decoration: none;
10
	}
10
}
11
}
11
}
12
</style>
12
</style>
13
<section class="wrapper">     
13
<section class="wrapper">
14
	<div class="row">
14
	<div class="row">
15
		<div class="col-lg-12">
15
		<div class="col-lg-12">
-
 
16
			<h3 class="page-header">
16
			<h3 class="page-header"><i class="icon_document_alt"></i>Catalog Item Management</h3>
17
				<i class="icon_document_alt"></i>Catalog Item Management
-
 
18
			</h3>
17
			<ol class="breadcrumb">
19
			<ol class="breadcrumb">
-
 
20
				<li><i class="fa fa-home"></i><a
18
				<li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
21
					href="${rc.contextPath}/dashboard">Home</a></li>
19
				<li><i class="icon_document_alt"></i>PriceDrop</li>
22
				<li><i class="icon_document_alt"></i>PriceDrop</li>
-
 
23
				<li><button type="button" data-toggle="modal"
20
				<li><button type="button" data-toggle="modal" class="btn btn-sm btn-primary mk_download_pricing" data-target="#addPricing">Download Pricing</li>
24
						class="btn btn-sm btn-primary mk_download_pricing"
-
 
25
						data-target="#addPricing">Download Pricing</li>
-
 
26
				<li><button type="button" data-toggle="modal"
21
				<li><button type="button" data-toggle="modal" class="btn btn-sm btn-primary" data-target="#addPriceModal">Add/Update Pricing</li>
27
						class="btn btn-sm btn-primary" data-target="#addPriceModal">Add/Update
-
 
28
						Pricing</li>
22
			</ol>
29
			</ol>
23
		</div>
30
		</div>
24
	</div>
31
	</div>
25
	<div class="form-group row">
32
	<div class="form-group row">
26
		<div class="col-lg-8">
33
		<div class="col-lg-6">
27
			<label for="typeaheaditem1">Item:</label>
34
			<label for="typeaheaditem1">Item:</label> <input
28
	    	<input placeholder="Search Item" type="text" class="form-control typeahead" id="typeaheaditem1" name="Item" data-provide="typeahead" autocomplete="off">
35
				placeholder="Search Item" type="text" class="form-control typeahead"
-
 
36
				id="typeaheaditem1" name="Item" data-provide="typeahead"
-
 
37
				autocomplete="off">
29
	    </div>
38
		</div>
30
		<div class="col-lg-4">
39
		<div class="col-lg-1">
31
			<div>&nbsp;</div>
40
			<div>&nbsp;</div>
32
			<button type="button" class="btn btn-primary mk_pause_button">Active/Pause</button>
41
			<button type="button" class="btn btn-primary mk_pause_button">Active/Pause</button>
33
		</div>
42
		</div>
-
 
43
 
-
 
44
		<div class="col-lg-4">
-
 
45
			<div>&nbsp;</div>
-
 
46
			<button type="button" class="btn btn-primary mk_hotdeal_button">Add/Remove
-
 
47
				Hotdeals</button>
-
 
48
		</div>
34
	</div>	
49
	</div>
35
</section>
50
</section>
36
<script type="text/javascript">
51
<script type="text/javascript">
37
$(document).ready(function() {
52
	$(document).ready(
-
 
53
			function() {
38
	var start = moment().subtract(29, 'days');
54
				var start = moment().subtract(29, 'days');
39
	var end = moment();
55
				var end = moment();
40
	
56
 
41
  	priceDropTable = $('#priceDrop').find('table').DataTable({
57
				priceDropTable = $('#priceDrop').find('table').DataTable({
42
  		pageLength: 20,
58
					pageLength : 20,
43
  		order:[[ 5, 'desc' ]]
59
					order : [ [ 5, 'desc' ] ]
44
	});
60
				});
45
  
-
 
46
  
61
 
47
  	getItemAheadOptions($("#typeaheaditem"),true,function(selectedItem){
62
				getItemAheadOptions($("#typeaheaditem"), true, function(
-
 
63
						selectedItem) {
48
		currentItem = selectedItem;
64
					currentItem = selectedItem;
49
		doGetAjaxRequestHandler(context+"/item-pricing/"+currentItem.itemId, function(response){
65
					doGetAjaxRequestHandler(context + "/item-pricing/"
-
 
66
							+ currentItem.itemId, function(response) {
50
			response = JSON.parse(response);
67
						response = JSON.parse(response);
51
			$('#oldDp').html(response.dp);
68
						$('#oldDp').html(response.dp);
52
			$('#oldMop').html(response.mop);
69
						$('#oldMop').html(response.mop);
53
			$('#oldTp').html(response.tp);
70
						$('#oldTp').html(response.tp);
54
			$('#oldNlc').html(response.nlc);
71
						$('#oldNlc').html(response.nlc);
55
		});
72
					});
56
	});
73
				});
57
	getItemAheadOptions($("#typeaheaditem1"),true, function(selectedItem){
74
				getItemAheadOptions($("#typeaheaditem1"), true, function(
-
 
75
						selectedItem) {
58
		currentItem = selectedItem;
76
					currentItem = selectedItem;
59
		doGetAjaxRequestHandler(context+"/item-pricing/"+currentItem.itemId, function(response){
77
					doGetAjaxRequestHandler(context + "/item-pricing/"
-
 
78
							+ currentItem.itemId,
-
 
79
							function(response) {
60
			$('.mk_pause_button').data("id", currentItem.catalogId);
80
								$('.mk_pause_button').data("id",
-
 
81
										currentItem.catalogId);
61
			$('.mk_pause_button').data("description", currentItem.itemDescription);
82
								$('.mk_pause_button').data("description",
-
 
83
										currentItem.itemDescription);
-
 
84
								$('.mk_hotdeal_button').data("id",
-
 
85
										currentItem.catalogId);
-
 
86
								$('.mk_hotdeal_button').data("description",
-
 
87
										currentItem.itemDescription);
-
 
88
 
62
			response = JSON.parse(response);
89
								response = JSON.parse(response);
63
			$("#mop").val(response.mop);
90
								$("#mop").val(response.mop);
64
			$("#mrp").val(response.mrp);
91
								$("#mrp").val(response.mrp);
65
			$("#dp").val(response.dp);
92
								$("#dp").val(response.dp);
66
			$("#tp").val(response.tp);
93
								$("#tp").val(response.tp);
67
			$('#dpValue').html("DP -" + response.dp);
94
								$('#dpValue').html("DP -" + response.dp);
68
			$('#mopValue').html("MOP -" + response.mop);
95
								$('#mopValue').html("MOP -" + response.mop);
69
			$('#mrpValue').html("MRP -"+ response.mrp);
96
								$('#mrpValue').html("MRP -" + response.mrp);
70
			$('#tpValue').html("TP -"+ response.tp);
97
								$('#tpValue').html("TP -" + response.tp);
71
		});
98
							});
72
	});
99
				});
73
	affectedDateInput=$('#affectedDate');
100
				affectedDateInput = $('#affectedDate');
74
	affectedDateInput.daterangepicker(getSingleDatePicker(), dateRangeCallback);
101
				affectedDateInput.daterangepicker(getSingleDatePicker(),
-
 
102
						dateRangeCallback);
75
	$("#newPriceDropModal").on('hidden.bs.modal', function () {
103
				$("#newPriceDropModal").on('hidden.bs.modal', function() {
76
	      $("#pdForm").trigger("reset");
104
					$("#pdForm").trigger("reset");
77
	});
105
				});
78
	$("#addPriceModal").on('hidden.bs.modal', function () {
106
				$("#addPriceModal").on('hidden.bs.modal', function() {
79
	      $("#pdForm1").trigger("reset");
107
					$("#pdForm1").trigger("reset");
80
	});
108
				});
81
});
109
			});
-
 
110
 
-
 
111
	$(document)
-
 
112
			.on(
-
 
113
					'click',
-
 
114
					"button.mk_hotdeal_button",
-
 
115
					function() {
-
 
116
						var clickedButton = $(this);
-
 
117
 
-
 
118
						var description = clickedButton.data("description");
-
 
119
						var catalogId = clickedButton.data("id");
-
 
120
						getHotdealsForItems(
-
 
121
								catalogId,
-
 
122
								0,
-
 
123
								"Add/Remove " + description,
-
 
124
								function(itemIds) {
-
 
125
									console.log(itemIds);
-
 
126
									if (itemIds != null) {
-
 
127
										bootbox
-
 
128
												.confirm(
-
 
129
														"Confirm Update "
-
 
130
																+ clickedButton
-
 
131
																		.data("description")
-
 
132
																+ "?",
-
 
133
														function(result) {
-
 
134
															console.log(result)
-
 
135
															if (result) {
-
 
136
																coloredItems
-
 
137
																		.forEach(function(
-
 
138
																				item) {
-
 
139
																			console
-
 
140
																					.log(item);
-
 
141
																			item.hotDeals = itemIds
-
 
142
																					.indexOf(item.id
-
 
143
																							+ "") >= 0;
-
 
144
																			console
-
 
145
																					.log(coloredItems)
-
 
146
																		});
-
 
147
																doPostAjaxRequestWithJsonHandler(
-
 
148
																		context
-
 
149
																				+ "/indent/confirm-hotdeals-pause/",
-
 
150
																		JSON
-
 
151
																				.stringify(coloredItems),
-
 
152
																		function(
-
 
153
																				response) {
-
 
154
																			if (response) {
-
 
155
																				bootbox
-
 
156
																						.alert("Item/s  Updated Successfully");
-
 
157
																			} else {
-
 
158
																				bootbox
-
 
159
																						.alert("Could not pause item");
-
 
160
																			}
-
 
161
 
-
 
162
																		});
-
 
163
															}
-
 
164
														});
-
 
165
									}
-
 
166
								});
-
 
167
					});
82
</script>
168
</script>
83
169