{#-
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
-#}
{% set hide_left_bar = True %}
{% set current_menu_item = '/auth/user_info' %}
{% extends "allura:templates/user_account_base.html" %}

{% block title %}{{c.user.username}} / Availability{% endblock %}

{% block header %}Availability timeslots of {{c.user.username}} {% endblock %}

{% block content %}
  {{ super() }}
  <div class="grid-20">
    <h2>Availability</h2>
    <div class="grid-18">
        Please, set your time intervals choosing a weekday and entering the
        time interval according to the timezone specified in your personal
        data, using the format HH:MM. If you didn't set any timezone, your
        timeslots could be meaningless to other users, therefore they will
        be ignored.
    </div>
    <div class="grid-18">
        You can also specify periods of time during which you won't be able
        to work on the forge, in orther to communicate other users that they
        can't contact you during those days. Please, do it specifying date
        intervals in format DD/MM/YYYY.
    </div>
  </div>
  <div class="grid-20">
    {%if c.user.get_availability_timeslots() %}
      <h3>Existing availability timeslots</h3>
      <table>
        <tr>
          <thead>
            <th>Weekday</th>
            <th>Start time</th>
            <th>End time</th>
            <th>Actions</th>
          </thead>
        </tr>
        {% for ts in c.user.get_availability_timeslots() %}
          {{g.theme.remove_timeslot_form.display(
                action="remove_timeslot",
                weekday=ts.week_day,
                starttime=ts.start_time,
                endtime=ts.end_time)}}
        {%endfor%}
      </table>
    {% endif %}
    <h3>Add a new availability timeslot</h3>
    {{g.theme.add_timeslot_form.display(action="add_timeslot")}}
  </div>

  <div class="grid-20">
    {%if c.user.get_inactive_periods() %}
      <h3>Existing periods of inactivity on the forge</h3>
      <table>
        <tr>
          <thead>
            <th>Start date</th>
            <th>End date</th>
            <th>Actions</th>
          </thead>
        </tr>
        {% for ip in c.user.get_inactive_periods() %}
          {{g.theme.remove_inactive_period_form.display(
                action="remove_inactive_period",
                startdate=ip.start_date,
                enddate=ip.end_date)}}
        {%endfor%}
      </table>
    {% endif %}
    <h3>Add a new period of inactivity on the forge</h3>
    {{g.theme.add_inactive_period_form.display(action="add_inactive_period")}}
  </div>
{% endblock %}
