<?php

db_table::createView("parc", "Parc");
Route::isJs(function () {
    ob_start();
?>
<div>
    <style>
        div[name="jokm"]{
          padding: 10px 16px;
        }
        div[name="jokm"]>div>div>.col-sm-12{
            overflow-x: auto;
            padding: 0px;
        }
    </style>

        <div name="jokm"><table id="xparc" class="table table-striped table-bordered" style="background:white;width:100%;font-size: 1.29rem;">
                <thead>
                    <tr>
                    <th>CHASSIS</th>
                    <th>MARQUE</th>
                    <th>GOV</th>
                    <th>MODELE</th>
                    <th>DMC</th>
                    <th>ENERGIE</th>
                    <th>Puissance</th>
                    <th>CARROSSERIE</th>
                    <th>genre</th>
                    <th>GAUCHE</th>
                    <th>CD_SERIE</th>
                    <th>DROIT_MIL</th>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                    <th>CHASSIS</th>
                    <th>MARQUE</th>
                    <th>GOV</th>
                    <th>MODELE</th>
                    <th>DMC</th>
                    <th>ENERGIE</th>
                    <th>Puissance</th>
                    <th>CARROSSERIE</th>
                    <th>genre</th>
                    <th>GAUCHE</th>
                    <th>CD_SERIE</th>
                    <th>DROIT_MIL</th>
                    </tr>
                </tfoot>
            </table>
            <button class="btn btn-primary" id="refchartab" onclick="chartab(1)"><span style="color:white" class="glyphicon glyphicon-refresh"></span></button>
            <div class="row">
                <div class="col-xs-6">
                    <canvas id="chart-areape-0"></canvas>
                </div>
                <div class="col-xs-6">
                    <canvas id="chart-areape-3"></canvas>
                </div>
                <div class="col-xs-9">
                    <canvas id="chart-areape-2"></canvas>
                </div>
                <div class="col-xs-9">
                    <canvas id="chart-areape-1"></canvas>
                </div>
                <div class="col-xs-9">
                    <canvas id="chart-areape-4"></canvas>
                </div>
            </div>
        </div>
        <dialog ng-model="vinDialog" titre="VIN : {{vinDialog.id}} " btn-fermer="true" width="fit-content">
            <vinlist piece-id="{{vinDialog.id}}"></vinlist>
        </dialog>
            
</div>
<?php
    $code = ob_get_clean();
    ?>
    <script>
        app.directive('parc', [function() {
            return {
                restrict: 'EA',
                transclude: false,
                replace: false,
                template: <?= json_encode(preg_replace("/\t|\n|\r/i", "", $code)) ?>,
                scope: {},
                controller: function($scope) {
                    $scope.form = {};
                    $scope.ctrl = $scope;
                    $scope.ijk = (i) => {
                        var ll=document.getElementsByTagName('vinlist').length;
                        if(ll>0){
                            $scope.vinDialog.id = i;
                            $scope.vinDialog.show();
                            angular.element(document.getElementsByTagName('vinlist')[ll-1]).scope().$$childTail.wwc(i);
                        }
                    };
                },
                link: function(scope, iElement, iAttrs) {
                  setTimeout(() => {
                    oou2();
                  }, 400);
                  
                }
            };
        }]);
    </script>
<?php
});
