pd , QC complete report ratings get : kdk
This commit is contained in:
parent
559aa8ed8e
commit
0068b7bd0f
@ -56,7 +56,7 @@
|
|||||||
<mat-icon style="color: white;">short_text</mat-icon>
|
<mat-icon style="color: white;">short_text</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-sidenav #mailnav [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" class="mail-sidebar pl-xs pr-xs">
|
<mat-sidenav #mailnav [mode]="isOver() ? 'over' : 'side'" [opened]="!isOver()" class="mail-sidebar pl-xs pr-xs">
|
||||||
<mat-card style="text-align:center;"> <button mat-raised-button color="red" *ngIf="reGenerateBtn" (click)="reGeneratePFReport()" style="padding: 0 58px !important;">Re-generate Report</button></mat-card>
|
<mat-card style="text-align:center;" *ngIf="qcStatus !== 'QC_COMPLETED'"> <button mat-raised-button color="red" *ngIf="reGenerateBtn" (click)="reGeneratePFReport()" style="padding: 0 58px !important;" >Re-generate Report</button></mat-card>
|
||||||
<button mat-menu-item *ngFor="let pd of pdReportVersionList" [ngClass]="{'active': selectedItem == item}" (click)="changeVersion(pd)" style="font-size: 0.9em !important;height:6% !important;line-height: normal !important;">
|
<button mat-menu-item *ngFor="let pd of pdReportVersionList" [ngClass]="{'active': selectedItem == item}" (click)="changeVersion(pd)" style="font-size: 0.9em !important;height:6% !important;line-height: normal !important;">
|
||||||
{{ pd.doc_name }}<span *ngIf="pd.is_latest == 1" [style.color]="'green'">( Current Version )</span><br>
|
{{ pd.doc_name }}<span *ngIf="pd.is_latest == 1" [style.color]="'green'">( Current Version )</span><br>
|
||||||
<span style="color:rgba(117, 115, 115, 0.87)!important;font-size:13px !important;">{{pd.createdby}}</span><br>
|
<span style="color:rgba(117, 115, 115, 0.87)!important;font-size:13px !important;">{{pd.createdby}}</span><br>
|
||||||
@ -64,13 +64,14 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
|
<mat-card *ngIf="qcStatus === 'QC_COMPLETED'" style="text-align:center;position: absolute;
|
||||||
|
bottom: 10px;"> <button mat-raised-button color="red" *ngIf="reGenerateBtn" (click)="reportReview()" style="padding: 0 58px !important;">QC Review</button> </mat-card>
|
||||||
</mat-sidenav>
|
</mat-sidenav>
|
||||||
|
|
||||||
|
|
||||||
<div class="main-content" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
<div class="main-content" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
|
||||||
|
{{qcStatus}}
|
||||||
<figure>
|
<figure style="min-height: 240px;">
|
||||||
|
|
||||||
<div *ngIf="latestPDDetails">
|
<div *ngIf="latestPDDetails">
|
||||||
<div style="margin: 12px;
|
<div style="margin: 12px;
|
||||||
@ -78,8 +79,8 @@
|
|||||||
padding: 8px;">
|
padding: 8px;">
|
||||||
<div style="text-align: right;" class="mb-1">
|
<div style="text-align: right;" class="mb-1">
|
||||||
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Edit" matTooltipPosition="above"
|
<button mat-raised-button mat-icon-button class="hover-icon " type="button" matTooltip="Edit" matTooltipPosition="above"
|
||||||
*ngIf="latestPDDetails.is_latest == 1" (click)="addNewQuestion()"><mat-icon>edit</mat-icon></button>
|
*ngIf="latestPDDetails.is_latest == 1 && qcStatus !== 'QC_COMPLETED'" (click)="addNewQuestion()"><mat-icon>edit</mat-icon></button>
|
||||||
<button mat-stroked-button *ngIf="latestPDDetails.is_latest == 0" (click)="changeDocumentEdit()">Restore</button>
|
<button mat-stroked-button *ngIf="latestPDDetails.is_latest == 0 && qcStatus !== 'QC_COMPLETED'" (click)="changeDocumentEdit()">Restore</button>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="reGenerateBtn">
|
<div *ngIf="reGenerateBtn">
|
||||||
<pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
|
<pdf-viewer [src]="latestPDDetails.doc_uri" [original-size]="false" [page]="1">
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { MatDialog,
|
|||||||
MatDialogRef,
|
MatDialogRef,
|
||||||
MAT_DIALOG_DATA } from "@angular/material";
|
MAT_DIALOG_DATA } from "@angular/material";
|
||||||
import { ModelEditPdReportComponent} from './model-edit-pd-report/model-edit-pd-report.component';
|
import { ModelEditPdReportComponent} from './model-edit-pd-report/model-edit-pd-report.component';
|
||||||
|
import { QcReviewComponent } from './qc-review/qc-review.component';
|
||||||
|
|
||||||
/**sweet alert */
|
/**sweet alert */
|
||||||
// import Swal from 'sweetalert2';
|
// import Swal from 'sweetalert2';
|
||||||
@ -117,12 +118,14 @@ export class PdReportComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public qcStatus: string = '';
|
||||||
getPdReportVersionList(){
|
getPdReportVersionList(){
|
||||||
this.pdTrigerService.getPdDocVersionList(this.startPD).subscribe(data => {
|
this.pdTrigerService.getPdDocVersionList(this.startPD).subscribe(data => {
|
||||||
if(data.status == 200 && data.dataStatus){
|
if(data.status == 200 && data.dataStatus){
|
||||||
this.pdReportVersionList = [...data.records].reverse();
|
this.pdReportVersionList = [...data.records.reports_urls].reverse();
|
||||||
let datas = this.pdReportVersionList.filter((a)=>{return a.is_latest == 1;})
|
let datas = this.pdReportVersionList.filter((a)=>{return a.is_latest == 1;})
|
||||||
this.latestPDDetails = datas[0];
|
this.latestPDDetails = datas[0];
|
||||||
|
this.qcStatus = data.records.pdstatus;
|
||||||
// alert(JSON.stringify(this.latestPDDetails));
|
// alert(JSON.stringify(this.latestPDDetails));
|
||||||
this.reGenerateBtn = true;
|
this.reGenerateBtn = true;
|
||||||
} else {
|
} else {
|
||||||
@ -174,6 +177,22 @@ export class PdReportComponent implements OnInit {
|
|||||||
console.log(this.latestPDDetails);
|
console.log(this.latestPDDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
reportReview(): void {
|
||||||
|
const dialogRef = this.dialog.open(QcReviewComponent, {
|
||||||
|
data: { startId : this.startPD },
|
||||||
|
disableClose: true
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed()
|
||||||
|
.subscribe(dataresult => {
|
||||||
|
// this.getPdReportFinalTemplateDetails();
|
||||||
|
// this.getQuestionsMasters();
|
||||||
|
// this.getBranch();
|
||||||
|
// this.isPopupOpened = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
changeDocumentEdit() : void{
|
changeDocumentEdit() : void{
|
||||||
|
|
||||||
|
|
||||||
@ -200,8 +219,6 @@ export class PdReportComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Swal('User Created');
|
// Swal('User Created');
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
<h2 mat-dialog-title>QC Completed Review</h2>
|
||||||
|
<mat-dialog-content class="mat-typography">
|
||||||
|
<!--<h3>Develop across all platforms</h3>-->
|
||||||
|
<div style="margin: 12px; width: 340px;">
|
||||||
|
<form role="form" *ngIf="showForm" [formGroup]="ngForm" accept-charset="UTF-8" novalidate>
|
||||||
|
<div>
|
||||||
|
<mat-form-field appearance="outline" style="width: 100%">
|
||||||
|
<mat-label>Remarks</mat-label>
|
||||||
|
<textarea matInput placeholder="Remarks" formControlName="qc_remarks"></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<app-rating [rating]="ngForm.get('qc_rating').value" (ratingClick)='ratingComponentClick($event)'></app-rating>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-button class="btn btn-primary" (click)="myClick()">Save</button>
|
||||||
|
<button mat-button mat-dialog-close>Cancel</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { QcReviewComponent } from './qc-review.component';
|
||||||
|
|
||||||
|
describe('QcReviewComponent', () => {
|
||||||
|
let component: QcReviewComponent;
|
||||||
|
let fixture: ComponentFixture<QcReviewComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ QcReviewComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(QcReviewComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
import { Component, OnInit, ViewChild , Input, Inject} from '@angular/core';
|
||||||
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
|
import { PdTrigerService } from '../../../../pd-service/pd-triger.service';
|
||||||
|
import { NotifierService } from "angular-notifier";
|
||||||
|
|
||||||
|
|
||||||
|
import {
|
||||||
|
MatDialog,
|
||||||
|
MatDialogRef,
|
||||||
|
MAT_DIALOG_DATA
|
||||||
|
} from '@angular/material';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-qc-review',
|
||||||
|
templateUrl: './qc-review.component.html',
|
||||||
|
styleUrls: ['./qc-review.component.scss']
|
||||||
|
})
|
||||||
|
export class QcReviewComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() questionId: number;
|
||||||
|
ngForm: FormGroup;
|
||||||
|
recordData: any;
|
||||||
|
showForm: Boolean;
|
||||||
|
/**
|
||||||
|
* Notifier service
|
||||||
|
*/
|
||||||
|
private notifier: NotifierService;
|
||||||
|
constructor( private _formBuilder: FormBuilder,
|
||||||
|
private pdTrigerService: PdTrigerService,
|
||||||
|
notifier: NotifierService ,
|
||||||
|
private dialogRef: MatDialogRef<QcReviewComponent>,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||||
|
this.notifier = notifier;
|
||||||
|
|
||||||
|
// this.mycontent = `<p>My html content</p>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.getQcCompleteReviewStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
getQcCompleteReviewStatus() {
|
||||||
|
this.pdTrigerService.getQCReportFinalReviewDetails(this.data.startId, "QC").subscribe(data => {
|
||||||
|
if(data['dataStatus']){
|
||||||
|
this.recordData = data.records[0];
|
||||||
|
this.ngForm = this._formBuilder.group({
|
||||||
|
qc_remarks: [this.recordData.qc_remarks],
|
||||||
|
qc_rating: [Number(this.recordData.qc_rating)],
|
||||||
|
pd_status: [this.recordData.pd_status],
|
||||||
|
})
|
||||||
|
this.showForm = true;
|
||||||
|
}
|
||||||
|
},err => {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange($event: any): void {
|
||||||
|
console.log('onChange');
|
||||||
|
// this.log += new Date() + "<br />";
|
||||||
|
}
|
||||||
|
|
||||||
|
myClick(): void {
|
||||||
|
let template = this.ngForm.value;
|
||||||
|
template.pd_id = this.data.startId;
|
||||||
|
console.log(JSON.stringify(template));
|
||||||
|
this.pdTrigerService.pdReviewStatusUpdate(template).subscribe(data=>{
|
||||||
|
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||||
|
this.dialogRef.close();
|
||||||
|
}, err => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
|
||||||
|
ratingClicked: number;
|
||||||
|
itemIdRatingClicked: string;
|
||||||
|
rating : number = 1;
|
||||||
|
|
||||||
|
ratingComponentClick(e){
|
||||||
|
this.ngForm.controls.qc_rating.setValue(e.rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -87,6 +87,8 @@ import { NgxViewerModule } from 'ngx-viewer';
|
|||||||
import { FinalRemarksComponent } from './list-pd/start-pd/forms/final-remarks/final-remarks.component';
|
import { FinalRemarksComponent } from './list-pd/start-pd/forms/final-remarks/final-remarks.component';
|
||||||
|
|
||||||
import { BusinessOtherFamilyMemberComponent } from './list-pd/start-pd/forms/dialogue/business-other-family-member/business-other-family-member.component';
|
import { BusinessOtherFamilyMemberComponent } from './list-pd/start-pd/forms/dialogue/business-other-family-member/business-other-family-member.component';
|
||||||
|
import { QcReviewComponent } from './list-pd/pd-report/qc-review/qc-review.component';
|
||||||
|
import { SharedModule } from "app/shared/shared.module";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom angular notifier options
|
* Custom angular notifier options
|
||||||
@ -264,7 +266,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
|||||||
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
|
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
|
||||||
// OwlNativeDateTimeModule,
|
// OwlNativeDateTimeModule,
|
||||||
// ],
|
// ],
|
||||||
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent],
|
declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent, GeneralInfoComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent],
|
||||||
|
|
||||||
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
|
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
|
||||||
// providers: [PdTrigerService, GetGeometricLocationService],
|
// providers: [PdTrigerService, GetGeometricLocationService],
|
||||||
@ -273,6 +275,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
ManagePdRoutingModule,
|
ManagePdRoutingModule,
|
||||||
NgxViewerModule,
|
NgxViewerModule,
|
||||||
|
SharedModule,
|
||||||
NotifierModule.withConfig(pdCustomNotifierOptions),
|
NotifierModule.withConfig(pdCustomNotifierOptions),
|
||||||
CKEditorModule,
|
CKEditorModule,
|
||||||
PdfViewerModule,
|
PdfViewerModule,
|
||||||
@ -307,7 +310,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
|
|||||||
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}],
|
{provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS}],
|
||||||
|
|
||||||
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,
|
entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PersonalInfoComponent,
|
||||||
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent],
|
ClientInfoComponent, SupplierInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, GeneralInfoComponent, PdRequirementComponent, ModelEditPdReportComponent, OtherApplicantDetailsComponent, NeighbourHoodComponent, DialogChangeCurrentVenrsion, FinalRemarksComponent, BusinessOtherFamilyMemberComponent, QcReviewComponent],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class ManagePdModule {
|
export class ManagePdModule {
|
||||||
|
|||||||
@ -331,6 +331,23 @@ getTypeofActivityForSuppliedInfoForm(pd_id: any): Observable<any>{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQCReportFinalReviewDetails(pd_id: any, flag : string ): Observable<any>{
|
||||||
|
return this._http.post<any>(this.apiUrl+"getQCLenderRemarks", {"records": { "pd_id" : pd_id, "flag" :flag }})
|
||||||
|
.pipe(
|
||||||
|
catchError(this.handleError('operation', []))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// pd review status update details
|
||||||
|
pdReviewStatusUpdate(editData: any): Observable<any> {
|
||||||
|
editData.fk_updatedby = this._aws.getlocale();
|
||||||
|
// editData.updatedon = currentdate;
|
||||||
|
return this._http.post<any>(this.apiUrl + "updatePDMaster", {records: editData})
|
||||||
|
|
||||||
|
.pipe(
|
||||||
|
catchError(this.handleError('operation', []))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// inWords(num) {
|
// inWords(num) {
|
||||||
|
|||||||
16
ng6-seed/src/app/shared/rating/rating.component.html
Normal file
16
ng6-seed/src/app/shared/rating/rating.component.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<fieldset class="rating">
|
||||||
|
<input type="radio" [name]="inputName" value="5" [checked]="rating===5" />
|
||||||
|
<label title="Rocks!" (click)='onClick(5)'>5 stars</label>
|
||||||
|
|
||||||
|
<input type="radio" [name]="inputName" value="4" [checked]="rating===4" />
|
||||||
|
<label title="Pretty good" (click)='onClick(4)'>4 stars</label>
|
||||||
|
|
||||||
|
<input type="radio" [name]="inputName" value="3" [checked]="rating===3" />
|
||||||
|
<label title="Meh" (click)='onClick(3)'>3 stars</label>
|
||||||
|
|
||||||
|
<input type="radio" [name]="inputName" value="2" [checked]="rating===2" />
|
||||||
|
<label title="Kinda bad" (click)='onClick(2)'>2 stars</label>
|
||||||
|
|
||||||
|
<input type="radio" [name]="inputName" value="1" [checked]="rating===1" />
|
||||||
|
<label title="Sucks big time" (click)='onClick(1)'>1 star</label>
|
||||||
|
</fieldset>
|
||||||
42
ng6-seed/src/app/shared/rating/rating.component.scss
Normal file
42
ng6-seed/src/app/shared/rating/rating.component.scss
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
.rating {
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating:not(:checked) > input {
|
||||||
|
position:absolute;
|
||||||
|
top:-9999px;
|
||||||
|
clip:rect(0,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating:not(:checked) > label {
|
||||||
|
float:right;
|
||||||
|
width:1em;
|
||||||
|
padding:0.1em;
|
||||||
|
overflow:hidden;
|
||||||
|
white-space:nowrap;
|
||||||
|
cursor:pointer;
|
||||||
|
font-size:200%;
|
||||||
|
line-height:1.2;
|
||||||
|
color:#ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating:not(:checked) > label:before {
|
||||||
|
content: '★ ';
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating > input:checked ~ label {
|
||||||
|
color: #f70;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating:not(:checked) > label:hover,
|
||||||
|
.rating:not(:checked) > label:hover ~ label {
|
||||||
|
color: gold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.rating > input:checked ~ label:hover,
|
||||||
|
.rating > input:checked ~ label:hover ~ label,
|
||||||
|
.rating > label:hover ~ input:checked ~ label {
|
||||||
|
color: #ea0;
|
||||||
|
}
|
||||||
25
ng6-seed/src/app/shared/rating/rating.component.spec.ts
Normal file
25
ng6-seed/src/app/shared/rating/rating.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { RatingComponent } from './rating.component';
|
||||||
|
|
||||||
|
describe('RatingComponent', () => {
|
||||||
|
let component: RatingComponent;
|
||||||
|
let fixture: ComponentFixture<RatingComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ RatingComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(RatingComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
25
ng6-seed/src/app/shared/rating/rating.component.ts
Normal file
25
ng6-seed/src/app/shared/rating/rating.component.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-rating',
|
||||||
|
templateUrl: './rating.component.html',
|
||||||
|
styleUrls: ['./rating.component.scss']
|
||||||
|
})
|
||||||
|
export class RatingComponent implements OnInit {
|
||||||
|
@Input() rating: number;
|
||||||
|
@Input() itemId: number;
|
||||||
|
@Output() ratingClick: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
inputName: string;
|
||||||
|
ngOnInit() {
|
||||||
|
this.inputName = this.itemId + '_rating';
|
||||||
|
}
|
||||||
|
onClick(rating: number): void {
|
||||||
|
this.rating = rating;
|
||||||
|
this.ratingClick.emit({
|
||||||
|
itemId: this.itemId,
|
||||||
|
rating: rating
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,19 +4,22 @@ import { MenuItems } from './menu-items/menu-items';
|
|||||||
import { HorizontalMenuItems } from './menu-items/horizontal-menu-items';
|
import { HorizontalMenuItems } from './menu-items/horizontal-menu-items';
|
||||||
import { AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from './accordion';
|
import { AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from './accordion';
|
||||||
import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.directive';
|
import { ToggleFullscreenDirective } from './fullscreen/toggle-fullscreen.directive';
|
||||||
|
import { RatingComponent} from './rating/rating.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AccordionAnchorDirective,
|
AccordionAnchorDirective,
|
||||||
AccordionLinkDirective,
|
AccordionLinkDirective,
|
||||||
AccordionDirective,
|
AccordionDirective,
|
||||||
ToggleFullscreenDirective
|
ToggleFullscreenDirective,
|
||||||
|
RatingComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
AccordionAnchorDirective,
|
AccordionAnchorDirective,
|
||||||
AccordionLinkDirective,
|
AccordionLinkDirective,
|
||||||
AccordionDirective,
|
AccordionDirective,
|
||||||
ToggleFullscreenDirective
|
ToggleFullscreenDirective,
|
||||||
|
RatingComponent
|
||||||
],
|
],
|
||||||
providers: [ MenuItems, HorizontalMenuItems ]
|
providers: [ MenuItems, HorizontalMenuItems ]
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user