<commit_before><?php use_helper("Date"); ?>
<?php use_javascript("lib/chart.min.js", "last") ?>

<ol class="breadcrumb">
  <li class="active"><a href="<?php echo url_for('degustation'); ?>">Dégustation</a></li>
</ol>

<h3>Création d'une dégustation</h3>
<form action="" method="post" class="form-horizontal">
    <?php echo $form->renderHiddenFields(); ?>
    <?php echo $form->renderGlobalErrors(); ?>
    <div class="row">
        <div class="col-sm-10 col-xs-12">
            <div class="form-group <?php if($form["date"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["date"]->renderError(); ?>
                <?php echo $form["date"]->renderLabel("Date de dégustation", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <div class="input-group date-picker-week">
                        <?php echo $form["date"]->render(array("class" => "form-control")); ?>
                        <div class="input-group-addon">
                            <span class="glyphicon-calendar glyphicon"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group <?php if($form["appellation"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["appellation"]->renderError(); ?>
                <?php echo $form["appellation"]->renderLabel("Appellation / Mention", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <?php echo $form["appellation"]->render(array("class" => "form-control")); ?>
                </div>
            </div>
            <div class="form-group bloc_condition" data-condition-cible="#bloc_date_prelevement">
                <div class="col-sm-8 col-sm-offset-4 col-xs-12">
                    <?php foreach(TourneeCreationForm::getActionChoices() as $key => $libelle): ?>
                        <label class="radio-inline">
                          <input type="radio" name="<?php echo $form["action"]->renderName(); ?>" <?php if($form["action"]->getValue() == $key): ?>checked="checked"<?php endif; ?> value="<?php echo $key ?>"> <?php echo $libelle ?>
                        </label>
                    <?php endforeach; ?>
                </div>
            </div>
            <div id="bloc_date_prelevement" data-condition-value="organiser" class="form-group <?php if($form["date"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["date_prelevement_debut"]->renderError(); ?>
                <?php echo $form["date_prelevement_debut"]->renderLabel("Date de début des prélévements", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <div class="input-group date-picker-week">
                        <?php echo $form["date_prelevement_debut"]->render(array("class" => "form-control")); ?>
                        <div class="input-group-addon">
                            <span class="glyphicon-calendar glyphicon"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group text-right">
                <div class="col-sm-4 col-sm-offset-6 col-xs-12">
                    <button type="submit" class="btn btn-default btn-lg btn-block btn-upper">Créer</button>
                </div>
            </div>
        </div>
    </div>
</form>

<div class="row">
    <div class="col-xs-12">
        <legend><small><small>Demandes de prélevements dans le temps</small></small></legend>
        <canvas id="graphique" width="920" class="col-xs-12" height="200"></canvas>
    </div>
</div>
<script type="text/javascript">
window.onload = function () {
        var ctx = document.getElementById("graphique").getContext("2d");
        var myNewChart = new Chart(ctx).Bar({
            labels: <?php echo json_encode(array_keys($demandes_alsace->getRawValue())) ?>,
            datasets: [
                {
                    label: "<NAME>",
                    fillColor: "rgba(120,120,220,0.2)",
                    strokeColor: "rgba(120,120,220,1)",
                    pointColor: "rgba(120,120,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    pointHighlightStroke: "rgba(120,120,220,1)",
                    data: <?php echo json_encode(array_values($demandes_alsace->getRawValue())) ?>
                },
                {
                    label: "VT / SGN",
                    fillColor: "rgba(0,220,220,0.2)",
                    strokeColor: "rgba(0,220,220,1)",
                    pointColor: "rgba(0,220,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    pointHighlightStroke: "rgba(0,220,220,1)",
                    data: <?php echo json_encode(array_values($demandes_vtsgn->getRawValue())) ?>
                },
            ]
        }, {multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"} );
};
</script>

<h3>Liste des tournées de dégustation</h3>
<?php if (isset($nonterminee)):?>
<a href="<?php echo url_for('degustation'); ?>" class="btn btn-block btn-primary">Voir toutes les dégustations</a>
<?php else: ?>
<a href="<?php echo url_for('degustation'); ?>?nonterminee=1" class="btn btn-block btn-primary">Voir les dégustations non-terminées</a>
<?php endif?>
<table class="table table-bordered table-striped table-condensed">
    <thead>
        <tr>
            <th class="col-xs-3">Date</th>
            <th class="col-xs-4">Produit</th>
            <th class="col-xs-3">Infos</th>
            <th class="col-xs-2">Statut</th><commit_msg>Degustation AVA: conditionner l'affichage du graph (car parfois pas de demandes)<commit_after><?php use_helper("Date"); ?>
<?php use_javascript("lib/chart.min.js", "last") ?>

<ol class="breadcrumb">
  <li class="active"><a href="<?php echo url_for('degustation'); ?>">Dégustation</a></li>
</ol>

<h3>Création d'une dégustation</h3>
<form action="" method="post" class="form-horizontal">
    <?php echo $form->renderHiddenFields(); ?>
    <?php echo $form->renderGlobalErrors(); ?>
    <div class="row">
        <div class="col-sm-10 col-xs-12">
            <div class="form-group <?php if($form["date"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["date"]->renderError(); ?>
                <?php echo $form["date"]->renderLabel("Date de dégustation", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <div class="input-group date-picker-week">
                        <?php echo $form["date"]->render(array("class" => "form-control")); ?>
                        <div class="input-group-addon">
                            <span class="glyphicon-calendar glyphicon"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group <?php if($form["appellation"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["appellation"]->renderError(); ?>
                <?php echo $form["appellation"]->renderLabel("Appellation / Mention", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <?php echo $form["appellation"]->render(array("class" => "form-control")); ?>
                </div>
            </div>
            <div class="form-group bloc_condition" data-condition-cible="#bloc_date_prelevement">
                <div class="col-sm-8 col-sm-offset-4 col-xs-12">
                    <?php foreach(TourneeCreationForm::getActionChoices() as $key => $libelle): ?>
                        <label class="radio-inline">
                          <input type="radio" name="<?php echo $form["action"]->renderName(); ?>" <?php if($form["action"]->getValue() == $key): ?>checked="checked"<?php endif; ?> value="<?php echo $key ?>"> <?php echo $libelle ?>
                        </label>
                    <?php endforeach; ?>
                </div>
            </div>
            <div id="bloc_date_prelevement" data-condition-value="organiser" class="form-group <?php if($form["date"]->hasError()): ?>has-error<?php endif; ?>">
                <?php echo $form["date_prelevement_debut"]->renderError(); ?>
                <?php echo $form["date_prelevement_debut"]->renderLabel("Date de début des prélévements", array("class" => "col-xs-4 control-label")); ?>
                <div class="col-sm-6 col-xs-8">
                    <div class="input-group date-picker-week">
                        <?php echo $form["date_prelevement_debut"]->render(array("class" => "form-control")); ?>
                        <div class="input-group-addon">
                            <span class="glyphicon-calendar glyphicon"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group text-right">
                <div class="col-sm-4 col-sm-offset-6 col-xs-12">
                    <button type="submit" class="btn btn-default btn-lg btn-block btn-upper">Créer</button>
                </div>
            </div>
        </div>
    </div>
</form>

<div class="row">
    <div class="col-xs-12">
        <legend><small><small>Demandes de prélevements dans le temps</small></small></legend>
        <?php if(array_keys($demandes_alsace->getRawValue())): ?>
          <canvas id="graphique" width="920" class="col-xs-12" height="200"></canvas>
        <?php else: ?>
          <div>
            <p class="text-muted">Pas encore de demande de prélèvement pour la campagne <?php echo ConfigurationClient::getInstance()->getCampagneManager()->getCurrent(); ?>.</p>
          </div>
        <?php endif; ?>
    </div>
</div>
<script type="text/javascript">
<?php if(array_keys($demandes_alsace->getRawValue())): ?>
  window.onload = function () {
          var ctx = document.getElementById("graphique").getContext("2d");
          myNewChart = new Chart(ctx).Bar({
              labels: <?php echo json_encode(array_keys($demandes_alsace->getRawValue())) ?>,
              datasets: [
                  {
                      label: "AOC Alsace",
                      fillColor: "rgba(120,120,220,0.2)",
                      strokeColor: "rgba(120,120,220,1)",
                      pointColor: "rgba(120,120,220,1)",
                      pointStrokeColor: "#fff",
                      pointHighlightFill: "#fff",
                      pointHighlightStroke: "rgba(120,120,220,1)",
                      data: <?php echo json_encode(array_values($demandes_alsace->getRawValue())) ?>
                  },
                  {
                      label: "VT / SGN",
                      fillColor: "rgba(0,220,220,0.2)",
                      strokeColor: "rgba(0,220,220,1)",
                      pointColor: "rgba(0,220,220,1)",
                      pointStrokeColor: "#fff",
                      pointHighlightFill: "#fff",
                      pointHighlightStroke: "rgba(0,220,220,1)",
                      data: <?php echo json_encode(array_values($demandes_vtsgn->getRawValue())) ?>
                  },
              ]
          }, {multiTooltipTemplate: "<%= datasetLabel %> - <%= value %>"} );
  };
<?php endif;?>

</script>

<h3>Liste des tournées de dégustation</h3>
<?php if (isset($nonterminee)):?>
<a href="<?php echo url_for('degustation'); ?>" class="btn btn-block btn-primary">Voir toutes les dégustations</a>
<?php else: ?>
<a href="<?php echo url_for('degustation'); ?>?nonterminee=1" class="btn btn-block btn-primary">Voir les dégustations non-terminées</a>
<?php endif?>
<table class="table table-bordered table-striped table-condensed">
    <thead>
        <tr>
            <th class="col-xs-3">Date</th>
            <th class="col-xs-4">Produit</th>
            <th class="col-xs-3">Infos</th>
            <th class="col-xs-2">Statut</th>
{'fraction_non_alphanumeric': 0.18199138502319417, 'fraction_numerical': 0.019052352551358516, 'mean_word_length': 2.0379969803724207, 'pattern_counts': {'":': 0, '<': 252, '<?xml version=': 0, '>': 308, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2502029', 'n_tokens_mistral': 3770, 'n_tokens_neox': 3512, 'n_words': 655}