Skip to content

Commit

Permalink
Merge pull request #111 from Sohith-code/self-registration-flow
Browse files Browse the repository at this point in the history
Removed start date and end date in self registration
  • Loading branch information
sureshece16 authored Dec 2, 2024
2 parents 4d387b0 + 94acad1 commit 827fcc9
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

::ng-deep .custom-leftmenu .mat-expansion-panel:not([class*=mat-elevation-z]) {
background: transparent !important;
margin-bottom: 8px !important;
// margin-bottom: 8px !important;
}


Expand All @@ -117,7 +117,7 @@
}

::ng-deep .menuPannel .mat-expansion-panel-header {
padding: 8px 24px !important;
padding: 16px 24px !important;
height: unset !important;
background: transparent !important;
font: 400 16px/24px Lato !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
}
}

::ng-deep .mat-expansion-panel-header {
:host ::ng-deep .mat-expansion-panel-header {
min-height: 48px !important;
height: inherit !important;
}
Expand Down
2 changes: 1 addition & 1 deletion project/ws/app/src/lib/routes/home/home.rounting.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const routes: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'welcome',
redirectTo: 'onboarding',
},
{
path: '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
<div class="self-registration-wrapper">
<div class="flex">
<div class="w-1/2 p-6 relative form-wrapper">
<ng-container *ngIf="!framewordId">
<img src="/assets/icons/bg-blur-self-registration.png" alt="icon" class="w-full">
<div class="nodata absolute inset-0 flex items-center justify-center">
<div class="flex flex-column items-center justify-center">
<img src="/assets/icons/empty_data.svg" alt="icon" class="mx-auto">
<span class="font-bold text-sm my-4 block">No designation has been imported from iGOT master.</span>
<button mat-flat-button class="mat-btn-outline" (click)="navigateTo('/app/home/org-designations')">Start
Importing</button>
</div>
</div>
</ng-container>
<ng-container *ngIf="framewordId">
<form [formGroup]="selfRegistrationForm">
<div class="create-registration-link">
<div class="flex gap-2 mb-8">
<span class="font-semibold fw-montserrat text-lg">Link Status -</span>
<div class="badge flex items-center"
[ngClass]="checkRegistrationStatus(configSvc.orgReadData.enddateregistration) ? 'active':'in-active'">
{{checkRegistrationStatus(configSvc.orgReadData.enddateregistration) ?
'Active': 'None'}}</div>

<ng-container *ngIf="!customRegistrationLinks">
<div class="w-1/2 p-6 relative form-wrapper">
<ng-container *ngIf="!framewordId">
<img src="/assets/icons/bg-blur-self-registration.png" alt="icon" class="w-full">
<div class="nodata absolute inset-0 flex items-center justify-center">
<div class="flex flex-column items-center justify-center">
<img src="/assets/icons/empty_data.svg" alt="icon" class="mx-auto">
<span class="font-bold text-sm my-4 block">No designation has been imported from iGOT master.</span>
<button mat-flat-button class="mat-btn-outline" (click)="navigateTo('/app/home/org-designations')">Start
Importing</button>
</div>
<div class="flex flex-column gap-1 w-full mat-field-rounded">
</div>
</ng-container>
<ng-container *ngIf="framewordId">
<form [formGroup]="selfRegistrationForm"
[ngClass]="{'h-full flex justify-center items-center': !customRegistrationLinks?.registrationLink}">
<div class="create-registration-link">
<div class="flex gap-2 mb-8">
<ng-container *ngIf="customRegistrationLinks?.registrationLink">
<span class="font-semibold fw-montserrat text-lg">Link Status -</span>
<div class="badge flex items-center"
[ngClass]="checkRegistrationStatus(configSvc.orgReadData.enddateregistration) ? 'active':'in-active'">
{{checkRegistrationStatus(configSvc.orgReadData.enddateregistration) ?
'Active': 'None'}}</div>
</ng-container>
</div>

<!-- <div class="flex flex-column gap-1 w-full mat-field-rounded">
<div class="flex items-center gap-1 required">
<span class="lable">Start Date</span>
</div>
Expand All @@ -32,8 +38,8 @@
<mat-datepicker-toggle matSuffix [for]="startDate"></mat-datepicker-toggle>
<mat-datepicker #startDate></mat-datepicker>
</mat-form-field>
</div>
<div class="flex flex-column gap-1 w-full mat-field-rounded">
</div> -->
<!-- <div class="flex flex-column gap-1 w-full mat-field-rounded">
<div class="flex items-center gap-1 required">
<span class="lable">End Date</span>
</div>
Expand All @@ -43,22 +49,24 @@
<mat-datepicker-toggle matSuffix [for]="endDate"></mat-datepicker-toggle>
<mat-datepicker #endDate></mat-datepicker>
</mat-form-field>
</div> -->
</div>
</div>
<div class="flex items-center justify-center mt-4">
<ng-container *ngIf="!customRegistrationLinks">
<button mat-flat-button class="mat-btn-flat" (click)="generateRegistrationLink()"
[disabled]="selfRegistrationForm.invalid">Generate Link</button>
</ng-container>
<ng-container *ngIf="customRegistrationLinks">
<button mat-flat-button class="mat-btn-outline" (click)="generateRegistrationLink()"
[disabled]="selfRegistrationForm.invalid">Publish New
Link</button>
</ng-container>
</div>
</form>
</ng-container>
</div>
<div class="flex items-center justify-center mt-4">
<ng-container *ngIf="!customRegistrationLinks">
<button mat-flat-button class="mat-btn-flat" (click)="generateRegistrationLink()"
[disabled]="selfRegistrationForm.invalid">Generate Link</button>
</ng-container>
<ng-container *ngIf="customRegistrationLinks">
<button mat-flat-button class="mat-btn-outline" (click)="generateRegistrationLink()"
[disabled]="selfRegistrationForm.invalid">Publish New
Link</button>
</ng-container>
</div>
</form>
</ng-container>
</div>
</ng-container>

<div class="w-1/2" [ngClass]="customRegistrationLinks ? 'px-4': 'p-4'">
<ng-container *ngIf="!customRegistrationLinks">
<img src="/assets/icons/bg-blur-self-registration-1.png" alt="icon">
Expand All @@ -71,24 +79,24 @@
<div class="flex gap-3 items-center">
<mat-icon class="mr-2">link</mat-icon>
<a class="brand-color cursor-pointer underline bg-inherit text-sm"
[href]="customRegistrationLinks.registrationLink"
target="_blank">{{customRegistrationLinks.registrationLink}}</a>
[href]="customRegistrationLinks?.registrationLink"
target="_blank">{{customRegistrationLinks?.registrationLink}}</a>
</div>
</div>

<div class="actions-buttons flex gap-4 items-center justify-center mt-4">
<button mat-flat-button class="mat-btn-outline"
(click)="copyLinkToClipboard(customRegistrationLinks.registrationLink);selectedButtonCode('copyLink')"
(click)="copyLinkToClipboard(customRegistrationLinks?.registrationLink);selectedButtonCode('copyLink')"
[ngClass]=" {'button-active': selectedButton==='copyLink' }">Copy Link</button>
<button mat-stroked-button class="mat-btn-outline"
(click)="sendViaEmail(customRegistrationLinks.registrationLink);selectedButtonCode('shareViaMail')"
(click)="sendViaEmail(customRegistrationLinks?.registrationLink);selectedButtonCode('shareViaMail')"
[ngClass]="{'button-active': selectedButton === 'shareViaMail'}">
<mat-icon class="mr-2"> email</mat-icon>
<span>Share on Mail</span>
</button>

<button mat-stroked-button class="mat-btn-outline"
(click)="sendViaWhatsApp(customRegistrationLinks.registrationLink);selectedButtonCode('shareViaWhatsapp')"
(click)="sendViaWhatsApp(customRegistrationLinks?.registrationLink);selectedButtonCode('shareViaWhatsapp')"
[ngClass]="{'button-active': selectedButton === 'shareViaWhatsapp'}">
<img src="/assets/icons/whatsapp.svg" alt="icon" class="mr-2" width="24" height="24">
<span>Share on Whats app</span>
Expand All @@ -99,22 +107,22 @@
<div class="wrapper-card py-4 px-12 rounded-lg mt-4">
<div class="flex justify-between">
<div class="qr-scanner-cont flex items-center">
<img [src]="customRegistrationLinks.qrRegistrationLink" alt="qr-scanner" width="115" height="115">
<img [src]="customRegistrationLinks?.qrRegistrationLink" alt="qr-scanner" width="115" height="115">
</div>
<div class="flex flex-column items-center justify-center gap-2">
<button mat-flat-button class="mat-btn-outline"
(click)="downloadQRCode(customRegistrationLinks.qrRegistrationLink);selectedButtonCode('downloadQR')"
(click)="downloadQRCode(customRegistrationLinks?.qrRegistrationLink);selectedButtonCode('downloadQR')"
[ngClass]="{'button-active': selectedButton === 'downloadQR'}">Download
QR</button>
<button mat-stroked-button class="mat-btn-outline"
(click)="sendViaEmail(customRegistrationLinks.qrRegistrationLink);selectedButtonCode('shareViaMailQR')"
(click)="sendViaEmail(customRegistrationLinks?.qrRegistrationLink);selectedButtonCode('shareViaMailQR')"
[ngClass]=" {'button-active': selectedButton==='shareViaMailQR' }">
<mat-icon class="mr-2"> email</mat-icon>
<span>Share on Mail</span>
</button>

<button mat-stroked-button class="mat-btn-outline"
(click)="sendViaWhatsApp(customRegistrationLinks.qrRegistrationLink);selectedButtonCode('shareViaWhatsappQR')"
(click)="sendViaWhatsApp(customRegistrationLinks?.qrRegistrationLink);selectedButtonCode('shareViaWhatsappQR')"
[ngClass]=" {'button-active': selectedButton==='shareViaWhatsappQR' }">
<img src="/assets/icons/whatsapp.svg" alt="icon" class="mr-2" width="24" height="24">
<span>Share on Whats app</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'
import { MatDialog } from '@angular/material/dialog'
import { ActivatedRoute, Router } from '@angular/router'
import { ICustomRegistrationQRCodeResponse, IOnBoardingConfig } from '../interface/onboarding.interface'
import { FormBuilder, FormGroup, Validators } from '@angular/forms'
import { FormBuilder, FormGroup } from '@angular/forms'
import { MatSnackBar } from '@angular/material/snack-bar'
import { Clipboard } from '@angular/cdk/clipboard'
import { LoadingPopupComponent } from '../loading-popup/loading-popup.component'
Expand All @@ -17,7 +17,7 @@ export class CustomSelfRegistrationComponent implements OnInit {
configSvc: any
onboardingConfig: IOnBoardingConfig | undefined
selfRegistrationForm!: FormGroup
customRegistrationLinks!: ICustomRegistrationQRCodeResponse
customRegistrationLinks: ICustomRegistrationQRCodeResponse | any
rootOrdId = ''
framewordId = ''
todayDate = new Date()
Expand All @@ -43,16 +43,17 @@ export class CustomSelfRegistrationComponent implements OnInit {
if (
this.framewordId &&
this.configSvc.orgReadData &&
this.configSvc?.orgReadData?.startdateregistration &&
this.configSvc.orgReadData?.enddateregistration
this.configSvc?.orgReadData?.registrationlink
) {
this.selfRegistrationForm.get('startDate')?.setValue(new Date(this.configSvc.orgReadData.startdateregistration))
this.selfRegistrationForm.get('endDate')?.setValue(new Date(this.configSvc.orgReadData.enddateregistration))
// this.selfRegistrationForm.get('startDate')?.setValue(new Date(this.configSvc.orgReadData.startdateregistration))
// this.selfRegistrationForm.get('endDate')?.setValue(new Date(this.configSvc.orgReadData.enddateregistration))
const links = {
registrationLink: this.configSvc.orgReadData.registrationlink,
qrRegistrationLink: this.configSvc.orgReadData.qrregistrationlink,
}
this.customRegistrationLinks = links
} else {
this.customRegistrationLinks = undefined
}
}

Expand All @@ -62,8 +63,8 @@ export class CustomSelfRegistrationComponent implements OnInit {

initializeForm(): void {
this.selfRegistrationForm = this.formBuilder.group({
startDate: ['', [Validators.required]],
endDate: ['', [Validators.required]],
startDate: [''],
endDate: [''],
})
}

Expand Down Expand Up @@ -114,22 +115,23 @@ export class CustomSelfRegistrationComponent implements OnInit {
const dialogRef = this.dialog.open(LoadingPopupComponent, {
autoFocus: false,
width: '365px',
height: '201px',
maxWidth: '80vw',
maxHeight: '90vh',
disableClose: true,
})

const payload = {
registrationStartDate: (Math.floor(this.selfRegistrationForm.controls['startDate'].value.getTime())),
registrationEndDate: (Math.floor(this.selfRegistrationForm.controls['endDate'].value.getTime())),
// registrationStartDate: (Math.floor(this.selfRegistrationForm.controls['startDate'].value.getTime())),
// registrationEndDate: (Math.floor(this.selfRegistrationForm.controls['endDate'].value.getTime())),
orgId: this.rootOrdId,
}
this.onboardingService.generateSelfRegistrationQRCode(payload).subscribe({
next: (response: any) => {
if (response.result && Object.keys(response.result).length > 0 && response.responseCode === 'OK') {
this.customRegistrationLinks = response.result
this.configSvc.orgReadData.enddateregistration = new Date(this.selfRegistrationForm.controls['endDate'].value)
this.configSvc.orgReadData.startdateregistration = new Date(this.selfRegistrationForm.controls['startDate'].value)
// this.configSvc.orgReadData.enddateregistration = new Date(this.selfRegistrationForm.controls['endDate'].value)
// this.configSvc.orgReadData.startdateregistration = new Date(this.selfRegistrationForm.controls['startDate'].value)
dialogRef.close()

} else if (response?.params?.errmsg) {
Expand All @@ -147,12 +149,13 @@ export class CustomSelfRegistrationComponent implements OnInit {
})
}

checkRegistrationStatus(endDateRegistration: string): boolean {
if (!endDateRegistration) { return false }
checkRegistrationStatus(_endDateRegistration: string): boolean {
// if (!endDateRegistration) { return false }

const endDate = new Date(endDateRegistration)
const today = new Date()
return today <= endDate
// const endDate = new Date(endDateRegistration)
// const today = new Date()
// return today <= endDate
return true
}

selectedButtonCode(type: string) {
Expand Down

0 comments on commit 827fcc9

Please sign in to comment.