Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Meu-Template-Angular-CSR
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Trần Anh Phú
Meu-Template-Angular-CSR
Commits
9025b15a
Commit
9025b15a
authored
Dec 11, 2024
by
vtduong0912
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
e3ca9e9e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
18 deletions
+69
-18
layout.component.ts
src/app/+admin/layout/feature/ui/layout.component.ts
+1
-4
job-list.component.ts
src/app/+admin/management/job/feature/job-list.component.ts
+13
-1
login.component.html
src/app/+login/feature/login.component.html
+5
-3
login.component.ts
src/app/+login/feature/login.component.ts
+19
-5
shell.routes.ts
src/app/+shell/feature/shell.routes.ts
+0
-2
footer.component.html
...+shell/ui/components/footer/feature/footer.component.html
+30
-2
layout.component.ts
src/app/+shell/ui/layout.component.ts
+1
-1
No files found.
src/app/+admin/layout/feature/ui/layout.component.ts
View file @
9025b15a
import
{
Router
Link
,
Router
Module
,
RouterOutlet
}
from
'@angular/router'
;
import
{
RouterModule
,
RouterOutlet
}
from
'@angular/router'
;
import
{
ChangeDetectionStrategy
,
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ChangeDetectionStrategy
,
Component
,
OnInit
}
from
'@angular/core'
;
import
{
NzLayoutModule
}
from
'ng-zorro-antd/layout'
;
import
{
NzLayoutModule
}
from
'ng-zorro-antd/layout'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
AdminHeaderComponent
}
from
"./components/header/feature/header.component"
;
import
{
AdminHeaderComponent
}
from
"./components/header/feature/header.component"
;
import
{
AdminFooterComponent
}
from
"./components/footer/feature/footer.component"
;
import
{
AdminFooterComponent
}
from
"./components/footer/feature/footer.component"
;
import
{
JobListComponent
}
from
"../../../management/job/feature/job-list.component"
;
@
Component
({
@
Component
({
selector
:
'admin-layout'
,
selector
:
'admin-layout'
,
...
@@ -13,12 +12,10 @@ import { JobListComponent } from "../../../management/job/feature/job-list.compo
...
@@ -13,12 +12,10 @@ import { JobListComponent } from "../../../management/job/feature/job-list.compo
imports
:
[
imports
:
[
RouterOutlet
,
RouterOutlet
,
NzLayoutModule
,
NzLayoutModule
,
RouterLink
,
RouterModule
,
RouterModule
,
CommonModule
,
CommonModule
,
AdminHeaderComponent
,
AdminHeaderComponent
,
AdminFooterComponent
,
AdminFooterComponent
,
JobListComponent
],
],
template
:
` <nz-content>
template
:
` <nz-content>
<div class="tw-container">
<div class="tw-container">
...
...
src/app/+admin/management/job/feature/job-list.component.ts
View file @
9025b15a
...
@@ -12,6 +12,7 @@ import { NzPaginationModule } from 'ng-zorro-antd/pagination';
...
@@ -12,6 +12,7 @@ import { NzPaginationModule } from 'ng-zorro-antd/pagination';
import
{
FormBuilder
,
FormGroup
,
FormsModule
,
ReactiveFormsModule
,
Validators
}
from
'@angular/forms'
;
import
{
FormBuilder
,
FormGroup
,
FormsModule
,
ReactiveFormsModule
,
Validators
}
from
'@angular/forms'
;
import
{
NzFormModule
}
from
'ng-zorro-antd/form'
;
import
{
NzFormModule
}
from
'ng-zorro-antd/form'
;
import
{
NzNotificationService
}
from
'ng-zorro-antd/notification'
;
import
{
NzNotificationService
}
from
'ng-zorro-antd/notification'
;
import
{
NzIconModule
}
from
'ng-zorro-antd/icon'
;
@
Component
({
@
Component
({
selector
:
'job-list'
,
selector
:
'job-list'
,
...
@@ -25,6 +26,7 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
...
@@ -25,6 +26,7 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
NzPaginationModule
,
NzPaginationModule
,
ReactiveFormsModule
,
ReactiveFormsModule
,
NzFormModule
,
NzFormModule
,
NzIconModule
,
FormsModule
FormsModule
],
],
styles
:
`
styles
:
`
...
@@ -134,10 +136,20 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
...
@@ -134,10 +136,20 @@ import { NzNotificationService } from 'ng-zorro-antd/notification';
</ng-container>
</ng-container>
</nz-modal>
</nz-modal>
<nz-content class="tw-my-3">
<nz-content class="tw-my-3">
<div class="tw-flex tw-gap-3">
<nz-form-item class="tw-flex-1">
<nz-form-control>
<nz-input-group>
<input class="tw-border tw-rounded-lg tw-w-full tw-h-8">
</nz-input-group>
</nz-form-control>
</nz-form-item>
<button type="button" class="tw-border tw-rounded-md tw-h-8 tw-px-3 tw-bg-sky"><span nz-icon nzType="search" nzTheme="outline"></span></button>
</div>
<nz-table
<nz-table
#rowTable
#rowTable
[nzData]="['']"
[nzData]="['']"
[nzPageSize]="
5
"
[nzPageSize]="
pageSize
"
[nzFrontPagination]="false"
[nzFrontPagination]="false"
class="tw-my-3"
class="tw-my-3"
>
>
...
...
src/app/+login/feature/login.component.html
View file @
9025b15a
...
@@ -51,10 +51,12 @@
...
@@ -51,10 +51,12 @@
<button
<button
(
click
)="
onLogin
()"
(
click
)="
onLogin
()"
nz-button
nz-button
nzType=
"primary"
nzType=
"default"
class=
"tw-text-lg tw-h-10"
class=
"tw-text-lg tw-h-10 tw-w-24"
(
disabled
)="
isLoggingIn
"
>
>
Login
<nz-spin
*
ngIf=
"isLoggingIn"
nzSimple
></nz-spin>
<span
*
ngIf=
"!isLoggingIn"
>
Login
</span>
</button>
</button>
</div>
</div>
</form>
</form>
...
...
src/app/+login/feature/login.component.ts
View file @
9025b15a
...
@@ -11,10 +11,12 @@ import { NzAlertModule } from 'ng-zorro-antd/alert';
...
@@ -11,10 +11,12 @@ import { NzAlertModule } from 'ng-zorro-antd/alert';
import
{
FormBuilder
,
FormGroup
,
ReactiveFormsModule
,
Validators
}
from
'@angular/forms'
;
import
{
FormBuilder
,
FormGroup
,
ReactiveFormsModule
,
Validators
}
from
'@angular/forms'
;
import
{
AuthService
}
from
'../data-access/service/auth.service'
;
import
{
AuthService
}
from
'../data-access/service/auth.service'
;
import
{
validateUsername
}
from
'../../shared/utils/form-validator/username.validator'
;
import
{
validateUsername
}
from
'../../shared/utils/form-validator/username.validator'
;
import
{
catchError
,
of
,
tap
}
from
'rxjs'
;
import
{
catchError
,
finalize
,
of
,
tap
}
from
'rxjs'
;
import
{
ResponseResult
}
from
'../../shared/data-access/interface/response.type'
;
import
{
ResponseResult
}
from
'../../shared/data-access/interface/response.type'
;
import
{
Login
}
from
'../data-access/model/login.model'
;
import
{
Login
}
from
'../data-access/model/login.model'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Router
}
from
'@angular/router'
;
import
{
NzNotificationService
}
from
'ng-zorro-antd/notification'
;
import
{
NzSpinModule
}
from
'ng-zorro-antd/spin'
;
@
Component
({
@
Component
({
selector
:
'meu-login'
,
selector
:
'meu-login'
,
...
@@ -30,19 +32,22 @@ import { Router } from '@angular/router';
...
@@ -30,19 +32,22 @@ import { Router } from '@angular/router';
NzCheckboxModule
,
NzCheckboxModule
,
NzAlertModule
,
NzAlertModule
,
NzFormModule
,
NzFormModule
,
NzSpinModule
,
ReactiveFormsModule
,
ReactiveFormsModule
,
],
],
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
})
export
class
LoginComponent
implements
OnInit
{
export
class
LoginComponent
implements
OnInit
{
isLoggingIn
:
boolean
=
false
;
passwordVisible
:
boolean
=
false
;
passwordVisible
:
boolean
=
false
;
errorMsg
:
string
=
""
;
errorMsg
:
string
=
""
;
signInFormGroup
:
FormGroup
;
signInFormGroup
:
FormGroup
;
// isEdit: boolean = false;
constructor
(
constructor
(
private
_fb
:
FormBuilder
,
private
_fb
:
FormBuilder
,
private
_authService
:
AuthService
,
private
_authService
:
AuthService
,
private
_router
:
Router
private
_router
:
Router
,
private
_cdr
:
ChangeDetectorRef
,
private
_notifcation
:
NzNotificationService
)
{
)
{
this
.
signInFormGroup
=
this
.
_fb
.
group
({
this
.
signInFormGroup
=
this
.
_fb
.
group
({
username
:
[
''
,
[
Validators
.
required
,
validateUsername
]],
username
:
[
''
,
[
Validators
.
required
,
validateUsername
]],
...
@@ -66,6 +71,7 @@ export class LoginComponent implements OnInit {
...
@@ -66,6 +71,7 @@ export class LoginComponent implements OnInit {
return
;
return
;
}
}
this
.
signInFormGroup
.
markAllAsTouched
();
this
.
signInFormGroup
.
markAllAsTouched
();
this
.
isLoggingIn
=
true
;
this
.
_authService
.
loginPost
(
data
)
this
.
_authService
.
loginPost
(
data
)
.
pipe
(
.
pipe
(
tap
((
response
:
ResponseResult
<
Login
.
Response
>
)
=>
{
tap
((
response
:
ResponseResult
<
Login
.
Response
>
)
=>
{
...
@@ -74,19 +80,27 @@ export class LoginComponent implements OnInit {
...
@@ -74,19 +80,27 @@ export class LoginComponent implements OnInit {
catchError
((
error
:
ResponseResult
<
any
>
)
=>
{
catchError
((
error
:
ResponseResult
<
any
>
)
=>
{
this
.
onError
(
error
);
this
.
onError
(
error
);
return
of
(
null
);
return
of
(
null
);
}),
finalize
(()
=>
{
this
.
isLoggingIn
=
false
;
this
.
_cdr
.
markForCheck
();
})
})
)
)
.
subscribe
();
.
subscribe
();
}
}
onSuccess
(
response
:
ResponseResult
<
Login
.
Response
>
)
{
onSuccess
(
response
:
ResponseResult
<
Login
.
Response
>
)
{
console
.
log
(
response
.
responseData
?.
token
);
localStorage
.
setItem
(
"token"
,
response
.
responseData
?.
token
??
""
);
localStorage
.
setItem
(
"token"
,
response
.
responseData
?.
token
??
""
);
localStorage
.
setItem
(
"role"
,
response
.
responseData
?.
role
??
""
);
localStorage
.
setItem
(
"role"
,
response
.
responseData
?.
role
??
""
);
this
.
_notifcation
.
create
(
'success'
,
'Login successfully!'
,
''
);
this
.
_router
.
navigate
([
'/home'
]);
this
.
_router
.
navigate
([
'/home'
]);
}
}
onError
(
error
:
ResponseResult
<
any
>
)
{
onError
(
error
:
ResponseResult
<
any
>
)
{
this
.
errorMsg
=
"Invalid username or password!"
;
}
}
}
}
src/app/+shell/feature/shell.routes.ts
View file @
9025b15a
import
{
Routes
}
from
'@angular/router'
;
import
{
Routes
}
from
'@angular/router'
;
import
{
LayoutComponent
}
from
'../ui/layout.component'
;
import
{
LayoutComponent
}
from
'../ui/layout.component'
;
import
{
AuthGuard
}
from
'../../+login/data-access/guard/auth.guard'
;
import
{
AdminGuard
}
from
'../../+login/data-access/guard/admin.guard'
;
import
{
AdminGuard
}
from
'../../+login/data-access/guard/admin.guard'
;
import
{
JobComponent
}
from
'../../+job/feature/job.component'
;
import
{
LoginGuard
}
from
'../../+login/data-access/guard/login.guard'
;
import
{
LoginGuard
}
from
'../../+login/data-access/guard/login.guard'
;
export
const
shellRoutes
:
Routes
=
[
export
const
shellRoutes
:
Routes
=
[
...
...
src/app/+shell/ui/components/footer/feature/footer.component.html
View file @
9025b15a
<nz-footer>
<nz-footer
class=
"tw-min-h-48 tw-bg-white"
>
<h1>
This is footer
</h1>
<div
class=
"tw-w-full tw-grid tw-grid-cols-1 md:tw-grid-cols-2 xl:tw-grid-cols-3"
>
<div>
<p
class=
"tw-text-lg tw-font-semibold"
>
Text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
</div>
<div>
<p
class=
"tw-text-lg tw-font-semibold"
>
Text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
</div>
<div>
<p
class=
"tw-text-lg tw-font-semibold"
>
Text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
<p>
Text text text
</p>
</div>
<div
class=
"tw-col-span-full tw-text-center tw-pt-6"
>
<p
class=
"tw-opacity-50"
>
2024 Copyright ... Angular
</p>
</div>
</div>
</nz-footer>
</nz-footer>
\ No newline at end of file
src/app/+shell/ui/layout.component.ts
View file @
9025b15a
import
{
CommonModule
,
DatePipe
}
from
'@angular/common'
;
import
{
CommonModule
}
from
'@angular/common'
;
import
{
import
{
ChangeDetectionStrategy
,
ChangeDetectionStrategy
,
Component
,
Component
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment