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
b4827927
Commit
b4827927
authored
Nov 05, 2024
by
vtduong0912
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: refactored
parent
4608598b
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
39 deletions
+79
-39
job-manager.model.ts
...min/management/job/data-access/model/job-manager.model.ts
+4
-18
job-manager.service.ts
...management/job/data-access/service/job-manager.service.ts
+8
-10
job-add.component.ts
src/app/+admin/management/job/feature/job-add.component.ts
+0
-0
job-delete.component.ts
...app/+admin/management/job/feature/job-delete.component.ts
+0
-0
job-form.component.ts
src/app/+admin/management/job/feature/job-form.component.ts
+15
-0
job-list.component.ts
src/app/+admin/management/job/feature/job-list.component.ts
+21
-10
job-update.component.ts
...app/+admin/management/job/feature/job-update.component.ts
+0
-0
job.component.ts
src/app/+admin/management/job/feature/job.component.ts
+27
-0
job-manager.routes.ts
src/app/+admin/management/job/job-manager.routes.ts
+1
-1
styles.scss
src/styles.scss
+3
-0
No files found.
src/app/+admin/management/job/data-access/model/job-manager.model.ts
View file @
b4827927
export
namespace
Job
s
{
export
type
Job
=
{
id
:
null
|
string
;
export
namespace
Job
Api
{
export
interface
Response
{
id
:
string
;
type
:
string
;
created_at
:
string
;
company
:
string
;
...
...
@@ -13,21 +13,7 @@ export namespace Jobs {
url
?:
string
;
}
export
interface
GetResponse
{
items
:
Job
[];
total
:
number
}
export
type
GetRequest
=
{
}
export
interface
Response
{
newItem
:
Job
}
export
type
Request
=
{
id
:
string
;
export
interface
Request
{
type
:
string
;
created_at
:
string
;
company
:
string
;
...
...
src/app/+admin/management/job/data-access/service/job-manager.service.ts
View file @
b4827927
import
{
HttpClient
}
from
"@angular/common/http"
;
import
{
Injectable
}
from
"@angular/core"
;
import
{
Job
s
}
from
"../model/job-manager.model"
;
import
{
Job
Api
}
from
"../model/job-manager.model"
;
import
{
ResponseResult
,
Rows
}
from
"../../../../../shared/data-access/interface/response.type"
;
@
Injectable
({
...
...
@@ -10,7 +10,7 @@ export class JobManagerService {
constructor
(
private
_http
:
HttpClient
)
{}
jobsGet
(
pageIndex
:
number
=
1
,
pageSize
:
number
=
5
)
{
return
this
.
_http
.
get
<
ResponseResult
<
Rows
<
Job
s
.
Job
>>>
(
'jobs'
,
{
return
this
.
_http
.
get
<
ResponseResult
<
Rows
<
Job
Api
.
Response
>>>
(
'jobs'
,
{
params
:
{
page
:
pageIndex
,
take
:
pageSize
...
...
@@ -18,17 +18,15 @@ export class JobManagerService {
});
}
jobsPost
(
request
:
Job
s
.
Request
)
{
return
this
.
_http
.
post
<
ResponseResult
<
Job
s
.
Response
>>
(
'jobs'
,
request
);
jobsPost
(
request
:
Job
Api
.
Request
)
{
return
this
.
_http
.
post
<
ResponseResult
<
Job
Api
.
Request
>>
(
'jobs'
,
request
);
}
jobsPut
(
request
:
Job
s
.
Request
)
{
return
this
.
_http
.
put
<
ResponseResult
<
Job
s
.
Response
>>
(
'jobs'
,
request
);
jobsPut
(
request
:
Job
Api
.
Request
)
{
return
this
.
_http
.
put
<
ResponseResult
<
Job
Api
.
Request
>>
(
'jobs'
,
request
);
}
jobsDelete
(
request
:
Jobs
.
Request
)
{
return
this
.
_http
.
delete
<
ResponseResult
<
Jobs
.
Response
>>
(
'jobs'
,
{
body
:
request
});
jobsDelete
(
id
:
number
)
{
return
this
.
_http
.
delete
<
ResponseResult
<
JobApi
.
Request
>>
(
'jobs'
);
}
}
\ No newline at end of file
src/app/+admin/management/job/feature/job-add.component.ts
deleted
100644 → 0
View file @
4608598b
src/app/+admin/management/job/feature/job-delete.component.ts
deleted
100644 → 0
View file @
4608598b
src/app/+admin/management/job/feature/job-form.component.ts
0 → 100644
View file @
b4827927
import
{
Component
,
OnInit
}
from
'@angular/core'
;
@
Component
({
selector
:
'job-form'
,
standalone
:
true
,
template
:
`
`
})
export
class
JobFormComponent
implements
OnInit
{
isHidden
:
boolean
=
true
;
constructor
()
{
}
ngOnInit
()
{
}
}
\ No newline at end of file
src/app/+admin/management/job/feature/job-list.component.ts
View file @
b4827927
...
...
@@ -5,7 +5,7 @@ import { CommonModule } from '@angular/common';
import
{
JobManagerService
}
from
'../data-access/service/job-manager.service'
;
import
{
catchError
,
of
,
tap
}
from
'rxjs'
;
import
{
ResponseResult
,
Rows
}
from
'../../../../shared/data-access/interface/response.type'
;
import
{
Job
s
}
from
'../data-access/model/job-manager.model'
;
import
{
Job
Api
}
from
'../data-access/model/job-manager.model'
;
import
{
NzButtonModule
}
from
'ng-zorro-antd/button'
;
@
Component
({
...
...
@@ -15,38 +15,49 @@ import { NzButtonModule } from 'ng-zorro-antd/button';
CommonModule
,
NzLayoutModule
,
NzTableModule
,
NzButtonModule
NzButtonModule
,
],
styles
:
`
nz-table[_ngcontent-jjj-c198] nz-pagination[_ngcontent-jjj-c198] {
justify-content: center;
}
`
,
template
:
`
<nz-content class="tw-my-3">
<button nz-button nzType="primary">Create new job</button>
<nz-table
#rowTable
[nzData]="jobsList"
[nzPageSize]="5"
nzShowPagination
nzShowSizeChanger
[nzPageSizeOptions]="[5, 10, 25, 50, 100]"
class="tw-my-3"
>
<thead>
<tr>
<th class="tw-text-start">
<th>
Ord.
</th>
<th>
Title
</th>
<th
class="tw-text-start"
>
<th>
Company
</th>
<th
class="tw-text-start"
>
<th>
Created at
</th>
<th
class="tw-text-start"
>
<th>
Actions
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let job of rowTable.data" class="tw-border-b">
<tr *ngFor="let job of rowTable.data; let idx = index" class="tw-border-b">
<td>
<p> {{ rowTable.nzPageSize * (rowTable.nzPageIndex - 1) + idx }}</p>
</td>
<td>
<p>{{ job.title }}</p>
</td>
...
...
@@ -71,7 +82,7 @@ export class JobListComponent implements OnInit {
pageIndex
:
number
=
1
;
pageSize
:
number
=
999
;
jobsList
:
Job
s
.
Job
[]
=
[];
jobsList
:
Job
Api
.
Response
[]
=
[];
@
Output
()
pageIndexChange
:
EventEmitter
<
number
>
=
new
EventEmitter
<
number
>
;
constructor
(
private
_service
:
JobManagerService
,
private
_cdr
:
ChangeDetectorRef
)
{
}
...
...
@@ -82,7 +93,7 @@ export class JobListComponent implements OnInit {
getAllJobs
(
pageIndex
:
number
=
1
,
pageSize
:
number
=
5
)
{
this
.
_service
.
jobsGet
(
pageIndex
,
pageSize
)
.
pipe
(
tap
((
response
:
ResponseResult
<
Rows
<
Job
s
.
Job
>>
)
=>
{
tap
((
response
:
ResponseResult
<
Rows
<
Job
Api
.
Response
>>
)
=>
{
this
.
jobsList
=
response
.
responseData
?.
rows
||
[];
console
.
log
(
this
.
jobsList
);
this
.
_cdr
.
markForCheck
();
...
...
src/app/+admin/management/job/feature/job-update.component.ts
deleted
100644 → 0
View file @
4608598b
src/app/+admin/management/job/feature/job.component.ts
0 → 100644
View file @
b4827927
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
JobListComponent
}
from
'./job-list.component'
;
import
{
NzButtonModule
}
from
'ng-zorro-antd/button'
;
import
{
JobFormComponent
}
from
'./job-form.component'
;
@
Component
({
selector
:
'job-parent'
,
standalone
:
true
,
imports
:
[
JobListComponent
,
JobFormComponent
,
NzButtonModule
],
template
:
`
<h1 class="tw-text-center tw-text-3xl tw-font-semibold tw-my-3">Jobs</h1>
<div class="tw-w-full tw-grid tw-justify-items-end">
<button nz-button nzType="primary">Create new job</button>
</div>
<job-form></job-form>
<job-list></job-list>
`
})
export
class
JobComponent
implements
OnInit
{
constructor
()
{
}
ngOnInit
()
{
}
}
\ No newline at end of file
src/app/+admin/management/job/job-manager.routes.ts
View file @
b4827927
...
...
@@ -4,7 +4,7 @@ const JOB_MANANGER_ROUTES: Route[] = [
{
path
:
''
,
loadComponent
:
()
=>
import
(
'./feature/job
-list.component'
).
then
((
m
)
=>
m
.
JobList
Component
),
import
(
'./feature/job
.component'
).
then
((
m
)
=>
m
.
Job
Component
),
}
]
export
default
JOB_MANANGER_ROUTES
\ No newline at end of file
src/styles.scss
View file @
b4827927
...
...
@@ -23,3 +23,6 @@ body {
margin
:
0
;
font-family
:
Roboto
,
"Helvetica Neue"
,
sans-serif
;
}
.ant-table-pagination
{
justify-content
:
center
!
important
;
}
\ No newline at end of file
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