github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/bv/src/pages/espace_perso/components/retours/RowSondage.vue (about)

     1  <template>
     2    <b-card class="my-1">
     3      <b-card-sub-title class="mt-1 mb-3">
     4        <b-row>
     5          <b-col>{{ subtitle }}</b-col>
     6          <b-col cols="3" class="text-right">
     7            <b-icon-info
     8              v-b-tooltip.html
     9              title="de 1 étoile (Décevant) à 4 étoiles (Très satisfaisant) <br/> 0 indique une réponse ignorée"
    10            ></b-icon-info>
    11          </b-col>
    12        </b-row>
    13      </b-card-sub-title>
    14      <b-card-text>
    15        <b-form-row>
    16          <b-col sm="6" md="4">
    17            <field-satisfaction
    18              v-model.number="innerSondage.infos_avant_sejour"
    19              label="Informations avant le séjour"
    20            >
    21            </field-satisfaction>
    22          </b-col>
    23          <b-col sm="6" md="4">
    24            <field-satisfaction
    25              v-model.number="innerSondage.infos_pendant_sejour"
    26              label="Informations pendant le séjour"
    27            >
    28            </field-satisfaction>
    29          </b-col>
    30          <b-col sm="6" md="4">
    31            <field-satisfaction
    32              v-model.number="innerSondage.hebergement"
    33              label="L'hébergement"
    34            >
    35            </field-satisfaction>
    36          </b-col>
    37        </b-form-row>
    38        <b-form-row>
    39          <b-col sm="6" md="4">
    40            <field-satisfaction
    41              v-model.number="innerSondage.activites"
    42              label="Les activités"
    43            >
    44            </field-satisfaction>
    45          </b-col>
    46          <b-col sm="6" md="4">
    47            <field-satisfaction
    48              v-model.number="innerSondage.theme"
    49              label="Le thème"
    50            >
    51            </field-satisfaction>
    52          </b-col>
    53          <b-col sm="6" md="4">
    54            <field-satisfaction
    55              v-model.number="innerSondage.nourriture"
    56              label="La nourriture"
    57            >
    58            </field-satisfaction>
    59          </b-col>
    60        </b-form-row>
    61        <b-form-row>
    62          <b-col sm="6" md="4">
    63            <field-satisfaction
    64              v-model.number="innerSondage.hygiene"
    65              label="L'hygiène corporelle et vestimentaire"
    66            >
    67            </field-satisfaction>
    68          </b-col>
    69          <b-col sm="6" md="4">
    70            <field-satisfaction
    71              v-model.number="innerSondage.ambiance"
    72              label="L'ambiance du groupe"
    73            >
    74            </field-satisfaction>
    75          </b-col>
    76          <b-col sm="6" md="4">
    77            <field-satisfaction
    78              v-model.number="innerSondage.ressenti"
    79              label="Le ressenti global de votre enfant"
    80            >
    81            </field-satisfaction>
    82          </b-col>
    83        </b-form-row>
    84        <b-form-group
    85          label="Message du participant"
    86          description="Si votre enfant souhaite donner son avis sur le séjour qu'il a vécu, la parole lui est donnée ci-dessus. Des regrets ? De bons souvenirs ? Des propositions d'amélioration ?"
    87        >
    88          <b-form-textarea
    89            v-model="innerSondage.message_enfant"
    90            rows="3"
    91            max-rows="10"
    92            placeholder="Exprimez-vous ici..."
    93          ></b-form-textarea>
    94        </b-form-group>
    95        <b-form-group
    96          label="Message du responsable"
    97          description="En tant que parents, vous avez une remarque, une suggestion, un ressenti à partager, avec plaisir ! N'hésitez pas à aborder tous les domaines : encadrement, activités, hébergement, repas, linge, etc. Nous prendrons soin à vous apporter une réponse en cas de besoin."
    98        >
    99          <b-form-textarea
   100            v-model="innerSondage.message_responsable"
   101            rows="3"
   102            max-rows="10"
   103            placeholder="Exprimez-vous ici..."
   104          ></b-form-textarea>
   105        </b-form-group>
   106  
   107        <b-row>
   108          <b-col class="text-right">
   109            <btn
   110              label="Enregistrer mon retour"
   111              variant="accent"
   112              @click="saveMessage"
   113            ></btn>
   114          </b-col>
   115        </b-row>
   116      </b-card-text>
   117    </b-card>
   118  </template>
   119  
   120  <script lang="ts">
   121  import Vue from "vue";
   122  import Component from "vue-class-component";
   123  import {
   124    CampPlus,
   125    PublicSondage,
   126    ContenuSondage,
   127    SatisfactionLabels,
   128    RepSondage
   129  } from "@/shared/logic/types";
   130  import Btn from "@/shared/Btn.vue";
   131  import { Watch } from "vue-property-decorator";
   132  import { C } from "../../logic/controller";
   133  import { ValidEvent } from "@/shared/utils";
   134  import { enumToOptions, nullTimeString } from "@/shared/logic/utils";
   135  import { nullRepSondage } from "../../logic/types";
   136  import FieldSatisfaction from "@/shared/fields/FieldSatisfaction.vue";
   137  
   138  const RowSondageProps = Vue.extend({
   139    props: {
   140      camp: Object as () => CampPlus,
   141      sondage: Object as () => PublicSondage | null
   142    }
   143  });
   144  
   145  @Component({
   146    components: { Btn, FieldSatisfaction }
   147  })
   148  export default class RowSondage extends RowSondageProps {
   149    innerSondage: RepSondage = this.duplique();
   150  
   151    satisfactions = enumToOptions(SatisfactionLabels);
   152    @Watch("sondage")
   153    s() {
   154      this.innerSondage = this.duplique();
   155    }
   156  
   157    private duplique() {
   158      return this.sondage !== null
   159        ? JSON.parse(JSON.stringify(this.sondage))
   160        : nullRepSondage();
   161    }
   162  
   163    get subtitle() {
   164      return "VOS IMPRESSIONS SUR LE SÉJOUR " + this.camp.label;
   165    }
   166  
   167    async saveMessage(event: ValidEvent) {
   168      event.spinning = true;
   169      const sondage = {
   170        id_crypted: this.sondage ? this.sondage.id_crypted : "",
   171        id_camp: this.camp.id,
   172        modified: nullTimeString,
   173        ...this.innerSondage
   174      };
   175      await C.data.saveSondage(sondage);
   176      event.spinning = false;
   177    }
   178  }
   179  </script>
   180  
   181  <style scoped></style>