define(["modules/tables/module","jqgrid","jqgrid-locale-en"],function(a){"use strict";a.registerDirective("jqGrid",["$compile",function(a){var b=0;return{replace:!0,restrict:"E",scope:{gridData:"="},template:'<div><table></table><div class="jqgrid-pagination"></div></div>',controller:["$scope","$element",function(a,b){a.editRow=function(a){b.find("table").editRow(a)},a.saveRow=function(a){b.find("table").saveRow(a)},a.restoreRow=function(a){b.find("table").restoreRow(a)}}],link:function(c,d){var e=b++,f="jqgrid-"+e;d.attr("id",f);var g="jqgrid-table-"+e,h=d.find("table");h.attr("id",g);var i="jqgrid-pager-"+e;d.find(".jqgrid-pagination").attr("id",i),h.jqGrid({data:c.gridData.data,datatype:"local",height:"auto",colNames:c.gridData.colNames||[],colModel:c.gridData.colModel||[],rowNum:10,rowList:[10,20,30],pager:"#"+i,sortname:"id",toolbarfilter:!0,viewrecords:!0,sortorder:"asc",gridComplete:function(){for(var a=h.jqGrid("getDataIDs"),b=0;b<a.length;b++){var c=a[b],d="<button class='btn btn-xs btn-default' tooltip='Edit Row' tooltip-append-to-body='true' ng-click='editRow("+c+")'><i class='fa fa-pencil'></i></button>",e="<button class='btn btn-xs btn-default' tooltip='Save Row' tooltip-append-to-body='true' ng-click='saveRow("+c+")'><i class='fa fa-save'></i></button>",f="<button class='btn btn-xs btn-default' tooltip='Cancel' tooltip-append-to-body='true' ng-click='restoreRow("+c+")'><i class='fa fa-times'></i></button>";h.jqGrid("setRowData",a[b],{act:d+e+f})}},editurl:"dummy.html",caption:"SmartAdmin jQgrid Skin",multiselect:!0,autowidth:!0}),h.jqGrid("navGrid","#"+i,{edit:!1,add:!1,del:!0}),h.jqGrid("inlineNav","#"+i),d.find(".ui-jqgrid").removeClass("ui-widget ui-widget-content"),d.find(".ui-jqgrid-view").children().removeClass("ui-widget-header ui-state-default"),d.find(".ui-jqgrid-labels, .ui-search-toolbar").children().removeClass("ui-state-default ui-th-column ui-th-ltr"),d.find(".ui-jqgrid-pager").removeClass("ui-state-default"),d.find(".ui-jqgrid").removeClass("ui-widget-content"),d.find(".ui-jqgrid-htable").addClass("table table-bordered table-hover"),d.find(".ui-jqgrid-btable").addClass("table table-bordered table-striped"),d.find(".ui-pg-div").removeClass().addClass("btn btn-sm btn-primary"),d.find(".ui-icon.ui-icon-plus").removeClass().addClass("fa fa-plus"),d.find(".ui-icon.ui-icon-pencil").removeClass().addClass("fa fa-pencil"),d.find(".ui-icon.ui-icon-trash").removeClass().addClass("fa fa-trash-o"),d.find(".ui-icon.ui-icon-search").removeClass().addClass("fa fa-search"),d.find(".ui-icon.ui-icon-refresh").removeClass().addClass("fa fa-refresh"),d.find(".ui-icon.ui-icon-disk").removeClass().addClass("fa fa-save").parent(".btn-primary").removeClass("btn-primary").addClass("btn-success"),d.find(".ui-icon.ui-icon-cancel").removeClass().addClass("fa fa-times").parent(".btn-primary").removeClass("btn-primary").addClass("btn-danger"),d.find(".ui-icon.ui-icon-seek-prev").wrap("<div class='btn btn-sm btn-default'></div>"),d.find(".ui-icon.ui-icon-seek-prev").removeClass().addClass("fa fa-backward"),d.find(".ui-icon.ui-icon-seek-first").wrap("<div class='btn btn-sm btn-default'></div>"),d.find(".ui-icon.ui-icon-seek-first").removeClass().addClass("fa fa-fast-backward"),d.find(".ui-icon.ui-icon-seek-next").wrap("<div class='btn btn-sm btn-default'></div>"),d.find(".ui-icon.ui-icon-seek-next").removeClass().addClass("fa fa-forward"),d.find(".ui-icon.ui-icon-seek-end").wrap("<div class='btn btn-sm btn-default'></div>"),d.find(".ui-icon.ui-icon-seek-end").removeClass().addClass("fa fa-fast-forward"),$(window).on("resize.jqGrid",function(){h.jqGrid("setGridWidth",$("#content").width())}),a(d.contents())(c)}}}])});