{% extends 'training_template.html' %}
{% load staticfiles %}
{% load lesson_extras %}

{% block training_content %}
    <div class="row">
        <div class="col-md-12">
            <p>This is the list of all SDCs that BSAC currently offer, expand an item to find out more and to register
                your
                interest. Once you've completed an SDC, and passed the assessment if applicable, a little tick will show
                next to the title.</p>
        </div>

        <div class="col-md-8">
            {% if sdcs %}
                {% for cat in categories %}
                    <h4>{{ cat.cat_name }}</h4>

                    <table class="table table-sm table-striped sdc-table sdc-table__courses">
                        <tr>
                            <th>Title</th>
                        </tr>
                        {% for sdc in cat.sdcs %}
                            <tr data-toggle="collapse" data-target="#sdc-info-{{ sdc.id }}">
                                <td>
                                    <div class="sdc-expand">
                                        <i class="sdc-interested fa fa-star sdc-register-interest sdc-register-interest-true-{{ sdc.id }}"
                                           title="You have indicated an interest in doing this SDC"
                                           {% if not profile|has_sdc_interest:sdc %}style="display:none"{% endif %}></i>
                                        {% if not profile|has_sdc:sdc %}
                                            <i data-toggle="collapse" data-target="#sdc-info-{{ sdc.id }}"
                                               class="fa fa-info-circle"></i>{% endif %}
                                    </div>

                                    <div class="sdc-title">
                                        {% if is_training %}
                                            {{ sdc.interested_members.count }}
                                        {% endif %}
                                        {% if profile|has_sdc:sdc %}
                                            <i class="sdc-has fa fa-check fa-fw"
                                               title="You have completed this SDC"></i>
                                        {% else %}
                                            {% if sdc.other_requirements and profile|cando_sdc:sdc %}
                                                <i class="sdc-other-requirements fa fa-adjust fa-fw"
                                                   title="This SDC has custom requirements"></i>
                                            {% elif not sdc.other_requirements and profile|cando_sdc:sdc %}
                                                <i class="sdc-cando fa fa-circle fa-fw" title="You can do this SDC"></i>
                                            {% else %}
                                                <i class="sdc-cantdo fa fa-circle-o fa-fw"
                                                   title="You currently do not have the BSAC qualification to undertake this SDC"></i>
                                            {% endif %}
                                        {% endif %}{{ sdc.title }}</div>

                                    <div id="sdc-info-{{ sdc.id }}" class="sdc-info collapse out">

                                        {# <button class="btn btn-mini alignright sdc-register-interest sdc-register-interest-false-{{sdc.pk}}" data-sdc-id={{sdc.pk}} type="button" {% if profile|has_sdc_interest:sdc %}style="display:none"{% endif %}>#}
                                        {#      <i class="fa fa-hand-right"></i> I'm Interested In Doing This</button> #}

                                        {{ sdc.description|linebreaks }}

                                        <div class="sdc-register-interest-true sdc-register-interest-true-{{ sdc.id }}"
                                             {% if not profile|has_sdc_interest:sdc %}style="display:none"{% endif %}>
                                            {# <button class="btn btn-danger btn-mini alignright sdc-cancel-interest" data-sdc-id={{sdc.pk}} type="button"><i class="fa fa-hand-right fa fa-white"></i> I'm No Longer Interested</button> #}
                                            <p>You have noted that you're interested in taking this course</p>
                                        </div>
                                        {% if is_training %}
                                            <h4>Interested Members</h4>
                                            <ul>
                                                {% for member in sdc.interested_members.all %}
                                                    <li>{{ member.get_full_name }}</li>
                                                {% endfor %}
                                            </ul>
                                        {% endif %}

                                    </div>


                                </td>
                            </tr>
                        {% endfor %}
                    </table>

                {% endfor %}
            {% else %}
                <p>You currently have not completed any SDCs.</p>
            {% endif %}
        </div>

        <div class="col-md-4 sdc-table sdc-table__key">
            <table class="table">
                <tr>
                    <td><i class="sdc-has fa fa-check fa-fw" title="You have completed this SDC"></i></td>
                    <td>SDC Attained</td>
                </tr>

                <tr>
                    <td><i class="sdc-cando fa fa-circle fa-fw" title="You can do this SDC"></i></td>
                    <td>You could do this SDC</td>
                </tr>
                <tr>
                    <td><i class="sdc-cantdo fa fa-circle-o fa-fw"
                           title="You currently do not have the BSAC qualification to undertake this SDC"></i></td>
                    <td>Your qualification is too low to do this SDC</td>
                </tr>
                <tr>
                    <td><i class="sdc-other-requirements fa fa-adjust fa-fw" title="This SDC has custom requirements">
                    </td>
                    <td>This SDC has complex requirements</td>
                </tr>
            </table>
        </div>
    </div>
{% endblock %}
