/**
 *
 */
angular.module("myApp", ["ngAnimate","ngResource", "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("layout3", {
            abstract: true,
            views: {
                "layout": {
                    templateUrl: "layout/layout3.html"
                }
            }
        })
        .state("layout2", {
            abstract: true,
            views: {
                "layout": {
                    templateUrl: "layout/layout2.html"
                }
            }
        })
        .state("layout4", {
            abstract: true,
            views: {
                "layout": {
                    templateUrl: "layout/layout4.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("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:"pages/timesheet/timeSheetDetail.html",
                    controller:"timeSheetDetailController"
                }
            }

        })
        .state("CatagoriManagement",{
            parent:'layout1',
            url:"/management/catagori",
            views:{
                "content":{
                    templateUrl: "pages/homepage/catagoriManagements.html",
                    controller: "MyHomeController"

                }
            }
        })
        .state("newsManagement",{
            parent:'layout1',
            url:"/management/catagori/:myCatagoriId",
            params:{
                myCatagoriId : null
            },
            views:{
                "content":{
                    templateUrl: "pages/homepage/newsManagements.html",
                    controller: "MyHomeController"

                }
            }
        })
        .state("newsEditManagement",{
            parent:'layout1',
            url:"/management/catagori/:myCatagoriEditId/news/:myNewsEditId",
            views:{
                "content":{
                    templateUrl: "pages/homepage/newsEditManagement.html",
                    controller: "MyHomeController"

                }
            }
        })
        .state("newsAddManagement",{
            parent:'layout1',
            url:"/management/HR/:employeeId/catagori/:myCatagoriAddId/createNews",
            views:{
                "content":{
                    templateUrl: "pages/homepage/newsAddManagement.html",
                    controller: "MyHomeController"

                }
            }
        })
        //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"
                }
            }
        })

        .state("project", {
            parent: 'layout1',
            url: "/project",
            views: {
                "content": {
                    templateUrl: "pages/project/project/projectListViews.html",
                    controller: "projectViewsController"
                }
            }
        })

        .state("addproject", {
            parent: 'layout1',
            url: "/addproject",
            views: {
                "content": {
                    templateUrl: "pages/project/project/projectAddViews.html",
                    controller: "insertProject"
                }
            }
        })

        .state("editproject", {
            parent: 'layout1',
            url: "/editproject/:ID",
            views: {
                "content": {
                    templateUrl: "pages/project/project/projectEditViews.html",
                    controller: "loadProjectDetail"
                }
            }
        })

        .state("groupProjectByProjectId", {
            parent: 'layout1',
            url: "/groupProjectByProjectId/:ID",
            params: {ID: null},
            views: {
                "content": {
                    templateUrl: "pages/project/groupproject/groupProjectView.html",
                    controller: "groupProjectShowController"
                }
            }
        })

        .state("addEmployeeProject", {
            parent: 'layout1',
            url: "/addEmployeeProject",
            views: {
                "content": {
                    templateUrl: "pages/project/groupproject/groupProjectAddView.html",
                    controller: "insertEmployeeProject"
                }
            }
        })

        .state("editEmployeeProject", {
            parent: 'layout1',
            url: "/editEmployeeProject/:ID",
            views: {
                "content": {
                    templateUrl: "pages/project/groupproject/groupProjectEditView.html",
                    controller: "loadEmployeeProjectDetail"
                }
            }
        })

        .state("issues", {
            parent: 'layout1',
            url: "/issues",
            views: {
                "content": {
                    templateUrl: "pages/issue/IssueView.html",
                    controller: "IssuesShowController"
                }
            }
        })

        .state("addIssues", {
            parent: 'layout1',
            url: "/addIssues",
            views: {
                "content": {
                    templateUrl: "pages/issue/IssueAdd.html",
                    controller: "IssuesAddController"
                }
            }
        })

        .state("IssuesComment", {
            parent: 'layout1',
            url: "/issuescomment/:IssuesId",
            views: {
                "content": {
                    templateUrl: "pages/issue/IssueDetailViews.html",
                    controller: "loadIssuesDetail"
                }
            }
        })
        .state("login", {
            parent: 'layout2',
            url: "/login",
            views: {
                "content": {
                    templateUrl: "pages/login/login.html",
                    controller: "loginController"
                }
            }
        })
        .state("register", {
            parent: 'layout2',
            url: "/register",
            views: {
                "content": {
                    templateUrl: "pages/login/register.html",
                    controller: "loginController"
                }
            }
        })
        .state("forgot-password", {
            parent: 'layout2',
            url: "/forgot-password",
            views: {
                "content": {
                    templateUrl: "pages/login/forgot-password.html",
                    controller: "loginController"
                }
            }
        })
        .state("gioithieu", {
            parent: 'app',
            url: "/gioithieu",
            views: {
                "content": {
                    templateUrl: "pages/gioithieu/gioithieu.htm",
                    controller: "gioithieuController"
                }
            }
        })


});

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