<commit_before>{% extends "base.html" %}
{%  load devicetags %}
{% load i18n %}

{% block title %}{{device.name}}{% endblock %}

{% block header %}
{% trans "Device" %}: {{device.name}}
{% endblock %}

{% block pullright %}
{% if device.archived == None %}
{% if perms.devices.delete_device %}<a  href="#" id="deletebutton" data-toggle="popover" class="btn btn-danger pull-right btn-sm" style="margin-left:10px"><i class="fa fa-trash-o" style="margin-right:7px"></i>{% trans "Delete" %}</a>{% endif %}
{% if perms.devices.change_device %}<a   href="#" id="archivebutton" data-toggle="popover" class="btn btn-danger pull-right btn-sm" style="margin-left:10px"><i class="fa fa-folder" style="margin-right:7px"></i>{% trans "Archive" %}</a>{% endif %}
{% if perms.devices.create_device %}<a href="{% url 'device-add-copy' device.id %}" class="btn btn-default pull-right btn-sm" style="margin-left:10px"><i class="fa fa-copy" style="margin-right:7px"></i>{% trans "Create Copy" %}</a>{% endif %}
{% if perms.devices.change_device %}<a href="{% url 'device-edit' device.id %}" class="btn btn-primary pull-right btn-sm" style="margin-left:10px"><i class="fa fa-pencil" style="margin-right:7px"></i>{% trans "Edit" %}</a>{% endif %}
{% if perms.devices.change_device or perms.devices.lend_device %}<a href="#" class="btn btn-primary pull-right btn-sm" style="margin-left:10px" data-target="#mailModal" data-toggle="modal"><i class="fa fa-envelope" style="margin-right:7px"></i>{% trans "Send Mail" %}</a>{% endif %}
{% if perms.devices.lend_device %}
  {% if device.currentlending != None %}
    <a href="#"  id="returnbutton" data-toggle="popover" class="btn btn-success pull-right btn-sm"style="margin-left:10px"><i class="fa fa-check" style="margin-right:7px"></i>{% trans "returned" %}</a>
  {% else %}
    <a  href="#" data-target="#lendModal" data-toggle="modal" class="btn btn-success pull-right btn-sm"style="margin-left:10px"><i class="fa fa-check" style="margin-right:7px"></i>{% trans "Lend" %}</a>
  {% endif %}
{% endif %}
{% else %}
{% if perms.devices.change_device %}
  <a  href="#" id="archivebutton" data-toggle="popover" class="btn btn-success pull-right btn-sm" style="margin-left:10px"><i class="fa fa-folder-open" style="margin-right:7px"></i>{% trans "Unarchive" %}</a>{% endif %}
{% endif %}
{% endblock %}

{% block content %}
<div class="row">
  <div class="col-xs-12 col-md-4">
    <table class="table table-bordered table-striped">
      <tbody>
        <tr><td>{% trans "Inventorynumber" %}</td><td>{{device.inventorynumber}}</td></tr>
        <tr><td>{% trans "Serialnumber" %}</td><td>{{device.serialnumber}}</td></tr>
        <tr><td>{% trans "MAC-Address" %}</td><td>{{device.macaddress}}</td></tr>
        <tr><td>{% trans "Devicetype" %}</td><td>{{device.devicetype}}</td></tr>
        <tr><td>{% trans "Manufacturer" %}</td><td>{{device.manufacturer}}</td></tr>
        <tr><td>{% trans "Room" %}</td><td>{{device.room}}</td></tr>
  {% for attributevalue in attributevalue_list %}
        <tr><td>{{attributevalue.typeattribute.name}}</td><td>{{attributevalue}}</td></tr>
{% endfor %}
        <tr><td>{% trans "Devicegroup" %}</td><td>{{device.group|default:"-"}}</td></tr>
        <tr><td>{% trans "Created by" %}</td><td><a href="{% url 'userprofile' device.creator.pk %}">{{ device.creator }}</a></td></tr>
        <tr><td>{% trans "Last edited" %}</td><td>{% if lastedit != None %}<a href="{% url 'device-history' device.pk lastedit.revision.pk %}">{{lastedit.revision.date_created}}</a> by {{lastedit.revision.user}}{% else %}{% trans "Not edited yet" %}{% endif %}</td></tr>
      </tbody>
    </table>

{% if device.webinterface != "" %}<a href="{{device.webinterface}}" target="_blank">{% trans "Go to webinterface" %}</a>{% endif %}

{% if device.description %}
<h4>{% trans "Description" %}</h4>
{{device.description|linebreaks}}
{% endif %}
  </div>
<div class="col-xs-12 col-md-5">
<h4>{% trans "Current Lending information" %}</h4>
    {% if device.currentlending != None %}
      <table class="table table-bordered table-striped">
      <tbody>
        <tr><td>{% trans "Lendt to" %}</td><td>{{device.currentlending.owner}}</td></tr>
        <tr><td>{% trans "Since" %}</td><td>{{device.currentlending.lenddate}}</td></tr>
        <tr><td>{% trans "Due to" %}</td><td>{{device.currentlending.duedate}}
{% if device.currentlending.duedate < weekago %}<span class="error-icon"><i class="fa fa-exclamation-circle"></i></span>
{% elif device.currentlending.duedate < today %}<span class="warning-icon"><i class="fa fa-exclamation-circle"></i></span>
{% endif %}
<tr><td>{% trans "Overdue notification" %}</td><td>{{device.currentlending.duedate_email|default_if_none:"Not sent"}}</td></tr>
</td></tr>
      </tbody>
    </table>
    {% else %}
    <p>{% trans "Currently not lent" %}</p>
    {% endif %}
</div>
  <div class="col-xs-12 col-md-3">
<div class="panel panel-primary">
  <!-- Default panel contents -->
  <div class="panel-heading">{% trans "IP-Addresses" %}</div>
  <ul class="list-group">
    {% for address in ipaddress_list %}
        <li class="list-group-item ipaddress-list">{{address.address}} <a href="{% url 'device-ipaddress-remove' device.pk address.pk %}" class="close delete right"><i class="fa fa-times"></i></a></li>
      {% endfor %}
  </ul>
  
          {% if device.archived == None and perms.devices.change_device %}
  <div class="panel-footer">
      <form method="post" action="{% url 'device-ipaddress' device.pk %}" style="margin:0px;">{% csrf_token %}
        {{ipaddressform.ipaddresses}}
        <div class="row" style="margin-top:10px; margin-left:0px; margin-right:0px;">
        <button type="submit" class ="btn btn-success btn-sm pull-right disabled" id="submitipaddress"><i class="fa fa-plus"></i> {% trans "Assign Addresses" %}</button>
    </div>
    <input type="hidden" name="device" value="{{ device.pk }}" />
      </form>
  </div>
    {% endif %}
</div>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
<ul class="nav nav-tabs" style="margin-top:20px">
  {% if perms.devices.change_device %}<li class="active"><a href="#notes" data-toggle="tab">{% trans "Notes" %}</a></li>{% endif %}
  {% if perms.devices.lend_device %}<li><a href="#lending" data-toggle="tab">{% trans "Lending history" %}</a></li>{% endif %}
  {% if perms.devices.change_device %}<li><a href="#edit" data-toggle="tab">{% trans "Edit history" %}</a></li>{% endif %}
  {% if perms.devices.lend_device %}<li><a href="#mail" data-toggle="tab">{% trans "Mail history" %}</a></li>{% endif %}
</ul>

<div class="tab-content">
{% if perms.devices.lend_device %}
  <div class="tab-pane active" id="notes">
<ul class="list-unstyled" style="padding-top:20px;">
  {% for note in device.notes.all %}
    <li>
        <div class="row">
            <div class="col-xs-2 col-md-1">
                {% if note.creator.avatar %}
                <img src="{{note.creator.avatar.url}}" class="img-rounded img-responsive" alt="" />
                {% endif %}
                <p style="padding-top:5px">{{note.creator}}</p>
            </div>
            <div class="col-xs-10 col-md-11">
                <div class="comment-text">
                    {{note.note|linebreaks}}
                </div>
                <div class="action">
                    <button type="button" class="btn btn-primary btn-xs" title="Edit">
                        <i class="fa fa-edit"></i>
                    </button>
                    <button type="button" class="btn btn-danger btn-xs" title="Delete">
                        <i class="fa fa-trash-o"></i>
                    </button>
                </div>
            </div>
        </div>
    </li>
{% endfor %}
</ul>

<form action='{% url "device-note-create" device.pk %}' method='post' class='form-horizontal col-md-6'>
  <textarea class="form-control" name="note" id="id_note"></textarea>
  <input type="hidden" name="device" value="{{ device.pk }}" />
  <input type="hidden" name="creator" value="{{ user.pk }}" />
  <button type="submit" class="btn btn-success btn-sm pull-right" style="margin-top:10px">
                        <i class="fa fa-pencil"></i> {% trans "Add note" %}
                    </button>
  </div>
{% endif %}
  {% if perms.devices.lend_device %}
  <div class="tab-pane" id="lending">
<h4>{% trans "10 last lendings" %}</h4>
    <table class="table table-bordered table-striped">
  <thead>
    <tr>
      <th>{% trans "User" %}</th>
      <th>{% trans "Since" %}</th>
      <th>{% trans "Duedate" %}</th>
      <th>{% trans "Returned" %}</th>
    </tr>
  </thead>
  <tbody>
    {% for lending in lending_list %}
    <tr>
      <td><a href="{% url 'userprofile' lending.owner.pk %}">{{lending.owner}}</a></td>
      <td>{{lending.lenddate}}</td>
      <td>{{lending.duedate|default_if_none:"never"}}</td>
      <td>{{lending.returndate|default_if_none:"not returned"}}</td>
    </tr>
     {% endfor %}
  </tbody>
</table><commit_msg>additional styling for notes<commit_after>{% extends "base.html" %}
{%  load devicetags %}
{% load i18n %}

{% block title %}{{device.name}}{% endblock %}

{% block header %}
{% trans "Device" %}: {{device.name}}
{% endblock %}

{% block pullright %}
{% if device.archived == None %}
{% if perms.devices.delete_device %}<a  href="#" id="deletebutton" data-toggle="popover" class="btn btn-danger pull-right btn-sm" style="margin-left:10px"><i class="fa fa-trash-o" style="margin-right:7px"></i>{% trans "Delete" %}</a>{% endif %}
{% if perms.devices.change_device %}<a   href="#" id="archivebutton" data-toggle="popover" class="btn btn-danger pull-right btn-sm" style="margin-left:10px"><i class="fa fa-folder" style="margin-right:7px"></i>{% trans "Archive" %}</a>{% endif %}
{% if perms.devices.create_device %}<a href="{% url 'device-add-copy' device.id %}" class="btn btn-default pull-right btn-sm" style="margin-left:10px"><i class="fa fa-copy" style="margin-right:7px"></i>{% trans "Create Copy" %}</a>{% endif %}
{% if perms.devices.change_device %}<a href="{% url 'device-edit' device.id %}" class="btn btn-primary pull-right btn-sm" style="margin-left:10px"><i class="fa fa-pencil" style="margin-right:7px"></i>{% trans "Edit" %}</a>{% endif %}
{% if perms.devices.change_device or perms.devices.lend_device %}<a href="#" class="btn btn-primary pull-right btn-sm" style="margin-left:10px" data-target="#mailModal" data-toggle="modal"><i class="fa fa-envelope" style="margin-right:7px"></i>{% trans "Send Mail" %}</a>{% endif %}
{% if perms.devices.lend_device %}
  {% if device.currentlending != None %}
    <a href="#"  id="returnbutton" data-toggle="popover" class="btn btn-success pull-right btn-sm"style="margin-left:10px"><i class="fa fa-check" style="margin-right:7px"></i>{% trans "returned" %}</a>
  {% else %}
    <a  href="#" data-target="#lendModal" data-toggle="modal" class="btn btn-success pull-right btn-sm"style="margin-left:10px"><i class="fa fa-check" style="margin-right:7px"></i>{% trans "Lend" %}</a>
  {% endif %}
{% endif %}
{% else %}
{% if perms.devices.change_device %}
  <a  href="#" id="archivebutton" data-toggle="popover" class="btn btn-success pull-right btn-sm" style="margin-left:10px"><i class="fa fa-folder-open" style="margin-right:7px"></i>{% trans "Unarchive" %}</a>{% endif %}
{% endif %}
{% endblock %}

{% block content %}
<div class="row">
  <div class="col-xs-12 col-md-4">
    <table class="table table-bordered table-striped">
      <tbody>
        <tr><td>{% trans "Inventorynumber" %}</td><td>{{device.inventorynumber}}</td></tr>
        <tr><td>{% trans "Serialnumber" %}</td><td>{{device.serialnumber}}</td></tr>
        <tr><td>{% trans "MAC-Address" %}</td><td>{{device.macaddress}}</td></tr>
        <tr><td>{% trans "Devicetype" %}</td><td>{{device.devicetype}}</td></tr>
        <tr><td>{% trans "Manufacturer" %}</td><td>{{device.manufacturer}}</td></tr>
        <tr><td>{% trans "Room" %}</td><td>{{device.room}}</td></tr>
  {% for attributevalue in attributevalue_list %}
        <tr><td>{{attributevalue.typeattribute.name}}</td><td>{{attributevalue}}</td></tr>
{% endfor %}
        <tr><td>{% trans "Devicegroup" %}</td><td>{{device.group|default:"-"}}</td></tr>
        <tr><td>{% trans "Created by" %}</td><td><a href="{% url 'userprofile' device.creator.pk %}">{{ device.creator }}</a></td></tr>
        <tr><td>{% trans "Last edited" %}</td><td>{% if lastedit != None %}<a href="{% url 'device-history' device.pk lastedit.revision.pk %}">{{lastedit.revision.date_created}}</a> by {{lastedit.revision.user}}{% else %}{% trans "Not edited yet" %}{% endif %}</td></tr>
      </tbody>
    </table>

{% if device.webinterface != "" %}<a href="{{device.webinterface}}" target="_blank">{% trans "Go to webinterface" %}</a>{% endif %}

{% if device.description %}
<h4>{% trans "Description" %}</h4>
{{device.description|linebreaks}}
{% endif %}
  </div>
<div class="col-xs-12 col-md-5">
<h4>{% trans "Current Lending information" %}</h4>
    {% if device.currentlending != None %}
      <table class="table table-bordered table-striped">
      <tbody>
        <tr><td>{% trans "Lendt to" %}</td><td>{{device.currentlending.owner}}</td></tr>
        <tr><td>{% trans "Since" %}</td><td>{{device.currentlending.lenddate}}</td></tr>
        <tr><td>{% trans "Due to" %}</td><td>{{device.currentlending.duedate}}
{% if device.currentlending.duedate < weekago %}<span class="error-icon"><i class="fa fa-exclamation-circle"></i></span>
{% elif device.currentlending.duedate < today %}<span class="warning-icon"><i class="fa fa-exclamation-circle"></i></span>
{% endif %}
<tr><td>{% trans "Overdue notification" %}</td><td>{{device.currentlending.duedate_email|default_if_none:"Not sent"}}</td></tr>
</td></tr>
      </tbody>
    </table>
    {% else %}
    <p>{% trans "Currently not lent" %}</p>
    {% endif %}
</div>
  <div class="col-xs-12 col-md-3">
<div class="panel panel-primary">
  <!-- Default panel contents -->
  <div class="panel-heading">{% trans "IP-Addresses" %}</div>
  <ul class="list-group">
    {% for address in ipaddress_list %}
        <li class="list-group-item ipaddress-list">{{address.address}} <a href="{% url 'device-ipaddress-remove' device.pk address.pk %}" class="close delete right"><i class="fa fa-times"></i></a></li>
      {% endfor %}
  </ul>
  
          {% if device.archived == None and perms.devices.change_device %}
  <div class="panel-footer">
      <form method="post" action="{% url 'device-ipaddress' device.pk %}" style="margin:0px;">{% csrf_token %}
        {{ipaddressform.ipaddresses}}
        <div class="row" style="margin-top:10px; margin-left:0px; margin-right:0px;">
        <button type="submit" class ="btn btn-success btn-sm pull-right disabled" id="submitipaddress"><i class="fa fa-plus"></i> {% trans "Assign Addresses" %}</button>
    </div>
    <input type="hidden" name="device" value="{{ device.pk }}" />
      </form>
  </div>
    {% endif %}
</div>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
<ul class="nav nav-tabs" style="margin-top:20px">
  {% if perms.devices.change_device %}<li class="active"><a href="#notes" data-toggle="tab">{% trans "Notes" %}</a></li>{% endif %}
  {% if perms.devices.lend_device %}<li><a href="#lending" data-toggle="tab">{% trans "Lending history" %}</a></li>{% endif %}
  {% if perms.devices.change_device %}<li><a href="#edit" data-toggle="tab">{% trans "Edit history" %}</a></li>{% endif %}
  {% if perms.devices.lend_device %}<li><a href="#mail" data-toggle="tab">{% trans "Mail history" %}</a></li>{% endif %}
</ul>

<div class="tab-content">
{% if perms.devices.lend_device %}
  <div class="tab-pane active" id="notes">
<ul class="list-unstyled" style="padding-top:20px;">
  {% for note in device.notes.all %}
    <li style="border-bottom:1px #dbdfe0 solid;padding-top:15px;padding-bottom:15px">
        <div class="row">
            <div class="col-xs-2 col-md-1">
                {% if note.creator.avatar %}
                <img src="{{note.creator.avatar.url}}" class="img-rounded img-responsive" alt="" />
                {% endif %}
                <p style="padding-top:5px;margin-bottom:0px">{{note.creator}}</p>
            </div>
            <div class="col-xs-10 col-md-11">
                <div class="comment-text">
                    {{note.note|linebreaks}}
                </div>
                <div class="action">
                    <button type="button" class="btn btn-primary btn-xs" title="Edit">
                        <i class="fa fa-edit"></i>
                    </button>
                    <button type="button" class="btn btn-danger btn-xs" title="Delete">
                        <i class="fa fa-trash-o"></i>
                    </button>
                </div>
            </div>
        </div>
    </li>
{% endfor %}
</ul>

<form action='{% url "device-note-create" device.pk %}' method='post' class='form-horizontal col-md-6 col-md-offset-1' style="padding-left:0px">
  <textarea class="form-control" name="note" id="id_note"></textarea>
  <input type="hidden" name="device" value="{{ device.pk }}" />
  <input type="hidden" name="creator" value="{{ user.pk }}" />
  <button type="submit" class="btn btn-success btn-sm pull-right" style="margin-top:10px">
                        <i class="fa fa-pencil"></i> {% trans "Add note" %}
                    </button>
  </div>
{% endif %}
  {% if perms.devices.lend_device %}
  <div class="tab-pane" id="lending">
<h4>{% trans "10 last lendings" %}</h4>
    <table class="table table-bordered table-striped">
  <thead>
    <tr>
      <th>{% trans "User" %}</th>
      <th>{% trans "Since" %}</th>
      <th>{% trans "Duedate" %}</th>
      <th>{% trans "Returned" %}</th>
    </tr>
  </thead>
  <tbody>
    {% for lending in lending_list %}
    <tr>
      <td><a href="{% url 'userprofile' lending.owner.pk %}">{{lending.owner}}</a></td>
      <td>{{lending.lenddate}}</td>
      <td>{{lending.duedate|default_if_none:"never"}}</td>
      <td>{{lending.returndate|default_if_none:"not returned"}}</td>
    </tr>
     {% endfor %}
  </tbody>
</table>
{'fraction_non_alphanumeric': 0.23310268474951565, 'fraction_numerical': 0.007583725435925824, 'mean_word_length': 3.61455938697318, 'pattern_counts': {'":': 0, '<': 535, '<?xml version=': 0, '>': 531, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6184951', 'n_tokens_mistral': 6626, 'n_tokens_neox': 6097, 'n_words': 1277}