taxonomy-management.component.html 8.97 KB
Newer Older
rajkumar's avatar
rajkumar committed
1 2 3 4 5 6 7
<div class="body">
  <div>
    <div class="mat-h3 mat-tittle">Register taxonomy</div>
  </div>
  <mat-divider></mat-divider>
  <div class="container">
    <mat-accordion>
Rajkumar-D's avatar
Rajkumar-D committed
8
      <mat-expansion-panel #formExpansionPanel (opened)="panelOpenState = true;" (closed)="panelOpenState = false"
rajkumar's avatar
rajkumar committed
9
        class="mat-body" [expanded]="true">
Rajkumar-D's avatar
Rajkumar-D committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
        <mat-expansion-panel-header>
          <mat-panel-title>
            <b>Register using form</b>
          </mat-panel-title>
        </mat-expansion-panel-header>
        <br>
        <a (click)="openDialog('Add',{'id':getId()},'Form')">Add taxa details<mat-icon>add_circle</mat-icon></a>
        <br><br>
        <div class="mat-vertical-content">
          <ng-template [ngTemplateOutlet]="taxonTables"
            [ngTemplateOutletContext]="{validDs:validFormDataSource,invalidDs:invalidFormDataSource,source:'Form'}">
          </ng-template>
        </div>
      </mat-expansion-panel>

      <mat-expansion-panel #spreadExpansionPanel (opened)="panelOpenState = true;" (closed)="panelOpenState = false"
        class="mat-body">
rajkumar's avatar
rajkumar committed
27 28 29 30 31 32 33 34 35
        <mat-expansion-panel-header>
          <mat-panel-title>
            <b>Register using spreadsheet</b>
          </mat-panel-title>
        </mat-expansion-panel-header>
        <mat-accordion>
          <mat-expansion-panel (opened)="panelOpenState = true;" (closed)="panelOpenState = false" class="mat-body">
            <mat-expansion-panel-header>
              <mat-panel-title>
Rajkumar-D's avatar
Rajkumar-D committed
36
                <b>Download spreadsheet to register taxa</b>
rajkumar's avatar
rajkumar committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
              </mat-panel-title>
            </mat-expansion-panel-header>
            <p class="mat-body">
              Please download the spreadsheet template containing the fields for registering taxa by using the 'Download
              TSV template' button.
            </p>
            <p class="mat-body">Spreadsheet columns:</p>
            <ol>
              <li>proposed_name: the organism name (mandatory). We will check if there is a taxa registered with the
                given name.</li>
              <li>name_type: allowed taxon name types are</li>
              <ul style="margin-left:20px">
                <li>Environmental Name</li>
                <li>Synthetic Name</li>
                <li>Novel Species</li>
                <li>Unidentified Species</li>
                <li>Published Name</li>
              </ul>
              <li>host: host associated with the taxon, if applicable</li>
              <li>project_id: project associated with the taxa, if applicable</li>
              <li>description: a short description of the taxon, please provide an authority or publication where
                available, or any other information describing the organism</li>
            </ol>
            <button mat-raised-button color="accent" (click)="downloadTaxonTsvTemplate()"
              style="margin-left: 5px;">Download TSV Template</button>
rajkumar's avatar
rajkumar committed
62

rajkumar's avatar
rajkumar committed
63 64 65 66
          </mat-expansion-panel>
          <mat-expansion-panel (opened)="panelOpenState = true" (closed)="panelOpenState = false" class="mat-body">
            <mat-expansion-panel-header>
              <mat-panel-title>
Rajkumar-D's avatar
Rajkumar-D committed
67
                <b>Upload filled spreadsheet to register taxa</b>
rajkumar's avatar
rajkumar committed
68 69
              </mat-panel-title>
            </mat-expansion-panel-header>
Rajkumar-D's avatar
Rajkumar-D committed
70
            <mat-horizontal-stepper #stepper>
rajkumar's avatar
rajkumar committed
71 72 73 74 75 76
              <mat-step label="Upload Spreadsheet">
                <form (ngSubmit)="uploadFile(form,stepper)" #form="ngForm">
                  <input type="file" required name="spreadSheet" [(ngModel)]="form.spreadSheet" observeFiles />
                  <button mat-raised-button color="accent" [disabled]="form.invalid ">Upload Completed
                    Spreadsheet</button>
                </form>
rajkumar's avatar
rajkumar committed
77 78

              </mat-step>
Rajkumar-D's avatar
Rajkumar-D committed
79
              <mat-step label="Register Taxa">
rajkumar's avatar
rajkumar committed
80 81 82 83 84
                <br>
                <ng-template [ngTemplateOutlet]="taxonTables"
                  [ngTemplateOutletContext]="{validDs:validSpreadsheetDataSource,invalidDs:invalidSpreadsheetDataSource,souece:'Spreadsheet'}">
                </ng-template>
              </mat-step>
Rajkumar-D's avatar
Rajkumar-D committed
85
            </mat-horizontal-stepper>
rajkumar's avatar
rajkumar committed
86 87 88 89
          </mat-expansion-panel>
        </mat-accordion>
      </mat-expansion-panel>

Rajkumar-D's avatar
Rajkumar-D committed
90

rajkumar's avatar
rajkumar committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    </mat-accordion>
    <div class="centred" *ngIf="showLoadingFlag" style="height:70px;">
      <mat-spinner [diameter]="50" [strokeWidth]="5" style="margin:0 auto;">
      </mat-spinner>
    </div>

  </div>
</div>

<!-- This is the template used for loading Unregistered taxa / Registered taxa table -->

<ng-template #taxonTables let-validDs="validDs" let-invalidDs="invalidDs" let-source="source">
  <div *ngIf="validDs && validDs.data.length > 0">
    <mat-card-subtitle>Unregistered taxa</mat-card-subtitle>
    <br>
    <div class="mat-elevation-z8">
      <table mat-table *ngIf="validDs" #table [dataSource]="validDs" class="mat-elevation-z8">
        <ng-container matColumnDef="proposedName">
          <th mat-header-cell *matHeaderCellDef> Proposed name </th>
          <td mat-cell *matCellDef="let element"> {{element.proposedName}} </td>
        </ng-container>
        <ng-container matColumnDef="nameType">
          <th mat-header-cell *matHeaderCellDef> Name type </th>
          <td mat-cell *matCellDef="let element"> {{element.nameType}} </td>
        </ng-container>
        <ng-container matColumnDef="host">
          <th mat-header-cell *matHeaderCellDef> Host </th>
          <td mat-cell *matCellDef="let element"> {{element.host}} </td>
        </ng-container>
        <ng-container matColumnDef="projectId">
          <th mat-header-cell *matHeaderCellDef> Project / Study Id</th>
          <td mat-cell *matCellDef="let element"> {{element.projectId}} </td>
        </ng-container>
        <ng-container matColumnDef="description">
          <th mat-header-cell *matHeaderCellDef> Description </th>
          <td mat-cell *matCellDef="let element"> {{element.description}} </td>
        </ng-container>
        <ng-container matColumnDef="message">
          <th mat-header-cell *matHeaderCellDef> Message </th>
          <td mat-cell *matCellDef="let element"> {{element.serverMessage}} </td>
        </ng-container>
        <ng-container matColumnDef="edit">
          <th mat-header-cell *matHeaderCellDef> Edit </th>
          <td mat-cell *matCellDef="let element">
            <mat-icon (click)="openDialog('Update',element,source)">edit</mat-icon>
          </td>
        </ng-container>
        <ng-container matColumnDef="remove">
          <th mat-header-cell *matHeaderCellDef> Remove </th>
          <td mat-cell *matCellDef="let element">
            <mat-icon (click)="openDialog('Delete',element,source)">delete</mat-icon>
          </td>
        </ng-container>

        <tr mat-header-row *matHeaderRowDef="displayedColumnsForValidTaxonomy"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumnsForValidTaxonomy;"></tr>
      </table>
    </div>
  </div>
  <br>
  <div *ngIf="invalidDs && invalidDs.data.length > 0">
    <mat-card-subtitle>Registered taxa</mat-card-subtitle>
    <br>
    <p class="mat-body">The following taxa have already been registered.</p>
    <div class="mat-elevation-z8">
      <table mat-table *ngIf="invalidDs" #table [dataSource]="invalidDs" class="mat-elevation-z8">
        <ng-container matColumnDef="proposedName">
          <th mat-header-cell *matHeaderCellDef> Proposed name </th>
          <td mat-cell *matCellDef="let element"> {{element.proposedName}} </td>
        </ng-container>
        <ng-container matColumnDef="nameType">
          <th mat-header-cell *matHeaderCellDef> Name type </th>
          <td mat-cell *matCellDef="let element"> {{element.nameType}} </td>
        </ng-container>
        <ng-container matColumnDef="host">
          <th mat-header-cell *matHeaderCellDef> Host </th>
          <td mat-cell *matCellDef="let element"> {{element.host}} </td>
        </ng-container>
        <ng-container matColumnDef="projectId">
          <th mat-header-cell *matHeaderCellDef> Project / Study Id</th>
          <td mat-cell *matCellDef="let element"> {{element.projectId}} </td>
        </ng-container>
        <ng-container matColumnDef="description">
          <th mat-header-cell *matHeaderCellDef> Description </th>
          <td mat-cell *matCellDef="let element"> {{element.description}} </td>
        </ng-container>
        <ng-container matColumnDef="message">
          <th mat-header-cell *matHeaderCellDef> Taxon ID </th>
          <td mat-cell *matCellDef="let element"> {{element.serverMessage}} </td>
        </ng-container>


        <tr mat-header-row *matHeaderRowDef="displayedColumnsForInvalidTaxonomy"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumnsForInvalidTaxonomy;"></tr>
      </table>
    </div>
  </div>
  <br>
  <!--<div style="text-align:Center" *ngIf="stepper.selectedIndex==1">-->
  <div style="text-align:Center">
    <button mat-raised-button color="accent" [disabled]="!taxonomySubmissionCheck(source)"
      (click)=submitTaxonomyRequest(source)>Check and make taxonomy request </button>
    <button mat-raised-button style="margin-left: 5px;" routerLink="">Cancel</button>
rajkumar's avatar
rajkumar committed
194
  </div>
rajkumar's avatar
rajkumar committed
195
</ng-template>