add report page and move map button to it

This commit is contained in:
Ryan Prather 2025-01-01 06:03:17 +00:00
parent 781935821b
commit 109384ec99
2 changed files with 94 additions and 8 deletions

View File

@ -16,11 +16,7 @@
<h6 class="text-white text-capitalize ps-3">Case Address List</h6>
</div>
<div>
<form action='{{ path('app_map_itinerary') }}' method='post' id='map-form' style='display:inline;'>
<input type='hidden' name='caseId' id='caseId'/>
<input type='hidden' name='caseDate' id='caseDate'/>
<button type='button' class='btn bg-gradient-info btn-block mb-3' id='map-itinerary'>Map Itinerary</button>
</form>
<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>
@ -36,7 +32,6 @@
<option value='{{ c.id }}'>{{ c.caseName }}</option>
{% endfor %}
</select>
<input type='date' id='date-filter'/>
</div>
<div class="table-responsive p-0">
<table class="table align-items-center mb-0">
@ -136,14 +131,13 @@
import * as notify from "{{ asset('vendor/notify.js/notify.js.index.js') }}";
import {filterAddressesByCase} from '{{ asset("js/app/filter.js") }}';
import {createItinerary, addLocationToItinerary, openMap} from '{{ asset("js/app/itinerary.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);
document.getElementById('map-itinerary').addEventListener('click', openMap);
});
</script>
{% endblock %}

View File

@ -0,0 +1,92 @@
{% 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">Travel Report</h6>
</div>
<div>
<form action='{{ path('app_map_itinerary') }}' method='post' id='map-form' style='display:inline;'>
<input type='hidden' name='caseId' id='caseId'/>
<input type='hidden' name='caseStartDate' id='startDate'/>
<input type='hidden' name='caseEndDate' id='endDate'/>
<button type='button' class='btn bg-gradient-info btn-block mb-3' id='map-itinerary'>Map Itinerary</button>
</form>
</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>
<input type='date' id='start-date-filter'/>
<input type='date' id='end-date-filter'/>
</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">Date</th>
<th class='text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Case</th>
<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Origin</th>
<th class='text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Destination</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Duration</th>
<th class='test-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Distance</th>
<th class="text-secondary opacity-7"></th>
</tr>
</thead>
<tbody id='itineraryList'>
{% for i in itineraries %}
<tr>
<td>{{ i.date|date('F j, Y') }}</td>
<td>{{ i.memberCase.caseName }}</td>
<td>{{ i.originLocation.name }}</td>
<td>{{ i.destLocation.name }}</td>
<td>{{ i.duration|date("%h:%i'%s''") }}</td>
<td>{{ i.distance }}</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
{% endblock %}
{% block page_js %}
<script type='module'>
import $ from "{{ asset('vendor/jquery/jquery.index.js') }}";
import {filterItineraryByCase} from '{{ asset("js/app/filter.js") }}';
import {openMap} from '{{ asset("js/app/itinerary.js") }}';
window.$ = $;
$(function () {
document.getElementById('case-filter').addEventListener('change', filterItineraryByCase);
document.getElementById('start-date-filter').addEventListener('change', filterItineraryByCase);
document.getElementById('end-date-filter').addEventListener('change', filterItineraryByCase);
document.getElementById('map-itinerary').addEventListener('click', openMap);
});
</script>
{% endblock %}