first commit
This commit is contained in:
35
templete/src/app/app-routing.module.ts
Normal file
35
templete/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { SidebarContentComponent } from './content/sidebar-content/sidebar-content.component';
|
||||
import { LicensePrivacyTermsComponent } from './component/license-privacy-terms/license-privacy-terms.component';
|
||||
|
||||
const routes: Routes = [
|
||||
|
||||
{ path: 'login', loadChildren: () => import('./controls/login-control/login-control.module').then(m => m.LoginControlModule) },
|
||||
|
||||
{ path: 'license', component: LicensePrivacyTermsComponent},
|
||||
|
||||
{
|
||||
path: 'main',
|
||||
component: SidebarContentComponent, // ✅ ใช้ layout นี้โดยตรง
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () =>
|
||||
import('./controls/main-control/main-control.module').then(
|
||||
(m) => m.MainControlModule
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{ path: '', redirectTo: 'login', pathMatch: 'full' },
|
||||
|
||||
{ path: '**', redirectTo: 'login' }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule {}
|
||||
0
templete/src/app/app.component.css
Normal file
0
templete/src/app/app.component.css
Normal file
1
templete/src/app/app.component.html
Normal file
1
templete/src/app/app.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
11
templete/src/app/app.component.ts
Normal file
11
templete/src/app/app.component.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
standalone: false,
|
||||
styleUrl: './app.component.css'
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'accounting-ng-nuttakit';
|
||||
}
|
||||
45
templete/src/app/app.module.ts
Normal file
45
templete/src/app/app.module.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
// import { LayoutComponent } from './content/content/layout/layout.component';
|
||||
import { SidebarContentComponent } from './content/sidebar-content/sidebar-content.component';
|
||||
import { SidebarComponent } from './component/sidebar/sidebar.component';
|
||||
// import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { LicensePrivacyTermsComponent } from './component/license-privacy-terms/license-privacy-terms.component';
|
||||
import { MainDashboardContentComponent } from './content/main-dashboard-content/main-dashboard-content.component';
|
||||
// import { MainDashboardComponent } from './component/main-dashboard/main-dashboard.component';
|
||||
// import { LoginForgotComponent } from './component/login-forgot/login-forgot.component';
|
||||
// import { LoginPageComponent } from './component/login-page/login-page.component';
|
||||
// import { LoginContentComponent } from './content/login-content/login-content.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
// LayoutComponent,
|
||||
SidebarContentComponent,
|
||||
SidebarComponent,
|
||||
LicensePrivacyTermsComponent,
|
||||
MainDashboardContentComponent,
|
||||
// MainDashboardComponent,
|
||||
// LoginForgotComponent,
|
||||
// LoginPageComponent,
|
||||
// LoginPageComponentComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
// ReactiveFormsModule,
|
||||
BrowserAnimationsModule,
|
||||
AppRoutingModule,
|
||||
HttpClientModule,
|
||||
FontAwesomeModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
@@ -0,0 +1,68 @@
|
||||
.policy-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
background: linear-gradient(135deg, #f3f6f9 0%, #e9eff5 100%);
|
||||
min-height: 100vh;
|
||||
padding: 40px 20px;
|
||||
color: #1a1f36;
|
||||
font-family: "Sarabun", "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
max-width: 800px;
|
||||
width: 100%;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
|
||||
padding: 40px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 13px;
|
||||
color: #6b737a;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
section {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 20px;
|
||||
margin-bottom: 10px;
|
||||
color: #0b1a2b;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 15px;
|
||||
color: #333;
|
||||
margin-bottom: 12px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0078d4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.footer-text {
|
||||
color: #6b737a;
|
||||
font-size: 13px;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<div class="policy-container">
|
||||
<div class="card">
|
||||
<h1 class="page-title">ข้อตกลงสิทธิ์การใช้งาน นโยบายความเป็นส่วนตัว และเงื่อนไขการให้บริการ</h1>
|
||||
<p class="subtitle">ปรับปรุงล่าสุด: 27 ตุลาคม 2025</p>
|
||||
|
||||
<section>
|
||||
<h2>1. ข้อตกลงสิทธิ์การใช้งาน (License Agreement)</h2>
|
||||
<p>
|
||||
ซอร์สโค้ด ส่วนประกอบ และทรัพย์สินการออกแบบทั้งหมดภายใต้โครงการ Nuttakit Software
|
||||
อยู่ภายใต้สัญญาอนุญาตแบบ <strong>MIT License</strong> เว้นแต่จะมีการระบุเป็นอย่างอื่นโดยเฉพาะ
|
||||
</p>
|
||||
<p>
|
||||
ท่านได้รับสิทธิ์ในการใช้งาน คัดลอก แก้ไข รวม รวมเข้ากับซอฟต์แวร์อื่น เผยแพร่ หรือแจกจ่ายซอฟต์แวร์นี้
|
||||
เพื่อวัตถุประสงค์ส่วนตัวหรือเชิงพาณิชย์ได้
|
||||
โดยต้องคงไว้ซึ่งข้อความลิขสิทธิ์และข้อความอนุญาตนี้ในสำเนาทั้งหมดของซอฟต์แวร์
|
||||
</p>
|
||||
<p>
|
||||
ซอฟต์แวร์นี้ถูกจัดให้ “ตามสภาพ” (AS IS)
|
||||
โดยไม่มีการรับประกันใด ๆ ไม่ว่าจะโดยชัดแจ้งหรือโดยนัย
|
||||
รวมถึงแต่ไม่จำกัดเฉพาะการรับประกันความเหมาะสมในการใช้งานหรือความถูกต้องของข้อมูล
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>2. นโยบายความเป็นส่วนตัว (Privacy Policy)</h2>
|
||||
<p>
|
||||
NuttakitSoftwareให้ความสำคัญกับความเป็นส่วนตัวของผู้ใช้งาน
|
||||
แอปพลิเคชันของเราจะเก็บข้อมูลเพียงบางส่วนเท่านั้น เช่น รหัสอุปกรณ์
|
||||
บันทึกการทำงาน หรือสถิติการใช้งาน
|
||||
เพื่อใช้ในการวิเคราะห์ ปรับปรุง และพัฒนาประสิทธิภาพของระบบ
|
||||
</p>
|
||||
<p>
|
||||
ข้อมูลส่วนบุคคล (Personal Identifiable Information — PII)
|
||||
จะไม่ถูกขาย แบ่งปัน หรือโอนไปยังบุคคลที่สามโดยไม่ได้รับความยินยอมจากท่านอย่างชัดเจน
|
||||
</p>
|
||||
<p>
|
||||
เราใช้มาตรฐานการเข้ารหัสระดับอุตสาหกรรม (AES-CBC)
|
||||
เพื่อรักษาความปลอดภัยในการส่งข้อมูลระหว่างแอปพลิเคชัน เซิร์ฟเวอร์ และ API
|
||||
</p>
|
||||
<p>
|
||||
ผู้ใช้สามารถร้องขอให้ลบหรือขอรับสำเนาข้อมูลของตนเองได้ตลอดเวลา
|
||||
โดยติดต่อทีมสนับสนุนของเรา
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>3. เงื่อนไขการให้บริการ (Terms of Service)</h2>
|
||||
<p>
|
||||
เมื่อท่านใช้งานซอฟต์แวร์หรือบริการของเรา ถือว่าท่านยอมรับและปฏิบัติตามกฎหมายและข้อบังคับที่เกี่ยวข้องทั้งหมด
|
||||
</p>
|
||||
<p>
|
||||
ท่านจะต้องไม่ใช้ซอฟต์แวร์ของเราในทางที่ผิด
|
||||
ไม่พยายามถอดรหัส แก้ไข ดัดแปลง หรือแสวงหาประโยชน์จากช่องโหว่ในระบบโดยไม่ได้รับอนุญาต
|
||||
</p>
|
||||
<p>
|
||||
Nuttakit ขอสงวนสิทธิ์ในการแก้ไขหรือยุติการให้บริการโดยไม่ต้องแจ้งให้ทราบล่วงหน้า
|
||||
หากตรวจพบการละเมิดความปลอดภัยหรือการใช้งานที่ไม่เหมาะสม
|
||||
</p>
|
||||
<p>
|
||||
ทีมพัฒนา Nuttakit และผู้ร่วมพัฒนาไม่รับผิดชอบต่อความเสียหายใด ๆ
|
||||
ที่อาจเกิดจากการใช้งานหรือไม่สามารถใช้งานซอฟต์แวร์นี้ได้
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>4. ช่องทางการติดต่อ (Contact)</h2>
|
||||
<p>
|
||||
หากท่านมีข้อสงสัยหรือข้อกังวลเกี่ยวกับข้อมูลส่วนบุคคลหรือเงื่อนไขการให้บริการ
|
||||
สามารถติดต่อเราได้ที่:
|
||||
<br />
|
||||
<strong>อีเมล:</strong> support@nuttakit.work<br />
|
||||
<strong>เว็บไซต์:</strong>
|
||||
<a href="https://nuttakit.work" target="_blank">https://nuttakit.work</a>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<hr />
|
||||
<p class="footer-text">© 2025 Nuttakit Software. สงวนลิขสิทธิ์ทั้งหมด</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-license-privacy-terms',
|
||||
standalone: false,
|
||||
templateUrl: './license-privacy-terms.component.html',
|
||||
styleUrl: './license-privacy-terms.component.css'
|
||||
})
|
||||
export class LicensePrivacyTermsComponent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
:root {
|
||||
--bg-1: #f3f6f9;
|
||||
--card-bg: #ffffff;
|
||||
--muted: #6b737a;
|
||||
--text: #0b1a2b;
|
||||
--primary: #0078d4;
|
||||
--primary-600: #0065b8;
|
||||
--radius: 8px;
|
||||
--shadow: 0 10px 30px rgba(11,26,43,0.08);
|
||||
--glass: rgba(255,255,255,0.6);
|
||||
}
|
||||
|
||||
/* Page layout */
|
||||
.login-widget {
|
||||
/* Fill the viewport and center the card. Do not let the page itself
|
||||
scroll; the card gets an internal max-height instead. */
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 28px 18px;
|
||||
background: linear-gradient(180deg, #f7f9fb 0%, var(--bg-1) 100%);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
|
||||
/* Card */
|
||||
.login-widget .card{
|
||||
width: 380px;
|
||||
max-width: calc(100% - 40px);
|
||||
background: var(--card-bg);
|
||||
border-radius: calc(var(--radius) + 2px);
|
||||
box-shadow: var(--shadow);
|
||||
padding: 22px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
/* Constrain the card so it never forces the page to scroll. If content
|
||||
grows, the card will scroll internally. */
|
||||
max-height: calc(100vh - 56px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Modal/backdrop styles */
|
||||
.login-backdrop{
|
||||
position: fixed;
|
||||
inset: 0; /* top:0; right:0; bottom:0; left:0; */
|
||||
background: rgba(0,0,0,0.38);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1040;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.login-modal{ width: 480px; max-width: 480px; }
|
||||
|
||||
.modal-card{
|
||||
border-radius: 12px;
|
||||
padding: 0; /* card children control internal padding */
|
||||
overflow: hidden;
|
||||
box-shadow: 0 20px 50px rgba(2,6,23,0.4);
|
||||
}
|
||||
|
||||
/* Slightly larger brand area inside modal */
|
||||
.modal-card .brand{ padding: 18px; }
|
||||
|
||||
/* Make the primary button pill-shaped and slightly larger */
|
||||
button.primary{
|
||||
color: #000;
|
||||
border-radius: 999px;
|
||||
padding: 10px 18px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* Make biometric and other action buttons visually lighter */
|
||||
.biometric{
|
||||
border-radius: 999px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
/* On small screens reduce modal padding and width to avoid overflow */
|
||||
@media (max-width: 420px){
|
||||
.login-backdrop{ padding: 12px; }
|
||||
.login-modal{ max-width: 100%; }
|
||||
.modal-card .brand{ padding: 12px; }
|
||||
}
|
||||
|
||||
/* Brand area */
|
||||
.brand{
|
||||
text-align: center;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid #eef2f5;
|
||||
}
|
||||
.brand .logo{
|
||||
height: 44px;
|
||||
width: 44px;
|
||||
object-fit: contain;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.brand h1{
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.2px;
|
||||
color: var(--text);
|
||||
}
|
||||
.brand .subtitle{
|
||||
margin: 6px 0 12px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Form area */
|
||||
.form{
|
||||
/* keep compact spacing inside the card */
|
||||
/* width: 410px; */
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 6px 0 2px;
|
||||
}
|
||||
|
||||
/* Field label wrapper */
|
||||
.field{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.field .label-text{
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
input[type="email"],
|
||||
input[type="password"],
|
||||
input[type="text"]{
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 12px;
|
||||
font-size: 15px;
|
||||
color: var(--text);
|
||||
background: #fff;
|
||||
border: 1px solid #d8dee6;
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
transition: box-shadow .14s ease, border-color .14s ease, transform .06s ease;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
input::placeholder{
|
||||
color: #9aa3ad;
|
||||
}
|
||||
input:focus{
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 6px 20px rgba(0,120,212,0.10);
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
/* Checkbox / stay signed */
|
||||
.stay-signed{
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.stay-signed input[type="checkbox"]{
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
accent-color: var(--primary);
|
||||
}
|
||||
|
||||
/* Actions row */
|
||||
.actions{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
button.primary{
|
||||
background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
|
||||
color: #000000;
|
||||
border: none;
|
||||
padding: 10px 14px;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 6px 18px rgba(0,120,212,0.12);
|
||||
transition: transform .06s ease, box-shadow .12s ease, opacity .12s ease;
|
||||
}
|
||||
button.primary:hover:not(:disabled){
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 10px 24px rgba(0,120,212,0.14);
|
||||
}
|
||||
button.primary:active{
|
||||
transform: translateY(0);
|
||||
}
|
||||
button.primary:disabled{
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Alternative options */
|
||||
.alt-options{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.biometric{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
background: transparent;
|
||||
color: var(--primary);
|
||||
border: 1px solid rgba(0,120,212,0.14);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
.biometric svg{ display: block; opacity: .95; }
|
||||
.biometric:hover{
|
||||
background: rgba(0,120,212,0.04);
|
||||
}
|
||||
|
||||
/* Help link */
|
||||
.help-link{
|
||||
margin-left: auto;
|
||||
font-size: 13px;
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
.help-link:hover{ text-decoration: underline; }
|
||||
|
||||
/* Footer */
|
||||
.footer{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #eef2f5;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.footer a{
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
.footer a:hover{ text-decoration: underline; }
|
||||
.divider{ color: #d0d6db; }
|
||||
|
||||
/* Focus styles for keyboard users */
|
||||
:focus{
|
||||
outline: none;
|
||||
}
|
||||
:focus-visible{
|
||||
outline: 3px solid rgba(0,120,212,0.12);
|
||||
outline-offset: 2px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* Small screens */
|
||||
@media (max-width:420px){
|
||||
.login-widget .card{
|
||||
padding: 18px;
|
||||
width: 100%;
|
||||
}
|
||||
.brand h1{ font-size: 18px; }
|
||||
.brand .subtitle{
|
||||
font-family: "Kanit";
|
||||
font-weight: 1000;
|
||||
font-style: normal; }
|
||||
.biometric span, .primary{ font-size: 13px; }
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<div class="login-backdrop">
|
||||
<div class="login-modal d-flex align-items-center justify-content-center ">
|
||||
<div class="card modal-card" role="dialog" aria-labelledby="signin-title" aria-modal="true">
|
||||
<div class="brand">
|
||||
<!-- <img src="assets/logo.png" alt="Company logo" class="logo" /> -->
|
||||
<img src="logo.png" alt="Company logo" class="logo mb-2"/>
|
||||
<h1 id="signin-title" class='kanit-bold'>ลืมรหัสผ่าน</h1>
|
||||
<p class="subtitle">โปรดกรอก Email ของท่าน</p>
|
||||
</div>
|
||||
<form [formGroup]="forgotFrm" class="form px-3 pb-3 login-mobile">
|
||||
<label class="field">
|
||||
<span class="label-text ">อีเมล์</span>
|
||||
<input type="email" formControlName="email" class="px-2 " id="englishInput" autocomplete="username" placeholder="nuttakit@gmail.com" aria-label="Email address" required />
|
||||
</label>
|
||||
|
||||
@if (isSendOtp === true) {
|
||||
<label class="field">
|
||||
<span class="label-text">รหัสยืนยัน OTP</span>
|
||||
<input type="email" formControlName="otp" autocomplete="otp" placeholder="123456" alt required/>
|
||||
</label>
|
||||
}
|
||||
<!-- <div class="justify-end flex"> -->
|
||||
<!-- <label class="stay-signed">
|
||||
<input type="checkbox" formControlName="remember" />
|
||||
<span>จดจำรหัสผ่าน</span>
|
||||
</label> -->
|
||||
<div class="flex flex-row gap-2 mt-4 justify-end">
|
||||
<div class="flex-row hover:-translate-y-2.5 transform transition-all">
|
||||
<button class="bg-[linear-gradient(180deg,var(--primary)_0%,var(--primary-600)_100%)]
|
||||
text-black
|
||||
border-0
|
||||
px-3.5 py-2.5
|
||||
rounded-md
|
||||
font-semibold
|
||||
cursor-pointer
|
||||
text-[14px]
|
||||
shadow-[0_6px_18px_var(--color-blue-500)]
|
||||
transition
|
||||
ease-in-out
|
||||
duration-100
|
||||
hover:scale-[1.02]
|
||||
active:opacity-90" (click)="isModalOpen = true">
|
||||
เปิด Modal
|
||||
</button>
|
||||
</div>
|
||||
@if (isSendOtp === false) {
|
||||
<div class="flex justify-end">
|
||||
@if (isLoading === true) {
|
||||
<button type="submit" class="primary cursor-progress!" disabled>
|
||||
กำลังส่ง...
|
||||
</button>
|
||||
} @else {
|
||||
<button type="submit" class="primary" (click)="onSubmin()">
|
||||
{{ 'ยืนยันส่ง OTP รีเซ็ตรหัสผ่าน' }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
} @else if(isSendOtp === true) {
|
||||
<div class="flex justify-end gap-2">
|
||||
<button type="button" class="primary" (click)="onSubmin()">
|
||||
{{ 'ส่งอีกครั้ง' }}
|
||||
</button>
|
||||
<button type="submit" class="primary" (click)="onVerifySubmit()">
|
||||
{{ 'รีเซ็ตรหัสผ่าน' }}
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<!-- <button mat-raised-button color="primary" [disabled]="isLoading">
|
||||
{{ isLoading ? 'กำลังส่ง...' : 'ส่งรหัส OTP' }}
|
||||
</button> -->
|
||||
<!-- } -->
|
||||
<!-- </div> -->
|
||||
</form>
|
||||
@if(isModalOpen){
|
||||
<div class="fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50" [formGroup]="forgotFrm">
|
||||
<div class="bg-white p-6 rounded-lg shadow-lg max-w-sm w-fit">
|
||||
<h2 class="text-xl font-bold mb-4">เปลี่ยนรหัสผ่าน</h2>
|
||||
<hr class="w-full h-1 bg-gray-300 rounded-sm shadow-neutral-400 md:my-1">
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">รหัสผ่านใหม่</label>
|
||||
<input type="password" id="newPassword" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" formControlName="newPassword" placeholder="กรอกรหัสผ่านใหม่">
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="confirmPassword" class="block text-sm font-medium text-gray-700 mb-1">ยืนยันรหัสผ่านใหม่</label>
|
||||
<input type="password" id="confirmPassword" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" formControlName="confirmPassword" placeholder="กรอกยืนยันรหัสผ่านใหม่">
|
||||
@if ( this.forgotFrm.get('confirmPassword')!.touched && this.forgotFrm.get('newPassword')?.value !== this.forgotFrm.get('confirmPassword')?.value ){
|
||||
<span class="text-red-600 md">รหัสผ่านไม่ตรงกัน</span>
|
||||
}
|
||||
</div>
|
||||
<!-- <hr class="w-full h-[] bg-gray-100 border-0 rounded-sm md:my-1 dark:bg-gray-700"> -->
|
||||
<div class="flex justify-end gap-2">
|
||||
<button class="bg-red-500 text-white px-4 py-2 rounded" (click)="isModalOpen = false">
|
||||
ปิด
|
||||
</button>
|
||||
<button class="bg-green-500 text-white px-4 py-2 rounded shadow-[0_1px_18px_var(--color-green-300)] hover:-translate-y-1.5 hover:shadow-[0_6px_18px_var(--color-green-500)] transition-all duration-500 ease-in-out" (click)="onSetNewPassword()">
|
||||
ยืนยัน
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,91 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { GeneralService } from '../../services/generalservice';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-forgot',
|
||||
standalone: false,
|
||||
templateUrl: './login-forgot.component.html',
|
||||
styleUrl: './login-forgot.component.css'
|
||||
})
|
||||
export class LoginForgotComponent implements OnInit {
|
||||
// @Input() brandName = 'Contoso';
|
||||
// @Input() subtitle = 'to your account';
|
||||
// @Input() mode = '';
|
||||
@Output() otpEventSubmit = new EventEmitter<any>();
|
||||
@Output() otpVerifyEventSubmit = new EventEmitter<any>();
|
||||
|
||||
forgotFrm!: FormGroup;
|
||||
isLoading: boolean = false;
|
||||
isSendOtp: boolean = false;
|
||||
isModalOpen: boolean = false;
|
||||
// busy = false;
|
||||
// message = '';
|
||||
|
||||
constructor(
|
||||
// private generalService: GeneralService
|
||||
// private fb: FormBuilder
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setupFormControl();
|
||||
}
|
||||
|
||||
setupFormControl(){
|
||||
this.forgotFrm = new FormGroup({
|
||||
email: new FormControl('',[Validators.required, Validators.email, Validators.maxLength(100)]),
|
||||
otp: new FormControl('',[Validators.required, Validators.maxLength(6)]),
|
||||
newPassword: new FormControl('',[Validators.required, Validators.maxLength(50)]),
|
||||
confirmPassword: new FormControl('',[Validators.required, Validators.maxLength(50)])
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
EventSubmit(event: any){
|
||||
this.otpEventSubmit.emit(event);
|
||||
}
|
||||
|
||||
|
||||
VerifyEventSubmit(event: any){
|
||||
this.otpVerifyEventSubmit.emit(event);
|
||||
}
|
||||
|
||||
onSubmin(){
|
||||
let data = {
|
||||
email: this.forgotFrm.get('email')?.value
|
||||
}
|
||||
|
||||
this.EventSubmit(data);
|
||||
}
|
||||
|
||||
onVerifySubmit(){
|
||||
let data = {
|
||||
email: this.forgotFrm.get('email')?.value,
|
||||
otp: this.forgotFrm.get('otp')?.value
|
||||
}
|
||||
this.VerifyEventSubmit(data);
|
||||
}
|
||||
|
||||
onSetNewPassword(){
|
||||
let newpassword = this.forgotFrm.get('newPassword')?.value;
|
||||
let confirmPassword = this.forgotFrm.get('confirmPassword')?.value;
|
||||
|
||||
let data = {
|
||||
email: this.forgotFrm.get('email')?.value,
|
||||
otp: this.forgotFrm.get('otp')?.value,
|
||||
newPassword: newpassword
|
||||
}
|
||||
|
||||
if (newpassword.trim() === confirmPassword.trim()) {
|
||||
// this.VerifyEventSubmit(data);
|
||||
console.log("Password matched! (รหัสผ่านตรงกัน)");
|
||||
} else {
|
||||
console.error("Password mismatched! (รหัสผ่านไม่ตรงกัน)");
|
||||
}
|
||||
|
||||
// console.log(newpassword.value);
|
||||
|
||||
}
|
||||
// otp: }
|
||||
}
|
||||
289
templete/src/app/component/login-page/login-page.component.css
Normal file
289
templete/src/app/component/login-page/login-page.component.css
Normal file
@@ -0,0 +1,289 @@
|
||||
:root {
|
||||
--bg-1: #f3f6f9;
|
||||
--card-bg: #ffffff;
|
||||
--muted: #6b737a;
|
||||
--text: #0b1a2b;
|
||||
--primary: #0078d4;
|
||||
--primary-600: #0065b8;
|
||||
--radius: 8px;
|
||||
--shadow: 0 10px 30px rgba(11,26,43,0.08);
|
||||
--glass: rgba(255,255,255,0.6);
|
||||
}
|
||||
|
||||
/* Page layout */
|
||||
.login-widget {
|
||||
/* Fill the viewport and center the card. Do not let the page itself
|
||||
scroll; the card gets an internal max-height instead. */
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 28px 18px;
|
||||
background: linear-gradient(180deg, #f7f9fb 0%, var(--bg-1) 100%);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
|
||||
/* Card */
|
||||
.login-widget .card{
|
||||
width: 380px;
|
||||
max-width: calc(100% - 40px);
|
||||
background: var(--card-bg);
|
||||
border-radius: calc(var(--radius) + 2px);
|
||||
box-shadow: var(--shadow);
|
||||
padding: 22px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
/* Constrain the card so it never forces the page to scroll. If content
|
||||
grows, the card will scroll internally. */
|
||||
max-height: calc(100vh - 56px);
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* Modal/backdrop styles */
|
||||
.login-backdrop{
|
||||
position: fixed;
|
||||
inset: 0; /* top:0; right:0; bottom:0; left:0; */
|
||||
background: rgba(0,0,0,0.38);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1040;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.login-modal{ width: 480px; max-width: 480px; }
|
||||
|
||||
.modal-card{
|
||||
border-radius: 12px;
|
||||
padding: 0; /* card children control internal padding */
|
||||
overflow: hidden;
|
||||
box-shadow: 0 20px 50px rgba(2,6,23,0.4);
|
||||
}
|
||||
|
||||
/* Slightly larger brand area inside modal */
|
||||
.modal-card .brand{ padding: 18px; }
|
||||
|
||||
/* Make the primary button pill-shaped and slightly larger */
|
||||
button.primary{
|
||||
color: #000;
|
||||
border-radius: 999px;
|
||||
padding: 10px 18px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* Make biometric and other action buttons visually lighter */
|
||||
.biometric{
|
||||
border-radius: 999px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
/* On small screens reduce modal padding and width to avoid overflow */
|
||||
@media (max-width: 420px){
|
||||
.login-backdrop{ padding: 12px; }
|
||||
.login-modal{ max-width: 100%; }
|
||||
.modal-card .brand{ padding: 12px; }
|
||||
}
|
||||
|
||||
/* Brand area */
|
||||
.brand{
|
||||
text-align: center;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid #eef2f5;
|
||||
}
|
||||
.brand .logo{
|
||||
height: 44px;
|
||||
width: 44px;
|
||||
object-fit: contain;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.brand h1{
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.2px;
|
||||
color: var(--text);
|
||||
}
|
||||
.brand .subtitle{
|
||||
margin: 6px 0 12px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Form area */
|
||||
.form{
|
||||
/* keep compact spacing inside the card */
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 6px 0 2px;
|
||||
}
|
||||
|
||||
/* Field label wrapper */
|
||||
.field{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.field .label-text{
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* Inputs */
|
||||
input[type="email"],
|
||||
input[type="password"],
|
||||
input[type="text"]{
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px 12px;
|
||||
font-size: 15px;
|
||||
color: var(--text);
|
||||
background: #fff;
|
||||
border: 1px solid #d8dee6;
|
||||
border-radius: 6px;
|
||||
outline: none;
|
||||
transition: box-shadow .14s ease, border-color .14s ease, transform .06s ease;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
input::placeholder{
|
||||
color: #9aa3ad;
|
||||
}
|
||||
input:focus{
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 6px 20px rgba(0,120,212,0.10);
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
/* Checkbox / stay signed */
|
||||
.stay-signed{
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.stay-signed input[type="checkbox"]{
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
accent-color: var(--primary);
|
||||
}
|
||||
|
||||
/* Actions row */
|
||||
.actions{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
button.primary{
|
||||
background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%);
|
||||
color: #000000;
|
||||
border: none;
|
||||
padding: 10px 14px;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 6px 18px rgba(0,120,212,0.12);
|
||||
transition: transform .06s ease, box-shadow .12s ease, opacity .12s ease;
|
||||
}
|
||||
button.primary:hover:not(:disabled){
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 10px 24px rgba(0,120,212,0.14);
|
||||
}
|
||||
button.primary:active{
|
||||
transform: translateY(0);
|
||||
}
|
||||
button.primary:disabled{
|
||||
opacity: 0.55;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* Alternative options */
|
||||
.alt-options{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.biometric{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 10px;
|
||||
background: transparent;
|
||||
color: var(--primary);
|
||||
border: 1px solid rgba(0,120,212,0.14);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
font-size: 13px;
|
||||
}
|
||||
.biometric svg{ display: block; opacity: .95; }
|
||||
.biometric:hover{
|
||||
background: rgba(0,120,212,0.04);
|
||||
}
|
||||
|
||||
/* Help link */
|
||||
.help-link{
|
||||
margin-left: auto;
|
||||
font-size: 13px;
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
}
|
||||
.help-link:hover{ text-decoration: underline; }
|
||||
|
||||
/* Footer */
|
||||
.footer{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #eef2f5;
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.footer a{
|
||||
color: var(--primary);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
.footer a:hover{ text-decoration: underline; }
|
||||
.divider{ color: #d0d6db; }
|
||||
|
||||
/* Focus styles for keyboard users */
|
||||
:focus{
|
||||
outline: none;
|
||||
}
|
||||
:focus-visible{
|
||||
outline: 3px solid rgba(0,120,212,0.12);
|
||||
outline-offset: 2px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
/* Small screens */
|
||||
@media (max-width:420px){
|
||||
.login-widget .card{
|
||||
padding: 18px;
|
||||
width: 100%;
|
||||
}
|
||||
.brand h1{ font-size: 18px; }
|
||||
.brand .subtitle{
|
||||
font-family: "Kanit";
|
||||
font-weight: 1000;
|
||||
font-style: normal; }
|
||||
.biometric span, .primary{ font-size: 13px; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<!-- Modal-like backdrop that covers the viewport -->
|
||||
<div class="login-backdrop">
|
||||
<div class="login-modal d-flex align-items-center justify-content-center">
|
||||
<div class="card modal-card" role="dialog" aria-labelledby="signin-title" aria-modal="true">
|
||||
<div class="brand">
|
||||
<!-- <img src="assets/logo.png" alt="Company logo" class="logo" /> -->
|
||||
<img src="logo.png" alt="Company logo" class="logo mb-2"/>
|
||||
<h1 id="signin-title" class='kanit-bold'>เข้าสู่ระบบ</h1>
|
||||
<p class="subtitle">บัญชีโปรแกรมจัดการบัญชีของคุณ</p>
|
||||
</div>
|
||||
<form [formGroup]="loginForm" (ngSubmit)="signIn()" class="form px-3 pb-3">
|
||||
<label class="field">
|
||||
<span class="label-text">อีเมล์</span>
|
||||
<input type="email" formControlName="email" autocomplete="username" placeholder="nuttakit@gmail.com" required />
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span class="label-text">รหัสผ่าน</span>
|
||||
<input type="password" formControlName="password" autocomplete="current-password" required />
|
||||
</label>
|
||||
|
||||
<div class="actions">
|
||||
<label class="stay-signed">
|
||||
<input type="checkbox" formControlName="remember" />
|
||||
<span>จดจำรหัสผ่าน</span>
|
||||
</label>
|
||||
<!-- <fa-icon [icon]="faCoffee" /> -->
|
||||
<button type="submit" class="primary" [disabled]="!(loginForm.get('email')?.valid && loginForm.get('password')?.value)" (click)="OnNavigateDashboard()">
|
||||
เข้าสู่ระบบ
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="alt-options">
|
||||
<button type="button" class="biometric" (click)="useBiometric()">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M12 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2z" fill="currentColor" opacity=".9"/>
|
||||
<path d="M6.2 10.9A6 6 0 0 1 12 6a6 6 0 0 1 5.8 4.9M12 22v-2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M4 12a8 8 0 0 1 16 0v1" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span>เข้าสู่ระบบด้วย Windows Hello / Touch ID</span>
|
||||
</button>
|
||||
|
||||
<a class="help-link" href="#" (click)="$event.preventDefault(); forgotPassword()">ลืมรหัส ใช่ หรือ ไม่?</a>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<a href="#" (click)="$event.preventDefault(); createAccount()">สร้างบัญชี</a>
|
||||
<span class="divider">•</span>
|
||||
<a href="#" (click)="$event.preventDefault(); privacy()">Privacy & terms</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
113
templete/src/app/component/login-page/login-page.component.ts
Normal file
113
templete/src/app/component/login-page/login-page.component.ts
Normal file
@@ -0,0 +1,113 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { faCoffee } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-page',
|
||||
standalone: false,
|
||||
templateUrl: './login-page.component.html',
|
||||
styleUrls: ['./login-page.component.css'],
|
||||
})
|
||||
export class LoginPageComponent implements OnInit {
|
||||
@Input() brandName = 'Contoso';
|
||||
@Input() subtitle = 'to your account';
|
||||
@Input() mode = '';
|
||||
@Output() signedIn = new EventEmitter<{ email: string; remember: boolean }>();
|
||||
|
||||
faCoffee = faCoffee;
|
||||
loginForm!: FormGroup;
|
||||
busy = false;
|
||||
message = '';
|
||||
|
||||
constructor(
|
||||
// private fb: FormBuilder
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setupFormControl();
|
||||
}
|
||||
|
||||
setupFormControl(): void {
|
||||
this.loginForm = new FormGroup({
|
||||
email: new FormControl('',[Validators.required, Validators.email, Validators.maxLength(100)]),
|
||||
password: new FormControl( '', [Validators.required, Validators.maxLength(50)]),
|
||||
remember: new FormControl(false)
|
||||
});
|
||||
}
|
||||
|
||||
async signIn(): Promise<void> {new FormControl
|
||||
if (this.loginForm.invalid) return;
|
||||
this.busy = true;
|
||||
this.message = '';
|
||||
try {
|
||||
// TODO: call your auth API here
|
||||
await fakeNetworkDelay();
|
||||
this.signedIn.emit({
|
||||
email: this.loginForm.value.email,
|
||||
remember: this.loginForm.value.remember,
|
||||
});
|
||||
} catch (err: any) {
|
||||
this.message = err?.message || 'Sign-in failed.';
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
async useBiometric(): Promise<void> {
|
||||
this.message = '';
|
||||
if (!('credentials' in navigator) || !('get' in (navigator as any).credentials)) {
|
||||
this.message = 'Biometric authentication is not available on this device/browser.';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.busy = true;
|
||||
// Example WebAuthn / PublicKeyCredential call. In a real application,
|
||||
// you must obtain the challenge and allowedCredentials from your server.
|
||||
const publicKeyCredentialRequestOptions = {
|
||||
// challenge must be provided by server as ArrayBuffer
|
||||
challenge: Uint8Array.from('server-provided-challenge', c => c.charCodeAt(0)).buffer,
|
||||
timeout: 60000,
|
||||
userVerification: 'preferred',
|
||||
} as any;
|
||||
|
||||
const credential: any = await (navigator as any).credentials.get({
|
||||
publicKey: publicKeyCredentialRequestOptions,
|
||||
});
|
||||
|
||||
// Send credential to server for verification (not implemented here).
|
||||
// Example: await this.authService.verifyWebAuthn(credential);
|
||||
|
||||
// On success:
|
||||
this.signedIn.emit({ email: '', remember: true });
|
||||
} catch (err: any) {
|
||||
this.message = err?.message || 'Biometric sign-in cancelled or failed.';
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
OnNavigateDashboard(){
|
||||
this.router.navigate(['main/dashboard']);
|
||||
}
|
||||
|
||||
forgotPassword(): void {
|
||||
// emit or navigate
|
||||
this.router.navigate(['/login/forgot-password']);
|
||||
}
|
||||
|
||||
createAccount(): void {
|
||||
this.message = 'Create account flow not implemented.';
|
||||
}
|
||||
|
||||
privacy(): void {
|
||||
this.router.navigate(['/license']);
|
||||
}
|
||||
}
|
||||
|
||||
/* tiny helper */
|
||||
function fakeNetworkDelay() {
|
||||
return new Promise(resolve => setTimeout(resolve, 600));
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<p>works</p>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-dashboard',
|
||||
standalone: false,
|
||||
templateUrl: './main-dashboard.component.html',
|
||||
styleUrl: './main-dashboard.component.css'
|
||||
})
|
||||
export class MainDashboardComponent {
|
||||
|
||||
}
|
||||
39
templete/src/app/component/sidebar/sidebar.component.css
Normal file
39
templete/src/app/component/sidebar/sidebar.component.css
Normal file
@@ -0,0 +1,39 @@
|
||||
/* .sidebar {
|
||||
width: 220px;
|
||||
background: #222;
|
||||
color: white;
|
||||
height: 100vh;
|
||||
padding: 20px;
|
||||
} */
|
||||
/* .sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
.sidebar li {
|
||||
margin: 10px 0;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
}
|
||||
.sidebar li:hover {
|
||||
color: #00bcd4;
|
||||
} */
|
||||
|
||||
@keyframes spin-slow {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
.animate-spin-slow {
|
||||
animation: spin-slow 8s linear infinite;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
position: absolute;
|
||||
z-index: 50;
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
.sidebar.expanded {
|
||||
transform: translateX(0);
|
||||
}
|
||||
}
|
||||
62
templete/src/app/component/sidebar/sidebar.component.html
Normal file
62
templete/src/app/component/sidebar/sidebar.component.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<div
|
||||
class="h-screen bg-linear-to-b from-amber-950 to-amber-900 text-gray-100 shadow-2xl flex flex-col relative transition-all duration-300 ease-in-out"
|
||||
[@sidebarState]="isOpen ? 'expanded' : 'collapsed'">
|
||||
|
||||
<button
|
||||
(click)="toggleSidebar()"
|
||||
class="absolute -right-3 top-6 bg-amber-700 hover:bg-amber-600 text-white rounded-full p-2 shadow-md transition-all duration-300">
|
||||
<i class="fas" [ngClass]="isOpen ? 'fa-angle-left' : 'fa-angle-right'"></i>
|
||||
</button>
|
||||
|
||||
<div class="flex items-center gap-3 p-5">
|
||||
<h3 *ngIf="isOpen" class="text-2xl font-bold transition-all duration-300">
|
||||
Global Sidebar
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<hr class="border-t border-amber-700 mx-4 my-4 opacity-70">
|
||||
|
||||
<ul class="flex flex-col gap-2 px-2 grow">
|
||||
<li class="group flex items-center gap-3 p-3 rounded-lg cursor-pointer
|
||||
hover:bg-amber-800 hover:shadow-lg transition-all duration-300 ease-in-out"
|
||||
(click)="navigate('/profile')">
|
||||
<i class="fas fa-user-circle text-xl group-hover:scale-110 transition-transform"></i>
|
||||
<span *ngIf="isOpen" class="text-lg font-medium">Profile</span>
|
||||
</li>
|
||||
|
||||
<li class="group flex items-center gap-3 p-3 rounded-lg cursor-pointer
|
||||
hover:bg-amber-800 hover:shadow-lg transition-all duration-300 ease-in-out"
|
||||
(click)="navigate('/report')">
|
||||
<i class="fas fa-chart-bar text-xl group-hover:scale-110 transition-transform"></i>
|
||||
<span *ngIf="isOpen" class="text-lg font-medium">Report</span>
|
||||
</li>
|
||||
|
||||
<li class="group flex items-center gap-3 p-3 rounded-lg cursor-pointer
|
||||
hover:bg-amber-800 hover:shadow-lg transition-all duration-300 ease-in-out"
|
||||
(click)="navigate('/dashboard')">
|
||||
<i class="fas fa-tachometer-alt text-xl group-hover:scale-110 transition-transform"></i>
|
||||
<span *ngIf="isOpen" class="text-lg font-medium">Dashboard</span>
|
||||
</li>
|
||||
|
||||
<li class="group flex items-center gap-3 p-3 rounded-lg cursor-pointer mt-auto
|
||||
hover:bg-red-700 hover:shadow-lg transition-all duration-300 ease-in-out"
|
||||
(click)="navigate('/logout')">
|
||||
<i class="fas fa-sign-out-alt text-xl group-hover:scale-110 transition-transform"></i>
|
||||
<span *ngIf="isOpen" class="text-lg font-medium text-red-200">Logout</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div
|
||||
*ngIf="isMobile && showOverlay"
|
||||
class="fixed inset-0 bg-black bg-opacity-50 z-40 transition-opacity duration-300"
|
||||
(click)="toggleSidebar()">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex-1 bg-gray-100 text-gray-900 overflow-y-auto">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
66
templete/src/app/component/sidebar/sidebar.component.ts
Normal file
66
templete/src/app/component/sidebar/sidebar.component.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { Component, HostListener, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { trigger, state, style, transition, animate } from '@angular/animations';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sidebar',
|
||||
standalone: false,
|
||||
templateUrl: './sidebar.component.html',
|
||||
styleUrls: ['./sidebar.component.css'],
|
||||
animations: [
|
||||
trigger('sidebarState', [
|
||||
state('expanded', style({
|
||||
width: '220px',
|
||||
opacity: 1
|
||||
})),
|
||||
state('collapsed', style({
|
||||
width: '70px',
|
||||
opacity: 0.95
|
||||
})),
|
||||
transition('expanded <=> collapsed', [
|
||||
animate('300ms ease-in-out')
|
||||
])
|
||||
])
|
||||
]
|
||||
})
|
||||
export class SidebarComponent implements OnInit {
|
||||
isOpen = true; // ขยายไหม
|
||||
isMobile = false; // ตรวจอุปกรณ์
|
||||
showOverlay = false; // สำหรับ mobile overlay
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.checkDevice();
|
||||
window.addEventListener('resize', () => this.checkDevice());
|
||||
}
|
||||
|
||||
@HostListener('window:resize')
|
||||
checkDevice() {
|
||||
this.isMobile = window.innerWidth <= 768;
|
||||
if (this.isMobile) {
|
||||
this.isOpen = false; // ซ่อน sidebar ตอนเข้า mobile
|
||||
} else {
|
||||
this.isOpen = true; // เปิดไว้ตลอดใน desktop
|
||||
this.showOverlay = false;
|
||||
}
|
||||
}
|
||||
|
||||
toggleSidebar() {
|
||||
if (this.isMobile) {
|
||||
this.showOverlay = !this.showOverlay;
|
||||
this.isOpen = this.showOverlay;
|
||||
} else {
|
||||
this.isOpen = !this.isOpen;
|
||||
}
|
||||
}
|
||||
|
||||
navigate(path: string) {
|
||||
this.router.navigate([path]);
|
||||
}
|
||||
|
||||
logout() {
|
||||
// TODO: handle logout logic
|
||||
this.router.navigate(['/login']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
:host {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100vh; /* ครอบเต็มหน้าจอ */
|
||||
overflow: hidden; /* ปิด scroll bar */
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.login-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column; /* ✅ แก้ตรงนี้ จาก row → column */
|
||||
align-items: center; /* ✅ จัดให้อยู่กลางแนวนอน */
|
||||
justify-content: center; /* ✅ จัดให้อยู่กลางแนวตั้ง */
|
||||
text-align: center; /* ✅ ให้ข้อความตรงกลาง */
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="justify-content-center flex-column">
|
||||
<!-- <h2>Login | เข้าสู่ระบบ ({{ mode }})</h2> -->
|
||||
@if (mode == "default") {
|
||||
<app-login-page [mode]="mode"></app-login-page>
|
||||
} @else if(mode == "forgot-password"){
|
||||
<app-login-forgot (otpEventSubmit)="onOtpSendSubmit($event)" (otpVerifyEventSubmit)="onVerifySubmit($event)"></app-login-forgot>
|
||||
}
|
||||
<!-- @else {
|
||||
|
||||
} -->
|
||||
</div>
|
||||
@@ -0,0 +1,98 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { GeneralService } from '../../services/generalservice';
|
||||
import { LoginForgotComponent } from '../../../app/component/login-forgot/login-forgot.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login-content',
|
||||
standalone: false,
|
||||
templateUrl: './login-content.component.html',
|
||||
styleUrl: './login-content.component.css'
|
||||
})
|
||||
export class LoginContentComponent implements OnInit {
|
||||
@ViewChild(LoginForgotComponent) loginForgotComponent!: LoginForgotComponent;
|
||||
mode: 'forgot-password' | 'default' = 'default';
|
||||
|
||||
constructor(
|
||||
private generalService: GeneralService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
let param = this.route.snapshot.paramMap.get('mode');
|
||||
|
||||
if (param === 'forgot-password') {
|
||||
this.mode = 'forgot-password';
|
||||
} else {
|
||||
this.router.navigate(['/login']);
|
||||
this.mode = 'default';
|
||||
}
|
||||
|
||||
switch (this.mode) {
|
||||
case 'default':
|
||||
break;
|
||||
|
||||
case 'forgot-password':
|
||||
break;
|
||||
|
||||
default:
|
||||
this.mode = 'default'; // กันพลาดไว้เลย
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onOtpSendSubmit(value: any){
|
||||
let uri = 'http://49.231.182.24:1012/api/otp/send';
|
||||
let request = {
|
||||
email: value.email
|
||||
// otp: value.otp
|
||||
}
|
||||
|
||||
this.loginForgotComponent.isLoading = true;
|
||||
this.generalService.postRequest(uri, request).subscribe({
|
||||
next: (result: any) => {
|
||||
if (result.code === '200') {
|
||||
console.log(`✅ OTP ส่งไปที่ ${value.email}`);
|
||||
} else {
|
||||
console.warn('⚠️ ไม่สามารถส่ง OTP ได้:', result.message_th);
|
||||
}
|
||||
},
|
||||
error: (error: any) => {
|
||||
this.loginForgotComponent.isSendOtp = false;
|
||||
this.loginForgotComponent.isLoading = false;
|
||||
console.error('❌ Error sending OTP:', error);
|
||||
},
|
||||
complete: () => {
|
||||
this.loginForgotComponent.isLoading = false;
|
||||
this.loginForgotComponent.isSendOtp = true;
|
||||
console.log('📨 OTP send request completed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onVerifySubmit(value: any){
|
||||
let uri = 'http://49.231.182.24:1012/api/otp/verify';
|
||||
let request = {
|
||||
email: value.email,
|
||||
otp: value.otp
|
||||
}
|
||||
this.generalService.postRequest(uri, request).subscribe({
|
||||
next: (result: any) => {
|
||||
if (result.code === '200') {
|
||||
console.log(`OTP ส่งไปยืนยันสำเร็จ`);
|
||||
} else {
|
||||
console.warn('⚠️ ไม่สามารถส่ง OTP ได้:', result.message_th);
|
||||
}
|
||||
},
|
||||
error: (error: any) => {
|
||||
console.error('❌ Error sending OTP:', error);
|
||||
},
|
||||
complete: () => {
|
||||
this.router.navigate(['/login']);
|
||||
console.log('📨 OTP send request completed');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<p>main-dashboard-content works!</p>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MainDashboardContentComponent } from './main-dashboard-content.component';
|
||||
|
||||
describe('MainDashboardContentComponent', () => {
|
||||
let component: MainDashboardContentComponent;
|
||||
let fixture: ComponentFixture<MainDashboardContentComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [MainDashboardContentComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(MainDashboardContentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-dashboard-content',
|
||||
standalone: false,
|
||||
templateUrl: './main-dashboard-content.component.html',
|
||||
styleUrl: './main-dashboard-content.component.css'
|
||||
})
|
||||
export class MainDashboardContentComponent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
.layout {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
.main-container {
|
||||
flex: 1;
|
||||
background: #f5f5f5;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="flex h-screen overflow-hidden">
|
||||
<!-- Sidebar (เฉพาะ main) -->
|
||||
<app-sidebar></app-sidebar>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="flex-1 overflow-y-auto bg-gray-50 text-gray-900">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sidebar-content',
|
||||
standalone: false,
|
||||
templateUrl: './sidebar-content.component.html',
|
||||
styleUrl: './sidebar-content.component.css'
|
||||
})
|
||||
export class SidebarContentComponent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { LoginContentComponent } from '../../content/login-content/login-content.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: LoginContentComponent },
|
||||
{ path: ':mode', component: LoginContentComponent } // ตัวอย่าง param /login/reset
|
||||
// { path: 'forgot-password', component: LoginContentComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class LoginControlRoutingModule { }
|
||||
@@ -0,0 +1,25 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { LoginContentComponent } from '../../content/login-content/login-content.component';
|
||||
import { LoginControlRoutingModule } from './login-control-routing.module';
|
||||
import { LoginPageComponent } from '../../component/login-page/login-page.component';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { LoginForgotComponent } from '../../component/login-forgot/login-forgot.component';
|
||||
// import { AppModule } from '../../app.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
LoginContentComponent,
|
||||
LoginPageComponent,
|
||||
LoginForgotComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
FontAwesomeModule,
|
||||
// AppModule,
|
||||
LoginControlRoutingModule
|
||||
]
|
||||
})
|
||||
export class LoginControlModule { }
|
||||
@@ -0,0 +1,28 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { MainDashboardComponent } from '../../component/main-dashboard/main-dashboard.component';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: 'dashboard', component: MainDashboardComponent },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'dashbord',
|
||||
// // loadChildren: () => import('./controls/profile-control/profile-control.module').then(m => m.ProfileControlModule)
|
||||
// },
|
||||
// {
|
||||
// path: 'report',
|
||||
// loadChildren: () => import('./controls/report-control/report-control.module').then(m => m.ReportControlModule)
|
||||
// },
|
||||
// { path: '', redirectTo: 'profile', pathMatch: 'full' }
|
||||
// ]
|
||||
|
||||
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
|
||||
{ path: '**', redirectTo: 'dashboard' }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class MainControlRoutingModule { }
|
||||
@@ -0,0 +1,21 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
// import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { MainControlRoutingModule } from './main-control-routing.module';
|
||||
|
||||
|
||||
import { MainDashboardComponent } from '../../component/main-dashboard/main-dashboard.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
MainDashboardComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MainControlRoutingModule,
|
||||
// BrowserAnimationsModule
|
||||
]
|
||||
})
|
||||
export class MainControlModule { }
|
||||
76
templete/src/app/services/generalservice.ts
Normal file
76
templete/src/app/services/generalservice.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class GeneralService {
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
// 🧱 Default header
|
||||
private getHttpOptions() {
|
||||
const headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
return { headers };
|
||||
}
|
||||
|
||||
// 🧩 Helper: wrap body ให้มี request ครอบเสมอ
|
||||
private wrapRequestBody(body: any): any {
|
||||
// ถ้ามี request อยู่แล้ว จะไม่ซ้ำ
|
||||
if (body && body.request) {
|
||||
return body;
|
||||
}
|
||||
return { request: body ?? {} };
|
||||
}
|
||||
|
||||
// 📦 POST Request
|
||||
postRequest(uri: string, body: any): Observable<any> {
|
||||
const payload = this.wrapRequestBody(body);
|
||||
return this.http.post(uri, payload, this.getHttpOptions()).pipe(
|
||||
map((res: any) => res),
|
||||
catchError((error: any) => {
|
||||
console.error('❌ [POST Request Error]:', error);
|
||||
return throwError(() => error);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// 📦 GET Request
|
||||
getRequest(uri: string): Observable<any> {
|
||||
return this.http.get(uri, this.getHttpOptions()).pipe(
|
||||
map((res: any) => res),
|
||||
catchError((error: any) => {
|
||||
console.error('❌ [GET Request Error]:', error);
|
||||
return throwError(() => error);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// 📦 PUT Request
|
||||
putRequest(uri: string, body: any): Observable<any> {
|
||||
const payload = this.wrapRequestBody(body);
|
||||
return this.http.put(uri, payload, this.getHttpOptions()).pipe(
|
||||
map((res: any) => res),
|
||||
catchError((error: any) => {
|
||||
console.error('❌ [PUT Request Error]:', error);
|
||||
return throwError(() => error);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// 📦 DELETE Request
|
||||
deleteRequest(uri: string, body?: any): Observable<any> {
|
||||
const payload = this.wrapRequestBody(body);
|
||||
return this.http.delete(uri, { ...this.getHttpOptions(), body: payload }).pipe(
|
||||
map((res: any) => res),
|
||||
catchError((error: any) => {
|
||||
console.error('❌ [DELETE Request Error]:', error);
|
||||
return throwError(() => error);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
18
templete/src/index.html
Normal file
18
templete/src/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>AccountingNgNuttakit</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css"> -->
|
||||
<!-- <link rel="stylesheet" href="node_modules/font-awesome/css/all.min.css"> -->
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
7
templete/src/main.ts
Normal file
7
templete/src/main.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { platformBrowser } from '@angular/platform-browser';
|
||||
import { AppModule } from './app/app.module';
|
||||
|
||||
platformBrowser().bootstrapModule(AppModule, {
|
||||
ngZoneEventCoalescing: true,
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
179
templete/src/styles.css
Normal file
179
templete/src/styles.css
Normal file
@@ -0,0 +1,179 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
/* Global base styles for the app. Keep lightweight and self-contained so
|
||||
the login component can reliably fill the viewport without producing
|
||||
an outer page scrollbar. */
|
||||
|
||||
/* Make sure the page and app root occupy full height so 100vh aligns */
|
||||
html, body, app-root {
|
||||
height: 100%;
|
||||
min-height: 100%;
|
||||
}
|
||||
/* เริ่มต้น: สำหรับ Desktop */
|
||||
.login-mobile {
|
||||
width: 415px;
|
||||
}
|
||||
|
||||
/* ถ้าเป็น Mobile (<=768px) ให้ลบ width ออก */
|
||||
@media (max-width: 768px) {
|
||||
.login-mobile {
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
z-index: 50;
|
||||
transition: transform 0.3s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* sensible default box model */
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Kanit", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
/* Prevent the browser from showing a scroll bar for the page itself;
|
||||
the login card will scroll internally if needed. */
|
||||
}
|
||||
|
||||
/* Simple utilities used by nested components in this workspace */
|
||||
.content-box {
|
||||
border: 2px solid black;
|
||||
padding: 10px;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.comp-box {
|
||||
border: 1px solid #555;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
/* Use flex centering so nested components (like the login widget)
|
||||
are centered without forcing the document to scroll. */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* If the project uses Bootstrap, the Bootstrap utilities will still apply.
|
||||
These local utility rules only ensure a consistent appearance if Bootstrap
|
||||
isn't available. */
|
||||
|
||||
|
||||
.kanit-thin {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 100;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-extralight {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-light {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-regular {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-medium {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-semibold {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-bold {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-extrabold {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 800;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-black {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 900;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.kanit-thin-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 100;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-extralight-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 200;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-light-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-regular-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-medium-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-semibold-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-bold-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-extrabold-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 800;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.kanit-black-italic {
|
||||
font-family: "Kanit", sans-serif;
|
||||
font-weight: 900;
|
||||
font-style: italic;
|
||||
}
|
||||
Reference in New Issue
Block a user