Domain

Epdr Message Table

les messages d’un plan de roulement (saisie, ou lecture avec pourcentages)

Options

Composant métier : posé tel quel, avec vos données. Ce qui change d’une ligne ou d’une page à l’autre :

Un message
<tbody class="table__body" data-repeater-item> une rangée par message (saisie)
Pourcentages
<tbody class="table__body"> lecture : le champ du pourcentage et le cadenas Verrouiller
Message verrouillé
aria-pressed="true"disabled sur le cadenas et sur le champ du pourcentage ; la valeur part dans un champ caché

Saisie · Type=Edit

Un message par tbody : Titre et Durée obligatoires, deux cases (mentions sanitaires, loi Évin) avec leur bulle d’information sur le titre de colonne, deux dates facultatives, la corbeille. Le bouton « Ajouter un message » est hors du tableau, à droite du Section Label, et pointe le bloc par data-repeater-add="messages". Avec le JS, « Ajouter » recopie le modèle (<template>), « Supprimer » est désactivé quand il ne reste qu’un message ; sans JS, ce sont des boutons d’envoi.

Messages
Numéro Titre Durée Mentions sanitaires Loi Évin Pas avant Pas après Actions
Message 1
Message 2
HTML
<div class="section-label">
  <h2 class="section-label__title">Messages</h2>
  <button class="section-label__actions button button--subtle button--neutral button--sm" type="submit" name="action" value="add" formnovalidate data-repeater-add="messages">Ajouter un message</button>
</div>
<div class="card">
  <div class="card__row card__row--flush">
    <div class="table-scroll" id="messages" data-repeater>
      <table class="table table--compact epdr-message-table" data-repeater-items>
        <caption class="visually-hidden">Messages</caption>
        <thead class="table__head">
          <tr class="table__row">
            <th class="table__header epdr-message-table__number" scope="col"><span class="visually-hidden">Numéro</span></th>
            <th class="table__header table__header--required" scope="col">Titre</th>
            <th class="table__header table__header--required epdr-message-table__duration" scope="col">Durée</th>
            <th class="table__header epdr-message-table__sanitary" scope="col">Mentions sanitaires<button class="table__info" type="button" aria-label="Information sur les mentions sanitaires" aria-describedby="messages-info-sanitary" data-tooltip="messages-info-sanitary"><svg class="icon icon--xs" aria-hidden="true"><use href="/icons.svg#icon-info"></use></svg></button><span class="tooltip" id="messages-info-sanitary" role="tooltip" hidden>Le message comporte des mentions sanitaires (par exemple « Bougez plus ») : trois versions, MS1, MS2 et MS3, sont créées et diffusées à tour de rôle.</span></th>
            <th class="table__header epdr-message-table__alcohol" scope="col">Loi Évin<button class="table__info" type="button" aria-label="Information sur la loi Évin" aria-describedby="messages-info-alcohol" data-tooltip="messages-info-alcohol"><svg class="icon icon--xs" aria-hidden="true"><use href="/icons.svg#icon-info"></use></svg></button><span class="tooltip" id="messages-info-alcohol" role="tooltip" hidden>Le message concerne une boisson alcoolisée : la mention de la loi Évin y est ajoutée.</span></th>
            <th class="table__header epdr-message-table__date" scope="col">Pas avant</th>
            <th class="table__header epdr-message-table__date" scope="col">Pas après</th>
            <th class="table__header epdr-message-table__actions" scope="col"><span class="visually-hidden">Actions</span></th>
          </tr>
        </thead>
        <tbody class="table__body" data-repeater-item>
          <tr class="table__row">
            <th class="table__header" scope="row">
              <span class="marker marker--sm marker--emphasis" aria-hidden="true" data-repeater-number>1</span>
              <span class="visually-hidden">Message <span data-repeater-number>1</span></span>
            </th>
            <td class="table__cell table__cell--control">
              <div class="field field--required">
                <div class="field-control">
                  <input type="text" id="message-1-title" name="messages[1][titre]" required aria-label="Titre du message 1" value="Grand Frais, les promotions" placeholder="Nom du message">
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field field--required">
                <div class="field-control" data-select>
                  <select id="message-1-duration" name="messages[1][duree]" required aria-label="Durée du message 1">
                    <option value="">Choisir</option>
                    <option value="5">5 s</option>
                    <option value="10">10 s</option>
                    <option value="15">15 s</option>
                    <option value="20">20 s</option>
                    <option value="25">25 s</option>
                    <option value="30" selected>30 s</option>
                    <option value="35">35 s</option>
                    <option value="40">40 s</option>
                    <option value="45">45 s</option>
                    <option value="50">50 s</option>
                    <option value="55">55 s</option>
                    <option value="60">60 s</option>
                  </select>
                  <svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-chevron-down"></use></svg>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <label class="checkbox">
                <input class="checkbox__control" type="checkbox" id="message-1-sanitary" name="messages[1][mentions_sanitaires]" value="1" checked aria-label="Mentions sanitaires du message 1">
                <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
              </label>
            </td>
            <td class="table__cell table__cell--control">
              <label class="checkbox">
                <input class="checkbox__control" type="checkbox" id="message-1-alcohol" name="messages[1][loi_evin]" value="1" aria-label="Loi Évin du message 1">
                <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
              </label>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field" data-date-picker>
                <div class="field-control">
                  <input type="text" id="message-1-not-before" name="messages[1][pas_avant]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" value="09/11/2026" aria-label="Pas avant, message 1">
                  <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-1-not-before-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                  <div class="date-picker__panel" id="message-1-not-before-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field" data-date-picker>
                <div class="field-control">
                  <input type="text" id="message-1-not-after" name="messages[1][pas_apres]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-label="Pas après, message 1">
                  <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-1-not-after-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                  <div class="date-picker__panel" id="message-1-not-after-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--actions">
              <button class="repeater__button button button--ghost button--danger button--sm button--icon-only" type="submit" name="action" value="remove-1" formnovalidate data-repeater-remove aria-label="Supprimer le message 1"><svg class="icon icon--sm" aria-hidden="true"><use href="/icons.svg#icon-trash"></use></svg></button>
            </td>
          </tr>
        </tbody>
        <tbody class="table__body" data-repeater-item>
          <tr class="table__row">
            <th class="table__header" scope="row">
              <span class="marker marker--sm marker--emphasis" aria-hidden="true" data-repeater-number>2</span>
              <span class="visually-hidden">Message <span data-repeater-number>2</span></span>
            </th>
            <td class="table__cell table__cell--control">
              <div class="field field--required">
                <div class="field-control">
                  <input type="text" id="message-2-title" name="messages[2][titre]" required aria-label="Titre du message 2" value="Grand Frais, le rayon boucherie" placeholder="Nom du message">
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field field--required">
                <div class="field-control" data-select>
                  <select id="message-2-duration" name="messages[2][duree]" required aria-label="Durée du message 2">
                    <option value="">Choisir</option>
                    <option value="5">5 s</option>
                    <option value="10">10 s</option>
                    <option value="15">15 s</option>
                    <option value="20" selected>20 s</option>
                    <option value="25">25 s</option>
                    <option value="30">30 s</option>
                    <option value="35">35 s</option>
                    <option value="40">40 s</option>
                    <option value="45">45 s</option>
                    <option value="50">50 s</option>
                    <option value="55">55 s</option>
                    <option value="60">60 s</option>
                  </select>
                  <svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-chevron-down"></use></svg>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <label class="checkbox">
                <input class="checkbox__control" type="checkbox" id="message-2-sanitary" name="messages[2][mentions_sanitaires]" value="1" aria-label="Mentions sanitaires du message 2">
                <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
              </label>
            </td>
            <td class="table__cell table__cell--control">
              <label class="checkbox">
                <input class="checkbox__control" type="checkbox" id="message-2-alcohol" name="messages[2][loi_evin]" value="1" aria-label="Loi Évin du message 2">
                <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
              </label>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field" data-date-picker>
                <div class="field-control">
                  <input type="text" id="message-2-not-before" name="messages[2][pas_avant]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-label="Pas avant, message 2">
                  <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-2-not-before-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                  <div class="date-picker__panel" id="message-2-not-before-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <div class="field" data-date-picker>
                <div class="field-control">
                  <input type="text" id="message-2-not-after" name="messages[2][pas_apres]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-label="Pas après, message 2">
                  <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-2-not-after-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                  <div class="date-picker__panel" id="message-2-not-after-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--actions">
              <button class="repeater__button button button--ghost button--danger button--sm button--icon-only" type="submit" name="action" value="remove-2" formnovalidate data-repeater-remove aria-label="Supprimer le message 2"><svg class="icon icon--sm" aria-hidden="true"><use href="/icons.svg#icon-trash"></use></svg></button>
            </td>
          </tr>
        </tbody>
        <template data-repeater-template>
          <tbody class="table__body" data-repeater-item>
            <tr class="table__row">
              <th class="table__header" scope="row">
                <span class="marker marker--sm marker--emphasis" aria-hidden="true" data-repeater-number>__n__</span>
                <span class="visually-hidden">Message <span data-repeater-number>__n__</span></span>
              </th>
              <td class="table__cell table__cell--control">
                <div class="field field--required">
                  <div class="field-control">
                    <input type="text" id="message-__n__-title" name="messages[__n__][titre]" required aria-label="Titre du message __n__" placeholder="Nom du message">
                  </div>
                </div>
              </td>
              <td class="table__cell table__cell--control">
                <div class="field field--required">
                  <div class="field-control" data-select>
                    <select id="message-__n__-duration" name="messages[__n__][duree]" required aria-label="Durée du message __n__">
                      <option value="">Choisir</option>
                      <option value="5">5 s</option>
                      <option value="10">10 s</option>
                      <option value="15">15 s</option>
                      <option value="20">20 s</option>
                      <option value="25">25 s</option>
                      <option value="30">30 s</option>
                      <option value="35">35 s</option>
                      <option value="40">40 s</option>
                      <option value="45">45 s</option>
                      <option value="50">50 s</option>
                      <option value="55">55 s</option>
                      <option value="60">60 s</option>
                    </select>
                    <svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-chevron-down"></use></svg>
                  </div>
                </div>
              </td>
              <td class="table__cell table__cell--control">
                <label class="checkbox">
                  <input class="checkbox__control" type="checkbox" id="message-__n__-sanitary" name="messages[__n__][mentions_sanitaires]" value="1" aria-label="Mentions sanitaires du message __n__">
                  <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
                </label>
              </td>
              <td class="table__cell table__cell--control">
                <label class="checkbox">
                  <input class="checkbox__control" type="checkbox" id="message-__n__-alcohol" name="messages[__n__][loi_evin]" value="1" aria-label="Loi Évin du message __n__">
                  <svg class="icon icon--2xs checkbox__icon" aria-hidden="true"><use href="/icons.svg#icon-check"></use></svg>
                </label>
              </td>
              <td class="table__cell table__cell--control">
                <div class="field" data-date-picker>
                  <div class="field-control">
                    <input type="text" id="message-__n__-not-before" name="messages[__n__][pas_avant]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-label="Pas avant, message __n__">
                    <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-__n__-not-before-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                    <div class="date-picker__panel" id="message-__n__-not-before-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                  </div>
                </div>
              </td>
              <td class="table__cell table__cell--control">
                <div class="field" data-date-picker>
                  <div class="field-control">
                    <input type="text" id="message-__n__-not-after" name="messages[__n__][pas_apres]" inputmode="numeric" autocomplete="off" placeholder="jj/mm/aaaa" aria-label="Pas après, message __n__">
                    <button class="field-control__button" type="button" aria-label="Choisir une date" aria-haspopup="dialog" aria-controls="message-__n__-not-after-panel" aria-expanded="false" data-date-picker-open hidden><svg class="icon icon--sm field-control__icon" aria-hidden="true"><use href="/icons.svg#icon-calendar"></use></svg></button>
                    <div class="date-picker__panel" id="message-__n__-not-after-panel" role="dialog" aria-label="Choisir une date" data-date-picker-panel hidden></div>
                  </div>
                </div>
              </td>
              <td class="table__cell table__cell--actions">
                <button class="repeater__button button button--ghost button--danger button--sm button--icon-only" type="submit" name="action" value="remove-__n__" formnovalidate data-repeater-remove aria-label="Supprimer le message __n__"><svg class="icon icon--sm" aria-hidden="true"><use href="/icons.svg#icon-trash"></use></svg></button>
              </td>
            </tr>
          </tbody>
        </template>
      </table>
    </div>
  </div>
</div>

Pourcentages · Type=Percent

Les messages en lecture, puis le Pourcentage (champ) et le cadenas Verrouiller : un message verrouillé a son champ désactivé. Les autres pourcentages ne se recalculent pas dans la page : le serveur renvoie la page.

Messages
Numéro Titre Durée Mentions sanitaires Loi Évin Pourcentage Verrouiller
Message 1 Grand Frais, les promotions 30 s Oui Non
Message 2 Grand Frais, le rayon boucherie 20 s Non Non
HTML
<div class="card">
  <div class="card__row card__row--flush">
    <div class="table-scroll" id="messages-pourcentage">
      <table class="table table--compact epdr-message-table">
        <caption class="visually-hidden">Messages</caption>
        <thead class="table__head">
          <tr class="table__row">
            <th class="table__header epdr-message-table__number" scope="col"><span class="visually-hidden">Numéro</span></th>
            <th class="table__header" scope="col">Titre</th>
            <th class="table__header epdr-message-table__duration" scope="col">Durée</th>
            <th class="table__header epdr-message-table__sanitary" scope="col">Mentions sanitaires<button class="table__info" type="button" aria-label="Information sur les mentions sanitaires" aria-describedby="p-messages-pourcentage-info-sanitary" data-tooltip="p-messages-pourcentage-info-sanitary"><svg class="icon icon--xs" aria-hidden="true"><use href="/icons.svg#icon-info"></use></svg></button><span class="tooltip" id="p-messages-pourcentage-info-sanitary" role="tooltip" hidden>Le message comporte des mentions sanitaires (par exemple « Bougez plus ») : trois versions, MS1, MS2 et MS3, sont créées et diffusées à tour de rôle.</span></th>
            <th class="table__header epdr-message-table__alcohol" scope="col">Loi Évin<button class="table__info" type="button" aria-label="Information sur la loi Évin" aria-describedby="p-messages-pourcentage-info-alcohol" data-tooltip="p-messages-pourcentage-info-alcohol"><svg class="icon icon--xs" aria-hidden="true"><use href="/icons.svg#icon-info"></use></svg></button><span class="tooltip" id="p-messages-pourcentage-info-alcohol" role="tooltip" hidden>Le message concerne une boisson alcoolisée : la mention de la loi Évin y est ajoutée.</span></th>
            <th class="table__header table__header--required epdr-message-table__percent" scope="col">Pourcentage</th>
            <th class="table__header epdr-message-table__locked" scope="col">Verrouiller</th>
          </tr>
        </thead>
        <tbody class="table__body">
          <tr class="table__row">
            <th class="table__header" scope="row">
              <span class="marker marker--sm marker--emphasis" aria-hidden="true">1</span>
              <span class="visually-hidden">Message 1</span>
            </th>
            <td class="table__cell">Grand Frais, les promotions</td>
            <td class="table__cell">30 s</td>
            <td class="table__cell">Oui</td>
            <td class="table__cell">Non</td>
            <td class="table__cell table__cell--control">
              <div class="field field--required field--disabled">
                <div class="field-control">
                  <input type="text" id="p-message-1-percent" name="messages_pourcentage[1][pourcentage]" required disabled aria-label="Pourcentage du message 1" value="50" inputmode="numeric">
                  <span class="field-control__text" aria-hidden="true">%</span>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <button class="button button--ghost button--brand button--sm button--icon-only" type="button" aria-label="Verrouiller le message 1" aria-pressed="true" data-toggle-pressed data-toggle-icons="icon-lock-unlocked icon-lock" data-toggle-intents="neutral brand" data-toggle-disables="p-message-1-percent" data-toggle-name="messages_pourcentage[1][verrouille]" data-tooltip="p-message-1-lock-tip"><svg class="icon icon--sm" aria-hidden="true"><use href="/icons.svg#icon-lock"></use></svg></button>
              <span class="tooltip" id="p-message-1-lock-tip" aria-hidden="true" hidden>Verrouiller</span>
            </td>
          </tr>
        </tbody>
        <tbody class="table__body">
          <tr class="table__row">
            <th class="table__header" scope="row">
              <span class="marker marker--sm marker--emphasis" aria-hidden="true">2</span>
              <span class="visually-hidden">Message 2</span>
            </th>
            <td class="table__cell">Grand Frais, le rayon boucherie</td>
            <td class="table__cell">20 s</td>
            <td class="table__cell">Non</td>
            <td class="table__cell">Non</td>
            <td class="table__cell table__cell--control">
              <div class="field field--required">
                <div class="field-control">
                  <input type="text" id="p-message-2-percent" name="messages_pourcentage[2][pourcentage]" required aria-label="Pourcentage du message 2" value="50" inputmode="numeric">
                  <span class="field-control__text" aria-hidden="true">%</span>
                </div>
              </div>
            </td>
            <td class="table__cell table__cell--control">
              <button class="button button--ghost button--neutral button--sm button--icon-only" type="button" aria-label="Verrouiller le message 2" aria-pressed="false" data-toggle-pressed data-toggle-icons="icon-lock-unlocked icon-lock" data-toggle-intents="neutral brand" data-toggle-disables="p-message-2-percent" data-toggle-name="messages_pourcentage[2][verrouille]" data-tooltip="p-message-2-lock-tip"><svg class="icon icon--sm" aria-hidden="true"><use href="/icons.svg#icon-lock-unlocked"></use></svg></button>
              <span class="tooltip" id="p-message-2-lock-tip" aria-hidden="true" hidden>Verrouiller</span>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>