/**
 *
 */
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/leaveFromeaveFromDetail.html",
        //             controller: "leaveFormController"
        //         }
        //     }
        // })
        // .state("timeSheetDetail", {
        //     parent: 'layout1',
        //     url: "/timesheetdetail/:id",
        //     views: {
        //         "content": {
        //             templateUrl: "pages/timesheet/l",
        //             controller: "timeSheetDetailController"
        //         }
        //     }
        // })
        .state("leaveform", {
            parent: 'layout1',
            url: "/leaveform",
            views: {
                "content": {
                    templateUrl: "pages/leaveform/leaveForm.html",
                    controller: "leaveFormController"
                }
            }
        })

        .state("leaveFormDetail", {
            parent: 'layout1',
            url: "/leaveformdetail/:id",
            views: {
                "content": {
                    templateUrl: "pages/leaveform/leaveFormDetail.html",
                    controller: "leaveFormDetailController"
                }
            }
        })
        .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:"page/timesheet/timeSheetDetail.html",
                    controller:"timeSheetDetailController"
                }
            }

        })
        .state("project", {
            parent: 'layout1',
            url: "/project",
            views: {
                "content": {
                    templateUrl: "pages/project/project.html",
                    controller: "projectController"
                }
            }
        })
        .state("news",{
            parent:'layout1',
            url:"/news",
            views:{
                "content":{
                    templateUrl:"pages/homepage/catagoriManagements.html",
                    controller:"homeController"
                }
            }
        })
        //report========================================================================================================
        .state("reportProject", {
            parent: 'layout1',
            url: "/report/project",
            views: {
                "content": {
                    templateUrl: "pages/report/timeSheetReport.html",
                    controller: "reportController"
                }
            }
        })

        .state("reportTimeSheet", {
            parent: 'layout1',
            url: "/report/project/:ID/timeSheet",
            views: {
                "content": {
                    templateUrl: "pages/report/timeSheetListViews.html",
                    controller: "timeSheetListController"
                }
            }
        })

        .state("reportEmployee", {
            parent: 'layout1',
            url: "/report/project/:ID/employee",
            views: {
                "content": {
                    templateUrl: "pages/report/employeeListViews.html",
                    controller: "listLackOfReportController"
                }
            }
        })
     //
        .state("report2", {
            parent: 'layout1',
            url: "/report/project2",
            views: {
                "content": {
                    templateUrl: "pages/report/reportPage.html",
                    controller: "reportController"
                }
            }
        })

        .state("allReport", {
            parent: 'layout1',
            url: "/report/project/:ID/allReport",
            views: {
                "content": {
                    templateUrl: "pages/report/reportListPage.html",
                    controller: "allProjectReportController"
                }
            }
        })

        .state("reportDetail", {
            parent: 'layout1',
            url: "/report/reportDetail/:ID",
            views: {
                "content": {
                    templateUrl: "pages/report/reportDetailPage.html",
                    controller: "projectReportDetailController"
                }
            }
        })

        .state("reportEmployeeLack", {
            parent: 'layout1',
            url: "/report/project/:ID/employeeReport",
            views: {
                "content": {
                    templateUrl: "pages/report/employeeListViews1.html",
                    controller: "listEmployeeLackController"
                }
            }
        })
    //end report=======================================================================================================


});

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 [];
        }
    };
}
