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
37bc6f67
Commit
37bc6f67
authored
Aug 26, 2024
by
Almouhannad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(F) Add status to doctor
parent
3da9960d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
10 deletions
+73
-10
doctor-status.component.html
...ctor-dashboard/doctor-status/doctor-status.component.html
+8
-5
doctor-status.component.ts
...doctor-dashboard/doctor-status/doctor-status.component.ts
+35
-3
doctors.service.ts
Clinics.Frontend/src/app/services/doctors/doctors.service.ts
+26
-0
doctor-notifications.service.ts
...ices/doctorsNotifications/doctor-notifications.service.ts
+4
-2
No files found.
Clinics.Frontend/src/app/components/doctor/doctor-dashboard/doctor-status/doctor-status.component.html
View file @
37bc6f67
<div
class=
"custom-child"
dir=
"rtl"
>
<div
class=
"custom-child"
dir=
"rtl"
>
<div
class=
"custom-bttuons-after-title custom-ok-button"
>
<div
class=
"custom-bttuons-after-title custom-ok-button"
>
<a
appScrollToTop
><button
class=
"btn btn-lg btn-outline-success"
style=
"width: 25%; cursor:auto"
>
الحالة:
<a
appScrollToTop
><button
class=
"btn btn-lg btn-outline-success"
style=
"width: 25%; cursor:auto"
>
الحالة:
متاح
</button></a>
{{doctorStatus}}
</button></a>
</div>
</div>
<div
class=
"custom-bttuons-after-title custom-create-button"
>
<div
class=
"custom-bttuons-after-title custom-create-button"
>
...
@@ -31,15 +31,18 @@
...
@@ -31,15 +31,18 @@
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"custom-select"
>
<div
class=
"custom-select"
>
<select
class=
"text-center mb-3 form-control"
>
<select
class=
"text-center mb-3 form-control"
<option
value=
"-1"
disabled
>
يرجى اختيار الحالة
</option>
[(
ngModel
)]="
doctorStatus
"
>
<!-- <option *ngFor="let doctor of doctors" [ngValue]="doctor.id">د. {{doctor.name}}</option> -->
<option
value=
"''"
disabled
>
يرجى اختيار الحالة
</option>
<option
*
ngFor=
"let status of statuses"
[
ngValue
]="
status
"
>
{{status}}
</option>
</select>
</select>
</div>
</div>
<a>
<a>
<div
class=
"custom-ok-button mb-3"
>
<div
class=
"custom-ok-button mb-3"
>
<button
class=
"btn btn-outline-secondary"
style=
"width:100%;"
(
click
)="
modal
.
dismiss
()"
>
<button
class=
"btn btn-outline-secondary"
style=
"width:100%;"
(
click
)="
modal
.
dismiss
()"
[
disabled
]="
doctorStatus =
==
''"
(
click
)="
onChangeStatus
()"
>
تأكيد
تأكيد
</button>
</button>
</div>
</div>
...
...
Clinics.Frontend/src/app/components/doctor/doctor-dashboard/doctor-status/doctor-status.component.ts
View file @
37bc6f67
...
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
...
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
import
{
AuthenticationService
}
from
'../../../../services/authentication/authentication.service'
;
import
{
AuthenticationService
}
from
'../../../../services/authentication/authentication.service'
;
import
{
UserData
}
from
'../../../../classes/authentication/user-data'
;
import
{
UserData
}
from
'../../../../classes/authentication/user-data'
;
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
NgbModal
}
from
'@ng-bootstrap/ng-bootstrap'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
DoctorsService
}
from
'../../../../services/doctors/doctors.service'
;
@
Component
({
@
Component
({
selector
:
'app-doctor-status'
,
selector
:
'app-doctor-status'
,
...
@@ -11,11 +13,14 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
...
@@ -11,11 +13,14 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
export
class
DoctorStatusComponent
implements
OnInit
{
export
class
DoctorStatusComponent
implements
OnInit
{
constructor
(
private
authenticationService
:
AuthenticationService
,
constructor
(
private
authenticationService
:
AuthenticationService
,
private
modalService
:
NgbModal
private
modalService
:
NgbModal
,
private
toastr
:
ToastrService
,
private
doctorsService
:
DoctorsService
)
{}
)
{}
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
setUserData
();
this
.
setDoctorStatus
();
}
}
userData
:
UserData
;
userData
:
UserData
;
...
@@ -29,4 +34,31 @@ export class DoctorStatusComponent implements OnInit {
...
@@ -29,4 +34,31 @@ export class DoctorStatusComponent implements OnInit {
size
:
'md'
size
:
'md'
});
});
}
}
doctorStatus
:
string
;
setDoctorStatus
():
void
{
this
.
doctorsService
.
getStatusByUserId
(
this
.
userData
.
id
)
.
subscribe
(
result
=>
{
if
(
result
.
status
===
false
)
{
this
.
toastr
.
error
(
'حدثت مشكلة، يرجى إعادة المحاولة'
);
}
else
{
this
.
doctorStatus
=
result
.
doctorStatus
!
;
}
})
}
statuses
:
string
[]
=
[
'مشغول'
,
'متاح'
,
'لديه مريض'
];
onChangeStatus
():
void
{
this
.
doctorsService
.
changeStatusByUserId
(
this
.
userData
.
id
,
this
.
doctorStatus
)
.
subscribe
(
result
=>
{
if
(
result
.
status
===
false
)
{
this
.
toastr
.
error
(
'حدثت مشكلة، يرجى إعادة المحاولة'
);
}
else
{
this
.
toastr
.
success
(
'تم تغيير الحالة بنجاح ✔'
)
}
})
}
}
}
Clinics.Frontend/src/app/services/doctors/doctors.service.ts
View file @
37bc6f67
...
@@ -38,4 +38,30 @@ export class DoctorsService {
...
@@ -38,4 +38,30 @@ export class DoctorsService {
})
})
);
);
}
}
getStatusByUserId
(
userId
:
number
):
Observable
<
{
status
:
boolean
,
errorMessage
:
string
|
null
,
doctorStatus
:
string
|
null
}
>
{
return
this
.
http
.
get
<
{
status
:
string
}
>
(
`
${
this
.
DOCTORS_ENDPOINT
}
/Status/
${
userId
}
`
)
.
pipe
(
map
((
response
:
{
status
:
string
})
=>
{
return
{
status
:
true
,
errorMessage
:
null
,
doctorStatus
:
response
.
status
};
}),
catchError
((
error
:
HttpErrorResponse
)
=>
{
console
.
error
(
error
.
error
.
detail
);
return
of
({
status
:
false
,
errorMessage
:
error
.
error
.
detail
,
doctorStatus
:
null
});
})
);
}
changeStatusByUserId
(
userId
:
number
,
doctorStatus
:
string
):
Observable
<
{
status
:
boolean
,
errorMessage
:
string
|
null
}
>
{
var
body
=
{
userId
:
userId
,
status
:
doctorStatus
};
return
this
.
http
.
post
(
`
${
this
.
DOCTORS_ENDPOINT
}
/Status`
,
body
)
.
pipe
(
map
(
_
=>
{
return
{
status
:
true
,
errorMessage
:
null
};
}),
catchError
((
error
:
HttpErrorResponse
)
=>
{
return
of
({
status
:
false
,
errorMessage
:
error
.
error
.
detail
});
})
);
}
}
}
Clinics.Frontend/src/app/services/doctorsNotifications/doctor-notifications.service.ts
View file @
37bc6f67
...
@@ -20,9 +20,11 @@ export class DoctorNotificationsService {
...
@@ -20,9 +20,11 @@ export class DoctorNotificationsService {
this
.
hubConnection
this
.
hubConnection
.
start
()
.
start
()
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
'Connected to signalR!'
)
//
console.log('Connected to signalR!')
})
})
.
catch
(
err
=>
console
.
error
(
'Error while starting connection: '
+
err
))
.
catch
(
// err => console.error('Error while starting connection: ' + err)
)
}
}
}
}
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