Edit beneficiary-diags and create-diag template on beneficiaries
This commit is contained in:
		
							parent
							
								
									bc948e0141
								
							
						
					
					
						commit
						395160db6e
					
				| 
						 | 
				
			
			@ -4,23 +4,23 @@
 | 
			
		|||
<div class="bg-white shadow sm:rounded-lg">
 | 
			
		||||
    <div class="px-4 py-5 sm:px-6">
 | 
			
		||||
        <h2 id="timeline-title" class="text-lg font-medium text-gray-900">Dignostiques réalisées</h2>
 | 
			
		||||
        <a href="{{.ViewState.beneficiary.ID}}/create-diag">
 | 
			
		||||
            <button type="button"
 | 
			
		||||
            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-ci-blue focus:ring-offset-2 sm:w-auto">
 | 
			
		||||
            {{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
 | 
			
		||||
            Créer un dignostque
 | 
			
		||||
            </button>
 | 
			
		||||
        </a>
 | 
			
		||||
    </div>
 | 
			
		||||
    <a href="{{.ViewState.beneficiary.ID}}/create-diag">
 | 
			
		||||
        <button type="button"
 | 
			
		||||
        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-ci-blue focus:ring-offset-2 sm:w-auto">
 | 
			
		||||
        {{$.IconSet.Icon "hero:outline/plus-circle" "h-5 w-5 mr-3"}}
 | 
			
		||||
        Créer un dignostque
 | 
			
		||||
        </button>
 | 
			
		||||
    </a>
 | 
			
		||||
    <div class="border-t border-gray-200">
 | 
			
		||||
        {{ $diagCount := len .ViewState.diag }}
 | 
			
		||||
        {{ $diagCount := len .ViewState.diags }}
 | 
			
		||||
        <ul role="list" class="divide-y divide-gray-200 flex-1">
 | 
			
		||||
            {{if eq $diagCount 0}}
 | 
			
		||||
                <li class="py-2 px-4">
 | 
			
		||||
                    <p class="py-5 mt-1 max-w-2xl text-sm text-gray-500">Aucun diagnostique effectué pour le moment.</p>
 | 
			
		||||
                </li>
 | 
			
		||||
            {{else}}
 | 
			
		||||
                {{range .ViewState.diag}}
 | 
			
		||||
                {{range .ViewState.diags}}
 | 
			
		||||
                {{if eq .Deleted false}}
 | 
			
		||||
                    <li class="py-5 px-4 flex">
 | 
			
		||||
                            <div class="flex-1 ml-3">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,29 +8,22 @@
 | 
			
		|||
    x-data="{
 | 
			
		||||
        fields: {
 | 
			
		||||
            name: null,
 | 
			
		||||
            last_name: null,
 | 
			
		||||
            email: null,
 | 
			
		||||
            phone_number: null,
 | 
			
		||||
            birthdate: null,
 | 
			
		||||
            file_number: null
 | 
			
		||||
            namespace: 'parcoursmob_beneficiaries',
 | 
			
		||||
            json_schema: null,
 | 
			
		||||
            ui_schema: null,
 | 
			
		||||
        },
 | 
			
		||||
        rules: {
 | 
			
		||||
            first_name: ['required'],
 | 
			
		||||
            last_name: ['required'],
 | 
			
		||||
            email: ['required', 'email'],
 | 
			
		||||
            phone_number: ['required', 'regexMatch:^((\\+)33|0)[1-9](\\d{2}){4}$'],
 | 
			
		||||
            birthdate: ['required'],
 | 
			
		||||
            file_number: ['required'],
 | 
			
		||||
            name: ['required']
 | 
			
		||||
            namespace: ['required']
 | 
			
		||||
            json_schema: ['required']
 | 
			
		||||
            ui_schema: ['required']
 | 
			
		||||
        },
 | 
			
		||||
        formValidation: {
 | 
			
		||||
            valid: false,
 | 
			
		||||
            fields: {
 | 
			
		||||
                first_name: {valid: null},
 | 
			
		||||
                last_name: {valid: null},
 | 
			
		||||
                email: {valid: null},
 | 
			
		||||
                phone_number: {valid: null},
 | 
			
		||||
                birthdate: {valid: null},
 | 
			
		||||
                file_number: {valid: null},
 | 
			
		||||
                name: {valid: null},
 | 
			
		||||
                json_schema: {valid: null},
 | 
			
		||||
                ui_schema: {valid: null},
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        isFormValid: true,
 | 
			
		||||
| 
						 | 
				
			
			@ -54,129 +47,69 @@
 | 
			
		|||
            <div class="md:grid md:grid-cols-3 md:gap-6">
 | 
			
		||||
                <div class="md:col-span-1">
 | 
			
		||||
                    <h3 class="text-lg font-medium leading-6 text-gray-900">Informations obligatoires</h3>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Informations personnelles sur le bénéficiaire obligatoires
 | 
			
		||||
                        pour créer son profil dans PARCOURSMOB</p>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Informations obligatoires
 | 
			
		||||
                        pour créer un diagnostique dans PARCOURSMOB</p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="mt-5 md:mt-0 md:col-span-2">
 | 
			
		||||
                    <div class="grid grid-cols-6 gap-6">
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="first_name" class="block text-sm font-medium text-gray-700">Prénom</label>
 | 
			
		||||
                            <input type="text" name="first_name" id="first_name" autocomplete="given-name"
 | 
			
		||||
                            <label for="name" class="block text-sm font-medium text-gray-700">Nom</label>
 | 
			
		||||
                            <input type="text" name="name" id="name" autocomplete="given-name"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl"
 | 
			
		||||
                                x-model="fields.first_name" @blur="validateField('first_name')"
 | 
			
		||||
                                :class="formValidation.fields.first_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="last_name" class="block text-sm font-medium text-gray-700">Nom</label>
 | 
			
		||||
                            <input type="text" name="last_name" id="last_name" autocomplete="family-name"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
 | 
			
		||||
                                x-model="fields.last_name" @blur="validateField('last_name')"
 | 
			
		||||
                                :class="formValidation.fields.last_name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="email" class="block text-sm font-medium text-gray-700">Email</label>
 | 
			
		||||
                            <input type="text" name="email" id="email" autocomplete="email"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
 | 
			
		||||
                                x-model="fields.email" @blur="validateField('email')"
 | 
			
		||||
                                :class="formValidation.fields.email.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="phone_number" class="block text-sm font-medium text-gray-700">Numéro de
 | 
			
		||||
                                téléphone</label>
 | 
			
		||||
                            <input type="text" name="phone_number" id="phone_number" autocomplete="phone" placeholder="+33612345678"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
 | 
			
		||||
                                x-model="fields.phone_number" @blur="validateField('phone_number')"
 | 
			
		||||
                                :class="formValidation.fields.phone_number.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="birthdate" class="block text-sm font-medium text-gray-700">Date de
 | 
			
		||||
                                naissance</label>
 | 
			
		||||
                            <input type="date" name="birthdate" id="birthdate" autocomplete="birthdate" placeholder="JJ/MM/AAAA"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
 | 
			
		||||
                                x-model="fields.birthdate" @blur="validateField('birthdate')"
 | 
			
		||||
                                :class="formValidation.fields.birthdate.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="file_number" class="block text-sm font-medium text-gray-700">Numéro de dossier (CAF / Pole Emploi ...)</label>
 | 
			
		||||
                            <input type="text" name="file_number" id="file_number" placeholder=""
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm rounded-2xl"
 | 
			
		||||
                                x-model="fields.file_number" @blur="validateField('file_number')"
 | 
			
		||||
                                :class="formValidation.fields.file_number.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                                x-model="fields.name" @blur="validateField('name')"
 | 
			
		||||
                                :class="formValidation.fields.name.valid == false ? 'border-co-red border-2' : 'border-gray-300'">
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
 | 
			
		||||
        <input type="hidden" name="namespace" value="parcoursmob_beneficiaries" />
 | 
			
		||||
        <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-6">
 | 
			
		||||
            <div class="md:grid md:grid-cols-3 md:gap-6">
 | 
			
		||||
                <div class="md:col-span-1">
 | 
			
		||||
                    <h3 class="text-lg font-medium leading-6 text-gray-900">Informations optionnelles</h3>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Autres informations de profil optionnelles</p>
 | 
			
		||||
                    <h3 class="text-lg font-medium leading-6 text-gray-900">Schéma JSON</h3>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Schéma JSON pour le diagnostique</p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
 | 
			
		||||
                <div class="mt-5 md:mt-0 md:col-span-2">
 | 
			
		||||
                    <div class="grid grid-cols-6 gap-6">
 | 
			
		||||
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="gender" class="block text-sm font-medium text-gray-700">Genre</label>
 | 
			
		||||
                            <div class="sm:mt-0 sm:col-span-2">
 | 
			
		||||
                                <select id="gender" name="gender" autocomplete="gender" x-model="gender"
 | 
			
		||||
                                    class="max-w-lg mt-1 block focus:ring-co-blue focus:border-co-blue w-full shadow-sm sm:max-w-xs sm:text-sm border-gray-300 rounded-2xl">
 | 
			
		||||
                                    <option value="0">Inconnu</option>
 | 
			
		||||
                                    <option value="1">Masculin</option>
 | 
			
		||||
                                    <option value="2">Féminin</option>
 | 
			
		||||
                                    <option value="9">Sans objet</option>
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <label for="json_schema" class="block text-sm font-medium text-gray-700">Schéma JSON</label>
 | 
			
		||||
                            <textarea name="json_schema" id="json_schema" autocomplete="json_schema"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl"
 | 
			
		||||
                                x-model="fields.json_schema" @blur="validateField('json_schema')"
 | 
			
		||||
                                :class="formValidation.fields.json_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <!-- <div class="col-span-3 sm:col-span-3">
 | 
			
		||||
                            <label class="block text-sm font-medium text-gray-700"> Photo </label>
 | 
			
		||||
                            <div class="mt-1 flex items-center space-x-5">
 | 
			
		||||
                                <span class="inline-block h-12 w-12 rounded-co overflow-hidden bg-gray-100">
 | 
			
		||||
                                    {{.IconSet.Icon "img:profile-picture-placeholder" "h-full w-full"}}
 | 
			
		||||
                                </span>
 | 
			
		||||
                                <button type="button"
 | 
			
		||||
                                    class="bg-white py-2 px-3 border border-gray-300 rounded-2xl shadow-sm text-sm leading-4 font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">
 | 
			
		||||
                                    Charger la photo
 | 
			
		||||
                                </button>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div> -->
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6">
 | 
			
		||||
        <div class="bg-white shadow px-4 py-5 sm:rounded-lg sm:p-6 mt-6">
 | 
			
		||||
            <div class="md:grid md:grid-cols-3 md:gap-6">
 | 
			
		||||
                <div class="md:col-span-1">
 | 
			
		||||
                    <h3 class="text-lg font-medium leading-6 text-gray-900">Paramètres</h3>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Paramètres liés au bénéficiaire, utiles pour exploiter les fonctionnalités de PARCOURSMOB</p>
 | 
			
		||||
                    <h3 class="text-lg font-medium leading-6 text-gray-900">Schéma UI</h3>
 | 
			
		||||
                    <p class="mt-1 text-sm text-gray-500">Schéma UI pour le diagnostique</p>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="mt-5 space-y-6 md:mt-0 md:col-span-2">
 | 
			
		||||
 | 
			
		||||
                    {{ $fieldName := "address" }}
 | 
			
		||||
                    {{ template "address_autocomplete" dict "FieldName" $fieldName }}
 | 
			
		||||
 | 
			
		||||
                    <!-- will dolater : tags, groups, ... -->
 | 
			
		||||
 | 
			
		||||
                <div class="mt-5 md:mt-0 md:col-span-2">
 | 
			
		||||
                    <div class="grid grid-cols-6 gap-6">
 | 
			
		||||
                        <div class="col-span-6 sm:col-span-3">
 | 
			
		||||
                            <label for="ui_schema" class="block text-sm font-medium text-gray-700">Schéma UI</label>
 | 
			
		||||
                            <textarea name="ui_schema" id="ui_schema" autocomplete="ui_schema"
 | 
			
		||||
                                class="mt-1 focus:ring-co-blue focus:border-co-blue block w-full shadow-sm sm:text-sm  rounded-2xl"
 | 
			
		||||
                                x-model="fields.ui_schema" @blur="validateField('ui_schema')"
 | 
			
		||||
                                :class="formValidation.fields.ui_schema.valid == false ? 'border-co-red border-2' : 'border-gray-300'"></textarea>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="flex justify-end">
 | 
			
		||||
            <p x-show="! isFormValid" class="px-4 py-2 text-sm text-co-red">Certains champs de sont pas valides.</p>
 | 
			
		||||
            <a href="/app/beneficiaries/">
 | 
			
		||||
            <a href="/app/beneficiaries/{{.ViewState.beneficiary}}">
 | 
			
		||||
                <button type="button"
 | 
			
		||||
                    class="bg-white py-2 px-4 border border-gray-300 rounded-2xl shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Annuler</button>
 | 
			
		||||
            </a>
 | 
			
		||||
            <button type="submit"
 | 
			
		||||
                class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-2xl text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Créer le bénéficiaire</button>
 | 
			
		||||
                class="ml-3 inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-2xl text-white bg-co-blue hover:bg-co-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-co-blue">Créer le diagnostique</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue