<commit_before><?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\bootstrap\Button;
use common\models\User;
use common\models\Question;
use common\components\Time;
/**
 * @var yii\web\View $this
 */

$this->title = "Past Check-ins";

function checkboxItemTemplate($index, $label, $name, $checked, $value) {
  $checked_val = ($checked) ? "btn-primary" : "";
  return "<button class='btn btn-default $checked_val' data-toggle='button' disabled='disabled' name='$name' value='$value'>$label</button>";
}
?>
<h1>View Past Check-ins</h1>
<div id='past-checkin-nav' class='btn-group'>
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "-1 week")]); ?>">&lt;&lt;</a> 
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "-1 day")]); ?>">&lt;</a> 
<?= yii\jui\DatePicker::widget([
  'name' => 'attributeName', 
  'value' => $utc_date,
  'options' => ['class'=> 'btn btn-default datepicker'],
  'dateFormat' => 'yyyy-MM-dd', 
  'clientOptions' => [
    'defaultDate' => $actual_date,
    'onSelect' => new \yii\web\JsExpression("function(dateText, obj) { location.href = '/checkin/view/'+dateText; }"),
    'beforeShowDay' => new \yii\web\JsExpression("function(date) { 
      var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
      var dates = ".json_encode($past_checkin_dates).";
      return [ dates.indexOf(string) > -1 ];
                }")
              ]
            ]) ?>
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "+1 day")]); ?>">&gt;</a> 
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "+1 week")]); ?>">&gt;&gt;</a> 
</div>

<?php
            switch(true) {
              case ($score < 30):
                $alert_level = "success";
                $alert_msg = "You're doing well! Keep on doing whatever it is you're doing!";
                break;

              case ($score < 50):
                $alert_level = "info";
                $alert_msg = "Some warning signs, but nothing too bad. Have some quiet time, process things, and call a friend.";
                break;
<commit_msg>Improving UI/X of past check-ins datepicker & navigation buttons (#52)<commit_after><?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\bootstrap\Button;
use common\models\User;
use common\models\Question;
use common\components\Time;
/**
 * @var yii\web\View $this
 */

$this->title = "Past Check-ins";

function checkboxItemTemplate($index, $label, $name, $checked, $value) {
  $checked_val = ($checked) ? "btn-primary" : "";
  return "<button class='btn btn-default $checked_val' data-toggle='button' disabled='disabled' name='$name' value='$value'>$label</button>";
}
?>
<h1>View Past Check-ins</h1>
<div id='past-checkin-nav' role='toolbar' class='btn-toolbar'>
  <div class='btn-group' role='group'>
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "-1 week")]); ?>">&lt;&lt;</a> 
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "-1 day")]); ?>">&lt;</a> 
  </div>
  <div class='btn-group' role='group'>
<?= yii\jui\DatePicker::widget([
  'name' => 'attributeName', 
  'value' => $utc_date,
  'options' => ['class'=> 'btn btn-default datepicker', 'readonly' => true],
  'dateFormat' => 'yyyy-MM-dd', 
  'clientOptions' => [
    'defaultDate' => $actual_date,
    'onSelect' => new \yii\web\JsExpression("function(dateText, obj) { location.href = '/checkin/view/'+dateText; }"),
    'beforeShowDay' => new \yii\web\JsExpression("function(date) { 
      var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
      var dates = ".json_encode($past_checkin_dates).";
      return [ dates.indexOf(string) > -1 ];
                }")
              ]
            ]) ?>
  </div>
  <div class='btn-group' role='group'>
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "+1 day")]); ?>">&gt;</a> 
    <a class="btn btn-default" href="<?= Url::toRoute(['checkin/view', 'date'=>Time::alterLocalDate($actual_date, "+1 week")]); ?>">&gt;&gt;</a> 
  </div>
</div>

<?php
            switch(true) {
              case ($score < 30):
                $alert_level = "success";
                $alert_msg = "You're doing well! Keep on doing whatever it is you're doing!";
                break;

              case ($score < 50):
                $alert_level = "info";
                $alert_msg = "Some warning signs, but nothing too bad. Have some quiet time, process things, and call a friend.";
                break;

{'fraction_non_alphanumeric': 0.20553033429632686, 'fraction_numerical': 0.004952538175815105, 'mean_word_length': 3.4549632352941178, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 80, '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': '4303845', 'n_tokens_mistral': 1633, 'n_tokens_neox': 1589, 'n_words': 343}