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
1d05da0f
Commit
1d05da0f
authored
3 months ago
by
tinhbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update form create job
parent
3487b3eb
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
226 additions
and
48 deletions
+226
-48
jobModel.model.ts
...+admin/Management/job/data-access/model/jobModel.model.ts
+9
-9
JobService.service.ts
...Management/job/data-access/services/JobService.service.ts
+15
-1
jobForm.component.html
...min/Management/job/feature/jobForm/jobForm.component.html
+109
-1
jobForm.component.ts
...admin/Management/job/feature/jobForm/jobForm.component.ts
+46
-3
jobLayout.component.html
...Management/job/feature/jobLayout/jobLayout.component.html
+1
-5
jobLayout.component.ts
...n/Management/job/feature/jobLayout/jobLayout.component.ts
+0
-1
jobList.component.html
...min/Management/job/feature/jobList/jobList.component.html
+9
-8
jobList.component.ts
...admin/Management/job/feature/jobList/jobList.component.ts
+10
-3
job.routes.ts
src/app/+admin/Management/job/job.routes.ts
+12
-2
admin.routes.ts
src/app/+admin/admin.routes.ts
+1
-6
layout.component.html
src/app/+admin/layout/feature/ui/layout.component.html
+10
-7
layout.component.ts
src/app/+admin/layout/feature/ui/layout.component.ts
+4
-2
No files found.
src/app/+admin/Management/job/data-access/model/jobModel.model.ts
View file @
1d05da0f
export
interface
JobModel
{
export
interface
JobModel
{
id
:
string
;
id
?
:
string
;
type
:
string
;
type
?
:
string
;
created_at
:
string
;
created_at
:
string
;
company
:
string
;
company
?
:
string
;
company_url
:
string
;
company_url
?
:
string
;
location
:
string
;
location
?
:
string
;
title
:
string
;
title
?
:
string
;
description
:
string
;
description
?
:
string
;
how_to_apply
:
string
;
how_to_apply
?
:
string
;
company_logo
:
string
;
company_logo
?
:
string
;
}
}
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/data-access/services/JobService.service.ts
View file @
1d05da0f
import
{
Injectable
}
from
'@angular/core'
;
import
{
Injectable
}
from
'@angular/core'
;
import
{
HttpClient
,
HttpHeaders
,
HttpParams
}
from
'@angular/common/http'
;
import
{
HttpClient
,
HttpHeaders
,
HttpParams
,
HttpRequest
}
from
'@angular/common/http'
;
import
{
Observable
}
from
'rxjs'
;
import
{
Observable
}
from
'rxjs'
;
import
{
environment
}
from
'../../../../../../environments/environment.development'
;
import
{
environment
}
from
'../../../../../../environments/environment.development'
;
...
@@ -16,4 +16,18 @@ export class JobService {
...
@@ -16,4 +16,18 @@ export class JobService {
.
set
(
'pageSize'
,
pageSize
.
toString
());
.
set
(
'pageSize'
,
pageSize
.
toString
());
return
this
.
http
.
get
<
any
>
(
this
.
apiUrl
,
{
params
});
return
this
.
http
.
get
<
any
>
(
this
.
apiUrl
,
{
params
});
}
}
addingNewJob
(
data
:
any
):
Observable
<
any
>
{
const
headers
=
new
HttpHeaders
()
.
set
(
'Content-Type'
,
'application/json'
)
.
set
(
'authorization'
,
`Bearer
${
localStorage
.
getItem
(
'token'
)}
`
);
return
this
.
http
.
post
<
any
>
(
this
.
apiUrl
,
data
,
{
headers
});
}
deleteJob
(
id
:
string
):
Observable
<
any
>
{
const
headers
=
new
HttpHeaders
()
.
set
(
'Content-Type'
,
'application/json'
)
.
set
(
'Authorization'
,
`Bearer
${
localStorage
.
getItem
(
'token'
)}
`
);
const
url
=
`
${
this
.
apiUrl
}
/
${
id
}
`
;
return
this
.
http
.
delete
<
any
>
(
url
,
{
headers
});
}
}
}
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobForm/jobForm.component.html
View file @
1d05da0f
form ne
<nz-card
nzTitle=
"Thêm công việc mới"
[
nzBordered
]="
true
"
style=
"width: 600px; margin: 0 auto; margin-top: 50px;"
>
<form
nz-form
(
ngSubmit
)="
onSubmit
()"
#
jobForm=
"ngForm"
>
<!-- Tiêu đề công việc -->
<nz-form-item>
<nz-form-label
nzFor=
"title"
[
nzSpan
]="
6
"
>
Tiêu đề
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<input
nz-input
type=
"text"
id=
"title"
name=
"title"
[(
ngModel
)]="
job
.
title
"
required
placeholder=
"Nhập tiêu đề công việc"
/>
</nz-form-control>
</nz-form-item>
<!-- Loại công việc -->
<nz-form-item>
<nz-form-label
nzFor=
"type"
[
nzSpan
]="
6
"
>
Loại
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<nz-select
id=
"type"
name=
"type"
[(
ngModel
)]="
job
.
type
"
required
placeholder=
"Chọn loại công việc"
>
<nz-option
nzValue=
"Full-time"
nzLabel=
"Full-time"
></nz-option>
<nz-option
nzValue=
"Part-time"
nzLabel=
"Part-time"
></nz-option>
<nz-option
nzValue=
"Freelance"
nzLabel=
"Freelance"
></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<!-- Công ty -->
<nz-form-item>
<nz-form-label
nzFor=
"company"
[
nzSpan
]="
6
"
>
Công ty
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<input
nz-input
type=
"text"
id=
"company"
name=
"company"
[(
ngModel
)]="
job
.
company
"
required
placeholder=
"Nhập tên công ty"
/>
</nz-form-control>
</nz-form-item>
<!-- URL công ty -->
<nz-form-item>
<nz-form-label
nzFor=
"company_url"
[
nzSpan
]="
6
"
>
Website
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<input
nz-input
type=
"url"
id=
"company_url"
name=
"company_url"
[(
ngModel
)]="
job
.
company_url
"
placeholder=
"Nhập URL của công ty"
/>
</nz-form-control>
</nz-form-item>
<!-- Địa điểm -->
<nz-form-item>
<nz-form-label
nzFor=
"location"
[
nzSpan
]="
6
"
>
Địa điểm
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<input
nz-input
type=
"text"
id=
"location"
name=
"location"
[(
ngModel
)]="
job
.
location
"
required
placeholder=
"Nhập địa điểm công việc"
/>
</nz-form-control>
</nz-form-item>
<!-- Mô tả -->
<nz-form-item>
<nz-form-label
nzFor=
"description"
[
nzSpan
]="
6
"
>
Mô tả
</nz-form-label>
<nz-form-control
[
nzSpan
]="
18
"
>
<textarea
nz-input
id=
"description"
name=
"description"
[(
ngModel
)]="
job
.
description
"
rows=
"4"
placeholder=
"Nhập mô tả công việc"
required
></textarea>
</nz-form-control>
</nz-form-item>
<!-- Nút Gửi -->
<nz-form-item>
<nz-form-control
[
nzSpan
]="
18
"
[
nzOffset
]="
6
"
>
<button
nz-button
nzType=
"primary"
[
disabled
]="!
jobForm
.
valid
"
>
Thêm Công Việc
</button>
</nz-form-control>
</nz-form-item>
</form>
</nz-card>
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobForm/jobForm.component.ts
View file @
1d05da0f
import
{
CommonModule
}
from
"@angular/common"
;
import
{
CommonModule
}
from
"@angular/common"
;
import
{
Component
}
from
"@angular/core"
;
import
{
Component
}
from
"@angular/core"
;
import
{
NzBreadCrumbModule
}
from
"ng-zorro-antd/breadcrumb"
;
import
{
NzButtonModule
}
from
"ng-zorro-antd/button"
;
import
{
NzCardModule
}
from
"ng-zorro-antd/card"
;
import
{
NzFormModule
}
from
"ng-zorro-antd/form"
;
import
{
NzIconModule
}
from
"ng-zorro-antd/icon"
;
import
{
NzLayoutModule
}
from
"ng-zorro-antd/layout"
;
import
{
NzMenuModule
}
from
"ng-zorro-antd/menu"
;
import
{
NzToolTipModule
}
from
"ng-zorro-antd/tooltip"
;
import
{
NzSelectModule
}
from
'ng-zorro-antd/select'
;
import
{
FormsModule
}
from
"@angular/forms"
;
import
{
JobModel
}
from
"../../data-access/model/jobModel.model"
;
import
{
JobService
}
from
"../../data-access/services/JobService.service"
;
import
{
NzNotificationService
}
from
'ng-zorro-antd/notification'
;
import
{
finalize
}
from
"rxjs"
;
@
Component
({
@
Component
({
selector
:
"app-job-form"
,
selector
:
"app-job-form"
,
templateUrl
:
"./jobForm.component.html"
,
templateUrl
:
"./jobForm.component.html"
,
standalone
:
true
,
standalone
:
true
,
imports
:
[
CommonModule
],
imports
:
[
CommonModule
,
NzButtonModule
,
NzBreadCrumbModule
,
NzIconModule
,
NzLayoutModule
,
NzMenuModule
,
NzToolTipModule
,
NzCardModule
,
NzFormModule
,
NzSelectModule
,
FormsModule
],
})
})
export
class
JobFormComponent
{}
export
class
JobFormComponent
{
job
:
JobModel
=
{
type
:
''
,
created_at
:
new
Date
().
toISOString
(),
company
:
''
,
company_url
:
''
,
location
:
''
,
title
:
''
,
description
:
''
};
constructor
(
private
jobService
:
JobService
,
private
notification
:
NzNotificationService
)
{}
onSubmit
()
{
console
.
log
(
'Job Data:'
,
this
.
job
);
this
.
jobService
.
addingNewJob
(
this
.
job
).
pipe
(
finalize
(()
=>
this
.
notification
.
success
(
'Success'
,
'Thêm thành công'
))
).
subscribe
();
}
}
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobLayout/jobLayout.component.html
View file @
1d05da0f
<span
class=
"tw-text-3xl tw-font-bold"
>
Job
</span>
<span
class=
"tw-text-3xl tw-font-bold"
>
Danh sách công việc
</span>
<div
class=
"tw-w-full tw-grid tw-justify-items-end"
>
<button
nz-button
nzType=
"primary"
>
Create new job
</button>
</div>
<app-job-form></app-job-form>
<app-job-list></app-job-list>
<app-job-list></app-job-list>
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobLayout/jobLayout.component.ts
View file @
1d05da0f
...
@@ -12,7 +12,6 @@ import { JobFormComponent } from "../jobForm/jobForm.component";
...
@@ -12,7 +12,6 @@ import { JobFormComponent } from "../jobForm/jobForm.component";
CommonModule
,
CommonModule
,
RouterModule
,
RouterModule
,
JobListComponent
,
JobListComponent
,
JobFormComponent
],
],
})
})
export
class
JobLayoutComponent
{
export
class
JobLayoutComponent
{
...
...
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobList/jobList.component.html
View file @
1d05da0f
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
>
>
<thead>
<thead>
<tr>
<tr>
<th>
Job Id
</th>
<th>
STT
</th>
<th>
Type
</th>
<th>
Loại công việc
</th>
<th>
T
itle
</th>
<th>
T
ên công việc
</th>
<th>
C
ompan
y
</th>
<th>
C
ông t
y
</th>
<th>
Location
</th>
<th>
Địa chỉ
</th>
<th>
Action
</th>
<th>
Thao tác
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
...
@@ -24,8 +24,9 @@
...
@@ -24,8 +24,9 @@
<td>
{{ data.location }}
</td>
<td>
{{ data.location }}
</td>
<td>
<td>
<nz-space
nzSize=
"small"
>
<nz-space
nzSize=
"small"
>
<button
class=
"tw-mr-2"
nz-button
nzType=
"default"
nzSize=
"small"
(
click
)="
onEdit
(
data
)"
>
Edit
</button>
<button
nz-button
class=
"tw-mr-2"
nzType=
"default"
nzSize=
"small"
>
Xem chi tiết
</button>
<button
nz-button
nzType=
"primary"
nzSize=
"small"
nzDanger
>
Delete
</button>
<button
class=
"tw-mr-2"
nz-button
nzType=
"primary"
nzSize=
"small"
(
click
)="
onEdit
(
data
)"
>
Sửa
</button>
<button
nz-button
nzType=
"primary"
nzSize=
"small"
nzDanger
(
click
)="
onDelete
(
data
)"
>
Xóa
</button>
</nz-space>
</nz-space>
</td>
</td>
</tr>
</tr>
...
...
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/feature/jobList/jobList.component.ts
View file @
1d05da0f
...
@@ -7,7 +7,7 @@ import { JobModel } from "../../data-access/model/jobModel.model";
...
@@ -7,7 +7,7 @@ import { JobModel } from "../../data-access/model/jobModel.model";
import
{
NzDividerModule
}
from
'ng-zorro-antd/divider'
;
import
{
NzDividerModule
}
from
'ng-zorro-antd/divider'
;
import
{
NzButtonModule
}
from
"ng-zorro-antd/button"
;
import
{
NzButtonModule
}
from
"ng-zorro-antd/button"
;
import
{
NzSpaceModule
}
from
'ng-zorro-antd/space'
;
import
{
NzSpaceModule
}
from
'ng-zorro-antd/space'
;
import
{
NzNotificationService
}
from
'ng-zorro-antd/notification'
;
@
Component
({
@
Component
({
selector
:
"app-job-list"
,
selector
:
"app-job-list"
,
...
@@ -47,7 +47,7 @@ export class JobListComponent implements OnInit {
...
@@ -47,7 +47,7 @@ export class JobListComponent implements OnInit {
).
subscribe
();
).
subscribe
();
}
}
constructor
(
private
jobService
:
JobService
)
{}
constructor
(
private
jobService
:
JobService
,
private
notification
:
NzNotificationService
)
{}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
loadDataFromServer
(
this
.
pageIndex
,
this
.
pageSize
);
this
.
loadDataFromServer
(
this
.
pageIndex
,
this
.
pageSize
);
...
@@ -55,6 +55,13 @@ export class JobListComponent implements OnInit {
...
@@ -55,6 +55,13 @@ export class JobListComponent implements OnInit {
onEdit
(
data
:
any
)
{
onEdit
(
data
:
any
)
{
console
.
log
(
data
);
console
.
log
(
data
);
}
}
onDelete
(
data
:
any
)
{
this
.
jobService
.
deleteJob
(
data
.
id
).
pipe
(
finalize
(()
=>
{
this
.
notification
.
success
(
'Success'
,
'Xóa thành công'
);
this
.
listOfJob
=
this
.
listOfJob
.
filter
(
job
=>
job
.
id
!==
data
.
id
);
})
).
subscribe
();
}
}
}
This diff is collapsed.
Click to expand it.
src/app/+admin/Management/job/job.routes.ts
View file @
1d05da0f
import
{
Route
}
from
'@angular/router'
;
import
{
Route
}
from
'@angular/router'
;
// file: job.routes.ts
const
JOB_ROUTES
:
Route
[]
=
[
const
JOB_ROUTES
:
Route
[]
=
[
{
{
path
:
''
,
path
:
'
jobLayout
'
,
loadComponent
:
()
=>
loadComponent
:
()
=>
import
(
'./feature/jobLayout/jobLayout.component'
).
then
(
import
(
'./feature/jobLayout/jobLayout.component'
).
then
(
(
m
)
=>
m
.
JobLayoutComponent
),
(
m
)
=>
m
.
JobLayoutComponent
),
},
{
path
:
'jobForm'
,
loadComponent
:
()
=>
import
(
'./feature/jobForm/jobForm.component'
).
then
(
(
m
)
=>
m
.
JobFormComponent
),
},
},
];
];
export
default
JOB_ROUTES
;
export
default
JOB_ROUTES
;
This diff is collapsed.
Click to expand it.
src/app/+admin/admin.routes.ts
View file @
1d05da0f
...
@@ -7,12 +7,7 @@ const ADMIN_ROUTES: Route[] = [
...
@@ -7,12 +7,7 @@ const ADMIN_ROUTES: Route[] = [
component
:
AdminLayoutComponent
,
component
:
AdminLayoutComponent
,
children
:
[
children
:
[
{
{
path
:
''
,
path
:
'job-management'
,
pathMatch
:
'full'
,
redirectTo
:
'configuration'
,
},
{
path
:
'jobs'
,
children
:
[
children
:
[
{
{
path
:
''
,
path
:
''
,
...
...
This diff is collapsed.
Click to expand it.
src/app/+admin/layout/feature/ui/layout.component.html
View file @
1d05da0f
...
@@ -2,22 +2,25 @@
...
@@ -2,22 +2,25 @@
<nz-sider
nzCollapsible
[(
nzCollapsed
)]="
isCollapsed
"
[
nzTrigger
]="
null
"
>
<nz-sider
nzCollapsible
[(
nzCollapsed
)]="
isCollapsed
"
[
nzTrigger
]="
null
"
>
<div
class=
"logo"
></div>
<div
class=
"logo"
></div>
<ul
nz-menu
nzTheme=
"dark"
nzMode=
"inline"
>
<ul
nz-menu
nzTheme=
"dark"
nzMode=
"inline"
>
<li
nz-submenu
nzTitle=
"
Management
"
nzIcon=
"user"
>
<li
nz-submenu
nzTitle=
"
Quản lí công việc
"
nzIcon=
"user"
>
<ul>
<ul>
<li
<li
nz-menu-item
nz-menu-item
routerLink=
"/admin/management/job
"
routerLink=
"/admin/job-management/jobLayout
"
>
>
Job
Danh sách công việc
</li>
</li>
<li
<li
nz-menu-item
nz-menu-item
routerLink=
"/admin/management/job
"
routerLink=
"/admin/job-management/jobForm
"
>
>
t
hêm công việc
T
hêm công việc
</li>
</li>
</ul>
</ul>
</li>
</li>
<li
nz-menu-item
nzIcon=
"close"
(
click
)="
logout
()"
>
Đăng xuất
</li>
</ul>
</ul>
</nz-sider>
</nz-sider>
<nz-layout>
<nz-layout>
...
...
This diff is collapsed.
Click to expand it.
src/app/+admin/layout/feature/ui/layout.component.ts
View file @
1d05da0f
...
@@ -19,7 +19,6 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
...
@@ -19,7 +19,6 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
RouterLink
,
RouterLink
,
CommonModule
,
CommonModule
,
RouterModule
,
RouterModule
,
DatePipe
,
HeaderComponent
,
HeaderComponent
,
FooterComponent
,
FooterComponent
,
NzButtonModule
,
NzButtonModule
,
...
@@ -37,5 +36,8 @@ export class AdminLayoutComponent implements OnInit {
...
@@ -37,5 +36,8 @@ export class AdminLayoutComponent implements OnInit {
constructor
()
{}
constructor
()
{}
isCollapsed
=
false
;
isCollapsed
=
false
;
ngOnInit
():
void
{}
ngOnInit
():
void
{}
logout
()
{
localStorage
.
clear
();
window
.
location
.
href
=
'/login'
;
}
}
}
This diff is collapsed.
Click to expand it.
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