~homeworkprod/byceps-bungalows

bdce316b20aafcba4f67f83a3a223061bad0682e — Jochen Kupperschmidt 3 months ago 14e73b0
Use `.itemlist` for admin bungalow occupants list
1 files changed, 77 insertions(+), 79 deletions(-)

M byceps/blueprints/admin/bungalow/templates/admin/bungalow/occupants.html
M byceps/blueprints/admin/bungalow/templates/admin/bungalow/occupants.html => byceps/blueprints/admin/bungalow/templates/admin/bungalow/occupants.html +77 -79
@@ 7,10 7,12 @@

{% block head %}
    <style>
      tbody.bungalow tr:first-child th,
      tbody.bungalow tr:first-child td {
        border-top-style: double;
        border-top-width: 3px;
      tbody.bungalow:not(:first-of-type) tr:first-child :is(th, td) {
        border-top: var(--table-border-color) solid 1px;
      }

      tbody.bungalow tr:not(:first-child) :is(th, td):first-child {
        padding-left: 0;
      }

      @media print {


@@ 49,84 51,80 @@
    </div>
  </div>

  <div class="box">

    <div class="row row--space-between mb">
      <div>
        Es sind <strong>{{ bungalows|length }}</strong> Bungalows belegt.
      </div>
      <div>
        <div class="data-label">{{ _('As at') }}</div>
        <div class="data-value">{{ now|datetimeformat }}</div>
      </div>
  <div class="block row row--space-between is-vcentered">
    <div>
      Es sind <strong>{{ bungalows|length }}</strong> Bungalows belegt.
    </div>
    <div>
      <div class="data-label">{{ _('As at') }}</div>
      <div class="data-value">{{ now|datetimeformat }}</div>
    </div>
  </div>

    {%- if bungalows %}
    <table class="index is-wide">
      <thead>
        <tr>
          <th>{{ render_icon('bungalow') }} Bungalow</th>
          <th>{{ render_icon('user') }} Bewohner (Alias)</th>
          <th>{{ render_icon('user') }} Bewohner (Name)</th>
          <th>{{ render_icon('info') }} Bemerkung</th>
        </tr>
      </thead>
      {%- for bungalow in bungalows %}
      <tbody class="bungalow">
        {%- with occupant_slots = occupant_slots_by_occupancy_id[bungalow.occupancy.id] %}
          {%- with occupant_slot_count = occupant_slots|length %}
            {%- for occupant_slot in occupant_slots %}
        <tr>
              {%- if loop.first %}
          <td rowspan="{{ occupant_slot_count + (1 if bungalow.occupancy.internal_remark else 0) }}">
            <strong>Nummer {{ bungalow.number }}</strong><br>
            {{ occupant_slot_count }} Plätze
          </td>
              {%- endif %}
              {%- if occupant_slot.occupant -%}
                {%- with occupant = occupant_slot.occupant -%}
          <td>{{ render_user_avatar_and_admin_link(occupant, size=16) }}</td>
          <td>
                  {%- with full_name = occupant.detail.full_name|default('', true)|trim %}
                    {%- if full_name -%}
              {{ full_name }}
                    {%- else -%}
              {{ 'nicht angegeben'|dim }}
                    {%- endif -%}
                  {%- endwith -%}
          </td>
          <td>
                  {%- with is_main_occupant = (bungalow.occupancy and bungalow.occupancy.manager_id == occupant.id) %}
                    {%- if is_main_occupant %}
                Hauptmieter/in
                    {%- endif %}
                  {%- endwith %}
  {%- if bungalows %}
  <table class="itemlist is-wide">
    <thead>
      <tr>
        <th>{{ render_icon('bungalow') }} Bungalow</th>
        <th>{{ render_icon('user') }} Bewohner (Alias)</th>
        <th>{{ render_icon('user') }} Bewohner (Name)</th>
        <th>{{ render_icon('info') }} Bemerkung</th>
      </tr>
    </thead>
    {%- for bungalow in bungalows %}
    <tbody class="bungalow">
      {%- with occupant_slots = occupant_slots_by_occupancy_id[bungalow.occupancy.id] %}
        {%- with occupant_slot_count = occupant_slots|length %}
          {%- for occupant_slot in occupant_slots %}
      <tr>
            {%- if loop.first %}
        <td rowspan="{{ occupant_slot_count + (1 if bungalow.occupancy.internal_remark else 0) }}">
          <strong>Nummer {{ bungalow.number }}</strong><br>
          {{ occupant_slot_count }} Plätze
        </td>
            {%- endif %}
            {%- if occupant_slot.occupant -%}
              {%- with occupant = occupant_slot.occupant -%}
        <td>{{ render_user_avatar_and_admin_link(occupant, size=16) }}</td>
        <td>
                {%- with full_name = occupant.detail.full_name|default('', true)|trim %}
                  {%- if full_name -%}
            {{ full_name }}
                  {%- else -%}
            {{ 'nicht angegeben'|dim }}
                  {%- endif -%}
                {%- endwith -%}
          </td>
              {%- else %}
          <td colspan="3">{{ 'frei'|dim }}</td>
              {%- endif %}
        </tr>
            {%- endfor %}
          {%- endwith %}
        </td>
        <td>
                {%- with is_main_occupant = (bungalow.occupancy and bungalow.occupancy.manager_id == occupant.id) %}
                  {%- if is_main_occupant %}
              Hauptmieter/in
                  {%- endif %}
                {%- endwith %}
              {%- endwith -%}
        </td>
            {%- else %}
        <td colspan="3">{{ 'frei'|dim }}</td>
            {%- endif %}
      </tr>
          {%- endfor %}
        {%- endwith %}
        {%- if bungalow.occupancy.internal_remark %}
        <tr>
          <td colspan="3">
            {%- if bungalow.occupancy and bungalow.occupancy.pinned %}
            {{ render_icon('pin') }} <em>Wechsel blockiert</em><br>
            {%- endif -%}
            <strong>Anmerkung:</strong> {{ bungalow.occupancy.internal_remark }}
          </td>
        </tr>
        {%- endif %}
      </tbody>
      {%- endfor %}
    </table>
    {%- else %}
    <div class="dimmed-box centered">Es sind keine Bungalows belegt.</div>
    {%- endif %}

  </div>
      {%- endwith %}
      {%- if bungalow.occupancy.internal_remark %}
      <tr>
        <td colspan="3">
          {%- if bungalow.occupancy and bungalow.occupancy.pinned %}
          {{ render_icon('pin') }} <em>Wechsel blockiert</em><br>
          {%- endif -%}
          <strong>Anmerkung:</strong> {{ bungalow.occupancy.internal_remark }}
        </td>
      </tr>
      {%- endif %}
    </tbody>
    {%- endfor %}
  </table>
  {%- else %}
  <div class="dimmed-box centered">Es sind keine Bungalows belegt.</div>
  {%- endif %}

{%- endblock %}