delphiki / lovelace-pronote

Lovelace cards for the Pronote integration
35 stars 4 forks source link

Feature Request : ajouter les cartes pour absences et évaluations #6

Open lunarok opened 7 months ago

lunarok commented 7 months ago

Je découvre ce repo complémentaire et c'est top, le style de rendu est classe Mais, il manquerait les absences et les évaluations pour être complet J'ai vérifier au cas ou dans les sources, mais je vois que les 4 décrits dans le readme

BBE-FR commented 6 months ago

j'utilise les markdowns suivants

Evaluations :


type: markdown
content: >-
  <table>  {% if state_attr('sensor.pronote_xxx_thibault_evaluations',
  'lessons')[0] is defined %} {% set items =
  state_attr('sensor.pronote_xxx_thibault_evaluations','evaluations')%} {%
  for i in range(0, items | count, 1) %} <tr><td colspan="3"><b>{{
  items[i].date.strftime("%d-%m") }} {{ items[i].subject }}</td> {% set
  acquisitions = items[i].acquisitions %} {% for j in
  range(0,acquisitions|count,1) %} <tr> <td>{{ acquisitions[j].name }}</td>
  <td>{{ acquisitions[j].domain }}</td> <td width="8%"> {% if
  acquisitions[j].level == 'Très bonne maîtrise' %} 🟢+ {% elif
  acquisitions[j].level == 'Maîtrise satisfaisante' %} 🟢 {% elif
  acquisitions[j].level == "Début de maîtrise" %} 🟡 {% elif
  acquisitions[j].level == 'Maîtrise fragile'  %} 🟠 {% elif
  acquisitions[j].level == 'Presque maîtrisé'  %} 🟡 {% else %} ?  {% endif
  %}</td> </tr> {% endfor %} </tr> {% endfor %} {% else %} Pas d'évaluation {%
  endif %}
title: Evaluations
card_mod:
  style:
    .: |
      ha-card ha-markdown {
                padding:0px
                border-top: 1px groove var(--divider-color);
                overflow-y: scroll;
                height: 100px;
              }
      ha-card ha-markdown.no-header {
        padding:0px
      }
    $: |
      h1.card-header {
        background-color:rgb(100, 100, 100);
          padding: 0px 0px 0px 12px !important;
          color: white !important;
          font-weight: normal;
          font-size: 1.5em !important;
          border-top-left-radius: 5px; 
          border-top-right-radius: 5px; 
          height: 100%;
      }        
    ha-markdown $: |
      h1 {
          font-weight: normal;
          font-size: 24px;
      }
      div {
          background-color:rgb(100, 100, 100);
          padding: 12px 12px;
          color:white;
          font-weight:normal;
          font-size:1.2em;
            border-top-left-radius: 5px; 
            border-top-right-radius: 5px; 
      }
      table{
        border-collapse: collapse;
        font-size: 0.9em;
        font-family: Roboto;
        width: 100%;
        outline: 0px solid #393c3d;
        margin-top: 10px;
      } caption {
          text-align: center;
          font-weight: bold;
          font-size: 1.2em;
      } td {
          padding: 5px 5px 5px 5px;
          text-align: left;
          border-bottom: 0px solid #1c2020;
      }
      tr {
          border-bottom: 0px solid #1c2020;
      }
      tr:last-of-type {
          border-bottom: transparent;
      }
      tr:nth-of-type(even) {
          background-color: rgb(54, 54, 54, 0.3);
      }
      mark {
          background: lightgreen;
          border-color: green;
          border-radius: 10px;
          padding: 5px;
      }
      span {
          background: orange;
          color: #222627;
          border-radius: 5px;
          padding: 5px;
      }
      tr:nth-child(n+2) > td:nth-child(2) {
        text-align: left;
      }

Absences:

type: markdown
content: >-
  {% if state_attr('sensor.pronote_xxx_thibault_absences', 'absences')[0] is
  defined %} <table>  {% set items = 
  state_attr('sensor.pronote_xxx_thibault_absences','absences') %} {% for i
  in range(0, items | count, 1) %} <tr> {%- if items[i].justified == True -%}
  <td> <mark> {{ items[i].from.strftime("%d-%m") }}</mark></td> {% else %} <td>
  <span>{{ items[i].from.strftime("%d-%m") }}</span></td>  {%- endif -%}  <td>{{
  items[i].hours }}</td> <td>{{ items[i].reason }}</td> {% endfor %} {% else %}
  Pas d'absences ce trimestre {% endif %}
title: Absences
card_mod:
  style:
    .: |
      ha-card ha-markdown {
                padding:0px
                border-top: 1px groove var(--divider-color);
                overflow-y: scroll;
                height: 100px;
              }
      ha-card ha-markdown.no-header {
        padding:0px
      }
    $: |
      h1.card-header {
        background-color:rgb(100, 100, 100);
          padding: 0px 0px 0px 12px !important;
          color: white !important;
          font-weight: normal;
          font-size: 1.5em !important;
          border-top-left-radius: 5px; 
          border-top-right-radius: 5px; 
          height: 100%;
      }        
    ha-markdown $: |
      h1 {
          font-weight: normal;
          font-size: 24px;
      }
      div {
          background-color:rgb(100, 100, 100);
          padding: 12px 12px;
          color:white;
          font-weight:normal;
          font-size:1.2em;
            border-top-left-radius: 5px; 
            border-top-right-radius: 5px; 
      }
      table{
        border-collapse: collapse;
        font-size: 0.9em;
        font-family: Roboto;
        width: 100%;
        outline: 0px solid #393c3d;
        margin-top: 10px;
      } caption {
          text-align: center;
          font-weight: bold;
          font-size: 1.2em;
      } td {
          padding: 5px 5px 5px 5px;
          text-align: left;
          border-bottom: 0px solid #1c2020;
      }
      tr {
          border-bottom: 0px solid #1c2020;
      }
      tr:last-of-type {
          border-bottom: transparent;
      }
      tr:nth-of-type(even) {
          background-color: rgb(54, 54, 54, 0.3);
      }
      mark {
          background: lightgreen;
          border-color: green;
          border-radius: 10px;
          padding: 5px;
      }
      span {
          background: orange;
          color: #222627;
          border-radius: 5px;
          padding: 5px;
      }
      tr:nth-child(n+2) > td:nth-child(2) {
        text-align: left;
      }

Retard:

type: markdown
content: >-
  {% if state_attr('sensor.pronote_xxx_thibault_delays', 'delays')[0] is
  defined %} <table> 
    <tr>
    <td><h4>Date</td>
    <td><h4>Min.</td>
    <td><h4>Justification/Raison</td>
    </tr>
    {% set items = state_attr('sensor.pronote_xxx_thibault_delays','delays')
  %}

  {% for i in range(0, items | count, 1) %}

  <tr>

  {%- if items[i].justified == True -%}

  <td> <mark> {{ items[i].date.strftime("%d-%m") }}</mark></td>

  {% else %}

  <td> <span>{{ items[i].date.strftime("%d-%m") }}</span></td> 

  {%- endif -%} 

  <td>{{ items[i].minutes }}</td>

  <td>({{ items[i].justification }}){{ items[i].reasons }} {% endfor %}   {%
  else %}Pas de retard ce Trimestre {% endif %}
title: Retards
card_mod:
  style:
    .: |
      ha-card ha-markdown {
                padding:0px
                border-top: 1px groove var(--divider-color);
                overflow-y: scroll;
                height: 100px;
              }
      ha-card ha-markdown.no-header {
        padding:0px
      }
    $: |
      h1.card-header {
        background-color:rgb(100, 100, 100);
          padding: 0px 0px 0px 12px !important;
          color: white !important;
          font-weight: normal;
          font-size: 1.5em !important;
          border-top-left-radius: 5px; 
          border-top-right-radius: 5px; 
          height: 100%;
      }        
    ha-markdown $: |
      h1 {
          font-weight: normal;
          font-size: 24px;
      }
      div {
          background-color:rgb(100, 100, 100);
          padding: 12px 12px;
          color:white;
          font-weight:normal;
          font-size:1.2em;
            border-top-left-radius: 5px; 
            border-top-right-radius: 5px; 
      }
      table{
        border-collapse: collapse;
        font-size: 0.9em;
        font-family: Roboto;
        width: 100%;
        outline: 0px solid #393c3d;
        margin-top: 10px;
      } caption {
          text-align: center;
          font-weight: bold;
          font-size: 1.2em;
      } td {
          padding: 5px 5px 5px 5px;
          text-align: left;
          border-bottom: 0px solid #1c2020;
      }
      tr {
          border-bottom: 0px solid #1c2020;
      }
      tr:last-of-type {
          border-bottom: transparent;
      }
      tr:nth-of-type(even) {
          background-color: rgb(54, 54, 54, 0.3);
      }
      mark {
          background: lightgreen;
          border-color: green;
          border-radius: 10px;
          padding: 5px;
      }
      span {
          background: orange;
          color: #222627;
          border-radius: 5px;
          padding: 5px;
      }
      tr:nth-child(n+2) > td:nth-child(2) {
        text-align: left;
      }

Punitions:

type: markdown
content: |2-
   <div>Punitions</div><table> 
    {% if state_attr('sensor.pronote_xxx_thibault_punishments','punishments')[0] is defined %}
      {% set items = state_attr('sensor.pronote_xxx_thibault_punishments','punishments')%}
    <tr>
    <td><h4>Date<h3></td>
    <td><h4>Matière</td>
    <td><h4>Raison</td>
    <td><h4>Circonstances</td>
    <td><h4>Punition</td>
    <td><h4>Durée</td>
    <td><h4>Exclusion</td>
    <td><h4>En cours</td>
    </tr>
    {% for i in range(0, items | count, 1) %}
    <tr>    
    <td>{{ items[i].date }}</td>
    <td>{{ items[i].subject }}</td>
    <td>{{ items[i].reasons }}</td>
    <td>{{ items[i].circumstances }}</td>
    <td>{{ items[i].nature }}</td>
    <td>{{ items[i].duration }}</td>
    <td>{{ items[i].exclusion }}</td>
    <td>{{ items[i].during_lesson }}</td>  
   </tr>
  {% endfor %}
  {% else %} Pas de punition
  {% endif %}
card_mod:
  style:
    .: |
      ha-card ha-markdown {
                padding:0px
                border-top: 1px groove var(--divider-color);
                overflow-y: scroll;
                height: 300px;
              }
      ha-card ha-markdown.no-header {
        padding:0px
      }
    $: |
      h1.card-header {
        background-color:rgb(100, 100, 100);
          padding: 0px 0px 0px 12px !important;
          color: white !important;
          font-weight: normal;
          font-size: 1.5em !important;
          border-top-left-radius: 5px; 
          border-top-right-radius: 5px; 
          height: 100%;
      }        
    ha-markdown $: |
      h1 {
          font-weight: normal;
          font-size: 24px;
      }
      div {
          background-color:rgb(100, 100, 100);
          padding: 12px 12px;
          color:white;
          font-weight:normal;
          font-size:1.2em;
            border-top-left-radius: 5px; 
            border-top-right-radius: 5px; 
      }
      table{
        border-collapse: collapse;
        font-size: 0.9em;
        font-family: Roboto;
        width: 100%;
        outline: 0px solid #393c3d;
        margin-top: 10px;
      } caption {
          text-align: center;
          font-weight: bold;
          font-size: 1.2em;
      } td {
          padding: 5px 5px 5px 5px;
          text-align: left;
          border-bottom: 0px solid #1c2020;
      }
      tr {
          border-bottom: 0px solid #1c2020;
      }
      tr:last-of-type {
          border-bottom: transparent;
      }
      tr:nth-of-type(even) {
          background-color: rgb(54, 54, 54, 0.3);
      }
      mark {
          background: lightgreen;
          border-color: green;
          border-radius: 10px;
          padding: 5px;
      }
      span {
          background: orange;
          color: #222627;
          border-radius: 5px;
          padding: 5px;
      }
      tr:nth-child(n+2) > td:nth-child(2) {
        text-align: left;
      }

Devoirs:

type: markdown
content: >-
  <table> {% if  
  state_attr('sensor.pronote_xxx_thibault_homework_period','homework') ==
  'is defined' %} {% set items =
  state_attr('sensor.pronote_xxx_thibault_homework_period','homework') %} {%
  for i in range(0, items | count, 1) %} {% if i == 0 %} <tr><td
  colspan="2"><b>{{ items[i].date.strftime("%A %d") }}</td></tr> {% endif %} {%
  if items[i].date > items[i-1].date %}  <tr><td colspan=2><p><b>{{
  items[i].date.strftime("%A %d") }}</p></td></tr>  {% endif %} <tr> {%- if
  items[i].done == true -%} <td>   <mark> {{ items[i].subject }}</mark></td> {%
  else %} <td>   <span> {{ items[i].subject }}</span></td> {%- endif -%} <td>{{
  items[i].description }}</td> <td></td> </tr> {% endfor %} {% else %} Pas de
  Devoirs {% endif %}
title: Devoirs
card_mod:
  style:
    .: |
      ha-card ha-markdown {
                padding:0px
                border-top: 1px groove var(--divider-color);
                overflow-y: scroll;
                height: 100px;
              }
      ha-card ha-markdown.no-header {
        padding:0px
      }
    $: |
      h1.card-header {
        background-color:rgb(100, 100, 100);
          padding: 0px 0px 0px 12px !important;
          color: white !important;
          font-weight: normal;
          font-size: 1.5em !important;
          border-top-left-radius: 5px; 
          border-top-right-radius: 5px; 
          height: 100%;
      }        
    ha-markdown $: |
      h1 {
          font-weight: normal;
          font-size: 24px;
      }
      div {
          background-color:rgb(100, 100, 100);
          padding: 12px 12px;
          color:white;
          font-weight:normal;
          font-size:1.2em;
            border-top-left-radius: 5px; 
            border-top-right-radius: 5px; 
      }
      table{
        border-collapse: collapse;
        font-size: 0.9em;
        font-family: Roboto;
        width: 100%;
        outline: 0px solid #393c3d;
        margin-top: 10px;
      } caption {
          text-align: center;
          font-weight: bold;
          font-size: 1.2em;
      } td {
          padding: 5px 5px 5px 5px;
          text-align: left;
          border-bottom: 0px solid #1c2020;
      }
      tr {
          border-bottom: 0px solid #1c2020;
      }
      tr:last-of-type {
          border-bottom: transparent;
      }
      tr:nth-of-type(even) {
          background-color: rgb(54, 54, 54, 0.3);
      }
      mark {
          background: lightgreen;
          border-color: green;
          border-radius: 10px;
          padding: 5px;
      }
      span {
          background: orange;
          color: #222627;
          border-radius: 5px;
          padding: 5px;
      }
      tr:nth-child(n+2) > td:nth-child(2) {
        text-align: left;
      }

Il suffira de mettre à jour au fur et à mesure lorsque les cartes pour chaque type de sensor seront dispo avec le même look et le même niveau que les cartes emploi du temps / notes et moyennes...