{% extends "p4l/p4l_base.html" %}
{% load static %}
{% load i18n %}
{% load p4lstringfilters %}

{% block page_title %}{% trans 'Record' %} {{ record.identifier }} - {% trans 'View' %}{% endblock %}

{% block content %}
<table class="table record-table">
  <thead>
    <tr><td>{% trans 'property' %}</td><td>{% trans 'value' %}</td></tr>
  </thead>
  <tbody>
    <tr>
      <td>URI</td>
      <td>{{ record.uri|default:'' }}</td>
    </tr>
    <tr>
      <td>{% trans 'subjects' %}</td>
      <td><ul>{% for k,v in subjects_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'themes' %}</td>
      <td><ul>{% for k,v in themes_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'countries' %}</td>
      <td><ul>{% for k,v in countries_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'identifier' %}</td>
      <td>{{ record.identifier }}</td>
    </tr>
    <tr>
      <td>{% trans 'notes' %}</td>
      <td>{{ record.notes|default:'' }}</td>
    </tr>
    <tr>
      <td>{% trans 'issns' %}</td>
      <td><ul>{% for i in record.issns.all %}<li>{{ i.issn|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'isbns' %}</td>
      <td><ul>{% for i in record.isbns.all %}<li>{{ i.isbn|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'document code' %}</td>
      <td><ul>{% for i in record.documentCodes.all %}<li>{{ i.documentCode|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'language' %}</td>
      <td>{% if record.language %}{{ language_label }} <small class="text-muted">({{ record.language.uri|default:'' }})</small>{% endif %}</td>
    </tr>
    <tr>
      <td>{% trans 'other languages' %}</td>
      <td><ul>{% for k,v in otherLanguages_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'titles' %}</td>
      <td><ul>{% for i in record.titles.all %}<li>{{ i.title|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'abstracts' %}</td>
      <td><ul>{% for i in record.abstracts.all %}<li>{{ i.abstract|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'added titles' %}</td>
      <td><ul>{% for i in record.addedTitles.all %}<li>{{ i.title|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'titles main document' %}</td>
      <td><ul>{% for i in record.titlesMainDocument.all %}<li>{{ i.title|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'edition statement' %}</td>
      <td>{{ record.editionStatement|default:'' }}</td>
    </tr>
    <tr>
      <td>{% trans 'imprints' %}</td>
      <td>
        <ul>
          {% for i in record.imprints.all %}
          <li>
            <ul class="list-unstyled">
              <li>{% trans 'City' %} : {{ i.imprintCity|default:'' }}</li>
              <li>{% trans 'Publisher' %} : {{ i.publisher|default:'' }}</li>
              <li>{% trans 'Date' %} : {{ i.imprintDate|default:'' }}</li>
              <li>{% trans 'Language' %} : {{ i.lang|default:'' }}</li>
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'collations' %}</td>
      <td><ul>{% for i in record.collations.all %}<li>{{ i.collation|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'volume issues' %}</td>
      <td>
        <ul>
          {% for i in record.volumeIssues.all %}
          <li>
            <ul class="list-unstyled">
              <li>{% trans 'Volume' %} : {{ i.volume|default:'' }}</li>
              <li>{% trans 'Number' %} : {{ i.number|default:'' }}</li>
              <li>{% trans 'Language' %} : {{ i.lang|default:'' }}</li>
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'project names' %}</td>
      <td><ul>{% for k,v in projects_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'periodicals' %}</td>
      <td><ul>{% for i in record.periodicals.all %}<li>{{ i.label|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'meetings' %}</td>
      <td>
        <ul>
          {% for i in record.meetings.all %}
          <li>
            <ul class="list-unstyled">
              <li>{{ i.label|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>
              <li>{% trans 'Number' %} : {{ i.meetingNumber|default:'' }}</li>
              <li>{% trans 'Place' %} : {{ i.meetingPlace|default:'' }}</li>
              <li>{% trans 'Date' %} : {{ i.meetingDate|default:'' }}</li>
              <li>{% trans 'Year' %} : {{ i.meetingYear|default:'' }}</li>
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'series' %}</td>
      <td>
        <ul>
          {% for i in record.series.all %}
          <li>
            <ul class="list-unstyled">
              <li>{{ i.title|default:'' }}{% if i.lang %} <small class="text-muted">({{ i.lang }})</small>{% endif %}</li>
              {% if i.volume %}<li>{% trans 'Volume' %} : {{ i.volume|default:'' }}</li>{% endif %}
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'authors' %}</td>
      <td><ul>{% for i in record.authors.all %}<li>{{ i.name|default:'' }}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'subject persons' %}</td>
      <td><ul>{% for i in record.subjectPersons.all %}<li>{{ i.name|default:'' }}</li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'subject corporate bodies' %}</td>
      <td><ul>{% for k,v in subjectCorporateBodies_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'subject meetings' %}</td>
      <td>
        <ul>
          {% for i in record.subjectMeetings.all %}
          <li>
            <ul class="list-unstyled">
              <li>{{ i.label|default:'' }}</li>
              <li>{% trans 'Number' %} : {{ i.meetingNumber|default:'' }}</li>
              <li>{% trans 'Place' %} : {{ i.meetingPlace|default:'' }}</li>
              <li>{% trans 'Date' %} : {{ i.meetingDate|default:'' }}</li>
              <li>{% trans 'Year' %} : {{ i.meetingYear|default:'' }}</li>
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'corporate authors' %}</td>
      <td><ul>{% for k,v in corporateAuthors_labels.items %}<li>{{ v }} <small class="text-muted">({{ k }})</small></li>{% endfor %}</ul></td>
    </tr>
    <tr>
      <td>{% trans 'Urls' %}</td>
      <td>
        <ul>
          {% for i in record.urls.all %}
          <li>
            <ul class="list-unstyled">
              <li>{% trans 'Address' %} : {{ i.address|default:'' }}</li>
              <li>{% trans 'Display' %} : {{ i.display|default:'' }}</li>
              <li>{% trans 'Access level' %} : {{ i.accessLevel|default:'' }}</li>
            </ul>
          </li>
          {% endfor %}
        </ul>
      </td>
    </tr>
    <tr>
      <td>{% trans 'record type' %}</td>
      <td>{{ recordType_label }} <small class="text-muted">({{ record.recordType|default:'' }})</small></td>
    </tr>
    <tr>
      <td>{% trans 'is document part' %}</td>
      <td><input type="checkbox" disabled="disabled" {% if record.isDocumentPart %}checked="checked"{% endif %} /></td>
    </tr>
    <tr>
      <td>{% trans 'is multilingual' %}</td>
      <td><input type="checkbox" disabled="disabled" {% if record.isMultilingual %}checked="checked"{% endif %} /></td>
    </tr>
  </tbody>
  <!--
    uri = models.URLField(max_length=2048, unique=True, db_index=True) #subject
    subjects = models.ManyToManyField('p4l.Subject') #dct:subject                                                       # Thesaurus with no country
    themes = models.ManyToManyField('p4l.Theme') #iiep:theme                                                            # Theme
    countries = models.ManyToManyField('p4l.Country') #iiep:country                                                     # Thesaurus filtered with country only
    identifier = models.CharField(max_length=128, unique=True, db_index=True) #dct:identifier    
    notes = models.TextField(blank=True, null=True) #iiep:notes    
    #issns foreign key from Isbn #iiep:issn
    #isbns foreign key from Isbn #iiep:isbn
    #documentCodes foreign key from Isbn #iiep:documentCode
    language = models.ForeignKey('p4l.Language', blank=True, null=True) #dct:language                                    # Language
    otherLanguages = models.ManyToManyField('p4l.Language', related_name='otherLanguage_record') #iiep:otherLanguage     # Language
    #titles foreign Key from Title #dct:title
    #addedTitles foreign Key from AddedTitle #iiep:addedTitle
    #titlesMainDocument foreign Key from TitleMainDocument #iiep:titleMainDocument
    editionStatement = models.CharField(max_length=1024, blank=True, null=True) #iiep:editionStatement
    #imprints foreign Key from Imprint #iiep:imprint
    #collations = foreign Key from Collation #iiep:collation
    #volumeIssues = foreign Key from VolumeIssue #iiep:volumeIssue
    projectNames = models.ManyToManyField('p4l.ProjectName') #iiep:projectName
    periodicals = models.ManyToManyField('p4l.Periodical', through='p4l.RecordPeriodical') #iiep:periodical
    meetings = models.ManyToManyField('p4l.Meeting', through='p4l.RecordMeeting') #iiep:meeting
    series = models.ManyToManyField('p4l.Serie', through='p4l.RecordSerie')  #iiep:serie
    authors = models.ManyToManyField('p4l.Author') #iiep:author
    subjectPersons = models.ManyToManyField('p4l.SubjectPerson') #iiep:subjectPerson
    subjectCorporateBodies = models.ManyToManyField('p4l.CorporateBody') #iiep:subjectCorporateBody                       # Organisation ?
    subjectMeetings = models.ManyToManyField('p4l.SubjectMeeting') #iiep:subjectMeeting
    corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor') #iiep:corporateAuthor                                # Organisation ?
    #urls foreign Key from Url #iiep:url
    recordType = models.URLField(max_length=2048) #dct:type
    isDocumentPart = models.BooleanField() #iiep:isDocumentPart
   -->
</table>
<div class="row">
    <div class="col-md-12 text-right">
      <a href="?uri={{ record.uri }}&lang=fr" alt="FR" /><img src="{% static 'p4l/img/blank.gif' %}" class="flag flag-fr" alt="FR" /></a>&nbsp;
      <a href="?uri={{ record.uri }}&lang=en" alt="EN" /><img src="{% static 'p4l/img/blank.gif' %}" class="flag flag-gb" alt="EN" /></a>&nbsp;
      <a href="?uri={{ record.uri }}&lang=es" alt="ES" /><img src="{% static 'p4l/img/blank.gif' %}" class="flag flag-es" alt="ES" /></a>
</div>
{% endblock %}