<?php

/* if(Route::in("/^\/?$/i",$v,true)){
    if (empty($_GET["url"]) && empty($_GET["api"])) {
        header("location:/?url=/dashboard");
        exit;
    }
} */

db_table::createView("dashboard", "Dashboard");
Route::isJs(function () {
    ob_start();
?>
<style type="text/css">

.box-widget {
    border: none;
    position: relative;
}
.box {
    position: relative;
    border-radius: 3px;
    background: #ffffff;
    border-top: 3px solid #d2d6de;
    margin-bottom: 20px;
    width: 100%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.widget-user .widget-user-header {
    padding: 20px;
    height: 120px;
    border-top-right-radius: 3px;
    border-top-left-radius: 3px;
}
.bg-yellow {
    background-color: #f39c12 !important;
}
.bg-blue {
    background-color: #0073b7 !important;
}
.bg-aqua {
    background-color: #00c0ef !important;
}
.bg-green {
    background-color: #00a65a !important;
}
.bg-red {
    background-color: #dd4b39 !important;
}
.widget-user .widget-user-username {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 25px;
    font-weight: 300;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    color:#fff;
}
.widget-user .widget-user-desc {
    margin-top: 0;
    color:#fff;
}

.widget-user .widget-user-image {
    position: absolute;
    top: 65px;
    left: 50%;
    margin-left: -45px;
}
.widget-user .widget-user-image>img {
    width: 90px;
    height: auto;
    border: 3px solid #fff;
    background-color: white;
}
.widget-user .box-footer {
    padding-top: 30px;
}
.box-footer {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-top: 1px solid #f4f4f4;
    padding: 10px;
    background-color: #fff;
}
.box .border-right {
    border-right: 1px solid #f4f4f4;
}
.description-block {
    display: block;
    margin: 10px 0;
    text-align: center;
}
.description-block>.description-header {
    margin: 0;
    padding: 0;
    font-weight: 600;
    font-size: 16px;
}
.description-block>.description-text {
    text-transform: uppercase;
}
</style>

    <div>
        <div class="container bootdey">
            <div class="row">
                <detailclientforcheck ng-repeat="elm in list" xid="{{elm.id}}" xname="{{elm.titre}}"></detailclientforcheck>
            </div>
        </div>
    </div>
    <?php
    $code = ob_get_clean();
    ?>
    <script>
        app.directive('dashboard', [function() {
            return {
                restrict: 'EA',
                transclude: false,
                replace: false,
                template: <?= json_encode(preg_replace("/\t|\n|\r/i", "", $code)) ?>,
                scope: {},
                controller: function($scope,$sce) {
                    $scope.list = [];
                    $scope.loadData = function(){
                        api("cgetclient",{},function(res){
                            $scope.list=res;
                            $scope.$apply();
                        });
                    };
                    $scope.loadData();
                },
                link: function(scope, iElement, iAttrs) {}
            };
        }]);
    </script>
<?php
});