{{ define "content" }}
<main class="py-10">
    <div class="max-w-3xl mx-auto px-4 sm:px-6 md:flex md:items-center md:justify-between md:space-x-5 lg:max-w-7xl lg:px-8">
        <div class="flex items-center space-x-5">
            <div>
                <h1 class="text-2xl font-bold text-gray-900">{{.ViewState.diag.Name}}</h1>
            </div>
            {{$diag := .ViewState.diag.ID}}
        </div>
        <div
        class="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
            {{if eq .ViewState.diag.Deleted false}}
            <a href="/app/diags/{{$diag}}/update" class="inline-flex"><button type="button"
                class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Modifier</button></a>
            <a href="/app/diags/{{$diag}}/delete" class="inline-flex"><button type="button"
                class="w-full px-4 py-2 border border-transparent text-sm font-medium rounded-2xl shadow-sm text-white bg-co-red hover:bg-co-red focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-co-blue">Retirer</button></a>
            {{end}}
        </div>
    </div>
    <div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 sm:px-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
        <div class="space-y-6 lg:col-start-1 lg:col-span-2">
            <section aria-labelledby="diag-information-title">
                <div class="bg-white shadow sm:rounded-lg">
                    <div class="px-4 py-5 sm:px-6">
                        <h2 id="diag" class="text-lg leading-6 font-medium text-gray-900">Informations</h2>
                        <p class="mt-1 max-w-2xl text-sm text-gray-500">Informations sur le diagnostic.</p>
                    </div>
                    <div class="border-t border-gray-200 px-4 py-5 sm:px-6">
                        <dl class="grid grid-cols-1 gap-x-4 gap-y-8 sm:grid-cols-2">
                            <div class="sm:col-span-1">
                                <dt class="text-sm font-medium text-gray-500">Date du diagnostic</dt>
                                <dd class="mt-1 text-sm text-gray-900">{{(timeFrom .ViewState.diag.Diagdate).Format "02/01/2006"}}</dd>
                            </div>
                            {{if eq .ViewState.diag.Namespace "parcoursmob_beneficiaries"}}
                            <div class="sm:col-span-1">
                                <dt class="text-sm font-medium text-gray-500">Type</dt>
                                <dd class="mt-1 text-sm text-gray-900">Diagnostic personnelle</dd>
                            </div>
                            {{end}}
                            {{if eq .ViewState.diag.Namespace "parcoursmob_vehicles"}}
                            <div class="sm:col-span-1">
                                <dt class="text-sm font-medium text-gray-500">Type</dt>
                                <dd class="mt-1 text-sm text-gray-900">Diagnostic automobile</dd>
                            </div>
                            {{end}}
                            {{if eq .ViewState.diag.Namespace "parcoursmob_bookings"}}
                            <div class="sm:col-span-1">
                                <dt class="text-sm font-medium text-gray-500">Type</dt>
                                <dd class="mt-1 text-sm text-gray-900">Diagnostic véhicule réservé</dd>
                            </div>
                            {{end}}
                            <!-- {{if .ViewState.diag.Json_schema}}
                            <div class="sm:col-span-2">
                                <dt class="text-sm font-medium text-gray-500">JSON_schema</dt>
                                <dd class="mt-1 text-sm text-gray-900">{{.ViewState.diag.Json_schema}}</dd>
                            </div>
                            {{end}}
                            {{if .ViewState.diag.Ui_schema}}
                            <div class="sm:col-span-2">
                                <dt class="text-sm font-medium text-gray-500">UI_schema</dt>
                                <dd class="mt-1 text-sm text-gray-900">{{.ViewState.diag.Ui_schema}}</dd>
                            </div>
                            {{end}} -->
                        </dl>
                    </div>
                </div>
            </section>
            <div class="mt-8 max-w-3xl mx-auto grid grid-cols-1 gap-6 sm:px-6 lg:max-w-7xl lg:grid-flow-col-dense lg:grid-cols-3">
                <div class="space-y-6 lg:col-start-1 lg:col-span-2">
                    <section aria-labelledby="event-documents">
                        <div class="bg-white mt-4 px-4 py-5 shadow sm:rounded-lg sm:px-6">
                            <h2 id="documents-title" class="text-lg font-medium text-gray-900">Documents</h2>
                            <div class="flex justify-between items-center">
                                <div>{{template "diags_files" .}}</div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
{{ end }}