หน้าล็อคอินลงชื่อเข้าใช้งาน

parent 2e759a02
import { Component, Renderer2 } from '@angular/core';
import { Component, ElementRef, Inject, Renderer2 } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { AuthService } from 'src/app/shared/services/auth.service';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-login-page',
templateUrl: './login-page.component.html',
styleUrls: ['./login-page.component.scss'],
templateUrl: './login-page2.component.html',
styleUrls: ['./login-page2.component.scss'],
})
export class LoginPageComponent {
public showPassword = false;
disabled = '';
active: any;
constructor(
private authservice: AuthService,
private router: Router,
private formBuilder: FormBuilder,
private renderer: Renderer2
) {
const bodyElement = this.renderer.selectRootElement('body', true);
constructor(@Inject(DOCUMENT)
private document: Document,
private elementRef: ElementRef,
private renderer: Renderer2,
private formBuilder: FormBuilder,
private router: Router,
private authservice: AuthService,) {
const bodyElement = this.renderer.selectRootElement('body', true);
this.renderer.setAttribute(bodyElement, 'class', 'cover1 justify-center');
}
ngOnInit(): void {
......@@ -27,6 +29,23 @@ export class LoginPageComponent {
username: ['spruko@admin.com', [Validators.required, Validators.email]],
password: ['sprukoadmin', Validators.required],
});
const authe: any = document.querySelector('.auth');
authe.setAttribute('class', 'h-full');
this.renderer.addClass(this.document.body, 'h-full');
this.renderer.addClass(this.document.body, '!py-0');
this.renderer.addClass(this.document.body, 'bg-white');
this.renderer.addClass(this.document.body, 'dark:bg-bgdark');
const html : any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.removeAttribute('data-header-styles', 'light');
//html.removeAttribute('data-nav-layout','vertical');
html.classList.add('h-full', 'light');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'dark');
}
}
// firebase
......@@ -103,5 +122,16 @@ export class LoginPageComponent {
ngOnDestroy(): void {
const bodyElement = this.renderer.selectRootElement('body', true);
this.renderer.removeAttribute(bodyElement, 'class');
this.renderer.removeClass(this.document.body, 'h-full');
this.renderer.removeClass(this.document.body, '!py-0');
this.renderer.removeClass(this.document.body, 'bg-white');
this.renderer.removeClass(this.document.body, 'dark:bg-bgdark');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.remove('h-full', 'dark');
}
const authe: any = document.querySelector('.h-full');
authe.removeAttribute('class', 'h-full');
}
}
}
\ No newline at end of file
<div class="auth">
<div class="flex h-full !py-0 bg-white dark:bg-bgdark">
<div class="grid grid-cols-12 gap-6 w-full h-full">
<div class="lg:col-span-6 col-span-12 hidden lg:block relative">
<div class="cover relative w-full h-full z-[1] p-10" >
<a routerLink="/dashboard/sales" class="header- logo">
<img style="height: 36px; width: 93px;"
src="./assets/img/brand-logos/logo-login-light.png"
alt="logo"
class="ltr:ml-auto rtl:mr-auto block"
/>
</a>
<div
class="authentication-page justify-center w-full max-w-7xl mx-auto p-0"
>
<img
src="./assets/img/loginform/Computer login-bro.png"
alt="logo"
class="mx-auto h-[500px]"
/>
</div>
</div>
</div>
<div class="lg:col-span-6 col-span-12">
<div class="authentication-page w-full">
<!-- ========== MAIN CONTENT ========== -->
<main id="content" class="w-full max-w-md mx-auto p-6">
<a routerLink="/dashboard/sales" class="header-logo">
<img
src="./assets/img/brand-logos/logo.png"
alt="logo"
class="mx-auto block dark:hidden"
/>
<img
src="./assets/img/brand-logos/desktop-dark.png"
alt="logo"
class="mx-auto hidden dark:block"
/>
</a>
<div class="mt-2">
<div class="p-4 sm:p-7">
<div class="text-center">
<h1
class="block text-2xl font-bold text-gray-800 dark:text-white"
>
Sign in
</h1>
<h1
class="block text-1xl font-bold text-gray-800 dark:text-white"
>
(ลงชื่อเข้าใช้งานระบบ)
</h1>
</div>
<div class="mt-5">
<!-- Form -->
<div>
<form [formGroup]="loginForm" (ngSubmit)="Submit()">
<div class="grid gap-y-4">
<!-- Form Group -->
<div>
<label
for="email"
class="block text-sm mb-2 dark:text-white"
>Email address (อีเมล์)</label
>
<div class="relative">
<input
type="email"
id="email"
name="email"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
placeholder="Username"
autocomplete
formControlName="username"
/>
</div>
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div>
<div class="flex justify-between items-center">
<label
for="password"
class="block text-sm mb-2 dark:text-white"
>Password (รหัสผ่าน)</label
>
<a
class="text-sm text-primary decoration-2 hover:underline font-medium"
routerLink="/forgotpassword/basic"
>Forgot password?</a
>
</div>
<div class="relative">
<input [type]="showPassword ? 'text' : 'password'"
id="password"
name="password"
class="py-2 px-3 block w-full border-gray-200 rounded-sm text-sm focus:border-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:text-white/70"
placeholder="Password"
autocomplete
formControlName="password"
/>
</div>
</div>
<!-- End Form Group -->
<!-- Checkbox -->
<div class="flex items-center">
<div class="flex">
<input
id="remember-me"
name="remember-me"
type="checkbox"
class="shrink-0 mt-0.5 border-gray-200 rounded text-primary focus:ring-primary dark:bg-bgdark dark:border-white/10 dark:checked:bg-primary dark:checked:border-primary dark:focus:ring-offset-white/10"
/>
</div>
<div class="ltr:ml-3 rtl:mr-3">
<label for="remember-me" class="text-sm dark:text-white"
>Remember me</label
>
</div>
</div>
<!-- End Checkbox -->
<a
routerLink="/dashboard/sales"
class="py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border border-transparent font-semibold bg-primary text-white hover:bg-primary focus:outline-none focus:ring-0 focus:ring-primary focus:ring-offset-0 transition-all text-sm dark:focus:ring-offset-white/10"
>Sign in</a
>
<div class="text-center">
<p class="mt-3 text-sm text-gray-600 dark:text-white/70">
Don't have an account yet?
(คุณมีบัญชีเเล้วหรือยัง?)
<a
class="text-primary decoration-2 hover:underline font-medium"
routerLink="/signin/basic"
>
Sign up here
(กรุณาลงทะเบียนที่นี่ หากคุณยังไม่มีบัญชีเข้าใช้)
</a>
</p>
</div>
</div>
</form>
</div>
<!-- End Form -->
</div>
</div>
</div>
</main>
<!-- ========== END MAIN CONTENT ========== -->
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
.cover::before{
position: absolute;
left: 0px;
right: 0px;
top: 0px;
z-index: -1;
height: 100%;
width: 100%;
content: var(--tw-content);
background-image: url('/assets/img/loginform/bg_signup.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
@media (min-width: 480px){
.authentication-page{
padding-top: 1rem;
padding-bottom: 1rem;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment