| 4755 |
amit.gupta |
1 |
// increase the default animation speed to exaggerate the effect
|
|
|
2 |
jQuery.fx.speeds._default = 1000;
|
|
|
3 |
$(function() {
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
$('.category').live('click', function() {
|
|
|
8 |
var categoryid = $(this).attr('id') + "-table";
|
|
|
9 |
alert("Toggle style for category" + categoryid);
|
|
|
10 |
$('.category-table').hide();
|
|
|
11 |
$('#'+categoryid).show();
|
|
|
12 |
return false;
|
|
|
13 |
});
|
|
|
14 |
|
|
|
15 |
$('.delete').live('click', function() {
|
|
|
16 |
var entityid = $(this).attr('id');
|
|
|
17 |
$('#dialog').dialog({
|
|
|
18 |
autoOpen: false,
|
|
|
19 |
width: 470,
|
|
|
20 |
height: 100,
|
|
|
21 |
modal: true,
|
|
|
22 |
title: 'Are you sure ? It will be permanently deleted. Continue ?',
|
|
|
23 |
buttons: {
|
|
|
24 |
"OK":function() { window.location.href = "/content/entity/" + entityid + "?_method=delete" },
|
|
|
25 |
"Cancel": function() { $(this).dialog("close"); }
|
|
|
26 |
}
|
|
|
27 |
});
|
|
|
28 |
|
|
|
29 |
$('#dialog').dialog('open');
|
|
|
30 |
|
|
|
31 |
return false;
|
|
|
32 |
});
|
|
|
33 |
|
|
|
34 |
$('.complete').live('click', function() {
|
|
|
35 |
var entityid = $(this).attr('id');
|
|
|
36 |
$('#dialog').dialog({
|
|
|
37 |
autoOpen: false,
|
|
|
38 |
width: 470,
|
|
|
39 |
height: 100,
|
|
|
40 |
modal: true,
|
|
|
41 |
title: 'The item will be completed, you will not be able to make further changes. Continue?',
|
|
|
42 |
buttons: {
|
|
|
43 |
"OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put&action=complete" },
|
|
|
44 |
"Cancel": function() { $(this).dialog("close"); }
|
|
|
45 |
}
|
|
|
46 |
});
|
|
|
47 |
|
|
|
48 |
$('#dialog').dialog('open');
|
|
|
49 |
|
|
|
50 |
return false;
|
|
|
51 |
});
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
$('.ready').live('click', function() {
|
|
|
55 |
var entityid = $(this).attr('id');
|
|
|
56 |
$('#dialog').dialog({
|
|
|
57 |
autoOpen: false,
|
|
|
58 |
width: 470,
|
|
|
59 |
height: 100,
|
|
|
60 |
modal: true,
|
|
|
61 |
title: 'The item will become available for consumers to place orders for. Continue?',
|
|
|
62 |
buttons: {
|
|
|
63 |
"OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put&action=ready" },
|
|
|
64 |
"Cancel": function() { $(this).dialog("close"); }
|
|
|
65 |
}
|
|
|
66 |
});
|
|
|
67 |
|
|
|
68 |
$('#dialog').dialog('open');
|
|
|
69 |
|
|
|
70 |
return false;
|
|
|
71 |
});
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
$('.assign').live('click', function() {
|
|
|
75 |
var entityid = $(this).attr('id');
|
|
|
76 |
|
|
|
77 |
$('#dialog-form').dialog({
|
|
|
78 |
autoOpen: false,
|
|
|
79 |
width: 470,
|
|
|
80 |
height: 400,
|
|
|
81 |
modal: true,
|
|
|
82 |
title: 'The item will be assigned. Are you sure ?',
|
|
|
83 |
buttons: {
|
|
|
84 |
"OK":function() {
|
|
|
85 |
var username = $('#username').val();
|
|
|
86 |
window.location.href = "/content/item-update/" + entityid + "?_method=put&action=assign&username=" + username;
|
|
|
87 |
},
|
|
|
88 |
"Cancel": function() { $(this).dialog("close"); }
|
|
|
89 |
}
|
|
|
90 |
});
|
|
|
91 |
|
|
|
92 |
$('#dialog-form').dialog('open');
|
|
|
93 |
|
|
|
94 |
return false;
|
|
|
95 |
});
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
});
|
|
|
99 |
|
|
|
100 |
function renderActionTable(obj){
|
|
|
101 |
var entityId = obj.aData[ obj.iDataColumn ];
|
|
|
102 |
var table = [];
|
|
|
103 |
table.push('<span style="padding:2px"><a href="/content/entity/' + entityId + '" target="_blank">View</a></span>');
|
|
|
104 |
table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="delete">Delete</a></span>');
|
|
|
105 |
table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="ready">Approve</a></span>');
|
|
|
106 |
table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="complete">Complete</a></span>');
|
|
|
107 |
table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="assign">Assign</a></span>');
|
|
|
108 |
return table.join("");
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
$(document).ready(function()
|
|
|
112 |
{
|
|
|
113 |
var oTable = $("#myTable").dataTable({
|
|
|
114 |
"aaSorting": [[ 1, "desc" ]],
|
|
|
115 |
"iDisplayLength": 100,
|
|
|
116 |
"bSort": false,
|
|
|
117 |
"bDeferRender" : true,
|
|
|
118 |
"sPaginationType": "full_numbers",
|
|
|
119 |
"sDom": '<"wrapper"flipt>',
|
|
|
120 |
"aaData": Entity.arr,
|
|
|
121 |
"aoColumns": [
|
|
|
122 |
{ "sTitle": "#" },
|
|
|
123 |
{
|
|
|
124 |
"sTitle": "Entity ID",
|
|
|
125 |
"fnRender" : function(obj){
|
|
|
126 |
var entityId = obj.aData[ obj.iDataColumn ];
|
|
|
127 |
return '<td><a href="/content/entity/' + entityId + '/edit">' + entityId + '</a></td>';
|
|
|
128 |
}
|
|
|
129 |
},
|
|
|
130 |
{ "sTitle": "Category" },
|
|
|
131 |
{ "sTitle": "Brand"},
|
|
|
132 |
{ "sTitle": "Model Name" },
|
|
|
133 |
{ "sTitle": "Model Number", "sClass": "center" },
|
|
|
134 |
{
|
|
|
135 |
"sTitle": "Item details",
|
|
|
136 |
"fnRender" : function(obj){
|
|
|
137 |
var entityId = obj.aData[ obj.iDataColumn ];
|
|
|
138 |
return '<a class="details-from-catalog" entityId="' + entityId +
|
|
|
139 |
'" href="#">see items</a>';
|
|
|
140 |
}
|
|
|
141 |
},
|
|
|
142 |
{ "sTitle": "Current Status" },
|
|
|
143 |
{ "sTitle": "Created By" },
|
|
|
144 |
{ "sTitle": "Assigned To" },
|
|
|
145 |
{ "sTitle": "Completed By" },
|
|
|
146 |
{
|
|
|
147 |
"sTitle": "Actions",
|
|
|
148 |
"sClass": "center",
|
|
|
149 |
"fnRender": renderActionTable
|
|
|
150 |
}
|
|
|
151 |
]
|
|
|
152 |
});
|
|
|
153 |
});
|