{% extends "views/report-templates/default.htm" %}
{% load i18n %}

{% block report %}
    {% block report_title_bar %}
    <!-- Custom Template Report Title Bar -->
    <div class="relative">

        <!-- Title Block -->
        <div class="afs-report-toolbar">
            <h1 class="afs-report-toolbar-title"><span class="afs-report-name">{% trans "Project:" %}</span><span data-bind="text: displayname" class="afs-report-instance-name"></span></h1>
        </div>

    </div>
    {% endblock report_title_bar %}

    
    {% block body %}
    <!-- Link nav -->
    <div class="afs-report-anchor-container">
        <ol class="afs-report-anchors breadcrumb">
            <!-- ko foreach: {data: sections, as: 'section'} -->
            <li data-bind="click: function(){$parent.activeSection(section.id)}, css: {active: $parent.activeSection() === section.id}, text: section.title" class="afs-report-a"></li>
            <!-- /ko -->
        </ol>
    </div>
    <div class="afs-tabbed-report">
        <div class="afs-tabbed-report-content">
            <!-- Names Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'name'">
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/name',
                    params: {
                        data: resource,
                        cards: nameCards,
                        dataConfig: nameDataConfig
                    }
                }"></div>
            </div>
            <!-- Description Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'description'">
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/description',
                    params: {
                        data: resource,
                        cards: descriptionCards,
                    }
                }"></div>
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/default',
                    params: {
                        data: parameterData,
                    }
                }"></div>
            </div>
            <!-- Documentation Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'documentation'">
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/documentation',
                    params: {
                        data: resource,
                        cards: documentationCards,
                        dataConfig: documentationDataConfig
                    }
                }"></div>
            </div>
            <!-- Parent Project Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'parthood'">
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/default',
                    params: {
                        data: parthoodData,
                    }
                }"></div>
            </div>
            <!-- Component Project Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'components'">
                <div class="afs-report-section">
                    <h2 class="afs-report-section-title"><i data-bind="click: function() {toggleVisibility(visible.childProjects)}, css: {'fa-angle-double-right': visible.childProjects(), 'fa-angle-double-up': !visible.childProjects()}, attr: {'aria-label': '{% trans "Expand/Collapse" %}'}" class="fa toggle"></i> {% trans "Child Projects" %}</h2>
                    <!-- Collapsible content -->
                    <div data-bind="visible: visible.childProjects" class="afs-report-collapsible-container pad-lft">

                        <!-- ko ifnot: collectionOfChildProjects().length -->
                        <div class="afs-nodata-note">{% trans "No child projects for this project" %}</div>
                        <!-- /ko -->
                        
                        <!-- ko if: collectionOfChildProjects().length -->
                        <div class="afs-report-subsection" >
                            <div>
                                <div class="afs-table pad-btm">
                                    <table class="table table-striped" cellspacing="0" width="100%">
                                        <thead>
                                            <tr class="afs-table-header">
                                                <th>{% trans "Project" %}</th>
                                                <th class="min-tabletl">{% trans "Description" %}</th>
                                                <th class="afs-table-control all"></th>
                                            </tr>
                                        </thead>
                                        <tbody data-bind="dataTablesForEach: { data: collectionOfChildProjects, dataTableOptions: getTableConfig(3) }">
                                            <tr>
                                                <td data-bind="text: displayname"></td>
                                                <td data-bind="text: displaydescription" class="display-description"></td>
                                                <td class="afs-table-control">
                                                    <div data-bind="if: link">
                                                        <a data-bind="attr: { href: link }">
                                                            <i class="fa fa-link" aria-label="{% trans 'Link' %}"></i>
                                                        </a>
                                                    </div>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <!-- /ko -->
                    </div>
                </div>
            </div>
            <!-- Project Timeline Tab -->
            <div class="afs-report-page" data-bind="if: activeSection() === 'substance'">
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/substance',
                    params: {
                        data: resource,
                        cards: substanceCards,
                        dataConfig: substanceDataConfig
                    }
                }"></div>
                <div data-bind="component: {
                    name: 'views/components/reports/scenes/default',
                    params: {
                        data: temporalData,
                    }
                }"></div>
            </div>
            <!-- JSON Tab -->
            <div class="afs-report-page afs-flex-col" data-bind="if: activeSection() === 'json'">
                <div class="afs-flex-col" data-bind="component: {
                    name: 'views/components/reports/scenes/json',
                    params: {
                        resourceInstanceId: reportMetadata().resourceinstanceid,
                    }
                }"></div>
            </div>
        </div>
    </div>            
    {% endblock body %}
{% endblock report %}


{% block summary %}

<div class="afs-summary-report-header">
    <h1 class="afs-summary-report-title"><span data-bind="text: displayname" class="afs-report-instance-name"></span><span class="afs-report-name pad-lft-sm">{% trans "(Project)" %}</span></h1>
</div>
<div class="model-summary-report">
    <div class="afs-report-page">

        <!-- Names -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Name of Project" %}</h2>
            <div class="afs-report-subsection">
                <!-- ko ifnot: nameSummary() && nameSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no names for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: nameSummary() && nameSummary().length -->
                <div class="afs-table pad-btm">
                    <table class="table table-striped" cellspacing="0" width="100%">
                        <thead>
                            <tr class="afs-table-header">
                                <th>{% trans "Name" %}</th>
                                <th>{% trans "Name Type" %}</th>
                            </tr>
                        </thead>
                        <tbody data-bind="dataTablesForEach: { data: nameSummary, dataTableOptions: getTableConfig(2) }">
                            <tr>
                                <td data-bind="text: content"></td>
                                <td data-bind="text: type"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Dates -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Dates of Project" %}</h2>
            <div class="afs-report-subsection">
                <!-- ko ifnot: datesSummary() && datesSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no dates for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: datesSummary() && datesSummary().length -->
                <div class="afs-table pad-btm">
                    <table class="table table-striped" cellspacing="0" width="100%">
                        <thead>
                            <tr lass="afs-table-header">
                                <th>{% trans "Beginning of the beginning" %}</th>
                                <th>{% trans "End of the beginning" %}</th>
                                <th>{% trans "Beginning of the end" %}</th>
                                <th>{% trans "End of the end" %}</th>
                            </tr>
                        </thead>
                        <tbody data-bind="dataTablesForEach: { data: datesSummary, dataTableOptions: getTableConfig(4) }">
                            <tr>
                                <td data-bind="text: beginning_of_beginning"></td>
                                <td data-bind="text: end_of_beginning"></td>
                                <td data-bind="text: beginning_of_end"></td>
                                <td data-bind="text: end_of_end"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Activity Type -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Activity Type of Project" %}</h2>
            <div class="afs-report-subsection">
                <!-- ko ifnot: activityTypeSummary() && activityTypeSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no activity types for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: activityTypeSummary() && activityTypeSummary().length -->
                <div class="afs-report-data-block" data-bind="foreach: activityTypeSummary ">
                    <div class="afs-block-value" data-bind="text: content"></div>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Parent Project -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Parent Project" %}</h2>
            <div class="afs-report-subsection">
                <!-- ko ifnot: parentProjectSummary() && parentProjectSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There is not a parent project for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: parentProjectSummary() && parentProjectSummary().length -->
                <div class="afs-report-data-block" data-bind="foreach: parentProjectSummary ">
                    <div class="afs-block-value"><a data-bind="click: function() {window.open(link);}, text: content" href="javascript:void(0)"></a></div>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Project Team -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Project Team" %}</h2>
            <div class="afs-report-subsection">
                <!-- ko ifnot: teamSummary() && teamSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no team members for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: teamSummary() && teamSummary().length -->
                <div class="afs-report-data-block" data-bind="foreach: teamSummary ">
                    <div class="afs-block-value"><a data-bind="click: function() {window.open(link);}, text: content" href="javascript:void(0)"></a><!-- ko if: $index() < $parent.teamSummary().length - 1  -->, <!-- /ko --></div>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Statements -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Statements about Project" %}</h2>
            <div class="afs-report-subsection" >
                <!-- ko ifnot: statementsSummary() && statementsSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no statements for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: statementsSummary() && statementsSummary().length -->
                <div class="afs-table pad-btm">
                    <table class="table table-striped" cellspacing="0" width="100%">
                        <thead>
                            <tr class="afs-table-header">
                                <th>{% trans "Statements" %}</th>
                                <th>{% trans "Type" %}</th>
                            </tr>
                        </thead>
                        <tbody data-bind="dataTablesForEach: { data: statementsSummary, dataTableOptions: getTableConfig(2) }">
                            <tr>
                                <td id="project-search-statement-content" data-bind="text: content"></td>
                                <td data-bind="text: type"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- /ko -->
            </div>
        </div>
        <!-- Identifier -->
        <div class="afs-report-section">
            <h2 class="afs-report-section-title">{% trans "Identifier for Project" %}</h2>
            <div class="afs-report-subsection" >
                <!-- ko ifnot: identifierSummary() && identifierSummary().length -->
                <h3 class="afs-report-nodata-message">{% trans "There are no identifiers for this resource" %}</h3>
                <!-- /ko -->

                <!-- ko if: identifierSummary() && identifierSummary().length -->
                <div class="afs-table">
                    <table class="table table-striped" cellspacing="0" width="100%">
                        <thead>
                            <tr class="afs-table-header">
                                <th>{% trans "Identifier" %}</th>
                                <th>{% trans "Type" %}</th>
                            </tr>
                        </thead>
                        <tbody data-bind="dataTablesForEach: { data: identifierSummary, dataTableOptions: getTableConfig(2) }">
                            <tr>
                                <td data-bind="text: content"></td>
                                <td data-bind="text: type"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <!-- /ko -->
            </div>
        </div>
    </div>
</div>

{% endblock summary %}
