59 lines
2.6 KiB
HTML
59 lines
2.6 KiB
HTML
|
{% extends 'program_base.html' %}
|
||
|
{% load leaflet_tags %}
|
||
|
|
||
|
{% block extra_head %}
|
||
|
{% leaflet_js %}
|
||
|
{% leaflet_css %}
|
||
|
{% endblock extra_head %}
|
||
|
|
||
|
{% block title %}
|
||
|
Facilities of type {{ facilitytype }} | {{ block.super }}
|
||
|
{% endblock %}
|
||
|
|
||
|
{% block content %}
|
||
|
<div class="panel panel-default">
|
||
|
<div class="panel-heading">
|
||
|
<h3 class="panel-title">Facilities of type {{ facilitytype }}</h3>
|
||
|
</div>
|
||
|
<div class="panel-body">
|
||
|
<div class="list-group">
|
||
|
{% for facility in facility_list %}
|
||
|
{% if request.user.is_authenticated %}
|
||
|
<a href="{% url 'facilities:facility_detail' camp_slug=camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid %}" class="list-group-item">
|
||
|
{% else %}
|
||
|
<div class="list-group-item">
|
||
|
{% endif %}
|
||
|
<h4 class="list-group-item-heading">
|
||
|
<i class="{{ facility.facility_type.icon }} fa-2x fa-pull-left fa-fw"></i> {{ facility.name }}
|
||
|
</h4>
|
||
|
<p class="list-group-item-text">{{ facility.description }}</p>
|
||
|
{% if request.user.is_authenticated %}
|
||
|
</a>
|
||
|
{% else %}
|
||
|
</div>
|
||
|
{% endif %}
|
||
|
{% endfor %}
|
||
|
</div>
|
||
|
<p>{% leaflet_map "facility_list" %}</p>
|
||
|
<a href="{% url "facilities:facility_type_list" camp_slug=camp.slug %}" class="btn btn-primary"><i class="fas fa-list"></i> Back to facility type list</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
// add a listener to add the marker for each facility on the leaflet map after it inits
|
||
|
window.addEventListener("map:init", function (e) {
|
||
|
var detail = e.detail;
|
||
|
{% for facility in facility_list %}
|
||
|
{% url "facilities:facility_detail" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as detail %}
|
||
|
{% url "facilities:facility_feedback" camp_slug=facility.camp.slug facility_type_slug=facility.facility_type.slug facility_uuid=facility.uuid as feedback %}
|
||
|
marker = L.marker([{{ facility.location.y }}, {{ facility.location.x }}]);
|
||
|
marker.addTo(detail.map);
|
||
|
marker.bindPopup("<b>{{ facility.name }}</b><br><p>{{ facility.description }}</p><p>Responsible team: {{ facility.facility_type.responsible_team.name }} Team</p>{% if request.user.is_authenticated %}<p><a href='{{ detail }}' class='btn btn-primary' style='color: white;'><i class='fas fa-search'></i> Details</a><a href='{{ feedback }}' class='btn btn-primary' style='color: white;'><i class='fas fa-comment-dots'></i> Feedback</a></p>{% endif %}");
|
||
|
{% endfor %}
|
||
|
detail.map.setView([{{ facility_list.0.location.y }}, {{ facility_list.0.location.x }}], 15);
|
||
|
}, false);
|
||
|
</script>
|
||
|
|
||
|
{% endblock %}
|
||
|
|