File

src/app/manage-learn/ecm-listing/ecm-listing.page.ts

Metadata

Index

Properties
Methods

Constructor

constructor(updateTracker: UpdateTrackerService, utils: UtilsService, localStorage: LocalStorageService, evdnsServ: EvidenceService, platform: Platform, routerParam: ActivatedRoute, router: Router)
Parameters :
Name Type Optional
updateTracker UpdateTrackerService No
utils UtilsService No
localStorage LocalStorageService No
evdnsServ EvidenceService No
platform Platform No
routerParam ActivatedRoute No
router Router No

Methods

checkForProgressStatus
checkForProgressStatus()
Returns : void
goToGeneralQuestionList
goToGeneralQuestionList()
Returns : void
ionViewWillEnter
ionViewWillEnter()
Returns : void
mapCompletedAndTotalQuestions
mapCompletedAndTotalQuestions()
Returns : void
navigateToEvidence
navigateToEvidence(index)
Parameters :
Name Optional
index No
Returns : void
openAction
openAction(assessment, evidenceIndex)
Parameters :
Name Optional
assessment No
evidenceIndex No
Returns : void

Properties

canShowManualRating
Type : boolean
currentEvidenceStatus
Type : string
entityData
Type : any
entityEvidences
Type : any
entityId
Type : any
entityName
Type : string
generalQuestions
Type : any
isIos
Type : boolean
Default value : this.platform.is("ios")
recentlyUpdatedEntity
Type : any
submissionId
Type : any
import { Component} from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { RouterLinks } from '@app/app/app.constant';
import { Platform } from '@ionic/angular';
import { LocalStorageService, UtilsService } from '../core';
import { EvidenceService } from '../core/services/evidence.service';
import { UpdateTrackerService } from '../core/services/update-tracker.service';

@Component({
  selector: 'app-ecm-listing',
  templateUrl: './ecm-listing.page.html',
  styleUrls: ['./ecm-listing.page.scss'],
})
export class EcmListingPage {

  entityId: any;
  entityName: string;
  entityEvidences: any;
  entityData: any;
  currentEvidenceStatus: string;
  isIos: boolean = this.platform.is("ios");
  generalQuestions: any;
  submissionId: any;
  recentlyUpdatedEntity: any;
  canShowManualRating: boolean;

  constructor(
    private updateTracker: UpdateTrackerService,
    private utils: UtilsService,
    private localStorage: LocalStorageService,
    private evdnsServ: EvidenceService,
    private platform: Platform,
    private routerParam: ActivatedRoute,
    private router: Router
  ) {
    this.routerParam.queryParams.subscribe((params) => {
      this.entityId = params.submisssionId;
      this.entityName = params.schoolName;
    })
  }


  ionViewWillEnter() {
    this.localStorage
      .getLocalStorage(this.utils.getAssessmentLocalStorageKey(this.entityId))
      .then((successData) => {
        this.entityData = successData;
        this.entityEvidences = this.updateTracker.getLastModifiedInEvidences(
          this.entityData["assessment"]["evidences"],
          this.recentlyUpdatedEntity
        );
        this.mapCompletedAndTotalQuestions();
        this.checkForProgressStatus();
        this.localStorage
          .getLocalStorage("generalQuestions_" + this.entityId)
          .then((successData) => {
            this.generalQuestions = successData;
          })
      })
  }

  mapCompletedAndTotalQuestions() {
    for (const evidence of this.entityEvidences) {
      let totalQuestions = 0;
      let completedQuestions = 0;
      for (const section of evidence.sections) {
        totalQuestions = totalQuestions + section.totalQuestions;
        completedQuestions = completedQuestions + section.completedQuestions;
      }
      let percentage = totalQuestions ? (completedQuestions / totalQuestions) * 100 : 0;
      if (!completedQuestions) {
        percentage = 0;
      }
      evidence.completePercentage = Math.trunc(percentage);
    }
  }

  goToGeneralQuestionList(): void {
  }

  checkForProgressStatus() {
    for (const evidence of this.entityEvidences) {
      if (evidence.isSubmitted) {
        evidence.progressStatus = "submitted";
      } else if (!evidence.startTime) {
        evidence.progressStatus = "";
      } else {
        evidence.progressStatus = "completed";
        for (const section of evidence.sections) {
          if (section.progressStatus === "inProgress" || !section.progressStatus) {
            evidence.progressStatus = "inProgress";
          }
        }
      }
    }
  }

  openAction(assessment, evidenceIndex) {
    this.utils.setCurrentimageFolderName(this.entityEvidences[evidenceIndex].externalId, assessment._id);
    const options = {
      _id: assessment._id,
      name: assessment.name,
      selectedEvidence: evidenceIndex,
      entityDetails: this.entityData,
    };
    this.evdnsServ.openActionSheet(options);
  }

  navigateToEvidence(index): void {
    if (this.entityEvidences[index].startTime) {
      this.utils.setCurrentimageFolderName(this.entityEvidences[index].externalId, this.entityId);
      this.router.navigate([RouterLinks.SECTION_LISTING],
        {
          queryParams: {
            submisssionId: this.entityId,
            evidenceIndex: index,
            schoolName: this.entityName
          }
        })

    } else {
      const entity = { _id: this.entityId, name: this.entityName };
      this.openAction(entity, index);
    }
  }

  // goToManualRating(): void {
  //   const navParams = {
  //     entityName: this.entityName,
  //     submissionId: this.entityData["assessment"].submissionId,
  //   };
  //   this.navCtrl.push(ManualRatingPage, { navParams });
  // }

  // checkAllEvidenceSubmitted(): null {
  //   if (!this.ngps.getNetworkStatus() || this.entityData.solution.scoringSystem != "manual") {
  //     console.log("No network");
  //     this.canShowManualRating = false;
  //     return;
  //   }
  //   const submissionId = this.entityData["assessment"].submissionId;
  //   this.manualRatingProvider
  //     .checkAllECMStatus(submissionId)
  //     .then((res) => {
  //       console.log(res);
  //       res.status == "ratingPending" ? (this.canShowManualRating = true) : (this.canShowManualRating = false);
  //     })
  //     .catch(() => (this.canShowManualRating = false));
  // }

}
<ion-content>
  <ion-item-group>
    <ion-item-divider color="light">
      <h3 class="headerText">
        <ion-icon name="book" class="ion-margin-right"></ion-icon>
        <span class="_wrap-text">{{entityName}}</span>
      </h3>
    </ion-item-divider>

    <button ion-item [disabled]="evidence?.notApplicable" *ngFor="let evidence of entityEvidences; let i= index"
      (click)="navigateToEvidence(i)" text-wrap>
      <div class="_flex-box" style="flex-wrap: wrap;">
        <ion-icon name="albums" class="ion-margin-right"></ion-icon>
        <div style="flex: 1;">{{ evidence?.name }}</div>
        <div *ngIf="evidence.progressStatus === 'completed' && !evidence?.notApplicable"
          class="_completed _flex-box progressWidth ion-float-right">
          <progress-bar [progress]="100" class="_full-width"></progress-bar>
        </div>
        <div *ngIf="!evidence.progressStatus && !evidence?.notApplicable && !isIos" class="_flex-box">
          <ion-icon name="arrow-forward" class="_progressIcon ion-float-right ion-margin-right"></ion-icon>
        </div>
        <div *ngIf="evidence.progressStatus === 'inProgress' && !evidence?.notApplicable"
          class="_inProgress _flex-box progressWidth ion-float-right">
          <progress-bar [progress]="evidence?.completePercentage" class=" _full-width"></progress-bar>
        </div>
        <div *ngIf="evidence.progressStatus === 'submitted' && !evidence?.notApplicable"
          class="_submitted _flex-box ion-float-right">
          {{'labels.submitted'|translate}} <ion-icon name="cloud-done" class="_progressIcon ion-margin-left"></ion-icon>
        </div>
        <div *ngIf="evidence?.notApplicable" class="_na _flex-box _float-right">
          {{'labels.notApplicable'|translate}} <ion-icon name="alert" class="_progressIcon ion-margin-left"></ion-icon>
        </div>
      </div>
    </button>

  </ion-item-group>
</ion-content>

./ecm-listing.page.scss


.doneIcon {
    color: green;
}

// .startSurvey {
//     color: $primary-color;

// }

ion-icon {
    font-size: 2rem;
}


.headerText {
    font-weight: 500 !important;
    font-size: 1.5rem !important;
    display: flex;
    align-items: center;

}

.feedBack {
    color: white !important;
    font-size: 1.5rem;
    padding-right: 10px
}

.progressWidth {
    min-width: 5.625rem;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""