File

src/app/manage-learn/imp-suggestions/imp-suggestions.page.ts

Metadata

Index

Properties
Methods

Constructor

constructor(router: Router, headerService: AppHeaderService)
Parameters :
Name Type Optional
router Router No
headerService AppHeaderService No

Methods

goToTemplateDetails
goToTemplateDetails(criteria, project)
Parameters :
Name Optional
criteria No
project No
Returns : void
ionViewWillEnter
ionViewWillEnter()
Returns : void

Properties

criterias
entityId
Type : string
headerConfig
Type : object
Default value : { showHeader: true, showBurgerMenu: false, actionButtons: [] }
item
observationId
Type : string
solutionId
Type : string
solutionName
Type : string
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { RouterLinks } from '@app/app/app.constant';
import { AppHeaderService } from '@app/services';

@Component({
  selector: 'app-imp-suggestions',
  templateUrl: './imp-suggestions.page.html',
  styleUrls: ['./imp-suggestions.page.scss'],
})
export class ImpSuggestionsPage {

  criterias;
  solutionName: string;
  observationId: string;
  entityId: string;
  item;
  solutionId: string;
  headerConfig = {
    showHeader: true,
    showBurgerMenu: false,
    actionButtons: []
};

  constructor(private router: Router, private headerService: AppHeaderService) {
    this.criterias = this.router.getCurrentNavigation().extras.state.data;
    this.solutionName = this.router.getCurrentNavigation().extras.state.solutionName;
    this.observationId = this.router.getCurrentNavigation().extras.state.observationId;
    this.entityId = this.router.getCurrentNavigation().extras.state.entityId;
    this.solutionId = this.router.getCurrentNavigation().extras.state.solutionId;
  }



  ionViewWillEnter() {
    this.headerConfig = this.headerService.getDefaultPageConfig();
    this.headerConfig.actionButtons = [];
    this.headerConfig.showHeader = true;
    this.headerConfig.showBurgerMenu = false;
    this.headerService.updatePageConfig(this.headerConfig);
}

  goToTemplateDetails(criteria, project) {
    this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`,project.externalId], {
      state: {
        "referenceFrom": "observation",
        "submissions": {
          "observationId": this.observationId,
          "entityId": this.entityId,
          "criteriaId": criteria.criteriaId,
          "score": criteria.level,
          "solutionId": this.solutionId
        }
      },
    });
  }

}

<ion-content>
  <h3 class="ion-padding-horizontal ion-text-capitalize">{{solutionName}}</h3>
  <div *ngIf="criterias?.length">
    <div *ngFor="let criteria of criterias;let i=index">
      <ion-card *ngIf="criteria.criteriaName">
        <ion-item class="ion-text-wrap">
          <div class="flex-box" (click)="item=i" style="width: 100%;">
            <div style="flex: 1">{{criteria.criteriaName}}</div>
            <div class="flex-box justify-content-center">
              <p class="ion-padding-end" style="margin-bottom: 0;">{{criteria.label}}</p>
              <ion-icon name="caret-down"></ion-icon>
            </div>
          </div>
        </ion-item>
      </ion-card>
      <!-- Improvement list in drop-down -->
      <div style="margin: 0 22px" class="panel" *ngIf="item===i">
        <ion-item-group>
          <ion-item-divider>
            <ion-label *ngIf="criteria.improvementProjects.length">{{'FRMELEMNTS_SUGGESTED_PROJECTS'|translate}}</ion-label>
            <ion-label *ngIf="!criteria.improvementProjects.length">{{'FRMELEMNTS_NO_SUGGESTIONS'|translate}}</ion-label>
          </ion-item-divider>

          <ion-item *ngFor="let project of criteria?.improvementProjects">
            <ion-label (click)="goToTemplateDetails(criteria, project)" class="ion-text-wrap">
              <p>{{project?.name}}</p>
              <small>{{project?.goal}}</small>
            </ion-label>
          </ion-item>
        </ion-item-group>
      </div>
    </div>
  </div>
</ion-content>

./imp-suggestions.page.scss

.flex-box {
    display: flex;
    align-items: center;
}

.justify-content-center {
    justify-content: center;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""