| 11992 |
vikram.rag |
1 |
<html>
|
|
|
2 |
<head>
|
|
|
3 |
<title>Private Deal Items</title>
|
|
|
4 |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
|
|
|
5 |
<script>
|
|
|
6 |
$(document).ready(function() {
|
|
|
7 |
$('#btnRight').live('click', function(e) {
|
|
|
8 |
var selectedOpts = $('#lstBox1 option:selected');
|
|
|
9 |
if (selectedOpts.length == 0) {
|
|
|
10 |
alert("Please select an Item.");
|
|
|
11 |
e.preventDefault();
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
$('#lstBox2').append($(selectedOpts).clone());
|
|
|
15 |
$(selectedOpts).remove();
|
|
|
16 |
e.preventDefault();
|
|
|
17 |
});
|
|
|
18 |
|
|
|
19 |
$('#btnLeft').live('click', function(e) {
|
|
|
20 |
var selectedOpts = $('#lstBox2 option:selected');
|
|
|
21 |
if (selectedOpts.length == 0) {
|
|
|
22 |
alert("Nothing to move.");
|
|
|
23 |
e.preventDefault();
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
$('#lstBox1').append($(selectedOpts).clone());
|
|
|
27 |
$(selectedOpts).remove();
|
|
|
28 |
e.preventDefault();
|
|
|
29 |
});
|
|
|
30 |
});
|
|
|
31 |
</script>
|
|
|
32 |
<script>
|
|
|
33 |
jQuery.fn.filterByText = function(textbox, selectSingleMatch) {
|
|
|
34 |
return this.each(function() {
|
|
|
35 |
var select = this;
|
|
|
36 |
var options = [];
|
|
|
37 |
$(select).find('option').each(function() {
|
|
|
38 |
options.push({value: $(this).val(), text: $(this).text()});
|
|
|
39 |
});
|
|
|
40 |
$(select).data('options', options);
|
|
|
41 |
$(textbox).bind('change keyup', function() {
|
|
|
42 |
var options = $(select).empty().data('options');
|
|
|
43 |
var search = $(this).val();
|
|
|
44 |
var regex = new RegExp(search,"gi");
|
|
|
45 |
|
|
|
46 |
jQuery.each(options, function(i) {
|
|
|
47 |
var option = options[i];
|
|
|
48 |
if(option.text.match(regex) !== null) {
|
|
|
49 |
$(select).append(
|
|
|
50 |
$('<option>').text(option.text).val(option.value)
|
|
|
51 |
);
|
|
|
52 |
}
|
|
|
53 |
});
|
|
|
54 |
if (selectSingleMatch === true && $(select).children().length === 1) {
|
|
|
55 |
$(select).children().get(0).selected = true;
|
|
|
56 |
}
|
|
|
57 |
});
|
|
|
58 |
});
|
|
|
59 |
};
|
|
|
60 |
|
|
|
61 |
$(function() {
|
|
|
62 |
$('#lstBox1').filterByText($('#textbox'), true);
|
|
|
63 |
});
|
|
|
64 |
</script>
|
|
|
65 |
<script>
|
|
|
66 |
function StoreSubTypes()
|
|
|
67 |
{
|
|
|
68 |
var _Catalogids = new Array();
|
|
|
69 |
$("#lstBox2 option").each(
|
|
|
70 |
function(index, option)
|
|
|
71 |
{
|
|
|
72 |
_Catalogids[index] = option;
|
|
|
73 |
}
|
|
|
74 |
);
|
|
|
75 |
$.post(/Support/news-letter!createPrivateDealsNewsLetter,{ '_Catalogids[]': Catalogids }, function(data){
|
|
|
76 |
console.log(data);
|
|
|
77 |
},'html');
|
|
|
78 |
}
|
|
|
79 |
</script>
|
|
|
80 |
</head>
|
|
|
81 |
<body>
|
|
|
82 |
<input id="textbox" type="text" /><br />
|
|
|
83 |
<table style="width: 100%">
|
|
|
84 |
<tr>
|
|
|
85 |
<td style='width:300px;'align = 'left'>
|
|
|
86 |
<b>Active Private Deal Items :</b><br/>
|
|
|
87 |
<select multiple="multiple" id='lstBox1' width='100%'>
|
|
|
88 |
#set($items = $action.getPrivateDealItems())
|
|
|
89 |
#foreach ( $item in $items )
|
|
|
90 |
<option value="$item.getCatalogItemId()">$item.getId() $item.getBrand() $item.getModelName() $item.getModelNumber() $item.getColor()</option>
|
|
|
91 |
#end
|
|
|
92 |
</select>
|
|
|
93 |
</td>
|
|
|
94 |
<td style='width:100%;text-align:center;vertical-align:middle;' >
|
|
|
95 |
<input type='button' id='btnRight' value =' > '/>
|
|
|
96 |
<br/><input type='button' id='btnLeft' value =' < '/>
|
|
|
97 |
</td>
|
|
|
98 |
<td style='width:300px;' align = 'right' width='100%'>
|
|
|
99 |
<b>Selected Active Deal Items :</b><br/>
|
|
|
100 |
<select multiple="multiple" id='lstBox2'>
|
|
|
101 |
</select>
|
|
|
102 |
</td>
|
|
|
103 |
</tr>
|
|
|
104 |
<button type="button" onclick="StoreSubTypes()">Generate NewsLetter</button>
|
|
|
105 |
</table>
|
|
|
106 |
</body>
|
|
|
107 |
</html>
|