Browse Source

Sunday pre-release 10/04/2022

devBranch
Benjamin Arhen 3 years ago
parent
commit
73d9b5bf20
  1. 44
      src/app/layout/common/user/user.component.html
  2. 15
      src/app/layout/common/user/user.component.ts
  3. 2
      src/app/pages/auth/sign-in/sign-in.component.html
  4. 15
      src/app/pages/auth/sign-in/sign-in.component.ts

44
src/app/layout/common/user/user.component.html

@ -1,22 +1,14 @@
<!-- Button --> <!-- Button -->
<button <button mat-icon-button [matMenuTriggerFor]="userActions">
mat-icon-button
[matMenuTriggerFor]="userActions">
<span class="relative"> <span class="relative">
<img <img class="w-10 h-10 rounded-full" *ngIf="showAvatar && user.businessLogo"
class="w-10 h-10 rounded-full"
*ngIf="showAvatar && user.businessLogo"
[src]="imageLoader(user.businessLogo,user.handle)"> [src]="imageLoader(user.businessLogo,user.handle)">
<mat-icon <mat-icon *ngIf="!showAvatar || !user.businessLogo" [svgIcon]="'heroicons_outline:user-circle'"></mat-icon>
*ngIf="!showAvatar || !user.businessLogo"
[svgIcon]="'heroicons_outline:user-circle'"></mat-icon>
</span> </span>
</button> </button>
<mat-menu <mat-menu [xPosition]="'before'" #userActions="matMenu">
[xPosition]="'before'"
#userActions="matMenu">
<button mat-menu-item> <button mat-menu-item>
<span class="flex flex-col leading-none"> <span class="flex flex-col leading-none">
<span>Signed in as</span> <span>Signed in as</span>
@ -28,39 +20,31 @@
<mat-icon [svgIcon]="'heroicons_outline:user-circle'"></mat-icon> <mat-icon [svgIcon]="'heroicons_outline:user-circle'"></mat-icon>
<span>Profile</span> <span>Profile</span>
</button> </button>
<button mat-menu-item (click)="generateCode()">
<mat-icon [svgIcon]="'heroicons_outline:qrcode'"></mat-icon>
<a href="javascript:void(0)" style="text-decoration: none;margin-right:10px;">Generate QR-Code</a>
</button>
<mat-divider class="my-2"></mat-divider> <mat-divider class="my-2"></mat-divider>
<button <button mat-menu-item (click)="signOut()">
mat-menu-item
(click)="signOut()">
<mat-icon [svgIcon]="'heroicons_outline:logout'"></mat-icon> <mat-icon [svgIcon]="'heroicons_outline:logout'"></mat-icon>
<span>Sign out</span> <span>Sign out</span>
</button> </button>
</mat-menu> </mat-menu>
<mat-menu <mat-menu class="user-status-menu" #userStatus="matMenu">
class="user-status-menu" <button mat-menu-item (click)="updateUserStatus('online')">
#userStatus="matMenu">
<button
mat-menu-item
(click)="updateUserStatus('online')">
<span class="w-4 h-4 mr-3 rounded-full bg-green-500"></span> <span class="w-4 h-4 mr-3 rounded-full bg-green-500"></span>
<span>Online</span> <span>Online</span>
</button> </button>
<button <button mat-menu-item (click)="updateUserStatus('away')">
mat-menu-item
(click)="updateUserStatus('away')">
<span class="w-4 h-4 mr-3 rounded-full bg-amber-500"></span> <span class="w-4 h-4 mr-3 rounded-full bg-amber-500"></span>
<span>Away</span> <span>Away</span>
</button> </button>
<button <button mat-menu-item (click)="updateUserStatus('busy')">
mat-menu-item
(click)="updateUserStatus('busy')">
<span class="w-4 h-4 mr-3 rounded-full bg-red-500"></span> <span class="w-4 h-4 mr-3 rounded-full bg-red-500"></span>
<span>Busy</span> <span>Busy</span>
</button> </button>
<button <button mat-menu-item (click)="updateUserStatus('not-visible')">
mat-menu-item
(click)="updateUserStatus('not-visible')">
<span class="w-4 h-4 mr-3 rounded-full bg-gray-400"></span> <span class="w-4 h-4 mr-3 rounded-full bg-gray-400"></span>
<span>Invisible</span> <span>Invisible</span>
</button> </button>

15
src/app/layout/common/user/user.component.ts

@ -9,6 +9,8 @@ import { TesoBusinessDetail } from 'app/models/businessModel';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { SettingsComponent } from 'app/pages/admin/Profile/Settings/settings.component'; import { SettingsComponent } from 'app/pages/admin/Profile/Settings/settings.component';
import { ProfileService } from 'app/pages/admin/Profile/profile.service';
import { QrcodeDialogComponent } from 'app/pages/admin/Profile/QRCode/qrcode-dialog.component';
@Component({ @Component({
selector: 'user', selector: 'user',
@ -35,6 +37,7 @@ export class UserComponent implements OnInit, OnDestroy {
private _router: Router, private _router: Router,
private _userService: UserService, private _userService: UserService,
private dialog: MatDialog, private dialog: MatDialog,
private _profileService: ProfileService,
) { ) {
} }
@ -110,4 +113,16 @@ export class UserComponent implements OnInit, OnDestroy {
disableClose: true, disableClose: true,
}) })
} }
generateCode() {
var dataImagge;
this._profileService.getQRCode().subscribe((response) => {
dataImagge = response;
this.dialog.open(QrcodeDialogComponent, {
hasBackdrop: true,
width: "400px",
height: "450px",
data: { image: dataImagge }
});
});
}
} }

2
src/app/pages/auth/sign-in/sign-in.component.html

@ -117,7 +117,7 @@
<mat-form-field appearance="outline"> <mat-form-field appearance="outline">
<ngx-mat-intl-tel-input [preferredCountries]="['gh', 'ng']" [onlyCountries]="['gh', 'ng']" <ngx-mat-intl-tel-input [preferredCountries]="['gh', 'ng']" [onlyCountries]="['gh', 'ng']"
[enablePlaceholder]="true" [enableSearch]="false" name="phone" formControlName="phone"> [enablePlaceholder]="true" [enableSearch]="false" name="phone" formControlName="phone" >
</ngx-mat-intl-tel-input> </ngx-mat-intl-tel-input>
<mat-hint style="color: wheat;">Standard call, message, or data rates may apply.</mat-hint> <mat-hint style="color: wheat;">Standard call, message, or data rates may apply.</mat-hint>
</mat-form-field> </mat-form-field>

15
src/app/pages/auth/sign-in/sign-in.component.ts

@ -8,11 +8,9 @@ import { AuthService } from 'app/core/auth/auth.service';
import { WindowService } from 'app/window.service'; import { WindowService } from 'app/window.service';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { getAuth, RecaptchaVerifier, signInWithPhoneNumber } from "firebase/auth";
import firebase from 'firebase/compat/app'; import firebase from 'firebase/compat/app';
import 'firebase/compat/auth'; import 'firebase/compat/auth';
import 'firebase/compat/firestore'; import 'firebase/compat/firestore';
import { environment } from 'environments/environment';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { VerificationDialogComponent } from '../verification/verification-dialog.component'; import { VerificationDialogComponent } from '../verification/verification-dialog.component';
import { ProfileImage } from 'app/models/generalModel'; import { ProfileImage } from 'app/models/generalModel';
@ -98,12 +96,7 @@ export class AuthSignInComponent implements OnInit {
* Sign in * Sign in
*/ */
authenticate(): void { authenticate(): void {
console.log(this.tryagin)
console.log(this.phonenumber)
// if(!this.phonenumber && this.phonenumber != this.previousNumber){
this.phonenumber = this.signInForm.get('phone').value; this.phonenumber = this.signInForm.get('phone').value;
// }
console.log(this.phonenumber)
this.showAlert = false; this.showAlert = false;
if (this.phonenumber) if (this.phonenumber)
if (this.tryagin < 3 || this.phonenumber != this.previousNumber) { if (this.tryagin < 3 || this.phonenumber != this.previousNumber) {
@ -190,6 +183,11 @@ export class AuthSignInComponent implements OnInit {
}); });
}).catch((error) => { }).catch((error) => {
// this.signInForm.reset(); // this.signInForm.reset();
this.alert = {
type: "error",
message: "An error occurred while authenticating you please try again after a while this could be a result poor internet connection"
}
this.showAlert = true;
grecaptcha.reset(this.recaptchedID); grecaptcha.reset(this.recaptchedID);
this.previousNumber = this.phonenumber; this.previousNumber = this.phonenumber;
}); });
@ -206,7 +204,7 @@ export class AuthSignInComponent implements OnInit {
} else { } else {
this.alert = { this.alert = {
type: "error", type: "error",
message: "An error occurred while authenticating you please try again after a while this could poor internet connection" message: "An error occurred while authenticating you please try again after a while this could be a result poor internet connection"
} }
this.showAlert = true; this.showAlert = true;
} }
@ -230,7 +228,6 @@ export class AuthSignInComponent implements OnInit {
} }
clear() { clear() {
console.log(this.newProfilePicture)
this.newProfilePicture = {}; this.newProfilePicture = {};
} }

Loading…
Cancel
Save