
{{define "content"}}
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
    <h1 class="text-2xl font-semibold text-gray-900">Organiser le transport solidaire</h1>
    <div class="sm:flex sm:items-center">
        <div class="sm:flex-auto">
          <p class="mt-2 text-sm text-gray-700"></p>
        </div>
        <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
          <form method="POST" action="/app/solidarity-transport/drivers/{{.ViewState.driver.ID}}/journeys/{{.ViewState.driver_journey.Id}}/noreturn">
            {{if .ViewState.driver_journey.Noreturn}}
            <button type="submit"
              class="inline-flex items-center justify-center rounded-2xl border border-transparent bg-co-blue px-4 py-2 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:w-auto">
              {{$.IconSet.Icon "hero:outline/arrow-path-rounded-square" "h-5 w-5 mr-3"}}
              Changer en aller-retour
            </button>
            {{else}}
            <button type="submit"
              class="inline-flex items-center justify-center rounded-2xl border border-transparent bg-co-blue px-4 py-2 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-co-blue focus:ring-offset-2 sm:w-auto">
              {{$.IconSet.Icon "hero:outline/arrow-long-right" "h-5 w-5 mr-3"}}
              Changer en aller simple
            </button>
            {{end}}
          </form>
        </div>
      </div>
</div>
<div class="max-w-7xl mx-auto py-8 px-4 sm:px-6 md:px-8">
  {{template "journey_preview" (dict "driver_journey" .ViewState.driver_journey "driver" .ViewState.driver "passenger" .ViewState.passenger "beneficiaries" .ViewState.beneficiaries)}}
          {{if ne .ViewState.passenger.ID ""}}
<div class="max-w-7xl m-auto px-4 sm:px-6 md:px-8 flex flex-col justify-items-center">
  {{if .ViewState.passenger}}
  {{$wallet := (or .ViewState.passenger.Data.wallet 0.0)}}
  {{if lt $wallet .ViewState.driver_journey.Price.Amount}}
    <p class="text-xl text-co-red text-center p-4">Le solde du compte mobilité est insuffisant.</p>
    {{end}}
  <form method="POST">
    {{if not .ViewState.driver_journey.Noreturn}}
    <div class="m-auto text-center">
      <label for="return_waiting_time" class="block text-sm font-medium text-gray-700">Durée d'attente à destination (minutes)</label>
      <input type="number" name="return_waiting_time" value="30"
        class="p-2 mt-1 mb-4 focus:ring-co-blue focus:border-co-blue block shadow-sm sm:text-sm  rounded-2xl bg-white m-auto" />
    </div>
    {{end}}
    <div class="m-auto text-center">
      <label for="motivation" class="block text-sm font-medium text-gray-700">Motif du trajet</label>
    <select name="motivation" id="motivation"
        class="p-2 mt-1 mb-4 focus:ring-co-blue focus:border-co-blue block shadow-sm sm:text-sm  rounded-2xl bg-white m-auto">
      <option value="Administratif">Administratif (trajet garanti)</option>
      <option value="Commerce">Commerce</option>
      <option value="Courses">Courses</option>
      <option value="Insertion">Insertion (trajet garanti)</option>
      <option value="Loisirs">Loisirs</option>
      <option value="Visite à un proche">Visite à un proche</option>
      <option value="Santé">Santé (trajet garanti)</option>
      <option selected="selected" value="">Autre&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
    </select>
    </div>
    {{template "submit_with_sms" 
      dict  "IconSet" .IconSet 
            "Viewstate" .ViewState 
            "ComponentState" (dict "submitText" "Envoyer la mise en relation"
                                   "doNotSendOption" true) 
            "SMSState" (dict "name" (.ViewState.config.GetString "service_name") 
                             "datetime" (timeFormat .ViewState.driver_journey.PassengerPickupDate "02/01/2006 15:04")
                             "baseUrl" (.ViewState.config.GetString "base_url") )}}
  </form>
    {{end}}
</div>
{{end}}

{{ end }}
