<!--<ion-header class="header-subpage" no-border *ngIf="!platform.is('desktop')">
  <ion-toolbar color="#2b94d1">
    <ion-title class="titolo-sezione-head">{{ 'parere_titolo' | translate }}</ion-title>
  </ion-toolbar>
</ion-header>-->

<ion-content class="chats">
  <!--<ion-row class="title-row" *ngIf="!platform.is('desktop')">
    <ion-buttons class="back-button-desktop" (click)="back()" title="{{ 'back_login' | translate }}">
      <ion-icon name="arrow-back-outline" color="#2b94d1" class="back" tappable></ion-icon>
    </ion-buttons>
    <div class="pareri-title">
      <ion-title>{{ 'parere_titolo' | translate }}</ion-title>
    </div>
  </ion-row>-->
  <div>
    <div>
      <div [ngSwitch]="parere" ngDefaultControl>
        <span *ngIf="!platform.is('desktop')">
        <div *ngSwitchCase="'lista'">
          <ion-row>
            <div class="search-date-smart">
              <ion-row>
                <span class="riga"><strong>{{ 'cerca' | translate }}</strong> {{ 'titolo' | translate }} <input type="text" name="calendar" [(ngModel)]="titolo" title="{{ 'ricerca_titolo' | translate }}" class="cerca-titolo-doc">
                </span>
                <ion-button (click)="cercaPareri()" class="search-arrow" title="{{ 'cerca' | translate }}">
                  <ion-icon class="button-icon-documenti-smart ios-icon" slot="icon-only" name="chevron-forward-circle-outline" title="{{ 'cerca' | translate }}"></ion-icon>
                </ion-button>
              </ion-row>
            </div>
          </ion-row>
          <ion-row>
            <div class="search-date-smart">
              <ion-row>
                <span class="riga">
                  <ion-checkbox name="privacy" [(ngModel)]="archiviati" class="check2"> </ion-checkbox>
                  <ion-label>{{ 'visualizza_archiviati' | translate }}</ion-label>
                </span>
                <ion-button (click)="cercaPareri()" class="search-arrow" title="{{ 'cerca' | translate }}">
                  <ion-icon class="button-icon-documenti-smart ios-icon" slot="icon-only" name="chevron-forward-circle-outline" title="{{ 'cerca' | translate }}"></ion-icon>
                </ion-button>
              </ion-row>
            </div>
          </ion-row>
          <span id="buttonsPareri" style="display:none">
            <ion-row>
              <div class="search-date-smart" *ngIf="!archiviati">
                <ion-row>
                  <span class="riga">
                    <ion-label>{{ 'archivia_pareri' | translate }}</ion-label>
                  </span>
                  <ion-button (click)="archiviaPareri(true)" class="search-arrow" title="{{ 'archivia_pareri' | translate }}">
                    <ion-icon class="button-icon-documenti-smart ios-icon" slot="icon-only" name="archive" title="{{ 'archivia_pareri' | translate }}"></ion-icon>
                  </ion-button>
                </ion-row>
              </div>
            </ion-row>
            <ion-row>
              <div class="search-date-smart" *ngIf="archiviati">
                <ion-row>
                  <span class="riga">
                    <ion-label>{{ 'undo_archivio_pareri' | translate }}</ion-label>
                  </span>
                  <ion-button (click)="archiviaPareri(false)" class="search-arrow" title="{{ 'riattiva_pareri' | translate }}">
                    <ion-icon class="button-icon-documenti-smart ios-icon" slot="icon-only" name="undo" title="{{ 'riattiva_pareri' | translate }}"></ion-icon>
                  </ion-button>
                </ion-row>
              </div>
            </ion-row>
          </span>
          <ion-row class="search-date-border-smart">
          </ion-row>
          <!--<div class="search-date  date-div">
            <div class="float-date">
              <span class="search-date item-no-border grigio">
                <div><strong>{{ 'cerca' | translate }}</strong> {{ 'titolo' | translate }} <input type="text" name="calendar" [(ngModel)]="titolo" title="{{ 'ricerca_titolo' | translate }}"></div>
              </span>
              <div class="clr"></div>
              <span class="search-date float-date riga item-no-border">
                <ion-checkbox name="privacy" [(ngModel)]="archiviati" class="check"> </ion-checkbox>
                <ion-label class="archivio-text"><span class="text">{{ 'visualizza_archiviati' | translate }}</span></ion-label>
                <ion-button (click)="cercaPareri()" class="search-arrow" title="{{ 'cerca' | translate }}">
                  <ion-icon class="button-icon" slot="icon-only" name="arrow-round-forward" title="{{ 'cerca' | translate }}"></ion-icon></ion-button>
              </span>
            </div>
            <div class="clr"></div>

            <span class="item-no-border" id="buttonsPareri" style="display:none">
              <div *ngIf="!archiviati" class="text">
                {{ 'archivia_pareri' | translate }}
                <ion-button (click)="archiviaPareri(true)" class="search-arrow" title="{{ 'archivia_pareri' | translate }}"><ion-icon class="button-icon-archivia" slot="icon-only" name="archive" title="{{ 'archivia_pareri' | translate }}"></ion-icon></ion-button>
              </div>
              <div *ngIf="archiviati" class="text">
                {{ 'undo_archivio_pareri' | translate }}
                <ion-button (click)="archiviaPareri(false)" class="search-arrow" title="{{ 'riattiva_pareri' | translate }}"><ion-icon class="button-icon-archivia" slot="icon-only" name="undo" title="{{ 'riattiva_pareri' | translate }}"></ion-icon></ion-button>
              </div>                
            </span>
          </div>-->
          <!--<div *ngFor="let parere of pareri; trackBy: trackByDoc" class="chat-list"> 
            <ion-checkbox name="privacy" [(ngModel)]="parere.checked" class="check" (click)="checkSelected(parere.idRichiesta)"> </ion-checkbox>          
            <div class="row-chat-list">
              <div class="data" text-wrap>
                {{parere.data}}
                <a class="select" (click)="apriParere(parere.idRichiesta)" tappable title="{{ 'visualizza_dettagli' | translate }}">
                  <ion-icon name="arrow-round-forward"></ion-icon>
                </a>
                <a class="select" (click)="loadPareri('initial')" tappable title="{{ 'aggiorna' | translate }}">
                  <ion-icon name="refresh-circle"></ion-icon>
                </a>
                <div text-wrap>{{parere.titolo}}</div>
              </div>
            </div>
          </div>-->
          <span>

            <!--<ion-list *ngFor="let parere of pareri; trackBy: trackByDoc" class="chat-list table-row">
              <div class="row-download-special">
                <div class="richieste-button group-icon3">        
                  <a class="select" (click)="loadPareri('initial')" tappable title="{{ 'aggiorna' | translate }}">
                    <ion-icon name="refresh-circle"></ion-icon>
                  </a>
                  <ion-label>{{ 'refresh' | translate }}</ion-label>
                </div>
                <div class="richieste-button group-icon2">
                  <a class="select" (click)="apriParere(parere.idRichiesta)" tappable title="{{ 'visualizza_dettagli' | translate }}">
                    <ion-icon name="arrow-round-forward"></ion-icon>
                  </a>
                  <ion-label>{{ 'apri' | translate }}</ion-label>
                </div>
              </div>
              <ion-checkbox name="privacy" [(ngModel)]="parere.checked" class="check" (click)="checkSelected(parere.idRichiesta)"> </ion-checkbox>          
              <div class="row-chat-list">
                <div class="data" text-wrap>
                  {{parere.data}}
                  <div text-wrap>{{parere.titolo}}</div>
                </div>
              </div>
            </ion-list>-->
            
            <ion-list *ngFor="let parere of pareri; trackBy: trackByDoc" class="row-results-smart" (click)="selection?toggleGroup(parere.idRichiesta):selectItem(parere.idRichiesta)"
              (press)="selectItem(parere.idRichiesta)" [ngStyle]="{'background-color': parere.checked ? '#c3ddec' : '#ffffff'}">
              <ion-checkbox name="privacy" [(ngModel)]="parere.checked" class="check" (click)="checkSelected(parere.idRichiesta)"> </ion-checkbox>          
              <div class="table-row"> 

                  <!--<div class="row-download-special">
                    <div class="group-icon3" >
                      <ion-icon name="refresh-circle" (click)="loadPareri('initial')" tappable title="{{ 'aggiorna' | translate }}"></ion-icon>
                      <ion-label>{{ 'refresh' | translate }}</ion-label>
                    </div>
                    <div class="group-icon3">
                      <ion-icon name="arrow-round-forward" (click)="apriParere(parere.idRichiesta)" tappable title="{{ 'visualizza_dettagli' | translate }}"></ion-icon>
                      <ion-label>{{ 'apri' | translate }}</ion-label>
                    </div>
                  </div>-->

                <div class="row-text data" text-wrap>
                  <div text-wrap>{{parere.titolo}}</div>
                  {{parere.data}}
                </div>
                <div class="row-download item-no-border">
                  <ion-icon class="button-icon-documenti-smart ios-icon" name="caret-forward-circle-outline" (click)="apriParere(parere.idRichiesta)" tappable title="{{ 'visualizza_dettagli' | translate }}"></ion-icon>
                </div>
                
              </div>              
            </ion-list>

            <!--
              <ion-list *ngFor="let documento of documenti.documenti; trackBy: trackByDoc" class="row-results">
          <ion-checkbox name="privacy" *ngIf="!platform.is('desktop')" [(ngModel)]="documento.checked" class="check" (click)="checkSelected(documento.idDocumento)"> </ion-checkbox>
          <div class="table-row">
            <div class="row-text">
              <strong>{{documento.titolo}}</strong>
              <div class="detail">
                {{documento.data}}
              </div>
            </div>
            <div class="row-download item-no-border">
              <a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download tappable title="{{ 'scarica_doc' | translate }}">
                <ion-icon name="cloud-download" title="{{ 'scarica_doc' | translate }}"></ion-icon>
              </a>
              non copiare questo<a *ngIf="platform.is('desktop')" href="{{documento.url}}" target="_blank" download>Clicca per scaricare il documento</a>
              <ion-icon name="share-alt" *ngIf="!platform.is('desktop')" (click)="getDocumento(documento.idDocumento, documento.nomeFile);" target="_blank" download tappable title="{{ 'condividi_documento' | translate }}"></ion-icon>
            </div>
          </div>
          <div class="clr"></div>
        </ion-list>
            -->
          </span>
          <!--<div class="foo-button" center>
            <div class="round-btn">
              <a (click)="createNuovoParere()" tappable>
                <ion-icon name="add" [style.color]="'#FFFFFF'"></ion-icon>
              </a>
            </div>
          </div>-->
        </div>
      </span>

      <span *ngIf="platform.is('desktop')">
        <div *ngSwitchCase="'lista'">
          <ion-row class="title-row">
            <ion-buttons class="back-button-desktop" (click)="back()" title="{{ 'back_login' | translate }}">
              <ion-icon name="arrow-back-outline" color="#2b94d1" class="back" tappable></ion-icon>
            </ion-buttons>
            <div class="pareri-title">
              <ion-title>{{ 'parere_titolo' | translate }}</ion-title>
            </div>
          </ion-row>
          <div class="search-date">
            <ion-row>
              <div class="riga">
                <strong>{{ 'cerca' | translate }}</strong> 
                {{ 'titolo' | translate }} 
                <input type="text" name="calendar" [(ngModel)]="titolo" title="{{ 'ricerca_titolo' | translate }}" class="cerca-titolo-doc" />
                <ion-button (click)="cercaPareri()" class="search-arrow" title="{{ 'cerca_documenti' | translate }}">
                  <ion-icon class="button-icon-documenti ios-icon" slot="icon-only" name="chevron-forward-circle-outline" title="{{ 'cerca_documenti' | translate }}"></ion-icon>
                </ion-button>
              </div>
              <div class="riga">
                <ion-checkbox name="privacy" [(ngModel)]="archiviati" class="check"> </ion-checkbox>
                <ion-label class="archivio-text"><span class="text">{{ 'visualizza_archiviati' | translate }}</span></ion-label>
                <ion-button (click)="cercaPareri()" class="search-arrow" title="{{ 'cerca' | translate }}">
                  <ion-icon class="button-icon-documenti ios-icon" slot="icon-only" name="chevron-forward-circle-outline" title="{{ 'cerca' | translate }}"></ion-icon>
                </ion-button>
              </div>
              <div class="riga" id="buttonsPareri" style="display:none">
                <div *ngIf="!archiviati" class="text">
                  {{ 'archivia_pareri' | translate }}
                  <ion-button (click)="archiviaPareri(true)" class="search-arrow" title="{{ 'archivia_pareri' | translate }}">
                    <ion-icon class="button-icon-documenti" slot="icon-only" name="archive" title="{{ 'archivia_pareri' | translate }}"></ion-icon></ion-button>
                </div>
                <div *ngIf="archiviati" class="text">
                  {{ 'undo_archivio_pareri' | translate }}
                  <ion-button (click)="archiviaPareri(false)" class="search-arrow" title="{{ 'riattiva_pareri' | translate }}">
                    <ion-icon class="button-icon-documenti" slot="icon-only" name="undo" title="{{ 'riattiva_pareri' | translate }}"></ion-icon></ion-button>
                </div>  
              </div>
            </ion-row>
          </div>
          <div class="content-index" *ngFor="let parere of pareri; trackBy: trackByDoc">
            <div tappable title="{{ 'visualizza_dettagli' | translate }}">
              <div class="struttura-sel documento-box" tappable #lock (mouseover)="lock.isHover = true" (mouseout)="lock.isHover = false">
                <ion-row class="row-box">
                  <ion-col>
                    <div class="documento-text">
                      <ion-row class="title">
                        <div class="checkbox-desktop">
                          <ion-checkbox name="privacy" [(ngModel)]="parere.checked" class="check" (click)="checkSelected(parere.idRichiesta)"> </ion-checkbox>
                        </div>
                        <div class="title" (click)="apriParere(parere.idRichiesta)">
                          <strong>{{parere.titolo}}</strong>
                        </div>
                      </ion-row>
                      <div class="data" (click)="apriParere(parere.idRichiesta)">
                        {{parere.data}}
                      </div>
                    </div>
                  </ion-col>
                  <ion-col (click)="apriParere(parere.idRichiesta)">
                    <div tappable class="icon3">
                      <img src="assets/img/parereNero.png" tappable/>
                      <!--<ion-icon *ngIf="lock.isHover" class="button-icon-download" slot="icon-only" name="download" title="{{ 'scarica_doc' | translate }}"></ion-icon>-->
                    </div>
                  </ion-col>
                </ion-row>
              </div>
            </div>
          </div>
        </div>
      </span>

        <div *ngSwitchCase="'dettaglio'">
          <ion-row class="title-row">
            <ion-buttons class="back-button-desktop" (click)="apriLista()" title="{{ 'back_pareri' | translate }}">
              <ion-icon name="arrow-back-outline" color="#2b94d1" class="back" tappable></ion-icon>
            </ion-buttons>
            <div class="pareri-title">
              <ion-title>{{parereAttivo.titolo}}</ion-title>
            </div>
          </ion-row>
          <div class="from-me-desktop">
            <div class="io">{{ 'io' | translate }} - {{parereAttivo.data}}</div>
            <p>{{parereAttivo.testo}}</p>
            <div class="download-doc" *ngIf="parereAttivo.nomeFile != null">
              <div class="image" title="{{ 'scarica_allegato' | translate }}">
                <a *ngIf="!platform.is('desktop')" (click)="getFile(parereAttivo.idRichiesta, parereAttivo.nomeFile, true);" target="_blank" download><ion-icon name="share-alt" [style.color]="'#e5e5ea'"></ion-icon></a>
                <a *ngIf="platform.is('desktop')" href="{{parereAttivo.url}}" target="_blank" download><ion-icon name="cloud-download" [style.color]="'#e5e5ea'"></ion-icon></a>
              </div>
              <div class="filename">{{parereAttivo.nomeFile}}</div>
            </div>
          </div>
          <div class="clr"></div>
          <div class="from-them-desktop" *ngIf="parereAttivo.interventi.length > 0">
            <div class="operatore">{{parereAttivo.interventi[0].utente}} - {{parereAttivo.interventi[0].data}}</div>
            <p>{{parereAttivo.interventi[0].testo}}</p>
            <div *ngIf="parereAttivo.interventi[0].nomeFile != null" class="download-doc">
              <div class="image" title="{{ 'scarica_allegato' | translate }}">
                <a *ngIf="!platform.is('desktop')" (click)="getFile(parereAttivo.interventi[0].idIntervento, parereAttivo.interventi[0].nomeFile, false);" target="_blank" download><ion-icon name="share-alt" [style.color]="'#2b94d1'"></ion-icon></a>
                <a *ngIf="platform.is('desktop')" href="{{parereAttivo.interventi[0].url}}" target="_blank" download><ion-icon name="cloud-download" [style.color]="'#2b94d1'"></ion-icon></a>
              </div>
              <div class="filename">{{parereAttivo.interventi[0].nomeFile}}</div>
            </div>
          </div>	
          <div class="clr"></div>
        </div>

        <div *ngSwitchCase="'new'">
          <ion-row class="title-row">
            <ion-buttons class="back-button-desktop" (click)="apriLista()" title="{{ 'back_pareri' | translate }}">
              <ion-icon name="arrow-back-outline" color="#2b94d1" class="back" tappable></ion-icon>
            </ion-buttons>
            <div class="pareri-title">
              <ion-title>{{ 'nuovo_parere' | translate }}</ion-title>
            </div>
          </ion-row>
          <form class="parere-form" #form="ngForm" (ngSubmit)="creaParere(form)">
            <div>
              <ion-item class="title-question">
                <ion-input class="item-no-border" name="title" type="text" placeholder="{{ 'inserire_titolo' | translate }}" ngModel required></ion-input>
              </ion-item>
            </div>
            <div>
              <ion-item class="question-extended item-no-border">
                <ion-textarea name="question" placeholder="{{ 'inserire_richiesta' | translate }}" ngModel required></ion-textarea>
              </ion-item>
            </div>
            <ion-item class="item-no-border"><h6 class="grigio font">{{ 'aggiungi_allegato' | translate }}</h6></ion-item>
            <div class="clr"></div>
            <ion-item class="item-no-border">
              <ion-input id="file" type="file" name="file" ngModel (change)="loadFile();" class="font"></ion-input>
            </ion-item>
            <ion-row>
              <div class="send">
                <ion-button type="submit" size="large" [disabled]="form.invalid" expand="block" color="#fcc73d" class="form-button">{{ 'invia' | translate }}</ion-button>
              </div>
              <div class="undo">
                <ion-button color="#515151" size="large" expand="block" (click)="apriLista()" class="form-button">{{ 'annulla' | translate }}</ion-button>
              </div>
            </ion-row>
          </form>
        </div>

      </div>
    </div>
  </div>
  <!--<ion-menu side="start" menu-id="pareri" content-id="parere">
    <ion-header>
      <ion-toolbar color="primary">
        <ion-title>Topics</ion-title>
      </ion-toolbar>
    </ion-header>
    <ion-content>
      <ion-button expand="block" (click)="createNuovoParere()">Chiedi Nuovo Parere</ion-button>
      <ion-list *ngFor="let parere of pareri; trackBy: trackByDoc">
        <div>
          <ion-item (click)="apriParere(parere.idRichiesta)">{{parere.titolo}}</ion-item>
        </div>
      </ion-list>
    </ion-content>
  </ion-menu>-->
  <!--<div class="chats" main>
    <div class="back">
      <a href="">
        <ion-icon name="arrow-round-forward" color="#2b94d1"></ion-icon>
      </a>
    </div>
    <ion-content padding id="parere">
      <ion-button expand="block" (click)="openSideMenu()">Apri Lista Pareri</ion-button>
      <h1>{{parereAttivo.titolo}}</h1>
      <h2>Domanda</h2>
      <ion-item>
        <ion-textarea name="question" placeholder="" ngModel [readonly]="true">{{parereAttivo.testo}}</ion-textarea> 
      </ion-item>
      <div *ngIf="parereAttivo != null">
        <ion-item *ngIf="parereAttivo.nomeFile != null"> 
          <a *ngIf="!platform.is('desktop')" (click)="getFile(parereAttivo.idRichiesta, parereAttivo.nomeFile, true);" target="_blank" download>Clicca per scaricare il documento</a>
          <a *ngIf="platform.is('desktop')" href="{{parereAttivo.url}}" target="_blank" download>Clicca per scaricare il documento che hai caricato ({{parereAttivo.nomeFile}})</a>
        </ion-item>
      
        <div *ngIf="parereAttivo.interventi.length > 0">
          <h2>Risposta</h2>
          <ion-item>
            <ion-textarea name="response" placeholder="" ngModel [readonly]="true">{{parereAttivo.interventi[0].testo}}</ion-textarea>
          </ion-item>
          <ion-item *ngIf="parereAttivo.interventi[0].nomeFile != null">
            <a *ngIf="!platform.is('desktop')" (click)="getFile(parereAttivo.interventi[0].idIntervento, parereAttivo.interventi[0].nomeFile, false);" target="_blank" download>Clicca per scaricare il documento</a>
            <a *ngIf="platform.is('desktop')" href="parereAttivo.interventi[0].url" target="_blank" download>Clicca per scaricare il documento caricato dall'operatore ({{parereAttivo.interventi[0].nomeFile}})</a>
        </ion-item>
        </div>
      </div>
    </ion-content>
  </div>
  <div id="modal"></div>-->
  <!--<div id="content"></div>-->
</ion-content>

<ion-footer class="footer-parere ion-no-border" no-border *ngIf="bottoneVisibile">
  <div class="foo-button" center>
    <div class="round-btn-desktop">
      <a (click)="createNuovoParere()" tappable title="{{ 'aggiungi_richiesta' | translate }}">
        <ion-icon name="add" [style.color]="'#FFFFFF'"></ion-icon>
      </a>
    </div>
  </div>
</ion-footer>
