cmtracker/templates/internal/cases/addresses/list-case-addresses.html.twig

144 lines
5.5 KiB
Twig
Raw Normal View History

{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
<div class="container-fluid py-2">
<div class="row">
<div class="col-12">
<div class="card my-4">
<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
<div class="d-flex justify-content-between bg-gradient-dark shadow-dark border-radius-lg pt-4 pb-3 ps-3 p-2">
<div>
<h6 class="text-white text-capitalize ps-3">Case Address List</h6>
</div>
<div>
<button type='button' class='btn bg-gradient-info btn-block mb-3' id='itinerary-report' onclick="window.open('{{ path('app_report_itinerary') }}', '_self')">Itinerary Report</button>
<button type='button' class='btn bg-gradient-success btn-block mb-3' id='create-itinerary'>Create Itinerary</button>
<button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('{{ path('app_case_add_address') }}', '_self')">Add Address</button>
</div>
</div>
</div>
<div class="card-body px-0 pb-2">
<div class=''>
Filters:
<select id='case-filter'>
<option value=''>-- Select --</option>
{% for c in cases %}
<option value='{{ c.id }}'>{{ c.caseName }}</option>
{% endfor %}
</select>
</div>
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
<thead>
<tr>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Name</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7 ps-2">Address</th>
<th class='text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Lat/Lon</th>
<th class="text-secondary opacity-7"></th>
</tr>
</thead>
<tbody id='addressList'>
{% for l in addresses %}
<tr>
<td>
<div class='d-flex px-2 py-1'>
<div class='d-flex flex-column justify-content-center'>
<h6 class='mb-0 text-small'>
{{ l.name }}
</h6>
</div>
</div>
</td>
<td title=''>
{{ l.getFormattedAddress()|raw }}
</td>
<td class='align-middle text-center text-xs'>
{{ l.lat }}/{{ l.lon }}
</td>
<td class='align-middle'>
<a href='{{ path('app_case_edit_address', {id: l.id}) }}' title='Edit Location'>
<i class="material-symbols-rounded opacity-5">edit</i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class='modal fade' id='exampleModalMessage' tabindex='-1' role='dialog' aria-labelledby='exampleModalMessageTitle'>
<div class='modal-dialog modal-dialog-centered' role='document'>
<div class='modal-content'>
<div class="modal-header">
<h6 class="modal-title font-weight-normal" id="exampleModalLabel">Add Itinerary</h6>
<button type="button" class="btn-close text-dark" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class='modal-body'>
<form>
<div class='input-group input-group-outline my-3'>
<input type='date' id='date' class='form-control'/>
</div>
<div class='input-group input-group-outline my-3'>
<select name="origin" id='origin' class='form-control'>
<option value=''>-- Origin --</option>
</select>
</div>
<div class='input-group input-group-outline my-3'>
<input type='time' name='departure' id='departure'/>
</div>
<div class='input-group input-group-outline my-3'>
<select name='destination' id='destination' class='form-control'>
<option value=''>-- Destination --</option>
</select>
</div>
<div class='input-group input-group-outline my-3'>
<input type='time' name='arrival' id='arrival'/>
</div>
<div class='input-group input-group-outline my-3'>
<input type='checkbox' name='case-mileage' id='case-mileage' value='1'/>
<label for='case-mileage' style='padding:5px;'>Case Mileage</label>
</div>
</form>
</div>
<div class='modal-footer'>
<button type='button' id='close-modal' class='btn bg-gradient-secondary' data-bs-dismiss='modal'>Close</button>
<button type='button' id='add-location-to-itinerary' class='btn bg-gradient-primary'>Add Location</button>
</div>
</div>
</div>
</div>
</main>
{% endblock %}
{% block page_js %}
<script type='module'>
import $ from "{{ asset('vendor/jquery/jquery.index.js') }}";
import * as notify from "{{ asset('vendor/notify.js/notify.js.index.js') }}";
import {filterAddressesByCase} from '{{ asset("js/app/filter.js") }}';
import {createItinerary, addLocationToItinerary} from '{{ asset("js/app/itinerary.js") }}';
window.$ = $;
$(function () {
document.getElementById('case-filter').addEventListener('change', filterAddressesByCase);
document.getElementById('create-itinerary').addEventListener('click', createItinerary);
document.getElementById('add-location-to-itinerary').addEventListener('click', addLocationToItinerary);
});
</script>
{% endblock %}