<cre-entity-edit
  *ngIf="material"
  title="Modifier le produit {{material.name}}"
  deleteConfirmMessage="Voulez-vous vraiment supprimer le produit {{material.name}}?"
  backButtonLink="/catalog/material/list"
  deletePermission="REMOVE_MATERIAL"
  [entity]="material"
  [formFields]="formFields"
  [unknownError]="unknownError"
  [customError]="errorMessage"
  (submit)="submit($event)"
  (delete)="delete()">
</cre-entity-edit>


<ng-template
  #simdutTemplate
  let-control="control"
  let-field="field">
  <div class="simdut-file w-100 d-flex justify-content-between">
    <button mat-raised-button color="primary" [disabled]="!hasSimdut"
            [attr.title]="!hasSimdut ? 'Ce produit n\'a pas de fiche signalitique' : null" (click)="openSimdutUrl()">
      Voir la fiche signalitique
    </button>
    <div class="edit-simdut-file-input">
      <button mat-raised-button color="accent" type="button">Modifier la fiche
        signalitique
      </button>
      <mat-form-field>
        <mat-label>{{field.label}}</mat-label>
        <ngx-mat-file-input #simdutFileInput [accept]="field.fileType" [formControl]="control"></ngx-mat-file-input>
      </mat-form-field>
    </div>
  </div>
</ng-template>
