| 11992 |
vikram.rag |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>Private Deal Items</title>
|
| 12112 |
kshitij.so |
4 |
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
|
|
|
5 |
<script type="text/javascript" src="/content/js/jQuery.viewSource.min.js"></script>
|
| 11992 |
vikram.rag |
6 |
<script>
|
|
|
7 |
$(document).ready(function() {
|
| 12112 |
kshitij.so |
8 |
$('#btnRight').on('click', function(e) {
|
| 11992 |
vikram.rag |
9 |
var selectedOpts = $('#lstBox1 option:selected');
|
|
|
10 |
if (selectedOpts.length == 0) {
|
|
|
11 |
alert("Please select an Item.");
|
|
|
12 |
e.preventDefault();
|
|
|
13 |
}
|
|
|
14 |
|
|
|
15 |
$('#lstBox2').append($(selectedOpts).clone());
|
|
|
16 |
$(selectedOpts).remove();
|
|
|
17 |
e.preventDefault();
|
|
|
18 |
});
|
| 12112 |
kshitij.so |
19 |
|
|
|
20 |
$('#viewSourceCode').on('click', function(e) {
|
|
|
21 |
$('#generated-news-letter').hide();
|
|
|
22 |
$("#source-code").show();
|
|
|
23 |
});
|
|
|
24 |
|
|
|
25 |
$('#viewHtml').on('click', function(e) {
|
|
|
26 |
$('#generated-news-letter').show();
|
|
|
27 |
$("#source-code").hide();
|
|
|
28 |
});
|
| 11992 |
vikram.rag |
29 |
|
| 12112 |
kshitij.so |
30 |
$('#btnLeft').on('click', function(e) {
|
| 11992 |
vikram.rag |
31 |
var selectedOpts = $('#lstBox2 option:selected');
|
|
|
32 |
if (selectedOpts.length == 0) {
|
|
|
33 |
alert("Nothing to move.");
|
|
|
34 |
e.preventDefault();
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
$('#lstBox1').append($(selectedOpts).clone());
|
|
|
38 |
$(selectedOpts).remove();
|
|
|
39 |
e.preventDefault();
|
|
|
40 |
});
|
|
|
41 |
});
|
|
|
42 |
</script>
|
|
|
43 |
<script>
|
|
|
44 |
jQuery.fn.filterByText = function(textbox, selectSingleMatch) {
|
|
|
45 |
return this.each(function() {
|
|
|
46 |
var select = this;
|
|
|
47 |
var options = [];
|
|
|
48 |
$(select).find('option').each(function() {
|
|
|
49 |
options.push({value: $(this).val(), text: $(this).text()});
|
|
|
50 |
});
|
|
|
51 |
$(select).data('options', options);
|
|
|
52 |
$(textbox).bind('change keyup', function() {
|
|
|
53 |
var options = $(select).empty().data('options');
|
|
|
54 |
var search = $(this).val();
|
|
|
55 |
var regex = new RegExp(search,"gi");
|
|
|
56 |
|
|
|
57 |
jQuery.each(options, function(i) {
|
|
|
58 |
var option = options[i];
|
|
|
59 |
if(option.text.match(regex) !== null) {
|
|
|
60 |
$(select).append(
|
|
|
61 |
$('<option>').text(option.text).val(option.value)
|
|
|
62 |
);
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
if (selectSingleMatch === true && $(select).children().length === 1) {
|
|
|
66 |
$(select).children().get(0).selected = true;
|
|
|
67 |
}
|
|
|
68 |
});
|
|
|
69 |
});
|
|
|
70 |
};
|
|
|
71 |
|
|
|
72 |
$(function() {
|
|
|
73 |
$('#lstBox1').filterByText($('#textbox'), true);
|
|
|
74 |
});
|
|
|
75 |
</script>
|
|
|
76 |
<script>
|
|
|
77 |
function StoreSubTypes()
|
|
|
78 |
{
|
| 12112 |
kshitij.so |
79 |
var _Catalogids = new Array();
|
| 11992 |
vikram.rag |
80 |
$("#lstBox2 option").each(
|
|
|
81 |
function(index, option)
|
|
|
82 |
{
|
| 12112 |
kshitij.so |
83 |
_Catalogids[index] = option.value;
|
| 11992 |
vikram.rag |
84 |
}
|
|
|
85 |
);
|
| 12112 |
kshitij.so |
86 |
console.log(_Catalogids.toString());
|
|
|
87 |
jQuery.ajax({
|
|
|
88 |
url: window.location.href+"!createPrivateDealsNewsLetter?itemIds="+_Catalogids,
|
|
|
89 |
type: 'POST',
|
|
|
90 |
async: false,
|
|
|
91 |
success : function(response) {
|
|
|
92 |
$('#generated-news-letter').empty();
|
|
|
93 |
$("#source-code").text('');
|
|
|
94 |
$('<iframe id="newsletter-iframe" style="width:100%;height:100%;margin-top:20px;"/>').appendTo('#generated-news-letter')
|
|
|
95 |
.contents().find('body').append(response);
|
|
|
96 |
$("#source-code").text(response);
|
|
|
97 |
$('#generated-news-letter').show();
|
|
|
98 |
$('#buttons').show();
|
|
|
99 |
},
|
|
|
100 |
cache: false,
|
|
|
101 |
contentType: "application/x-www-form-urlencoded",
|
|
|
102 |
processData: false
|
|
|
103 |
});
|
|
|
104 |
return false;
|
| 11992 |
vikram.rag |
105 |
}
|
|
|
106 |
</script>
|
| 12112 |
kshitij.so |
107 |
<style>
|
|
|
108 |
td {
|
|
|
109 |
padding: 20px;
|
|
|
110 |
}
|
|
|
111 |
</style>
|
| 11992 |
vikram.rag |
112 |
</head>
|
|
|
113 |
<body>
|
| 12112 |
kshitij.so |
114 |
<div style="border: 2px solid blue; height: 10%; padding: 10px; width: 30%;" class="searchBox">
|
|
|
115 |
<label style="font-weight: bold; margin-right: 10px;">Search Item</label>
|
|
|
116 |
<input type="text" id="textbox" style="width: 50%;">
|
|
|
117 |
</div>
|
|
|
118 |
<table style="width: 100%; border: 2px solid blue; margin-top: 20px;">
|
| 11992 |
vikram.rag |
119 |
<tr>
|
| 12112 |
kshitij.so |
120 |
<td style='min-width:300px;'align = 'left'>
|
| 11992 |
vikram.rag |
121 |
<b>Active Private Deal Items :</b><br/>
|
| 12112 |
kshitij.so |
122 |
<select multiple="multiple" id='lstBox1' style="width:100%">
|
| 11992 |
vikram.rag |
123 |
#set($items = $action.getPrivateDealItems())
|
|
|
124 |
#foreach ( $item in $items )
|
| 12112 |
kshitij.so |
125 |
<option value="$item.getId()">$item.getId() $item.getBrand() $item.getModelName() $item.getModelNumber() $item.getColor()</option>
|
| 11992 |
vikram.rag |
126 |
#end
|
|
|
127 |
</select>
|
|
|
128 |
</td>
|
|
|
129 |
<td style='width:100%;text-align:center;vertical-align:middle;' >
|
| 12112 |
kshitij.so |
130 |
<input type="button" style="margin-bottom: 15px;" id="btnRight" value=">">
|
|
|
131 |
<br/>
|
|
|
132 |
<input type="button" value="<" id="btnLeft" style="margin-bottom: 15px;">
|
|
|
133 |
<br/>
|
|
|
134 |
<button onclick="StoreSubTypes()" type="button">Generate NewsLetter</button>
|
| 11992 |
vikram.rag |
135 |
</td>
|
| 12112 |
kshitij.so |
136 |
<td align="" width="100%" style="min-width: 300px;">
|
| 11992 |
vikram.rag |
137 |
<b>Selected Active Deal Items :</b><br/>
|
| 12112 |
kshitij.so |
138 |
<select id="lstBox2" multiple="multiple" style="width: 100%;">
|
| 11992 |
vikram.rag |
139 |
</select>
|
|
|
140 |
</td>
|
|
|
141 |
</tr>
|
|
|
142 |
</table>
|
| 12112 |
kshitij.so |
143 |
<div id="buttons" style="float: right; border: 2px solid blue; display: block;height:50px;margin-top:15px;display:none;">
|
|
|
144 |
<button id="viewSourceCode" type="button" style="float: right; margin-top: 15px; margin-right: 10px;">View Source</button>
|
|
|
145 |
<button id="viewHtml" type="button" style="float: right; margin: 15px;">View New Letter</button>
|
|
|
146 |
</div>
|
|
|
147 |
<div id="generated-news-letter" style="margin-top:30px;display:none;">
|
|
|
148 |
</div>
|
|
|
149 |
<textarea id="source-code" style="width: 100%;height: 100%;font-size: 12px;color:black;font-weight: 14px;font-family: sans-serif;margin-top:20px;display:none;border:2px solid grey;"></textarea>
|
| 11992 |
vikram.rag |
150 |
</body>
|
|
|
151 |
</html>
|