parcoursmob-default-theme/web/layouts/organized_carpool/overview.html

67 lines
4.1 KiB
HTML

{{ define "content" }}
{{$defaultTab := "carpoolService"}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<h1 class="text-2xl font-semibold text-gray-900">Covoiturage solidaire</h1>
<div class="bg-white shadow sm:rounded-lg sm:overflow-hidden my-4" x-data="{
tab: '{{or .ViewState.tab $defaultTab}}',
to(event) {
this.tab = event.target.value
}
}">
<div class="divide-y divide-gray-200">
<div>
<div class="hidden sm:block">
<div class="border-b border-gray-200 pl-4 flex justify-between items-center">
<nav class="-mb-px flex space-x-8" aria-label="Tabs">
<a href="#" @click="tab = 'carpoolService'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'carpoolService' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Trajets </a>
<a href="#" @click="tab = 'drivers'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'drivers' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Covoitureurs solidaires </a>
<a href="#" @click="tab = 'carpoolHistory'"
class="whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm"
:class="tab == 'carpoolHistory' ? 'border-co-blue text-co-blue' : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'">
Trajets passés </a>
</nav>
<div class="pr-4" x-show="tab == 'carpoolHistory'">
{{$exportURL := "/exports/organized-carpool/bookings.xlsx"}}
{{$hasParams := false}}
{{if .ViewState.hist_filters.date_start}}{{$exportURL = printf "%s?start_date=%s" $exportURL .ViewState.hist_filters.date_start}}{{$hasParams = true}}{{end}}
{{if .ViewState.hist_filters.date_end}}{{if $hasParams}}{{$exportURL = printf "%s&end_date=%s" $exportURL .ViewState.hist_filters.date_end}}{{else}}{{$exportURL = printf "%s?end_date=%s" $exportURL .ViewState.hist_filters.date_end}}{{$hasParams = true}}{{end}}{{end}}
{{if .ViewState.hist_filters.status}}{{if $hasParams}}{{$exportURL = printf "%s&status=%s" $exportURL .ViewState.hist_filters.status}}{{else}}{{$exportURL = printf "%s?status=%s" $exportURL .ViewState.hist_filters.status}}{{end}}{{end}}
<a href="{{$exportURL}}">
<button type="button"
class="inline-flex items-center justify-center bg-white hover:bg-gray-50 border-gray-300 border px-4 py-2 text-gray-700 flex items-center text-sm rounded-2xl focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
Exporter
</button>
</a>
</div>
</div>
</div>
</div>
<div x-show="tab == 'carpoolService'">{{template "carpool_bookings_list" .}}</div>
<div x-show="tab == 'drivers'">{{template "carpool_drivers_list" .}}</div>
<div x-show="tab == 'carpoolHistory'">{{template "carpool_bookings_history" .}}</div>
</div>
</div>
</div>
{{ end }}