graphics-page.component.html 2.68 KiB
<body>
  <h1>Générer un graphique</h1>
  <div class="graph-select">
    <form action="">
      <!-- Select graphic -->
      <mat-form-field class="select-graph">
        <mat-label>Graphique</mat-label>
        <mat-select [(value)]="matSelectedValue" (selectionChange)="manageSelection()" required>
          <mat-option *ngFor="let graphic of graphics" [value]="graphic" >{{ graphic }}</mat-option>
        </mat-select>
      </mat-form-field>
      <!-- Select type of graphic -->
      <mat-form-field class="graphic-type">
        <mat-label>Type de graphique</mat-label>
        <mat-select [(value)]="matSelectedGraphic" (selectionChange)="manageSelection()" required>
          <mat-option *ngFor="let type of graphicTypes" [value]="type">{{ type }}</mat-option>
        </mat-select>
      </mat-form-field>
      <!-- This is displayed if select-graph.value === graphics[0] or graphics[1] -->
      <div>
        <mat-form-field class="form-cp">
          <mat-label>Titre du communiqué</mat-label>
          <mat-select [(value)]="matSelectedName" (selectionChange)="manageSelection()" [formControl]="formControlName" required>
            <mat-option *ngFor="let name of articleNames" [value]="name">{{ name }}</mat-option>
          </mat-select>
          <mat-error *ngIf="formControlName.hasError('required')">Vous devez selectionner un article</mat-error>
        </mat-form-field>
      </div>
      <!-- Add buttons generate and cancel -->
      <button mat-raised-button (click)="generateGraphic()" type="submit" class="button-generate" title="Générer le graphique">Générer graphique</button>
      <button mat-button title="Annuler" class="button-cancel" (click)="reset()">X</button>
    </form>
    <div class="horizontal-sep"></div>
  </div>
  <!-- Display graphic if inputs are accurates and button generate is clicked on -->
   <app-graphics *ngIf="validate" [graphicType]="matSelectedGraphic" [graphic]="matSelectedValue" [codeCP]="matSelectedName" [arrayGraphics]="graphics" [arrayGraphicTypes]="graphicTypes" (errorOcc)="error()"></app-graphics>
   <!-- Displayed if an error has occurred while trying to generate the graphic -->
   <p *ngIf="errorOcc" class="error-occurred">Une erreur est survenue. Réessayez plus tard</p>
</body>
<!-- To do
    Ask what type of graphic for what data, generate it and display component Graphics + display articles related below the graphic
-->
<!-- Les graphiques possibles
  - Pour un code CP, la tonalité des retombéées
  - Pour un code CP, les departements des retombées
  - Type de retombées, possibilité de croiser avec la tonalite
  - journaux des retombées
  - retombées par departement
  - tonalité globale
  - retombées par theme
 -->