"use strict";
webapimodule.directive('home', function () {
    return ({
        restrict: 'AE',
        transclude: true,
        replace: true,
        templateUrl: "Views/Home.html",
        controller: "homeDirective",//controller to bind
        controllerAs: "vm",
        bindToController: true,//
    })
}).controller('homeDirective', function ($scope) {
    

    this.$onInit = function () {
        //$scope.GetEmployeeFiles();
    }

    var data = new kendo.data.DataSource({
        data: [{"district":"sample","mandal":"sample","employee_code":"sample","entityname":"sample","global_org_name":"sample"}],
        pageSize: 200,
        serverPaging: false,
        serverFiltering: false,
        serverSorting: false,
        batch: true,
    });

    $scope.mainGridOptions =
        {
            dataSource: data,
            columns: [
                { field: "district", title: "District", width: 110 },
                { field: "mandal", title: "Mandal", width: 205 },
                { field: "employee_code", title: "Employee Code", /*headerAttributes: { style: "text-align: center; background-color:brown" }*/width: 147 },
                { field: "entityname", title: "Entity Name", width: 220 },
                { field: "global_org_name", title: "Global Org Name", width: 785 },
                { field: "fullname", title: "Full Name", width: 470 },
                { field: "designation", title: "Designation", width: 368 },
                { field: "postname", title: "Postname", width: 368 },
                { field: "orgname", title: "Organisation", width: 1544 },
                { field: "aadharnumber", title: "UID", width: 160 },
                //{ field: "mobile", title: "Mobile Number" },
                //{ field: "email", title: "Title" },
                { field: "postdetailid", title: "Post Detail Id", width: 127 },
                { field: "opbalancecount", title: "Opening Balance Count", attributes: { style: "text-align: right;" }, width: 211 },
                { field: "filecreated", title: "File Created", attributes: { style: "text-align: right;" }, width: 117 },
                { field: "file_received", title: "File Received", attributes: { style: "text-align: right;" }, width: 126 },
                { field: "total", title: "Total", attributes: { style: "text-align: right;" }, width: 60 },
                { field: "files_closed", title: "Files Closed", attributes: { style: "text-align: right;" }, width: 116 },
                { field: "files_forwarded", title: "Files Forwarded", attributes: { style: "text-align: right;" }, width: 146 },
                { field: "files_parked", title: "Files Parked", attributes: { style: "text-align: right;" }, width: 116 },
                { field: "pending", title: "Pending", attributes: { style: "text-align: right;" }, width: 100 }
                //{ field: "url", title: "URL", template: '<img src="{{dataItem.url}}" style="width:100%;height:100px;" ng-click="open(dataItem)">' },

                //,{ command: ["edit", "destroy"], title: "Edit/Delete", width: "175px", editable: "inline" }
            ],
            selectable: "single, row",
            pageable: true,
            //filterable: true,
            serverFiltering: true,
            groupable: true,
            resizable: true,
            scrollable: {
                mode: "virtual",
            },
            filterable:
            {
                mode: "row"
            },
            dataBound: function () {
                //for (var i = 0; i < this.columns.length; i++) {
                //    this.autoFitColumn(i);
                //}
            },
            toolbar: ["excel"],
            excel: {
                fileName: "UI Grid Export.xlsx",
                proxyURL: "https://demos.telerik.com/kendo-ui/service/export",
                filterable: true,
                allPages: true
            },
            //pdf:
            //{
            //    fileName: "UI TreeList Export.pdf",
            //    proxyURL: "https://demos.telerik.com/kendo-ui/service/export",
            //    allPages: true
            //},
            pdf: {
                fileName: "Kendo UI Export.pdf",
                proxyURL: "https://demos.telerik.com/kendo-ui/service/export"
            },
            //    noRecords: {
            //        template: "<div class='bg-info'><div style='background-color:transparent !important;' class='jumbotron'><p><span class='glyphicon glyphicon - info - sign'></span>No data Available.</p></div></div>"
            //},

        };

});