{{$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}}{{$hasParams = true}}{{end}}{{end}}
{{if .ViewState.hist_filters.departure_geo}}{{if $hasParams}}{{$exportURL = printf "%s&departure_geo=%s" $exportURL .ViewState.hist_filters.departure_geo}}{{else}}{{$exportURL = printf "%s?departure_geo=%s" $exportURL .ViewState.hist_filters.departure_geo}}{{$hasParams = true}}{{end}}{{end}}
{{if .ViewState.hist_filters.destination_geo}}{{if $hasParams}}{{$exportURL = printf "%s&destination_geo=%s" $exportURL .ViewState.hist_filters.destination_geo}}{{else}}{{$exportURL = printf "%s?destination_geo=%s" $exportURL .ViewState.hist_filters.destination_geo}}{{$hasParams = true}}{{end}}{{end}}
{{if .ViewState.hist_filters.passenger_address_geo}}{{if $hasParams}}{{$exportURL = printf "%s&passenger_address_geo=%s" $exportURL .ViewState.hist_filters.passenger_address_geo}}{{else}}{{$exportURL = printf "%s?passenger_address_geo=%s" $exportURL .ViewState.hist_filters.passenger_address_geo}}{{$hasParams = true}}{{end}}{{end}}
{{template "carpool_bookings_list" .}}
{{template "carpool_drivers_list" .}}
{{template "carpool_bookings_history" .}}