Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BookingMyHrManagement
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
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
Chanachai
BookingMyHrManagement
Commits
29d61a5f
Commit
29d61a5f
authored
Dec 21, 2021
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ปุ่มเพิ่ม Contact
parent
9e9a7ed7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
58 deletions
+83
-58
contact-admin.component.html
src/app/pages/contact-admin/contact-admin.component.html
+61
-46
contact-admin.component.ts
src/app/pages/contact-admin/contact-admin.component.ts
+22
-12
No files found.
src/app/pages/contact-admin/contact-admin.component.html
View file @
29d61a5f
<div
class=
"content"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<form
[
formGroup
]="
myFormAddContact
"
>
<div
class=
"row"
>
<div
class=
"col-6 md-1"
>
<label>
ชื่อผู้แจ้ง Bug:
</label>
<input
input
class=
" form-control"
placeholder=
""
type=
"text"
formControlName=
"ctName"
/>
</div>
<div
class=
"col-6 md-1"
>
<label
for=
"typeahead-focus"
>
หัวข้อการแจ้ง Bug:
</label>
<input
input
class=
" form-control"
placeholder=
""
type=
"text"
formControlName=
"ctHead"
/>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-6 md-1"
>
<label
for=
"typeahead-focus"
>
หน้าต่างที่ต้องการแจ้ง Bug:
</label>
<input
id=
"typeahead-focus"
type=
"text"
class=
"form-control"
[
ngbTypeahead
]="
search
"
(
focus
)="
focus
$.
next
($
any
($
event
).
target
.
value
)"
(
click
)="
click
$.
next
($
any
($
event
).
target
.
value
)"
#
instance=
"ngbTypeahead"
formControlName=
"ctTab"
/>
</div>
<div
class=
"col-6 mb-1"
>
<label
for=
"exampleFormControlSelect1"
>
วันที่เริ่มต้น
</label>
<input
type=
"date"
class=
"form-control"
value=
""
formControlName=
"sDate"
/>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
หมายเหตุ
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
formControlName=
"ctDesc"
></textarea>
</div>
</div>
</div>
</form>
<div
class=
"card-footer"
>
<div
class=
"d-grid gap-2 d-md-flex justify-content-md-center"
>
<button
class=
"btn btn-primary btn-sm"
[
disabled
]=""
type=
"submit"
(
click
)="
saveContact
()"
>
บันทึก
</button>
<button
class=
"btn btn-primary btn-sm"
type=
"cancel"
(
click
)="
model
.
dismiss
('
Cross
click
')"
>
ยกเลิก
</button>
</div>
</div>
</div>
</div>
<button
class=
"btn btn-lg btn-outline-primary"
(
click
)="
openAdd
(
addContact
)"
>
เพิ่มรายการ
</button>
<div
class=
"card"
>
<div
class=
"row text-center"
>
<div
class=
"col-sm-12"
>
...
...
@@ -135,7 +92,8 @@
<div
class=
"row"
>
<div
class=
"col-sm-12 mb-1"
>
<label
for=
"exampleFormControlSelect1"
>
วันที่แจ้ง
</label>
<input
readonly
type=
"date"
class=
"form-control"
formControlName=
"sDate"
/>
<input
readonly
type=
"date"
class=
"form-control"
[(
ngModel
)]="
modelContact
.
sDate
"
formControlName=
"sDate"
/>
</div>
</div>
<div
class=
" row"
>
...
...
@@ -168,3 +126,59 @@
</div>
</div>
</ng-template>
<ng-template
#
addContact
let-modal
>
<div
class=
" col-md-12"
style=
"padding: 0; "
>
<div
class=
"card"
style=
"margin: 0; "
>
<div
class=
"card-body"
>
<form
[
formGroup
]="
myFormContact
"
>
<div
class=
"row"
>
<div
class=
"col-6 md-1"
>
<label>
ชื่อผู้แจ้ง Bug:
</label>
<input
input
class=
" form-control"
placeholder=
""
type=
"text"
formControlName=
"ctName"
[(
ngModel
)]="
modelContact
.
ctName
"
/>
</div>
<div
class=
"col-6 md-1"
>
<label
for=
"typeahead-focus"
>
หัวข้อการแจ้ง Bug:
</label>
<input
input
class=
" form-control"
placeholder=
""
type=
"text"
formControlName=
"ctHead"
[(
ngModel
)]="
modelContact
.
ctHead
"
/>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-6 md-1"
>
<label
for=
"typeahead-focus"
>
หน้าต่างที่ต้องการแจ้ง Bug:
</label>
<input
id=
"typeahead-focus"
type=
"text"
class=
"form-control"
[(
ngModel
)]="
modelContact
.
ctTab
"
[
ngbTypeahead
]="
search
"
(
focus
)="
focus
$.
next
($
any
($
event
).
target
.
value
)"
(
click
)="
click
$.
next
($
any
($
event
).
target
.
value
)"
#
instance=
"ngbTypeahead"
formControlName=
"ctTab"
/>
</div>
<div
class=
"col-6 mb-1"
>
<label
for=
"exampleFormControlSelect1"
>
วันที่เริ่มต้น
</label>
<input
type=
"date"
class=
"form-control"
value=
""
formControlName=
"sDate"
[(
ngModel
)]="
modelContact
.
sDate
"
>
</div>
</div>
<div
class=
" row"
>
<div
class=
" col-md-12"
>
<div
class=
" form-group"
>
<label>
หมายเหตุ
</label>
<textarea
class=
"form-control"
id=
"exampleFormControlTextarea1"
rows=
"3"
placeholder=
"......"
formControlName=
"ctDesc"
[(
ngModel
)]="
modelContact
.
ctDesc
"
></textarea>
</div>
</div>
</div>
</form>
<div
class=
"card-footer"
>
<div
class=
"d-grid gap-2 d-md-flex justify-content-md-center"
>
<button
class=
"btn btn-primary btn-sm"
[
disabled
]=""
type=
"submit"
(
click
)="
saveContact
()"
>
บันทึก
</button>
<button
class=
"btn btn-primary btn-sm"
type=
"cancel"
(
click
)="
model
.
dismiss
('
Cross
click
')"
>
ยกเลิก
</button>
</div>
</div>
</div>
</div>
</div>
</ng-template>
\ No newline at end of file
src/app/pages/contact-admin/contact-admin.component.ts
View file @
29d61a5f
...
...
@@ -6,11 +6,11 @@ import { Subject } from 'rxjs/internal/Subject';
import
{
Contact
}
from
'src/app/models/contact.model'
;
import
{
ContactService
}
from
'src/app/service/contact.service'
;
const
pages
=
[
'หน้าหลัก'
,
'รายการอุปกรณ์'
,
'รายการจอง-เบิกทั้งหมด'
];
const
pages
=
[
'หน้าหลัก'
,
'รายการอุปกรณ์'
,
'รายการจอง-เบิกทั้งหมด'
];
@
Component
({
selector
:
'app-contact-admin'
,
templateUrl
:
'./contact-admin.component.html'
,
templateUrl
:
'./contact-admin.component.html'
,
styleUrls
:
[
'./contact-admin.component.scss'
]
})
export
class
ContactAdminComponent
implements
OnInit
{
...
...
@@ -30,16 +30,16 @@ export class ContactAdminComponent implements OnInit {
modelContact
=
new
Contact
();
myFormContact
:
FormGroup
;
myFormAddContact
:
FormGroup
;
myFormContact
:
FormGroup
;
myFormAddContact
:
FormGroup
;
sDate
=
""
;
@
ViewChild
(
'instance'
,
{
static
:
true
})
instance
:
NgbTypeahead
;
@
ViewChild
(
'instance'
,
{
static
:
true
})
instance
:
NgbTypeahead
;
focus$
=
new
Subject
<
string
>
();
click$
=
new
Subject
<
string
>
();
constructor
(
private
ContactService
:
ContactService
,
private
modalService
:
NgbModal
)
{
}
constructor
(
private
ContactService
:
ContactService
,
private
modalService
:
NgbModal
)
{
}
ngOnInit
():
void
{
this
.
listContact
=
this
.
ContactService
.
getListContact
();
...
...
@@ -86,11 +86,11 @@ export class ContactAdminComponent implements OnInit {
}
}
openContact
(
content
:
string
,
item
:
Contact
)
{
this
.
modelContact
=
item
;
openContact
(
content
:
string
,
item
:
Contact
)
{
this
.
modelContact
=
item
;
let
sDate
=
this
.
modelContact
.
sDate
.
split
(
'/'
)
this
.
sDate
=
sDate
[
0
]
+
"-"
+
sDate
[
1
]
+
"-"
+
sDate
[
2
]
this
.
sDate
=
sDate
[
0
]
+
"-"
+
sDate
[
1
]
+
"-"
+
sDate
[
2
]
this
.
myFormContact
=
new
FormGroup
({
ctName
:
new
FormControl
(
this
.
modelContact
.
ctName
),
...
...
@@ -106,12 +106,12 @@ export class ContactAdminComponent implements OnInit {
},
(
reason
)
=>
{
this
.
closeResult
=
`Dismissed
${
this
.
getDismissReason
(
reason
)}
`
;
});
console
.
log
(
"date"
,
this
.
modelContact
)
console
.
log
(
"date"
,
this
.
modelContact
)
}
saveContact
()
{
this
.
modelContact
.
sDate
=
this
.
modelContact
.
sDate
.
split
(
"-"
)[
0
]
+
"/"
+
this
.
modelContact
.
sDate
.
split
(
"-"
)[
1
]
+
"/"
+
this
.
modelContact
.
sDate
.
split
(
"-"
)[
2
];
this
.
modelContact
.
ctStatus
=
0
;
this
.
modelContact
.
sDate
=
this
.
modelContact
.
sDate
.
split
(
"-"
)[
0
]
+
"/"
+
this
.
modelContact
.
sDate
.
split
(
"-"
)[
1
]
+
"/"
+
this
.
modelContact
.
sDate
.
split
(
"-"
)[
2
];
this
.
modelContact
.
ctStatus
=
0
;
this
.
ContactService
.
addContact
(
this
.
modelContact
);
this
.
modalService
.
dismissAll
();
this
.
ngOnInit
();
...
...
@@ -129,4 +129,14 @@ export class ContactAdminComponent implements OnInit {
this
.
modalService
.
dismissAll
();
this
.
ngOnInit
();
}
openAdd
(
addContact
)
{
this
.
modelContact
=
new
Contact
;
this
.
modalService
.
open
(
addContact
,
{
ariaLabelledBy
:
'modal-basic-title'
}).
result
.
then
((
result
)
=>
{
this
.
closeResult
=
`Closed with:
${
result
}
`
;
},
(
reason
)
=>
{
this
.
closeResult
=
`Dismissed
${
this
.
getDismissReason
(
reason
)}
`
;
});
}
}
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