Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
HIAST-Clinics
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
almohanad.hafez
HIAST-Clinics
Commits
6949ca50
Commit
6949ca50
authored
Aug 23, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(F) complete update features
parent
f89e1817
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
12 deletions
+119
-12
doctor-users.service.ts
...d/src/app/usecases/admin/services/doctor-users.service.ts
+33
-0
update-doctor-user.component.ts
...onents/update-doctor-user/update-doctor-user.component.ts
+3
-3
update-doctor-personal-data-query.ts
...ersonal-data/classes/update-doctor-personal-data-query.ts
+3
-1
update-doctor-personal-data-result.ts
...rsonal-data/classes/update-doctor-personal-data-result.ts
+10
-0
update-doctor-personal-data-form.component.ts
...l-data-form/update-doctor-personal-data-form.component.ts
+24
-4
update-doctor-user-data-result.ts
...octor-user-data/classes/update-doctor-user-data-result.ts
+9
-0
update-doctor-user-query.ts
...date-doctor-user-data/classes/update-doctor-user-query.ts
+3
-1
update-doctor-user-data-form.component.ts
...-user-data-form/update-doctor-user-data-form.component.ts
+34
-3
No files found.
Clinics.Frontend/src/app/usecases/admin/services/doctor-users.service.ts
View file @
6949ca50
...
@@ -7,6 +7,10 @@ import { GetAllDoctorUsersResponse } from '../list-doctor-users/classes/get-all-
...
@@ -7,6 +7,10 @@ import { GetAllDoctorUsersResponse } from '../list-doctor-users/classes/get-all-
import
{
CreateDoctorUserCommand
}
from
'../create-doctor-user/classes/create-doctor-user-command'
;
import
{
CreateDoctorUserCommand
}
from
'../create-doctor-user/classes/create-doctor-user-command'
;
import
{
CreateDoctorUserResult
}
from
'../create-doctor-user/classes/create-doctor-user-result'
;
import
{
CreateDoctorUserResult
}
from
'../create-doctor-user/classes/create-doctor-user-result'
;
import
{
DoctorUserResponse
}
from
'../update-doctor-user/classes/doctor-user-response'
;
import
{
DoctorUserResponse
}
from
'../update-doctor-user/classes/doctor-user-response'
;
import
{
UpdateDoctorPersonalDataQuery
}
from
'../update-doctor-user/update-doctor-personal-data/classes/update-doctor-personal-data-query'
;
import
{
UpdateDoctorPersonalDataResult
}
from
'../update-doctor-user/update-doctor-personal-data/classes/update-doctor-personal-data-result'
;
import
{
updateDoctorUserQuery
}
from
'../update-doctor-user/update-doctor-user-data/classes/update-doctor-user-query'
;
import
{
UpdateDoctorUserDataResult
}
from
'../update-doctor-user/update-doctor-user-data/classes/update-doctor-user-data-result'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'root'
providedIn
:
'root'
...
@@ -67,5 +71,34 @@ export class DoctorUsersService {
...
@@ -67,5 +71,34 @@ export class DoctorUsersService {
}
}
// #endregion
// #endregion
// #region Update doctor peronsal info
updateDoctorPersonalInfo
(
query
:
UpdateDoctorPersonalDataQuery
)
:
Observable
<
UpdateDoctorPersonalDataResult
>
{
return
this
.
http
.
put
(
this
.
DOCTORUSERS_ENDPOINT
,
query
)
.
pipe
(
map
(
_
=>
{
return
new
UpdateDoctorPersonalDataResult
(
true
);
}),
catchError
((
error
:
HttpErrorResponse
)
=>
{
return
of
(
new
UpdateDoctorPersonalDataResult
(
false
,
error
.
error
.
detail
))
})
)
}
// #endregion
// #region Update doctor user data
updateDoctorUserData
(
query
:
updateDoctorUserQuery
):
Observable
<
UpdateDoctorUserDataResult
>
{
return
this
.
http
.
put
(
`
${
this
.
DOCTORUSERS_ENDPOINT
}
/Users`
,
query
)
.
pipe
(
map
(
_
=>
{
return
new
UpdateDoctorUserDataResult
(
true
);
}),
catchError
((
error
:
HttpErrorResponse
)
=>
{
return
of
(
new
UpdateDoctorUserDataResult
(
false
,
error
.
error
.
detail
))
})
)
}
// #endregion
// #endregion
// #endregion
}
}
\ No newline at end of file
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/components/update-doctor-user/update-doctor-user.component.ts
View file @
6949ca50
...
@@ -3,7 +3,7 @@ import { DoctorUsersService } from '../../../services/doctor-users.service';
...
@@ -3,7 +3,7 @@ import { DoctorUsersService } from '../../../services/doctor-users.service';
import
{
DoctorUserResponse
}
from
'../../classes/doctor-user-response'
;
import
{
DoctorUserResponse
}
from
'../../classes/doctor-user-response'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
UpdateDoctorPersonalDataQuery
}
from
'../../update-doctor-personal-data/classes/update-doctor-personal-data-query'
;
import
{
UpdateDoctorPersonalDataQuery
}
from
'../../update-doctor-personal-data/classes/update-doctor-personal-data-query'
;
import
{
updateDoctorUserQuery
}
from
'../../update-doctor-user-data/classes/update
DoctorUserQ
uery'
;
import
{
updateDoctorUserQuery
}
from
'../../update-doctor-user-data/classes/update
-doctor-user-q
uery'
;
@
Component
({
@
Component
({
selector
:
'app-update-doctor-user'
,
selector
:
'app-update-doctor-user'
,
...
@@ -24,11 +24,11 @@ export class UpdateDoctorUserComponent implements OnInit{
...
@@ -24,11 +24,11 @@ export class UpdateDoctorUserComponent implements OnInit{
this
.
doctorUsersService
.
getDoctorUserById
(
this
.
doctorUserId
)
this
.
doctorUsersService
.
getDoctorUserById
(
this
.
doctorUserId
)
.
subscribe
(
doctorUser
=>
{
.
subscribe
(
doctorUser
=>
{
this
.
doctorUser
=
doctorUser
!
;
this
.
doctorUser
=
doctorUser
!
;
this
.
editPersonalDataQuery
=
new
UpdateDoctorPersonalDataQuery
(
this
.
editPersonalDataQuery
=
new
UpdateDoctorPersonalDataQuery
(
doctorUser
!
.
id
,
this
.
doctorUser
.
firstName
,
this
.
doctorUser
.
middleName
,
this
.
doctorUser
.
firstName
,
this
.
doctorUser
.
middleName
,
this
.
doctorUser
.
lastName
this
.
doctorUser
.
lastName
);
);
this
.
editUserDataQuery
=
new
updateDoctorUserQuery
(
doctorUser
!
.
userName
);
this
.
editUserDataQuery
=
new
updateDoctorUserQuery
(
doctorUser
!
.
id
,
doctorUser
!
.
userName
);
}
}
)
)
}
}
...
...
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-personal-data/classes/update-doctor-personal-data-query.ts
View file @
6949ca50
export
class
UpdateDoctorPersonalDataQuery
{
export
class
UpdateDoctorPersonalDataQuery
{
public
id
:
number
;
public
firstName
:
string
;
public
firstName
:
string
;
public
middleName
:
string
;
public
middleName
:
string
;
public
lastName
:
string
;
public
lastName
:
string
;
constructor
(
firstName
:
string
,
middleName
:
string
,
lastName
:
string
)
{
constructor
(
id
:
number
,
firstName
:
string
,
middleName
:
string
,
lastName
:
string
)
{
this
.
id
=
id
;
this
.
firstName
=
firstName
;
this
.
firstName
=
firstName
;
this
.
middleName
=
middleName
;
this
.
middleName
=
middleName
;
this
.
lastName
=
lastName
;
this
.
lastName
=
lastName
;
...
...
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-personal-data/classes/update-doctor-personal-data-result.ts
0 → 100644
View file @
6949ca50
export
class
UpdateDoctorPersonalDataResult
{
public
status
:
boolean
;
public
errorMessage
:
string
|
null
=
null
;
constructor
(
status
:
boolean
,
errorMessage
:
string
|
null
=
null
)
{
this
.
status
=
status
;
this
.
errorMessage
=
errorMessage
;
}
}
\ No newline at end of file
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-personal-data/components/update-doctor-personal-data-form/update-doctor-personal-data-form.component.ts
View file @
6949ca50
...
@@ -3,6 +3,7 @@ import { DoctorUsersService } from '../../../../services/doctor-users.service';
...
@@ -3,6 +3,7 @@ import { DoctorUsersService } from '../../../../services/doctor-users.service';
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
NgForm
}
from
'@angular/forms'
;
import
{
UpdateDoctorPersonalDataQuery
}
from
'../../classes/update-doctor-personal-data-query'
;
import
{
UpdateDoctorPersonalDataQuery
}
from
'../../classes/update-doctor-personal-data-query'
;
import
{
Router
}
from
'@angular/router'
;
@
Component
({
@
Component
({
selector
:
'app-update-doctor-personal-data-form'
,
selector
:
'app-update-doctor-personal-data-form'
,
...
@@ -13,17 +14,18 @@ export class UpdateDoctorPersonalDataFormComponent {
...
@@ -13,17 +14,18 @@ export class UpdateDoctorPersonalDataFormComponent {
//#region CTOR DI
//#region CTOR DI
constructor
(
private
doctorUsersService
:
DoctorUsersService
,
constructor
(
private
doctorUsersService
:
DoctorUsersService
,
private
toastrService
:
ToastrService
private
toastrService
:
ToastrService
,
private
router
:
Router
)
{}
)
{}
//#endregion
//#endregion
// #region Inputs
// #region Inputs
@
Input
(
"formModel"
)
formModel
:
UpdateDoctorPersonalDataQuery
=
new
UpdateDoctorPersonalDataQuery
(
''
,
''
,
''
);
@
Input
(
"formModel"
)
formModel
:
UpdateDoctorPersonalDataQuery
=
new
UpdateDoctorPersonalDataQuery
(
1
,
''
,
''
,
''
);
// #endregion
// #endregion
//#region Variables
//#region Variables
@
ViewChild
(
"form"
)
updateDoctorPseronalDataF
orm
:
NgForm
;
@
ViewChild
(
"form"
)
f
orm
:
NgForm
;
isFailure
:
boolean
=
false
;
isFailure
:
boolean
=
false
;
errorMessage
:
string
;
errorMessage
:
string
;
...
@@ -31,7 +33,25 @@ export class UpdateDoctorPersonalDataFormComponent {
...
@@ -31,7 +33,25 @@ export class UpdateDoctorPersonalDataFormComponent {
// #region On submut
// #region On submut
onSubmit
():
void
{
onSubmit
():
void
{
this
.
isFailure
=
false
;
if
(
this
.
form
.
valid
)
{
this
.
doctorUsersService
.
updateDoctorPersonalInfo
(
this
.
formModel
)
.
subscribe
(
result
=>
{
if
(
result
.
status
===
true
)
{
this
.
toastrService
.
success
(
'تم تعديل البيانات بنجاح'
);
this
.
router
.
navigateByUrl
(
'admin/doctors'
);
}
else
{
this
.
isFailure
=
true
;
this
.
errorMessage
=
result
.
errorMessage
!
;
this
.
form
.
form
.
markAsPristine
();
}
}
)
}
}
}
// #endregion
// #endregion
...
...
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-user-data/classes/update-doctor-user-data-result.ts
0 → 100644
View file @
6949ca50
export
class
UpdateDoctorUserDataResult
{
status
:
boolean
;
errorMessage
:
string
|
null
=
null
;
constructor
(
status
:
boolean
,
errorMessage
:
string
|
null
=
null
)
{
this
.
status
=
status
;
this
.
errorMessage
=
errorMessage
;
}
}
\ No newline at end of file
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-user-data/classes/update
DoctorUserQ
uery.ts
→
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-user-data/classes/update
-doctor-user-q
uery.ts
View file @
6949ca50
export
class
updateDoctorUserQuery
{
export
class
updateDoctorUserQuery
{
public
id
:
number
;
public
userName
:
string
;
public
userName
:
string
;
public
password
:
string
|
null
=
null
;
public
password
:
string
|
null
=
null
;
constructor
(
userName
:
string
,
password
:
string
|
null
=
null
)
{
constructor
(
id
:
number
,
userName
:
string
,
password
:
string
|
null
=
null
)
{
this
.
id
=
id
;
this
.
userName
=
userName
;
this
.
userName
=
userName
;
this
.
password
=
password
;
this
.
password
=
password
;
}
}
...
...
Clinics.Frontend/src/app/usecases/admin/update-doctor-user/update-doctor-user-data/components/update-doctor-user-data-form/update-doctor-user-data-form.component.ts
View file @
6949ca50
import
{
Component
,
Input
}
from
'@angular/core'
;
import
{
Component
,
Input
,
ViewChild
}
from
'@angular/core'
;
import
{
updateDoctorUserQuery
}
from
'../../classes/updateDoctorUserQuery'
;
import
{
updateDoctorUserQuery
}
from
'../../classes/update-doctor-user-query'
;
import
{
DoctorUsersService
}
from
'../../../../services/doctor-users.service'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Router
}
from
'@angular/router'
;
import
{
NgForm
}
from
'@angular/forms'
;
@
Component
({
@
Component
({
selector
:
'app-update-doctor-user-data-form'
,
selector
:
'app-update-doctor-user-data-form'
,
...
@@ -8,12 +12,39 @@ import { updateDoctorUserQuery } from '../../classes/updateDoctorUserQuery';
...
@@ -8,12 +12,39 @@ import { updateDoctorUserQuery } from '../../classes/updateDoctorUserQuery';
})
})
export
class
UpdateDoctorUserDataFormComponent
{
export
class
UpdateDoctorUserDataFormComponent
{
// #region CTOR DI
constructor
(
private
doctorUsersService
:
DoctorUsersService
,
private
toastrService
:
ToastrService
,
private
router
:
Router
)
{}
// #endregion
@
ViewChild
(
'form'
)
form
:
NgForm
;
isFailure
:
boolean
=
false
;
isFailure
:
boolean
=
false
;
errorMessage
:
string
;
errorMessage
:
string
;
@
Input
(
"formModel"
)
formModel
:
updateDoctorUserQuery
;
@
Input
(
"formModel"
)
formModel
:
updateDoctorUserQuery
;
onSubmit
():
void
{
onSubmit
():
void
{
if
(
this
.
form
.
valid
)
{
this
.
isFailure
=
false
;
this
.
doctorUsersService
.
updateDoctorUserData
(
this
.
formModel
)
.
subscribe
(
result
=>
{
if
(
result
.
status
===
true
)
{
this
.
toastrService
.
success
(
'تم تحديث البيانات بنجاح'
);
this
.
router
.
navigateByUrl
(
'admin/doctors'
);
}
else
{
this
.
isFailure
=
true
;
this
.
errorMessage
=
result
.
errorMessage
!
;
this
.
form
.
form
.
markAsPristine
();
}
}
)
}
}
}
}
}
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