Rev 19600 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
// increase the default animation speed to exaggerate the effectjQuery.fx.speeds._default = 1000;$(function() {$('.category').live('click', function() {var categoryid = $(this).attr('id') + "-table";alert("Toggle style for category" + categoryid);$('.category-table').hide();$('#'+categoryid).show();return false;});$('.delete').live('click', function() {var entityid = $(this).attr('id');$('#dialog').dialog({autoOpen: false,width: 470,height: 100,modal: true,title: 'Are you sure ? It will be permanently deleted. Continue ?',buttons: {"OK":function() { window.location.href = "/content/entity/" + entityid + "?_method=delete" },"Cancel": function() { $(this).dialog("close"); }}});$('#dialog').dialog('open');return false;});$('.clone').live('click', function() {var entityid = $(this).attr('id');$('#dialog-duplicate').dialog({autoOpen: false,width: 470,height: 300,modal: true,title: 'Enter the entity id',buttons: {"OK":function() {var entityOld = $('#dup-entity').val();var patt=/^[0-9]{7}$/;if(patt.test(entityOld)){window.location.href = "/content/item-update/" + entityid +"?_method=put&action=dup-entity&entity-old=" + entityOld;}else {alert("Please enter a valid entity id.")}},"Cancel": function() { $(this).dialog("close"); }}});$('#dialog-duplicate').dialog('open');return false;});$('.complete').live('click', function() {var entityid = $(this).attr('id');$('#dialog').dialog({autoOpen: false,width: 470,height: 100,modal: true,title: 'The item will be completed, you will not be able to make further changes. Continue?',buttons: {"OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put&action=complete" },"Cancel": function() { $(this).dialog("close"); }}});$('#dialog').dialog('open');return false;});$('.ready').live('click', function() {var entityid = $(this).attr('id');$('#dialog').dialog({autoOpen: false,width: 470,height: 100,modal: true,title: 'The item will become available for consumers to place orders for. Continue?',buttons: {"OK":function() { window.location.href = "/content/item-update/" + entityid + "?_method=put&action=ready" },"Cancel": function() { $(this).dialog("close"); }}});$('#dialog').dialog('open');return false;});$('.assign').live('click', function() {var entityid = $(this).attr('id');$('#dialog-form').dialog({autoOpen: false,width: 470,height: 400,modal: true,title: 'The item will be assigned. Are you sure ?',buttons: {"OK":function() {var username = $('#username').val();window.location.href = "/content/item-update/" + entityid + "?_method=put&action=assign&username=" + username;},"Cancel": function() { $(this).dialog("close"); }}});$('#dialog-form').dialog('open');return false;});});function renderActionTable(obj){var entityId = obj.aData[ obj.iDataColumn ];var table = [];table.push('<span style="padding:2px"><a href="/content/entity/' + entityId + '" target="_blank">View</a></span>');table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="delete">Delete</a></span>');table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="ready">Approve</a></span>');table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="complete">Complete</a></span>');table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="assign">Assign</a></span>');table.push('<span style="border-left:1px solid black; padding:2px"><a href="" id="' + entityId + '" class="clone">Clone</a></span>');return table.join("");}$(document).ready(function(){var oTable = $("#myTable").dataTable({"aaSorting": [[ 1, "desc" ]],"iDisplayLength": 500,"bSort": false,"bDeferRender" : true,"sPaginationType": "full_numbers","sDom": '<"wrapper"flipt>',"aaData": Entity.arr,"aLengthMenu" : [ [ 25,50,100,500 ],"aoColumns": [{ "sTitle": "#" },{"sTitle": "Entity ID","fnRender" : function(obj){var entityId = obj.aData[ obj.iDataColumn ];return '<td><a href="/content/entity/' + entityId + '/edit">' + entityId + '</a></td>';}},{ "sTitle": "Category" },{ "sTitle": "Brand"},{ "sTitle": "Model Name" },{ "sTitle": "Model Number", "sClass": "center" },{"sTitle": "Item details","fnRender" : function(obj){var entityId = obj.aData[ obj.iDataColumn ];return '<a class="details-from-catalog" entityId="' + entityId +'" href="#">see items</a>';}},{ "sTitle": "Current Status" },{ "sTitle": "Ready On" },{ "sTitle": "Assigned To" },{ "sTitle": "Completed By" },{"sTitle": "Actions","sClass": "center","fnRender": renderActionTable,"bSearchable" : false}]});});function exportEntities(){$("#myTable").tableExport({type:'csv',escape:'false', ignoreColumn:[0,6,7,8,9,10,11]});}