Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/inc/registryView.php b/src/inc/registryView.php
new file mode 100644
index 0000000..1767bc3
--- /dev/null
+++ b/src/inc/registryView.php
@@ -0,0 +1,91 @@
+<?php
+class registryView {
+  public static function renderRegistry(&$registry, &$companies, $scrollable = false, $showPersonAndCompany = true, $isForWorker = false, $isForValidationView = false) {
+    global $conf, $renderRegistryAutoIncremental;
+    if (!isset($renderRegistryAutoIncremental)) $renderRegistryAutoIncremental = 0;
+    $menu = "";
+    ?>
+    <div class="mdl-shadow--2dp overflow-wrapper incidents-wrapper<?=($scrollable ? " incidents-wrapper--scrollable" : "")?>">
+      <table class="incidents">
+        <tr>
+          <?php if ($conf["debug"]) { ?><th>ID</th><?php } ?>
+          <th<?=($isForValidationView ? " class=\"has-checkbox\"" : "")?>>
+            <?php if ($isForValidationView) {
+              ?>
+              <label for="checkboxall_r_<?=$renderRegistryAutoIncremental?>" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" data-check-all="true">
+                <input type="checkbox" id="checkboxall_r_<?=$renderRegistryAutoIncremental?>" class="mdl-checkbox__input" autocomplete="off">
+              </label>
+              <?php
+            }
+            ?>
+          </th>
+          <?php
+          if ($showPersonAndCompany) {
+            ?>
+            <th>Nombre</th>
+            <th>Empresa</th>
+            <?php
+          }
+          ?>
+          <th>Día</th>
+          <th>Jornada laboral</th>
+          <th>Desayuno</th>
+          <th>Comida</th>
+          <th></th>
+        </tr>
+        <?php
+        foreach ($registry as $record) {
+          $id = (int)$record["id"]."_".(int)$renderRegistryAutoIncremental;
+          $breakfastInt = [$record["beginsbreakfast"], $record["endsbreakfast"]];
+          $lunchInt = [$record["beginslunch"], $record["endslunch"]];
+          ?>
+          <tr<?=($record["invalidated"] == 1 ? ' class="mdl-color-text--grey-700 line-through"' : '')?>>
+            <?php if ($conf["debug"]) { ?><td><?=(int)$record["id"]?></td><?php } ?>
+            <td class="icon-cell<?=($isForValidationView ? " has-checkbox" : "")?>">
+              <?php
+              if ($isForValidationView) {
+                ?>
+                <label for="checkbox_r_<?=$id?>" class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
+                  <input type="checkbox" id="checkbox_r_<?=$id?>" data-record="<?=(int)$record["id"]?>" class="mdl-checkbox__input" autocomplete="off">
+                </label>
+                <?php
+              } else {
+                ?>
+                <i id="state<?=$id?>" class="material-icons <?=security::htmlsafe(registry::$stateIconColors[$record["state"]])?>"><?=security::htmlsafe(registry::$stateIcons[$record["state"]])?></i>
+                <?php
+                visual::addTooltip("state".$id, security::htmlsafe(registry::$stateTooltips[$record["state"]]));
+              }
+              ?>
+            </td>
+            <?php
+            if ($showPersonAndCompany) {
+              ?>
+              <td class="can-strike"><span<?=($isForWorker ? '' : ' data-dyndialog-href="dynamic/user.php?id='.(int)$record["personid"].'"')?>><?=security::htmlsafe($record["workername"])?></span></td>
+              <td class="can-strike"><?=security::htmlsafe($companies[$record["companyid"]])?></td>
+              <?php
+            }
+            ?>
+            <td class="can-strike"><?=strftime("%d %b %Y", $record["day"])?></td>
+            <td class="centered can-strike"><?=schedules::sec2time($record["beginswork"])." - ".schedules::sec2time($record["endswork"])?></td>
+            <td class="centered can-strike"><?=(intervals::measure($breakfastInt) == 0 ? "-" : ($isForWorker ? export::sec2hours(intervals::measure($breakfastInt)) : schedules::sec2time($record["beginsbreakfast"])." - ".schedules::sec2time($record["endsbreakfast"])))?></td>
+            <td class="centered can-strike"><?=(intervals::measure($lunchInt) == 0 ? "-" : ($isForWorker ? export::sec2hours(intervals::measure($lunchInt)) : schedules::sec2time($record["beginslunch"])." - ".schedules::sec2time($record["endslunch"])))?></td>
+            <td><button id="actions<?=$id?>" class="mdl-button mdl-js-button mdl-button--icon mdl-js-ripple-effect custom-actions-btn"><i class="material-icons icon">more_vert</i></button></td>
+          </tr>
+          <?php
+          $menu .= '<ul class="mdl-menu mdl-menu--unaligned mdl-js-menu mdl-js-ripple-effect" for="actions'.$id.'">';
+
+          if (!$isForWorker && $record["invalidated"] == 0) {
+            $menu .= '<a href="dynamic/invalidaterecord.php?id='.(int)$record["id"].'" data-dyndialog-href="dynamic/invalidaterecord.php?id='.(int)$record["id"].'"><li class="mdl-menu__item">Invalidar</li></a>';
+          }
+
+          $menu .= '<a href="dynamic/authorsrecord.php?id='.(int)$record["id"].'" data-dyndialog-href="dynamic/authorsrecord.php?id='.(int)$record["id"].'"><li class="mdl-menu__item">Autoría</li></a></ul>';
+
+          $renderRegistryAutoIncremental++;
+        }
+        ?>
+      </table>
+      <?php echo $menu; ?>
+    </div>
+  <?php
+  }
+}