/**
 *
 */
angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {

    $locationProvider.hashPrefix('');
    $urlRouterProvider.otherwise("/employees");

    $stateProvider
        .state("layout1", {
            abstract: true,
            views: {
                "layout": {
                    templateUrl: "layout/layout1.html"
                }
            }
        })
        .state("layout2", {
            abstract: true,
            views: {
                "layout": {
                    templateUrl: "layout/layout2.html"
                }
            }
        })


        .state("employees", {
            parent: 'layout1',
            url: "/employees",
            views: {
                "content": {
                    templateUrl: "pages/employee/employee.html",
                    controller: "employeeController"
                }
            }
        })
        .state("createEmployee", {
            parent: 'layout1',
            url: "/createEmployee",
            params: {
                emp: null
            },
            views: {
                "content": {
                    templateUrl: "pages/employee/createEmployee.html",
                    controller: "createEmployeeController"
                }
            }
        })


        .state("timeSheet", {
            parent: 'layout1',
            url: "/timesheet",
            views: {
                "content": {
                    templateUrl: "pages/timesheet/timeSheet.html",
                    controller: "timeSheetController"
                }
            }
        })
        .state("timeSheetDetail", {
            parent: 'layout1',
            url: "/timesheetdetail/:id",
            views: {
                "content": {
                    templateUrl: "pages/timesheet/timeSheetDetail.html",
                    controller: "timeSheetDetailController"
                }
            }
        })
        .state("leaveForm", {
            parent: 'layout2',
            url: "/leaveform",
            views: {
                "content": {
                    templateUrl: "pages/leaveform/leaveForm.html",
                    controller: "leaveFormController"
                }
            }
        })

        .state("leaveFormDetail", {
            parent: 'layout2',
            url: "/leaveformdetail/:id",
            views: {
                "content": {
                    templateUrl: "pages/leaveform/leaveFormDetail.html",
                    controller: "leaveFormDetailController"
                }
            }
        })


});

angular
    .module('myApp')
    .filter('lmto', lmto);

function lmto() {
    return function (items, limit, offset) {
        if (items.length > 0) {
            return items.slice(offset, offset + limit);
        } else {
            return [];
        }
    };
}
