| 23973 |
govind |
1 |
var saleHistory = saleHistory || {};
|
|
|
2 |
saleHistory.searchText = "";
|
|
|
3 |
saleHistory.searchType = "";
|
|
|
4 |
saleHistory.startTime = "";
|
|
|
5 |
saleHistory.endTime = "";
|
| 23343 |
ashik.ali |
6 |
|
|
|
7 |
$(function() {
|
| 23973 |
govind |
8 |
|
| 23343 |
ashik.ali |
9 |
$(".sale-history").live('click', function() {
|
|
|
10 |
console.log("Sale History Button Clicked...")
|
| 23973 |
govind |
11 |
saleHistory("main-content", "", "", startDate, endDate);
|
| 23343 |
ashik.ali |
12 |
});
|
| 23973 |
govind |
13 |
|
|
|
14 |
$('#searchType').live(
|
|
|
15 |
'change',
|
|
|
16 |
function() {
|
|
|
17 |
var searchType = $("#searchType option:selected").val();
|
|
|
18 |
var searchTypevalue = $(this).find('option:selected').text();
|
|
|
19 |
;
|
|
|
20 |
saleHistory.searchType = searchType;
|
|
|
21 |
console.log("selected searchType = " + searchType);
|
|
|
22 |
|
|
|
23 |
saleHistory("main-content", saleHistory.searchType, "",
|
|
|
24 |
startDate, endDate);
|
|
|
25 |
|
|
|
26 |
$("#sale-history-search-text").val('');
|
|
|
27 |
});
|
|
|
28 |
|
|
|
29 |
$("#sale-history-search-button").live(
|
|
|
30 |
'click',
|
|
|
31 |
function() {
|
|
|
32 |
console.log("sale-history-search-button clicked")
|
|
|
33 |
var searchType = $("#searchType option:selected").val();
|
|
|
34 |
console.log("searchType = " + searchType);
|
|
|
35 |
$("#searchType").removeClass("border-highlight");
|
|
|
36 |
// if(searchType == ""){
|
|
|
37 |
// alert("Please choose Search Type");
|
|
|
38 |
// $("#searchType").addClass("border-highlight");
|
|
|
39 |
// }else{
|
|
|
40 |
saleHistory.searchText = $("#sale-history-search-text").val();
|
|
|
41 |
saleHistory.searchType = searchType;
|
|
|
42 |
saleHistory.startTime = startDate;
|
|
|
43 |
saleHistory.endTime = endDate;
|
|
|
44 |
if (typeof (saleHistory.searchText) == "undefined"
|
|
|
45 |
|| !saleHistory.searchText) {
|
|
|
46 |
saleHistory.searchText = "";
|
|
|
47 |
}
|
|
|
48 |
saleHistorySearchInfo(saleHistory.searchType,
|
|
|
49 |
saleHistory.searchText, saleHistory.startTime,
|
|
|
50 |
saleHistory.endTime);
|
|
|
51 |
// $("#sale-history-search-text").val(saleHistory.searchText);
|
|
|
52 |
// $("#searchType").val(searchType);
|
|
|
53 |
// $('input[name="startDateTime"]').val(saleHistory.startTime);
|
|
|
54 |
// $('input[name="endDateTime"]').val(saleHistory.endTime);
|
|
|
55 |
// }
|
|
|
56 |
});
|
|
|
57 |
|
| 23584 |
ashik.ali |
58 |
$(".search-order").live('click', function() {
|
|
|
59 |
console.log("search-order clicked")
|
|
|
60 |
loadSearchOrder("main-content");
|
| 23973 |
govind |
61 |
});
|
|
|
62 |
|
|
|
63 |
$("#search-order-button").live(
|
|
|
64 |
'click',
|
|
|
65 |
function() {
|
|
|
66 |
console.log("search-order-button clicked")
|
|
|
67 |
var invoiceNumber = $("#search-order-text").val();
|
|
|
68 |
loadSearchOrderDetails(invoiceNumber,
|
|
|
69 |
"search-order-details-container");
|
|
|
70 |
});
|
|
|
71 |
|
|
|
72 |
$("#sale-history-paginated .next").live(
|
|
|
73 |
'click',
|
|
|
74 |
function() {
|
|
|
75 |
var params = {};
|
|
|
76 |
params['searchType'] = saleHistory.searchType;
|
|
|
77 |
params['searchValue'] = saleHistory.searchText;
|
|
|
78 |
params['startTime'] = walletHistory.startTime;
|
|
|
79 |
params['endTime'] = walletHistory.endTime;
|
|
|
80 |
loadPaginatedNextItems('/getPaginatedSaleHistory', params,
|
|
|
81 |
'sale-history-paginated', 'sale-history-table',
|
|
|
82 |
'sale-details-container');
|
|
|
83 |
$(this).blur();
|
|
|
84 |
});
|
|
|
85 |
|
|
|
86 |
$("#sale-history-paginated .previous").live(
|
|
|
87 |
'click',
|
|
|
88 |
function() {
|
|
|
89 |
var params = {};
|
|
|
90 |
params['searchType'] = saleHistory.searchType;
|
|
|
91 |
params['searchValue'] = saleHistory.searchText;
|
|
|
92 |
params['startTime'] = walletHistory.startTime;
|
|
|
93 |
params['endTime'] = walletHistory.endTime;
|
|
|
94 |
loadPaginatedPreviousItems('/getPaginatedSaleHistory', params,
|
|
|
95 |
'sale-history-paginated', 'sale-history-table',
|
|
|
96 |
'sale-details-container');
|
|
|
97 |
$(this).blur();
|
|
|
98 |
});
|
|
|
99 |
|
|
|
100 |
// grn-details
|
|
|
101 |
|
|
|
102 |
$(".sale-details").live('click', function() {
|
| 23654 |
amit.gupta |
103 |
orderId = $(this).attr('data');
|
| 23973 |
govind |
104 |
console.log("orderId = " + orderId);
|
|
|
105 |
loadSaleDetails(orderId, "sale-details-container");
|
| 23343 |
ashik.ali |
106 |
});
|
|
|
107 |
});
|
|
|
108 |
|
| 23973 |
govind |
109 |
function loadSaleDetails(orderId, domId) {
|
|
|
110 |
doGetAjaxRequestHandler(context + "/saleDetails?orderId=" + orderId,
|
|
|
111 |
function(response) {
|
|
|
112 |
$('#' + domId).html(response);
|
|
|
113 |
});
|
| 23343 |
ashik.ali |
114 |
}
|
|
|
115 |
|
| 23973 |
govind |
116 |
function loadSearchOrder(domId) {
|
|
|
117 |
doGetAjaxRequestHandler(context + "/getSearchOrder", function(response) {
|
| 23584 |
ashik.ali |
118 |
$('#' + domId).html(response);
|
|
|
119 |
});
|
|
|
120 |
}
|
|
|
121 |
|
| 23973 |
govind |
122 |
function loadSearchOrderDetails(invoiceNumber, domId) {
|
|
|
123 |
doGetAjaxRequestHandler(context + "/searchOrderDetails?invoiceNumber="
|
|
|
124 |
+ invoiceNumber, function(response) {
|
| 23584 |
ashik.ali |
125 |
$('#' + domId).html(response);
|
|
|
126 |
});
|
|
|
127 |
}
|
|
|
128 |
|
| 23973 |
govind |
129 |
function saleHistory(domId, searchType, searchValue, startTime, endTime) {
|
|
|
130 |
doGetAjaxRequestHandler(context + "/saleHistory?searchType=" + searchType
|
|
|
131 |
+ "&searchValue=" + searchValue + "&startTime=" + startTime
|
|
|
132 |
+ "&endTime=" + endTime, function(response) {
|
| 23343 |
ashik.ali |
133 |
$('#' + domId).html(response);
|
|
|
134 |
});
|
|
|
135 |
}
|
|
|
136 |
|
| 23973 |
govind |
137 |
function saleHistorySearchInfo(searchType, searchText, startTime, endTime) {
|
| 23343 |
ashik.ali |
138 |
saleHistory("main-content", searchType, searchText, startTime, endTime);
|
|
|
139 |
}
|