Subversion Repositories SmartDukaan

Rev

Rev 1051 | Rev 1152 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
162 naveen 1
<!DOCTYPE html PUBLIC 
2
    "-//W3C//DTD XHTML 1.1 Transitional//EN"
3
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
 
5
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
<head>
7
<title>List of Entities</title>
242 naveen 8
<script type="text/javascript" src="jquery/jquery-1.4.2.js"></script>
9
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.core.js"></script>
10
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.widget.js"></script>
11
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.position.js"></script>
12
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.autocomplete.js"></script>
13
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.dialog.js"></script>
14
<script type="text/javascript" src="jquery/validation/jquery.validate.js"></script>
15
 
16
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.mouse.js"></script>
17
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.draggable.js"></script>
18
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.ui.resizable.js"></script>
19
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.core.js"></script>
20
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.blind.js"></script>
21
<script type="text/javascript" src="jquery/jqueryui/ui/jquery.effects.drop.js"></script>
516 rajveer 22
<script type="text/javascript" src="jquery/jquery.chained.js"></script>
579 rajveer 23
<script type="text/javascript" src="jquery/jquery.tablesorter.js"></script>
242 naveen 24
<script>
25
// increase the default animation speed to exaggerate the effect
26
jQuery.fx.speeds._default = 1000;
27
$(function() {
579 rajveer 28
 
29
 
30
 
31
	$('.category').click(function() {
32
	    var categoryid = $(this).attr('id') + "-table";
33
		alert("Toggle style for category" + categoryid);
34
		$('.category-table').hide();
35
		$('#'+categoryid).show();
36
		return false;
37
	});
38
 
39
	$('.delete').click(function() {
40
		var entityid = $(this).attr('id');
725 chandransh 41
        $('#dialog').dialog({
579 rajveer 42
                    autoOpen: false,
43
    				width: 470,
44
            	    height: 100,
45
                    modal: true,
46
    				title: 'Are you sure ? It will be permanently deleted. Continue ?',
47
                    buttons: {
48
                    "OK":function() { window.location.href = "/content/entity/" + entityid + "?_method=delete" },
49
                    "Cancel": function() { $(this).dialog("close"); }
50
            }
51
         });
52
 
53
		$('#dialog').dialog('open');
54
 
55
		return false;
56
	});
1051 rajveer 57
 
58
	$('.complete').click(function() {
59
		var entityid = $(this).attr('id');
60
        $('#dialog').dialog({
61
                    autoOpen: false,
62
    				width: 470,
63
            	    height: 100,
64
                    modal: true,
65
    				title: 'The item will be completed, you will not be able to make further changes.  Continue?',
66
                    buttons: {
67
                    "OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put&action=complete" },
68
                    "Cancel": function() { $(this).dialog("close"); }
69
            }
70
         });
71
 
72
		$('#dialog').dialog('open');
73
 
74
		return false;
75
	});
76
 
579 rajveer 77
 
725 chandransh 78
    $('.ready').click(function() {
79
		var entityid = $(this).attr('id');
80
        $('#dialog').dialog({
81
                    autoOpen: false,
82
    				width: 470,
83
            	    height: 100,
84
                    modal: true,
85
    				title: 'The item will become available for consumers to place orders for. Continue?',
86
                    buttons: {
87
                    "OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put" },
88
                    "Cancel": function() { $(this).dialog("close"); }
89
            }
90
         });
91
 
92
		$('#dialog').dialog('open');
93
 
94
		return false;
95
	});
1051 rajveer 96
 
97
 
98
	$('.assign').click(function() {
99
		var entityid = $(this).attr('id');
100
 
101
        $('#dialog-form').dialog({
102
                    autoOpen: false,
103
    				width: 470,
104
            	    height: 400,
105
                    modal: true,
106
					title: 'The item will be assigned. Are you sure ?',
107
                    buttons: {
108
                    "OK":function() {
109
					var username = $('#username').val();
110
						window.location.href = "/content/item-update/" + entityid + "?_method=put&action=assign&username=" + username; 
111
					},
112
                    "Cancel": function() { $(this).dialog("close"); }
113
            }
114
         });
115
 
116
		$('#dialog-form').dialog('open');
117
 
118
		return false;
119
	});
120
 
121
 
242 naveen 122
});
516 rajveer 123
 
579 rajveer 124
$(document).ready(function() 
125
    { 
126
        $("#myTable").tablesorter(); 
127
    } 
128
); 
129
 
516 rajveer 130
</script>
131
 
579 rajveer 132
 
198 naveen 133
<link type="text/css" href="jquery/jqueryui/themes/ui-lightness/jquery.ui.all.css" rel="stylesheet" />
162 naveen 134
<style type="text/css">
212 naveen 135
 
136
* { font-family: Verdana; font-size: 96%; }
137
label { width: 10em; float: left; }
138
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
139
p { clear: both; }
140
.submit { margin-left: 12em; }
141
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
142
 
162 naveen 143
table {
144
    border-width: 1px 1px 1px 1px;
145
    border-spacing: 2px;
146
    border-style: outset outset outset outset;
147
    border-color: gray gray gray gray;
148
    border-collapse: separate;
149
    background-color: white;
150
}
151
th {
152
    border-width: 1px 1px 1px 1px;
153
    padding: 1px 1px 1px 1px;
154
    border-style: inset inset inset inset;
155
    border-color: gray gray gray gray;
156
    background-color: white;
157
    -moz-border-radius: 0px 0px 0px 0px;
158
}
159
td {
160
    border-width: 1px 1px 1px 1px;
161
    padding: 1px 1px 1px 1px;
162
    border-style: inset inset inset inset;
163
    border-color: gray gray gray gray;
164
    background-color: white;
165
    -moz-border-radius: 0px 0px 0px 0px;
166
}
242 naveen 167
div.dialog {
168
    padding:12px;
169
    font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif";
170
}
162 naveen 171
</style>
242 naveen 172
 
162 naveen 173
</head>
174
<body>
208 naveen 175
<div>
1051 rajveer 176
	<span align="right"> Welcome $action.getUsername()   <a href="$request.contextPath/logout">logout</a></span>
177
</div>
178
<div>
162 naveen 179
    <h1>Entities</h1>
242 naveen 180
 
1051 rajveer 181
	<div style="color:green;">
242 naveen 182
    #sactionmessage()
1051 rajveer 183
	</div>
184
	<div style="color:red;">
185
	#sactionerror()
186
	</div>
242 naveen 187
 
1051 rajveer 188
    <a href="$request.contextPath/entity/new">Create New</a>
162 naveen 189
    <p></p>
250 naveen 190
    #set ( $entities = $action.getEntities() )
1051 rajveer 191
	#set ( $entitiesState = $action.getEntitiesState() )
192
	#set ( $users = $action.getAllUserNames() )
250 naveen 193
 
194
    <div>
1051 rajveer 195
	#drawAllEntities($entities)
250 naveen 196
    </div>
1051 rajveer 197
</div>
250 naveen 198
 
1051 rajveer 199
<div id="dialog" title="">
200
</div>
579 rajveer 201
 
1051 rajveer 202
<div style="display:none;">
203
<div id="dialog-form" title="Select an user to assign">
204
    <p class="validateTips">All form fields are required.</p> 
205
 	<form> 
206
	<fieldset> 
207
		<label for="user">Username</label> 
208
		<select id="username" name="username">
209
		#foreach($user in $users)
210
			<option value="$user" class="text ui-widget-content ui-corner-all">$user</option>
579 rajveer 211
		#end
1051 rajveer 212
        </select>
579 rajveer 213
 
1051 rajveer 214
	</fieldset> 
215
	</form>
216
</div> 
250 naveen 217
</div>
218
 
219
</body>
220
</html>
221
 
579 rajveer 222
#macro (drawAllEntities $entities)
223
	    <table id="myTable">
224
	        <thead>
225
            <tr style="border: 1px">
226
                <th>#</th>
227
                <th>Entity ID</th>
228
                <th>Category</th>
229
                <th>Brand</th>
230
                <th>Model Number</th>
231
                <th>Model Name</th>
1051 rajveer 232
				<th>Current Status</th>
233
				<th>Created By</th>
234
				<th>Assigned To</th>
235
				<th>Completed By</th>
236
                <th colspan="5">Actions</th>
579 rajveer 237
            </tr>
238
        </thead>
239
        <tbody>
240
    #foreach ( $entity in $entities )
241
            <tr style="border: 1px">
242
                <td>$velocityCount</td>
243
                #set ( $entityid = $entity.getID() )
1051 rajveer 244
				#set ( $entityState = $entitiesState.get($entityid))
245
 
579 rajveer 246
                <td><a href="/content/entity/$entityid/edit">$entityid</a></td>
247
                <td>$action.getCategoryName($entity.getCategoryID())</td>
248
                <td>$entity.getBrand()</td>
249
                <td>$entity.getModelNumber()</td>
250
                <td>$entity.getModelName()</td>
1051 rajveer 251
 
252
				<td>$entityState.getStatus()</td>
253
                <td>$entityState.getCreatedBy()</td>
254
				<td>#if($entityState.getAssignedTo())$entityState.getAssignedTo()#end</td>
255
				<td>#if($entityState.getCompletedBy())$entityState.getCompletedBy()#end</td>
256
 
579 rajveer 257
                <td><a href="/content/entity/$entityid" target="_blank">View</a></td>
258
                <!-- <td><a href="" id="$entityid" class="opener">Media</a></td> -->
259
                <td><a href=""  id="$entityid" class="delete">Delete</a></td>
1051 rajveer 260
				<td><a href=""  id="$entityid" class="ready">Approve</a></td>
261
 
262
				<td><a href=""  id="$entityid" class="complete">Complete</a></td>
263
				<td><a href=""  id="$entityid" class="assign">Assign</a></td>
579 rajveer 264
            </tr>
265
    #end
266
        </tbody>
267
    </table>
268
 
269
#end