<?php
global $myUser;
if(!$myUser->connected()) throw new Exception("Vous devez être connecté pour accéder à cette fonctionnalité",401);
if(!$myUser->can('dashboard','configure')) throw new Exception("Vous n'avez pas la permission pour executer cette fonctionnalité",403);
require_once(__DIR__.SLASH.'Dashboard.class.php');
?>


<div class="row">
    <div class="col-md-12">
          <h3><i class="fas fa-wrench"></i> Réglages Dashboard
                <?php if($myUser->can('dashboard', 'edit')) : ?>
        <div onclick="dashboard_setting_save();" class="btn btn-success right"><i class="fas fa-check"></i> Enregistrer</div>
        <?php endif; ?>
          </h3>
        <hr/>
    </div>
</div>
<p>Veuillez remplir les informations ci dessous.</p>

<!-- <div class="row">
    
    <div class="col-xl-12"> -->
          <?php /*echo Configuration::html('dashboard');*/ ?>
<!--     </div>
</div> -->
<div class="row">
    <!-- search results -->
    <div class="col-xl-12">

        <h3>Pages de dashboard</h3>
        <table id="dashboards" class="table table-striped " data-entity-search="dashboard_dashboard_search">
            <thead>
                <tr>
                    <th data-sortable="label">Libellé</th>
                    <th data-sortable="icon">Icône</th>
                    <th data-sortable="default">Par défaut</th>
                    <th></th>
                </tr>
            </thead>
            
            <thead>
                <tr id="dashboard-form" data-action="dashboard_dashboard_save" data-id="">
                    <th><input id="label" name="label" class="form-control" placeholder="" value="" type="text"></th>
                    <th><input id="icon" name="icon" data-type="icon" class="form-control" placeholder="" value="" type="text"></th>
                    <th><input id="default" name="default" class="form-control" data-type="checkbox" type="checkbox"></th>
                    <th><div onclick="dashboard_dashboard_save();" class="btn btn-success"><i class="fas fa-check"></i> Enregistrer</div></th>
                </tr>
            </thead>
            
            <tbody>
                <tr data-id="{{id}}" class="hidden">
                    <td>{{label}}</td>
                    <td><i class="{{icon}}"></i> {{icon}}</td>
                    <td>{{#default}}<i class="fas fa-check text-success"></i>{{/default}}{{^default}}<i class="fas fa-times text-danger"></i>{{/default}}</td>
                    <td>
                        <div class="btn-group btn-group-sm" role="group">
                            <div class="btn btn-info " onclick="dashboard_dashboard_edit(this);"><i class="fas fa-pencil-alt"></i></div>
                            <div class="btn btn-danger " onclick="dashboard_dashboard_delete(this);"><i class="far fa-trash-alt"></i></div>
                        </div>
                    </td>
                </tr>
           </tbody>
        </table>

         <!-- Pagination -->
       
        <ul class="pagination">
            <li class="page-item hidden" data-value="{{value}}" title="Voir la page {{label}}" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');dashboard_dashboard_search();">
                <a class="page-link" href="#">{{label}}</a>
            </li>
        </ul>

    </div>
</div>
