Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
HIMS
Project
Project
Details
Activity
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
Sandeep Sagar
HIMS
Commits
71a17529
Commit
71a17529
authored
Oct 12, 2023
by
Sandeep Sagar Panjala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit
parent
476e4126
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1604 additions
and
0 deletions
+1604
-0
age.pipe.ts
Presentation/Hims.Admin/src/app/shared/pipes/age.pipe.ts
+60
-0
format-bytes.pipe.ts
...tion/Hims.Admin/src/app/shared/pipes/format-bytes.pipe.ts
+17
-0
from-array.pipe.ts
...tation/Hims.Admin/src/app/shared/pipes/from-array.pipe.ts
+15
-0
gender.pipe.ts
Presentation/Hims.Admin/src/app/shared/pipes/gender.pipe.ts
+22
-0
index.ts
Presentation/Hims.Admin/src/app/shared/pipes/index.ts
+14
-0
initials.pipe.ts
...entation/Hims.Admin/src/app/shared/pipes/initials.pipe.ts
+33
-0
marital-status.pipe.ts
...on/Hims.Admin/src/app/shared/pipes/marital-status.pipe.ts
+24
-0
minute-seconds.pipe.ts
...on/Hims.Admin/src/app/shared/pipes/minute-seconds.pipe.ts
+16
-0
safe.pipe.ts
Presentation/Hims.Admin/src/app/shared/pipes/safe.pipe.ts
+13
-0
search.pipe.ts
Presentation/Hims.Admin/src/app/shared/pipes/search.pipe.ts
+15
-0
sort-form-array.pipe.ts
...n/Hims.Admin/src/app/shared/pipes/sort-form-array.pipe.ts
+27
-0
sort-form.pipe.ts
...ntation/Hims.Admin/src/app/shared/pipes/sort-form.pipe.ts
+27
-0
to-array.pipe.ts
...entation/Hims.Admin/src/app/shared/pipes/to-array.pipe.ts
+19
-0
utc-to-local.pipe.ts
...tion/Hims.Admin/src/app/shared/pipes/utc-to-local.pipe.ts
+21
-0
appointment-refresh.service.ts
...in/src/app/shared/services/appointment-refresh.service.ts
+30
-0
appointment-toggle.service.ts
...min/src/app/shared/services/appointment-toggle.service.ts
+11
-0
banner.service.ts
...tion/Hims.Admin/src/app/shared/services/banner.service.ts
+44
-0
bill-notificaton.service.ts
...Admin/src/app/shared/services/bill-notificaton.service.ts
+43
-0
communication.service.ts
...ms.Admin/src/app/shared/services/communication.service.ts
+205
-0
dashboard.service.ts
...n/Hims.Admin/src/app/shared/services/dashboard.service.ts
+21
-0
final-bill.service.ts
.../Hims.Admin/src/app/shared/services/final-bill.service.ts
+11
-0
http-error.service.ts
.../Hims.Admin/src/app/shared/services/http-error.service.ts
+28
-0
http.service.ts
...tation/Hims.Admin/src/app/shared/services/http.service.ts
+55
-0
icon.service.ts
...tation/Hims.Admin/src/app/shared/services/icon.service.ts
+30
-0
identity.service.ts
...on/Hims.Admin/src/app/shared/services/identity.service.ts
+55
-0
index.ts
Presentation/Hims.Admin/src/app/shared/services/index.ts
+27
-0
jitsi.service.ts
...ation/Hims.Admin/src/app/shared/services/jitsi.service.ts
+39
-0
menu.service.ts
...tation/Hims.Admin/src/app/shared/services/menu.service.ts
+257
-0
notify.service.ts
...tion/Hims.Admin/src/app/shared/services/notify.service.ts
+225
-0
print-option.service.ts
...ims.Admin/src/app/shared/services/print-option.service.ts
+33
-0
print.service.ts
...ation/Hims.Admin/src/app/shared/services/print.service.ts
+144
-0
queue.service.ts
...ation/Hims.Admin/src/app/shared/services/queue.service.ts
+12
-0
redirect-appointment.service.ts
...n/src/app/shared/services/redirect-appointment.service.ts
+11
-0
resource.service.ts
...on/Hims.Admin/src/app/shared/services/resource.service.ts
+0
-0
No files found.
Presentation/Hims.Admin/src/app/shared/pipes/age.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
import
*
as
moment
from
"moment"
;
@
Pipe
({
name
:
"age"
})
export
class
AgePipe
implements
PipeTransform
{
//transform(value: Date): string {
// let today = moment();
// let birthdate = moment(value);
// let years = today.diff(birthdate, 'years');
// let html: string = years + " yr ";
// html += today.subtract(years, 'years').diff(birthdate, 'months') + " mo";
// return html; // only yr ,m
//}
transform
(
value
:
Date
|
string
,
precision
:
"years"
|
"months"
|
"days"
=
"years"
)
{
if
(
!
value
)
{
return
""
;
}
const
today
=
moment
();
const
birthdate
=
moment
(
value
);
let
age
=
''
;
switch
(
precision
)
{
case
"days"
:
age
+=
today
.
diff
(
birthdate
,
'years'
)
+
'Y '
;
//years
const
y
=
today
.
diff
(
birthdate
,
'years'
);
//yr
age
+=
today
.
subtract
(
y
,
'years'
).
diff
(
birthdate
,
'months'
)
+
'M '
;
// months
var
m
=
today
.
diff
(
birthdate
,
'months'
);
//m
birthdate
.
add
(
m
,
'months'
);
age
+=
today
.
diff
(
birthdate
,
'days'
)
+
'D'
;
//days
break
;
case
"months"
:
age
+=
today
.
diff
(
birthdate
,
'years'
)
+
'Y '
;
//years
const
yr
=
today
.
diff
(
birthdate
,
'years'
);
//yr
age
+=
today
.
subtract
(
yr
,
'years'
).
diff
(
birthdate
,
'months'
)
+
'M'
;
// months
break
;
default
:
age
+=
today
.
diff
(
birthdate
,
'years'
)
+
'Y '
;
//years
break
;
}
return
age
;
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/format-bytes.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
function
formatBytes
(
a
:
number
,
b
:
number
)
{
if
(
0
===
a
)
return
"0 Bytes"
;
const
c
=
0
>
b
?
0
:
b
,
d
=
Math
.
floor
(
Math
.
log
(
a
)
/
Math
.
log
(
1024
));
return
parseFloat
((
a
/
Math
.
pow
(
1024
,
d
)).
toFixed
(
c
))
+
" "
+
[
"Bytes"
,
"KB"
,
"MB"
,
"GB"
,
"TB"
,
"PB"
,
"EB"
,
"ZB"
,
"YB"
][
d
]
}
@
Pipe
({
name
:
"formatBytes"
})
export
class
FormatBytesPipe
implements
PipeTransform
{
transform
(
size
:
number
,
length
=
2
)
{
if
(
!
size
)
{
return
""
;
}
return
formatBytes
(
size
,
length
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/from-array.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"fromArray"
})
export
class
FromArrayPipe
implements
PipeTransform
{
transform
(
value
:
Array
<
string
>
)
{
if
(
!
value
&&
!
value
.
length
)
{
return
""
;
}
return
value
.
join
(
", "
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/gender.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"gender"
})
export
class
GenderPipe
implements
PipeTransform
{
transform
(
val
:
string
)
{
switch
(
val
)
{
case
"M"
:
return
"Male"
;
case
"F"
:
return
"Female"
;
case
"O"
:
return
"Other"
;
case
"A"
:
return
"Ambiguous"
;
default
:
return
"N/A"
;
}
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/index.ts
0 → 100644
View file @
71a17529
export
*
from
"./safe.pipe"
;
export
*
from
"./initials.pipe"
;
export
*
from
"./utc-to-local.pipe"
;
export
*
from
"./format-bytes.pipe"
;
export
*
from
"./gender.pipe"
;
export
*
from
"./marital-status.pipe"
;
export
*
from
"./from-array.pipe"
;
export
*
from
"./to-array.pipe"
;
export
*
from
"./minute-seconds.pipe"
;
export
*
from
"./search.pipe"
;
export
*
from
"./sort-form-array.pipe"
;
export
*
from
"./sort-form.pipe"
;
export
*
from
"./age.pipe"
;
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/initials.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"initials"
})
export
class
InitialsPipe
implements
PipeTransform
{
transform
(
value
:
any
)
{
if
(
!
value
)
{
return
""
;
}
if
(
value
.
indexOf
(
" "
)
>
0
)
{
const
titles
=
value
.
split
(
" "
);
return
titles
[
0
].
substring
(
0
,
1
).
toUpperCase
()
+
titles
[
titles
.
length
-
1
].
substring
(
0
,
1
).
toUpperCase
();
}
else
{
return
value
.
substring
(
0
,
2
).
toUpperCase
();
}
}
}
@
Pipe
({
name
:
"spaceTitle"
})
export
class
TitlePipe
implements
PipeTransform
{
transform
(
value
:
any
)
{
if
(
!
value
)
{
return
""
;
}
return
value
.
replace
(
/
([
A-Z
])
/g
,
" $1"
).
replace
(
"Mi Qlave"
,
"MiQlave"
).
trim
();
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/marital-status.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"maritalStatus"
})
export
class
MaritalStatusPipe
implements
PipeTransform
{
transform
(
val
:
string
)
{
switch
(
val
)
{
case
"M"
:
return
"Married"
;
case
"S"
:
return
"Single"
;
case
"D"
:
return
"Divorced"
;
case
"W"
:
return
"Widowed"
;
case
"O"
:
return
"Other"
;
default
:
return
"N/A"
;
}
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/minute-seconds.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"minuteSeconds"
})
export
class
MinuteSecondsPipe
implements
PipeTransform
{
transform
(
value
:
number
):
string
{
if
(
!
value
)
{
return
""
;
}
const
minutes
=
Math
.
floor
(
value
/
60
);
return
minutes
.
toString
().
padStart
(
2
,
"0"
)
+
":"
+
(
value
-
minutes
*
60
).
toString
().
padStart
(
2
,
"0"
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/safe.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
import
{
DomSanitizer
}
from
"@angular/platform-browser"
;
@
Pipe
({
name
:
"safe"
})
export
class
SafePipe
implements
PipeTransform
{
constructor
(
private
readonly
sanitizer
:
DomSanitizer
)
{
}
transform
(
url
:
string
)
{
return
this
.
sanitizer
.
bypassSecurityTrustResourceUrl
(
url
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/search.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"search"
})
export
class
SearchPipe
implements
PipeTransform
{
transform
(
value
,
keys
:
string
,
term
:
string
)
{
if
(
!
term
)
{
return
value
;
}
return
(
value
||
[]).
filter
(
item
=>
keys
.
split
(
","
).
some
(
key
=>
item
.
hasOwnProperty
(
key
)
&&
new
RegExp
(
term
,
"gi"
).
test
(
item
[
key
])));
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/sort-form-array.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"sortFormArray"
,
pure
:
false
})
export
class
SortFormArrayPipe
implements
PipeTransform
{
transform
(
array
:
Array
<
string
>
,
property
:
string
):
Array
<
string
>
{
if
(
array
!==
undefined
)
{
return
array
.
sort
((
a
:
any
,
b
:
any
)
=>
{
const
aValue
=
a
[
property
];
const
bValue
=
b
[
property
];
if
(
aValue
<
bValue
)
{
return
-
1
;
}
else
if
(
aValue
>
bValue
)
{
return
1
;
}
else
{
return
0
;
}
});
}
return
array
;
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/sort-form.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"sortForm"
,
pure
:
false
})
export
class
SortFormPipe
implements
PipeTransform
{
transform
(
array
:
Array
<
any
>
,
property
:
string
):
Array
<
string
>
{
if
(
array
!==
undefined
)
{
return
array
.
sort
((
a
:
any
,
b
:
any
)
=>
{
const
aValue
=
a
.
value
[
property
];
const
bValue
=
b
.
value
[
property
];
if
(
aValue
<
bValue
)
{
return
-
1
;
}
else
if
(
aValue
>
bValue
)
{
return
1
;
}
else
{
return
0
;
}
});
}
return
array
;
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/to-array.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
@
Pipe
({
name
:
"toArray"
})
export
class
ToArrayPipe
implements
PipeTransform
{
transform
(
value
:
any
)
{
if
(
!
value
)
{
return
[];
}
if
(
value
.
indexOf
(
","
)
<
0
)
{
return
[
value
];
}
return
value
.
split
(
","
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/pipes/utc-to-local.pipe.ts
0 → 100644
View file @
71a17529
import
{
Pipe
,
PipeTransform
}
from
"@angular/core"
;
import
*
as
moment
from
"moment"
;
@
Pipe
({
name
:
"utcToLocal"
})
export
class
UTCToLocalPipe
implements
PipeTransform
{
transform
(
date
:
string
|
Date
,
isTimestamp
?:
boolean
,
format
?:
string
)
{
if
(
!
date
)
{
return
""
;
}
isTimestamp
=
isTimestamp
===
null
||
isTimestamp
===
undefined
?
true
:
isTimestamp
;
const
dateFormat
=
isTimestamp
?
"MM/DD/YYYY hh:mm a"
:
"MM/DD/YYYY"
;
const
utcTime
=
date
;
const
offset
=
moment
().
utcOffset
();
return
moment
.
utc
(
utcTime
).
utcOffset
(
offset
).
format
(
format
?
format
:
dateFormat
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/services/appointment-refresh.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
BehaviorSubject
,
Observable
,
Subject
}
from
"rxjs"
;
import
{
HealthCard
}
from
"../entities"
;
@
Injectable
()
export
class
AppointmentRefreshService
{
private
jitsiSource
=
new
BehaviorSubject
(
null
);
jitsiAccount
:
Observable
<
any
>
=
this
.
jitsiSource
.
asObservable
();
refresh
(
isRefreshed
:
boolean
)
{
this
.
jitsiSource
.
next
(
isRefreshed
);
}
private
source
=
new
BehaviorSubject
(
null
);
appointment
:
Observable
<
any
>
=
this
.
source
.
asObservable
();
refreshAppointment
(
isRefreshed
:
boolean
)
{
this
.
source
.
next
(
isRefreshed
);
}
private
conditionalRefreshSource
=
new
BehaviorSubject
(
null
);
conditionalRefresh
:
Observable
<
any
>
=
this
.
conditionalRefreshSource
.
asObservable
();
conditionalRefreshAppointment
(
model
:
{})
{
this
.
conditionalRefreshSource
.
next
(
model
);
}
private
healthCard
=
new
Subject
();
healthCardDetail
:
Observable
<
any
>
=
this
.
healthCard
.
asObservable
();
onClickHealthCard
(
item
:
HealthCard
)
{
this
.
healthCard
.
next
(
item
);
}
}
Presentation/Hims.Admin/src/app/shared/services/appointment-toggle.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
Observable
,
Subject
}
from
"rxjs"
;
@
Injectable
()
export
class
AppointmentToggleService
{
private
source
=
new
Subject
<
boolean
>
();
subscriber
:
Observable
<
boolean
>
=
this
.
source
.
asObservable
();
toggle
(
is
:
boolean
)
{
this
.
source
.
next
(
is
);
}
}
Presentation/Hims.Admin/src/app/shared/services/banner.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
ApiResources
,
UtilHelper
}
from
"../helpers"
;
import
{
HttpService
}
from
"."
;
import
{
Setting
}
from
"../entities"
;
@
Injectable
()
export
class
BannerService
{
constructor
(
private
readonly
httpService
:
HttpService
)
{
}
//get(callback?: Function) {
// const request = {
// imageType: "Banner"
// };
// this.httpService
// .get(ApiResources.getURI(ApiResources.setting.base, ApiResources.setting.applyLogo), request)
// .subscribe(
// (response: ImageReports) => {
// callback(response);
// },
// () => {
// callback();
// }
// );
//}
getBannerImage
(
callback
?:
Function
)
{
this
.
httpService
.
get
<
Array
<
Setting
>>
(
ApiResources
.
getURI
(
ApiResources
.
setting
.
base
,
ApiResources
.
setting
.
fetch
),
{
type
:
"Banner"
,
active
:
true
},
true
)
.
subscribe
(
(
response
:
Array
<
Setting
>
)
=>
{
if
(
response
&&
response
.
length
>
0
)
{
if
(
UtilHelper
.
isEmpty
(
response
[
0
].
imageUrl
))
{
response
[
0
].
imageUrl
=
`
${
ApiResources
.
getURI
(
ApiResources
.
resources
.
base
,
ApiResources
.
resources
.
getProfileImage
)}
?imagePath=
${
response
[
0
].
imageUrl
}
`
;
callback
(
response
[
0
].
imageUrl
);
}
}
},
()
=>
{
callback
();
}
);
}
}
Presentation/Hims.Admin/src/app/shared/services/bill-notificaton.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
HttpService
}
from
"./http.service"
;
import
{
ApiResources
}
from
"../helpers"
;
import
{
NotifyService
}
from
"./notify.service"
;
import
{
MasterBillModel
}
from
"../entities"
;
import
{
Router
}
from
"@angular/router"
;
@
Injectable
()
export
class
BillNotificationService
{
masterBill
:
Array
<
MasterBillModel
>
;
constructor
(
private
readonly
httpService
:
HttpService
,
private
readonly
notifyService
:
NotifyService
,
private
readonly
router
:
Router
,
)
{
this
.
masterBill
=
new
Array
<
MasterBillModel
>
();
}
get
(
patientId
?:
number
)
{
const
request
=
{
patientId
:
patientId
}
this
.
httpService
.
post
(
ApiResources
.
getURI
(
ApiResources
.
masterbill
.
base
,
ApiResources
.
masterbill
.
fetchPatientDue
),
request
)
.
subscribe
(
(
response
:
Array
<
MasterBillModel
>
)
=>
{
this
.
masterBill
=
response
;
if
(
response
&&
response
.
length
>
0
)
{
this
.
notifyService
.
confirm
(
`You are having Payment Due in <b>
${
this
.
masterBill
[
0
].
modulesName
}
</b>, Do you want to pay ?`
,
()
=>
{
this
.
onPayDue
(
this
.
masterBill
[
0
].
encryptedPatientId
)
},
()
=>
{
$
(
"#printButton"
).
click
();
})
}
},
()
=>
{
}
);
}
onPayDue
(
encryptedPatientId
:
string
)
{
this
.
router
.
navigateByUrl
(
`app/masters/final-master-bill/
${
encryptedPatientId
}
`
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/services/communication.service.ts
0 → 100644
View file @
71a17529
import
{
EventEmitter
,
Injectable
}
from
'@angular/core'
;
import
{
HttpTransportType
,
HubConnection
,
HubConnectionBuilder
,
IHttpConnectionOptions
,
LogLevel
}
from
'@microsoft/signalr'
;
import
{
AppConfig
}
from
"@shared/services"
;
import
{
UtilHelper
}
from
'../helpers'
;
import
{
CommunicationMessageModel
}
from
'../models'
;
@
Injectable
()
export
class
CommunicationService
{
public
connectionStatus
:
boolean
;
public
individualConnectionStatus
:
boolean
;
public
hubConnection
:
HubConnection
;
public
customGroups
:
Array
<
CommunicationGroupMeta
>
;
messageReceived
=
new
EventEmitter
<
CommunicationMessageModel
>
();
public
uniqueId
:
string
;
public
appConfigUrl
:
any
;
constructor
()
{
this
.
customGroups
=
new
Array
<
CommunicationGroupMeta
>
();
}
/* Initial Connections */
public
createConnection
(
callback
?:
Function
)
{
const
myInterval
=
setInterval
(()
=>
{
const
appConfigUrl
=
{
...
AppConfig
.
settings
};
if
(
UtilHelper
.
isEmpty
(
appConfigUrl
[
"signalR"
]))
{
const
url
=
appConfigUrl
[
"signalR"
];
this
.
create
(
url
);
clearInterval
(
myInterval
);
callback
&&
callback
()
}
},
10
);
}
private
create
(
url
:
string
)
{
const
options
=
{
transport
:
HttpTransportType
.
ServerSentEvents
,
logging
:
LogLevel
.
Information
,
// accessTokenFactory: () => { return Token.getToken() }
}
as
IHttpConnectionOptions
;
this
.
hubConnection
=
new
HubConnectionBuilder
()
.
withUrl
(
url
,
options
)
.
withAutomaticReconnect
()
.
build
();
}
public
startConnection
(
id
:
string
,
callback
?:
Function
):
void
{
this
.
hubConnection
.
start
()
.
then
(()
=>
{
console
.
info
(
"Communication Started."
);
this
.
connectionStatus
=
true
;
this
.
subscribeToGroup
(
id
,
true
,
()
=>
{
callback
&&
callback
();
});
})
.
catch
(
err
=>
{
console
.
info
(
"Communication failed to start."
);
console
.
error
(
err
);
this
.
connectionStatus
=
false
;
//setTimeout(() => {
// this.startConnection(id);
//}, 5000);
});
}
public
stopConnection
():
void
{
this
.
unsubscribeToAllGroup
();
this
.
hubConnection
.
stop
()
.
then
(()
=>
{
console
.
info
(
"Communication stopped."
);
this
.
connectionStatus
=
false
;
this
.
customGroups
=
new
Array
<
CommunicationGroupMeta
>
();
})
.
catch
(
err
=>
{
console
.
log
(
"Communication failed to stop."
);
console
.
error
(
err
);
//setTimeout(() => {
// this.stopConnection();
//}, 10000);
});
}
/* Groups */
public
subscribeToGroup
(
groupName
:
string
,
isIndividual
=
false
,
onSuccess
:
()
=>
void
=
()
=>
{
},
onFailure
:
()
=>
void
=
()
=>
{
})
{
if
(
!
this
.
connectionStatus
)
{
onFailure
();
return
;
}
this
.
hubConnection
.
invoke
(
"SubscribeToGroup"
,
groupName
)
.
then
(()
=>
{
if
(
isIndividual
)
{
this
.
individualConnectionStatus
=
true
;
}
else
{
let
group
=
this
.
customGroups
.
find
(
x
=>
x
.
groupName
===
groupName
);
if
(
!
group
)
{
group
=
new
CommunicationGroupMeta
();
group
.
groupName
=
groupName
;
group
.
status
=
true
;
this
.
customGroups
.
push
(
group
);
}
else
{
group
.
status
=
true
;
}
}
onSuccess
();
}).
catch
(
err
=>
{
console
.
log
(
"Cominication failed to subscribe to group"
);
console
.
error
(
err
);
if
(
isIndividual
)
{
this
.
individualConnectionStatus
=
false
;
}
else
{
const
group
=
this
.
customGroups
.
find
(
x
=>
x
.
groupName
===
groupName
);
if
(
group
)
{
group
.
status
=
false
;
}
}
//if (isIndividual) {
// setTimeout(() => {
// this.subscribeToGroup(groupName, true);
// }, 10000);
//}
});
}
public
unsubscribeToGroup
(
groupName
:
string
)
{
this
.
hubConnection
.
invoke
(
"UnsubscribeToGroup"
,
groupName
)
.
then
(()
=>
{
this
.
customGroups
=
this
.
customGroups
.
filter
(
x
=>
x
.
groupName
!==
groupName
);
})
.
catch
(
err
=>
{
console
.
log
(
"Cominication failed to unsubscribe from group"
);
console
.
error
(
err
);
});
}
public
unsubscribeToAllGroup
()
{
this
.
customGroups
.
forEach
(
groupName
=>
{
this
.
hubConnection
.
invoke
(
"UnsubscribeToGroup"
,
groupName
)
.
catch
(
err
=>
{
console
.
log
(
"Cominication failed to unsubscribe from all group"
);
console
.
error
(
err
);
});
});
}
sendMessage
(
message
:
CommunicationMessageModel
)
{
this
.
hubConnection
.
invoke
(
"Communication"
,
message
);
}
/* Send Messages */
public
sendGlobalMessage
(
message
:
CommunicationMessageMeta
)
{
this
.
hubConnection
.
invoke
(
"CommunicationGlobal"
,
message
);
}
public
sendGroupMessage
(
message
:
CommunicationMessageMeta
)
{
this
.
hubConnection
.
invoke
(
"CommunicationGroup"
,
message
);
}
/* Helpers */
public
getConnectionStatus
(
groupName
:
string
):
boolean
|
null
{
const
group
=
this
.
customGroups
.
find
(
x
=>
x
.
groupName
===
groupName
);
return
group
?
group
.
status
:
null
;
}
//private subscribeToIndividualCommunication(id: string) {
// this.hubConnection.invoke(Wordings.subscribeIndividual, id)
// .then(() => {
// this.individualConnectionStatus = true;
// }).catch(err => {
// this.individualConnectionStatus = false;
// console.error(err.toString());
// setTimeout(() => {
// this.subscribeToIndividualCommunication(id);
// }, 5000);
// });
//}
//private unsubscribeToIndividualCommunication(id: string) {
// this.hubConnection.invoke(Wordings.unsubscribeIndividual, id)
// .catch(err => console.error(err.toString()));
//}
}
export
class
CommunicationGroupMeta
{
groupName
:
string
;
status
:
boolean
;
}
export
class
CommunicationMessageMeta
{
type
:
number
;
uniqueId
:
string
;
mainEid
:
string
;
subEid
:
string
;
message
:
string
;
groupName
:
string
;
ownerEid
:
string
;
}
Presentation/Hims.Admin/src/app/shared/services/dashboard.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
ControlType
}
from
"../enums/control-type.enum"
;
@
Injectable
()
export
class
DashboardService
{
getControlType
=
(
dataType
:
string
)
=>
{
switch
(
dataType
)
{
case
"boolean"
:
case
"bool"
:
return
ControlType
.
Boolean
;
case
"date"
:
return
ControlType
.
Date
;
case
"varchar"
:
case
"text"
:
return
ControlType
.
Text
;
default
:
return
ControlType
.
Number
;
}
}
}
Presentation/Hims.Admin/src/app/shared/services/final-bill.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
Observable
,
Subject
}
from
"rxjs"
;
@
Injectable
()
export
class
FinalBillService
{
private
source
=
new
Subject
<
boolean
>
();
get
:
Observable
<
boolean
>
=
this
.
source
.
asObservable
();
set
(
isRefresh
:
boolean
)
{
this
.
source
.
next
(
isRefresh
);
}
}
Presentation/Hims.Admin/src/app/shared/services/http-error.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
HttpErrorInfo
}
from
'../models'
;
@
Injectable
()
export
class
HttpErrorService
{
messages
:
Array
<
HttpErrorInfo
>
;
timeout
:
any
;
constructor
()
{
this
.
messages
=
new
Array
<
HttpErrorInfo
>
();
}
add
(
model
:
HttpErrorInfo
)
{
this
.
messages
=
new
Array
<
HttpErrorInfo
>
();
this
.
messages
.
push
(
model
);
clearTimeout
(
this
.
timeout
);
this
.
timeout
=
setTimeout
(()
=>
{
this
.
messages
=
new
Array
<
HttpErrorInfo
>
();
},
3000
);
}
close
=
()
=>
{
clearTimeout
(
this
.
timeout
);
this
.
messages
=
new
Array
<
HttpErrorInfo
>
();
}
}
Presentation/Hims.Admin/src/app/shared/services/http.service.ts
0 → 100644
View file @
71a17529
import
{
HttpClient
,
HttpHeaders
}
from
"@angular/common/http"
;
import
{
Injectable
}
from
"@angular/core"
;
import
{
Observable
}
from
"rxjs"
;
@
Injectable
()
export
class
HttpService
{
constructor
(
private
readonly
http
:
HttpClient
)
{
}
get
<
TResponse
>
(
apiEndPoint
:
string
,
request
?:
any
,
auth
=
true
):
Observable
<
TResponse
>
{
let
headers
=
new
HttpHeaders
();
if
(
!
auth
)
{
headers
=
headers
.
append
(
"Auth"
,
"True"
);
}
return
this
.
http
.
get
<
TResponse
>
(
apiEndPoint
,
{
headers
:
headers
,
params
:
request
});
}
post
<
TResponse
>
(
apiEndPoint
:
string
,
request
:
any
,
auth
=
true
):
Observable
<
TResponse
>
{
let
headers
=
new
HttpHeaders
();
if
(
!
auth
)
{
headers
=
headers
.
append
(
"Auth"
,
"False"
);
}
return
this
.
http
.
post
<
TResponse
>
(
apiEndPoint
,
request
,
{
headers
:
headers
});
}
put
<
TResponse
>
(
apiEndPoint
:
string
,
request
:
any
,
auth
=
true
):
Observable
<
TResponse
>
{
let
headers
=
new
HttpHeaders
();
if
(
!
auth
)
{
headers
=
headers
.
append
(
"Auth"
,
"False"
);
}
return
this
.
http
.
put
<
TResponse
>
(
apiEndPoint
,
request
,
{
headers
:
headers
});
}
delete
<
TResponse
>
(
apiEndPoint
:
string
,
request
?:
any
,
auth
=
true
):
Observable
<
TResponse
>
{
let
headers
=
new
HttpHeaders
();
if
(
!
auth
)
{
headers
=
headers
.
append
(
"Auth"
,
"True"
);
}
return
this
.
http
.
delete
<
TResponse
>
(
apiEndPoint
,
{
headers
:
headers
,
params
:
request
});
}
postFile
<
TResponse
>
(
apiEndPoint
:
string
,
request
:
any
,
auth
=
true
):
Observable
<
TResponse
>
{
let
headers
=
new
HttpHeaders
();
if
(
!
auth
)
{
headers
=
headers
.
append
(
"Auth"
,
"True"
);
}
return
this
.
http
.
post
<
TResponse
>
(
apiEndPoint
,
request
,
{
headers
:
headers
,
reportProgress
:
true
});
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/services/icon.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
HttpService
}
from
"."
;
import
{
Setting
}
from
"../entities"
;
import
{
ApiResources
,
UtilHelper
}
from
"../helpers"
;
@
Injectable
()
export
class
IconService
{
constructor
(
private
readonly
httpService
:
HttpService
)
{
}
getIconImage
(
callback
?:
Function
)
{
this
.
httpService
.
get
<
Array
<
Setting
>>
(
ApiResources
.
getURI
(
ApiResources
.
setting
.
base
,
ApiResources
.
setting
.
fetch
),
{
type
:
"Icon"
,
active
:
true
},
true
)
.
subscribe
({
next
:
(
response
:
Array
<
Setting
>
)
=>
{
if
(
response
&&
response
.
length
>
0
)
{
if
(
response
[
0
].
active
)
{
if
(
UtilHelper
.
isEmpty
(
response
[
0
].
imageUrl
))
{
response
[
0
].
imageUrl
=
`
${
ApiResources
.
getURI
(
ApiResources
.
resources
.
base
,
ApiResources
.
resources
.
getProfileImage
)}
?imagePath=
${
response
[
0
].
imageUrl
}
`
;
callback
(
response
[
0
].
imageUrl
);
}
}
}
},
error
:
()
=>
{
callback
();
}
});
}
}
Presentation/Hims.Admin/src/app/shared/services/identity.service.ts
0 → 100644
View file @
71a17529
import
{
HttpClient
}
from
"@angular/common/http"
;
import
{
Injectable
}
from
"@angular/core"
;
import
{
NgbModal
}
from
"@ng-bootstrap/ng-bootstrap"
;
import
{
Observable
}
from
"rxjs"
;
import
{
ApiResources
}
from
"@shared/helpers"
;
import
{
IUserAccount
,
IAuthToken
}
from
"@shared/models"
;
export
const
appUrls
=
{
login
:
"/login"
,
home
:
"/app/dashboard"
,
notFound
:
"/not-found"
,
serverError
:
"/server-error"
,
forbidden
:
"/forbidden"
}
@
Injectable
()
export
class
IdentityService
{
headers
:
Object
=
{
headers
:
{
ignoreLoadingBar
:
""
,
"Auth"
:
"False"
}
};
constructor
(
private
readonly
http
:
HttpClient
,
private
readonly
modalService
:
NgbModal
)
{
}
signIn
(
account
:
IUserAccount
):
Observable
<
Response
>
{
return
this
.
http
.
post
<
Response
>
(
location
.
origin
+
location
.
pathname
+
"api/identity/sign-in"
,
account
,
this
.
headers
);
}
signOut
():
Observable
<
Response
>
{
if
(
this
.
modalService
.
hasOpenModals
())
{
this
.
modalService
.
dismissAll
();
}
return
this
.
http
.
post
<
Response
>
(
location
.
origin
+
location
.
pathname
+
"api/identity/sign-out"
,
{},
this
.
headers
);
}
status
():
Observable
<
number
>
{
return
this
.
http
.
post
<
number
>
(
location
.
origin
+
location
.
pathname
+
"api/identity/status"
,
{},
this
.
headers
);
}
get
():
Observable
<
IUserAccount
>
{
return
this
.
http
.
post
<
IUserAccount
>
(
location
.
origin
+
location
.
pathname
+
"api/identity/get"
,
{},
this
.
headers
);
}
update
(
authToken
:
IAuthToken
):
Observable
<
Response
>
{
return
this
.
http
.
post
<
Response
>
(
location
.
origin
+
location
.
pathname
+
"api/identity/update"
,
authToken
,
this
.
headers
);
}
refreshToken
(
reference
:
string
):
Observable
<
IAuthToken
>
{
const
request
=
{
token
:
reference
};
const
apiEndPoint
=
ApiResources
.
getURI
(
ApiResources
.
account
.
base
,
ApiResources
.
account
.
refresh
);
return
this
.
http
.
put
<
IAuthToken
>
(
apiEndPoint
,
request
);
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/services/index.ts
0 → 100644
View file @
71a17529
export
*
from
"../../app.config"
;
export
*
from
"../../app.data"
;
export
*
from
"./appointment-refresh.service"
;
export
*
from
"./appointment-toggle.service"
;
export
*
from
"./banner.service"
;
export
*
from
"./bill-notificaton.service"
;
export
*
from
"./communication.service"
;
export
*
from
"./dashboard.service"
;
export
*
from
"./final-bill.service"
;
export
*
from
"./http-error.service"
;
export
*
from
"./http.service"
;
export
*
from
"./icon.service"
;
export
*
from
"./identity.service"
;
export
*
from
"./jitsi.service"
;
export
*
from
"./menu.service"
;
export
*
from
"./notify.service"
;
export
*
from
"./print-option.service"
;
export
*
from
"./print.service"
;
export
*
from
"./queue.service"
;
export
*
from
"./redirect-appointment.service"
;
export
*
from
"./resource.service"
;
export
*
from
"./setting.service"
;
export
*
from
"./shared.service"
;
export
*
from
"./timeline-toggle.service"
;
export
*
from
"./url.service"
;
export
*
from
"./validator.service"
;
export
*
from
"./video-link.service"
;
Presentation/Hims.Admin/src/app/shared/services/jitsi.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
Observable
,
Subject
}
from
"rxjs"
;
@
Injectable
()
export
class
JitsiService
{
isRoomActive
=
false
;
ipAddress
:
string
;
private
jitsiSource
=
new
Subject
();
jitsiAccount
:
Observable
<
any
>
=
this
.
jitsiSource
.
asObservable
();
call
(
accountId
:
{})
{
this
.
jitsiSource
.
next
(
accountId
);
}
private
callSource
=
new
Subject
();
callAccount
:
Observable
<
any
>
=
this
.
callSource
.
asObservable
();
joinCall
(
roomName
:
{})
{
this
.
callSource
.
next
(
roomName
);
}
private
closeSource
=
new
Subject
<
boolean
>
();
closeAccount
:
Observable
<
boolean
>
=
this
.
closeSource
.
asObservable
();
closeCall
(
is
:
boolean
)
{
this
.
closeSource
.
next
(
is
);
}
private
emergencySource
=
new
Subject
<
object
>
();
emergencyAccount
:
Observable
<
object
>
=
this
.
emergencySource
.
asObservable
();
emergency
(
is
:
object
)
{
this
.
emergencySource
.
next
(
is
);
}
private
endSource
=
new
Subject
<
string
>
();
endAccount
:
Observable
<
string
>
=
this
.
endSource
.
asObservable
();
endCall
(
roomName
:
string
)
{
this
.
endSource
.
next
(
roomName
);
}
}
Presentation/Hims.Admin/src/app/shared/services/menu.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
ActivatedRoute
,
Params
}
from
"@angular/router"
;
import
{
AllowType
,
MenuType
}
from
"../enums"
;
import
{
ApiResources
}
from
"../helpers"
;
import
{
IMenuModel
,
IMenuOverAllModel
}
from
"../models"
;
import
{
HttpService
}
from
"./http.service"
;
import
{
NotifyService
}
from
"./notify.service"
;
@
Injectable
()
export
class
MenuService
{
private
records
:
Array
<
IMenuModel
>
;
private
access
:
boolean
;
isHitMenu
=
true
;
private
menuButtonCodes
:
Array
<
string
>
;
constructor
(
private
readonly
notifyService
:
NotifyService
,
private
readonly
httpService
:
HttpService
,
)
{
}
private
setFromLocal
=
()
=>
{
if
(
!
this
.
records
)
{
const
localMenus
=
localStorage
.
getItem
(
"menus"
);
if
(
localMenus
)
{
const
data
=
(
JSON
.
parse
(
localMenus
)
as
IMenuOverAllModel
);
this
.
records
=
data
.
menus
;
this
.
access
=
data
.
isFullAccess
;
this
.
menuButtonCodes
=
data
.
menuButtonCodes
;
this
.
isHitMenu
=
true
;
}
}
}
private
compare
=
(
a
:
IMenuModel
,
b
:
IMenuModel
)
=>
{
if
(
a
.
priority
<
b
.
priority
)
{
return
-
1
;
}
if
(
a
.
priority
>
b
.
priority
)
{
return
1
;
}
return
0
;
}
fetch
=
(
accountId
:
number
,
roleId
:
number
,
callback
?:
Function
)
=>
{
this
.
httpService
.
post
<
IMenuOverAllModel
>
(
ApiResources
.
getURI
(
ApiResources
.
account
.
base
,
ApiResources
.
account
.
getMenus
),
{
accountId
:
accountId
,
roleId
:
roleId
},
false
)
.
subscribe
((
data
:
IMenuOverAllModel
)
=>
{
this
.
setMenus
=
data
;
this
.
isHitMenu
=
false
;
callback
();
});
}
getFirstSubMenuByUrl
=
(
url
:
string
)
=>
{
const
lastIndex
=
url
.
lastIndexOf
(
"/"
);
url
=
url
.
substring
(
0
,
lastIndex
);
const
record
=
this
.
records
.
find
(
x
=>
x
.
url
.
toLowerCase
()
===
url
.
toLowerCase
());
if
(
record
)
{
const
subMenu
=
this
.
records
.
filter
(
x
=>
x
.
menuTypeId
===
MenuType
.
SubMenu
&&
x
.
mainPage
===
record
.
mainPage
&&
x
.
url
.
indexOf
(
":"
)
===
-
1
);
if
(
subMenu
.
length
>
0
)
{
return
subMenu
[
0
].
url
;
}
}
return
null
;
}
menus
=
(
menuType
:
MenuType
=
null
,
mainPage
:
string
=
null
,
subPage
:
string
=
null
):
Array
<
IMenuModel
>
=>
{
this
.
setFromLocal
();
if
(
!
this
.
records
)
return
new
Array
<
IMenuModel
>
();
let
filtered
=
this
.
records
;
if
(
menuType
)
{
filtered
=
filtered
.
filter
(
x
=>
MenuType
.
SubMenu
===
menuType
?
x
.
menuTypeId
===
menuType
||
x
.
menuTypeId
===
MenuType
.
CategoryMenu
:
x
.
menuTypeId
===
menuType
);
}
if
(
mainPage
)
{
filtered
=
filtered
.
filter
(
x
=>
x
.
mainPage
===
mainPage
);
}
if
(
subPage
)
{
filtered
=
filtered
.
filter
(
x
=>
x
.
subPage
===
subPage
);
}
const
final
=
filtered
.
sort
(
this
.
compare
);
final
.
forEach
(
item
=>
{
const
urlTokens
=
item
.
url
.
split
(
"/"
);
for
(
let
i
=
urlTokens
.
length
-
1
;
i
>=
0
;
i
--
)
{
if
(
urlTokens
[
i
].
indexOf
(
":"
)
===
-
1
)
{
item
.
subPage
=
urlTokens
[
i
];
break
;
}
}
});
return
final
;
}
set
setMenus
(
data
:
IMenuOverAllModel
)
{
this
.
records
=
data
.
menus
;
this
.
access
=
data
.
isFullAccess
;
this
.
menuButtonCodes
=
data
.
menuButtonCodes
;
localStorage
.
setItem
(
"menus"
,
JSON
.
stringify
(
data
));
}
get
getDefaultRoute
():
string
{
this
.
setFromLocal
();
return
this
.
records
&&
this
.
records
.
length
>
0
?
this
.
records
[
0
].
url
:
"login"
;
}
removeFromLocal
=
()
=>
{
localStorage
.
removeItem
(
"menus"
);
}
isMenuButtonAllowed
=
(
code
:
string
)
=>
{
if
(
!
this
.
menuButtonCodes
)
{
this
.
setFromLocal
();
}
return
this
.
access
||
(
this
.
menuButtonCodes
||
[]
as
Array
<
string
>
).
find
(
x
=>
x
===
code
);
}
isAllowed
=
(
uri
:
string
,
showNotify
=
false
):
AllowType
|
string
=>
{
this
.
setFromLocal
();
if
(
!
this
.
records
)
return
AllowType
.
BreakIt
;
if
(
this
.
access
)
return
AllowType
.
Allowed
;
const
currentSplit
=
uri
.
split
(
"/"
);
let
isOverallPass
=
false
;
const
matchedUrls
=
this
.
records
.
filter
(
x
=>
x
.
count
===
currentSplit
.
length
);
for
(
let
i
=
0
;
i
<
matchedUrls
.
length
;
i
++
)
{
const
url
=
matchedUrls
[
i
].
url
;
let
isPass
=
false
;
const
existingSplit
=
url
.
split
(
"/"
);
for
(
let
j
=
0
;
j
<
existingSplit
.
length
;
j
++
)
{
const
item
=
existingSplit
[
j
];
if
(
item
.
indexOf
(
":"
)
!==
-
1
)
{
isPass
=
true
;
continue
;
}
if
(
j
>=
currentSplit
.
length
)
{
isPass
=
false
;
break
;
}
if
(
item
===
currentSplit
[
j
])
{
isPass
=
true
;
}
else
{
isPass
=
false
;
break
;
}
}
if
(
isPass
)
{
isOverallPass
=
true
;
break
;
}
}
if
(
showNotify
&&
!
isOverallPass
)
{
this
.
notifyService
.
hideAll
();
const
isAlternative
=
this
.
getFirstSubMenuByUrl
(
uri
);
if
(
isAlternative
)
{
return
isAlternative
;
}
else
{
this
.
notifyService
.
info
(
`You do not have access to this page (
${
uri
}
).`
);
}
}
return
isOverallPass
?
AllowType
.
Allowed
:
AllowType
.
NotAllowed
;
}
getNextRoute
=
(
url
:
string
,
params
:
Params
,
route
:
ActivatedRoute
):
Promise
<
string
>
=>
{
return
new
Promise
(
async
(
resolve
)
=>
{
let
foundUrl
=
decodeURIComponent
(
decodeURIComponent
(
url
));
const
parentParams
=
route
.
parent
.
params
[
"value"
]
||
{};
const
childParams
=
(
params
.
params
?
params
.
params
:
params
)
||
{};
const
allParams
=
{
...
parentParams
,
...
childParams
};
Object
.
keys
(
allParams
).
forEach
((
key
)
=>
{
const
decodedValue
=
decodeURIComponent
(
decodeURIComponent
(
allParams
[
key
]));
foundUrl
=
foundUrl
.
replace
(
`/
${
decodedValue
}
/`
,
`/:
${
key
}
/`
);
})
const
currentRoute
=
this
.
records
.
find
((
x
)
=>
x
.
url
===
foundUrl
);
if
(
currentRoute
)
{
let
nextRoute
=
this
.
records
.
find
((
x
)
=>
{
const
basicCondition
=
this
.
basicCondition
(
x
,
currentRoute
);
return
currentRoute
.
menuTypeId
===
MenuType
.
CategoryMenu
?
basicCondition
&&
x
.
category
===
currentRoute
.
category
:
basicCondition
;
});
if
(
nextRoute
)
{
resolve
(
this
.
getReverseStrategyLink
(
nextRoute
.
url
,
allParams
));
}
if
(
currentRoute
.
menuTypeId
===
MenuType
.
CategoryMenu
)
{
nextRoute
=
this
.
records
.
find
((
x
)
=>
this
.
basicCondition
(
x
,
currentRoute
));
if
(
nextRoute
)
{
resolve
(
this
.
getReverseStrategyLink
(
nextRoute
.
url
,
allParams
));
}
}
nextRoute
=
this
.
records
.
find
((
x
)
=>
x
.
mainPage
===
currentRoute
.
mainPage
&&
x
.
menuTypeId
===
MenuType
.
SubMenu
&&
x
.
priority
===
1
);
if
(
nextRoute
)
{
resolve
(
this
.
getReverseStrategyLink
(
nextRoute
.
url
,
allParams
));
}
}
return
resolve
(
null
);
})
}
getCurrentRoute
=
(
url
:
string
,
params
:
Params
,
route
:
ActivatedRoute
):
Promise
<
IMenuModel
>
=>
{
return
new
Promise
(
async
(
resolve
)
=>
{
let
foundUrl
=
decodeURIComponent
(
decodeURIComponent
(
url
));
const
parentParams
=
route
.
parent
.
params
[
"value"
]
||
{};
const
childParams
=
(
params
.
params
?
params
.
params
:
params
)
||
{};
const
allParams
=
{
...
parentParams
,
...
childParams
};
Object
.
keys
(
allParams
).
forEach
((
key
)
=>
{
const
decodedValue
=
decodeURIComponent
(
decodeURIComponent
(
allParams
[
key
]));
foundUrl
=
foundUrl
.
replace
(
`/
${
decodedValue
}
`
,
`/:
${
key
}
`
);
})
const
currentRoute
=
this
.
records
.
find
((
x
)
=>
x
.
url
===
foundUrl
);
return
resolve
(
currentRoute
);
})
}
private
getReverseStrategyLink
=
(
url
:
string
,
params
:
Params
)
=>
{
let
foundUrl
=
url
;
const
obj
=
params
;
Object
.
keys
(
obj
).
forEach
((
key
)
=>
{
const
encodedValue
=
encodeURIComponent
(
decodeURIComponent
(
decodeURIComponent
(
obj
[
key
])));
foundUrl
=
foundUrl
.
replace
(
`:
${
key
}
`
,
encodedValue
);
})
return
foundUrl
;
}
private
basicCondition
=
(
compateTo
:
IMenuModel
,
compareWith
:
IMenuModel
)
=>
{
if
(
compareWith
)
{
return
compateTo
.
mainPage
===
compareWith
.
mainPage
&&
compateTo
.
priority
===
(
compareWith
.
priority
+
1
);
}
return
false
;
}
}
Presentation/Hims.Admin/src/app/shared/services/notify.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
*
as
bootbox
from
"bootbox"
;
import
{
ToastrService
}
from
"ngx-toastr"
;
function
emptyFunction
()
{
}
@
Injectable
()
export
class
NotifyService
{
constructor
(
private
readonly
toastrService
:
ToastrService
)
{
}
hideAll
()
{
return
bootbox
.
hideAll
();
}
warningToast
(
message
:
string
)
{
this
.
toastrService
.
warning
(
message
,
"Warning!"
);
}
infoToast
(
message
:
string
)
{
this
.
toastrService
.
info
(
message
,
"Information!"
);
}
successToast
(
message
:
string
)
{
this
.
toastrService
.
success
(
message
,
"Success!"
);
}
errorToast
(
message
:
string
)
{
this
.
toastrService
.
error
(
message
,
"Error!"
);
}
defaultErrorToast
()
{
this
.
toastrService
.
error
(
"Sorry! Error occurred. Please try again later."
,
"Error!"
);
}
warning
(
message
:
string
,
callback
?:
any
)
{
message
=
message
||
"Warning"
;
return
bootbox
.
dialog
({
title
:
`<i class="fe-alert-triangle h1 text-warning"></i>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Ok"
,
className
:
"btn-sm btn-warning"
,
callback
:
callback
===
null
?
emptyFunction
:
callback
}
}
});
}
info
(
message
:
string
,
callback
?:
any
)
{
message
=
message
||
"Information"
;
return
bootbox
.
dialog
({
title
:
`<i class="fe-info h1 text-info"></i>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Ok"
,
className
:
"btn-sm btn-info"
,
callback
:
callback
===
null
?
emptyFunction
:
callback
}
}
});
}
success
(
message
:
string
,
callback
?:
any
)
{
message
=
message
||
"Success"
;
return
bootbox
.
dialog
({
title
:
`<i class="fe-check-circle h1 text-success"></i>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Ok"
,
className
:
"btn-sm btn-success"
,
callback
:
callback
===
null
?
emptyFunction
:
callback
}
}
});
}
error
(
message
:
string
,
callback
?:
any
)
{
message
=
message
||
"Error"
;
return
bootbox
.
dialog
({
title
:
`<i class="fe-alert-circle h1 text-danger"></i>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Ok"
,
className
:
"btn-sm btn-danger"
,
callback
:
callback
===
null
?
emptyFunction
:
callback
}
}
});
}
defaultError
(
callback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-alert-circle h1 text-danger"></i>`
,
message
:
"Sorry error occurred. Please try again later."
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Ok"
,
className
:
"btn-sm btn-danger"
,
callback
:
callback
===
null
?
emptyFunction
:
callback
}
}
});
}
delete
(
yesCallback
?:
any
,
noCallback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-help-circle h1 text-danger"></i><h4>Are you sure?</h4>`
,
message
:
"Do you really want to delete this record? This process cannot be undone."
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Yes! Delete"
,
className
:
"btn-sm btn-danger mr-1"
,
callback
:
yesCallback
===
null
?
emptyFunction
:
yesCallback
},
no
:
{
label
:
"No! Cancel"
,
className
:
"btn-sm btn-light"
,
callback
:
noCallback
===
null
?
emptyFunction
:
noCallback
}
}
});
}
confirm
(
message
:
string
,
yesCallback
?:
any
,
noCallback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-help-circle h1 text-danger"></i><h4>Are you sure?</h4>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Yes! Confirm"
,
className
:
"btn-sm btn-success mr-1"
,
callback
:
yesCallback
===
null
?
emptyFunction
:
yesCallback
},
no
:
{
label
:
"No! Cancel"
,
className
:
"btn-sm btn-danger"
,
callback
:
noCallback
===
null
?
emptyFunction
:
noCallback
}
}
});
}
advancedConfirm
(
message
:
string
,
yesLabel
:
string
,
yesCallback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-help-circle h1 text-primary"></i><h4>Are you sure?</h4>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
yesLabel
,
className
:
"btn-sm btn-primary mr-1"
,
callback
:
yesCallback
===
null
?
emptyFunction
:
yesCallback
}
}
});
}
endCallConfirm
(
message
:
string
,
endMeetingCallback
?:
any
,
leaveMeetingCallback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-help-circle h1 text-primary"></i><h4>Are you sure?</h4>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"End Call"
,
className
:
"btn-sm btn-danger mr-1"
,
callback
:
endMeetingCallback
===
null
?
emptyFunction
:
endMeetingCallback
},
leave
:
{
label
:
"Leave Call"
,
className
:
"btn-sm btn-warning mr-1"
,
callback
:
leaveMeetingCallback
===
null
?
emptyFunction
:
leaveMeetingCallback
},
no
:
{
label
:
"Cancel"
,
className
:
"btn-sm btn-light"
}
}
});
}
SampleAcceptionConfirm
(
message
:
string
,
endMeetingCallback
?:
any
,
leaveMeetingCallback
?:
any
)
{
return
bootbox
.
dialog
({
title
:
`<i class="fe-help-circle h1 text-primary"></i><h4>Are you sure?</h4>`
,
message
:
message
,
closeButton
:
false
,
className
:
"modal fade effect-scale"
,
buttons
:
{
yes
:
{
label
:
"Sample Accept"
,
className
:
"btn-sm btn-outline-success mr-1"
,
callback
:
endMeetingCallback
===
null
?
emptyFunction
:
endMeetingCallback
},
leave
:
{
label
:
"Sample Reject"
,
className
:
"btn-sm btn-outline-danger mr-1"
,
callback
:
leaveMeetingCallback
===
null
?
emptyFunction
:
leaveMeetingCallback
},
no
:
{
label
:
"Back"
,
className
:
"btn-sm btn-light"
}
}
});
}
}
\ No newline at end of file
Presentation/Hims.Admin/src/app/shared/services/print-option.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
ApiResources
,
UtilHelper
}
from
"../helpers"
;
//import { PrintSetting } from "../entities/print-setting.entity";
import
{
HttpService
}
from
"."
;
import
{
Setting
}
from
"../entities"
;
@
Injectable
()
export
class
PrintOptionService
{
constructor
(
private
readonly
httpService
:
HttpService
,)
{
}
get
(
callback
?:
Function
)
{
this
.
httpService
.
get
<
Array
<
Setting
>>
(
ApiResources
.
getURI
(
ApiResources
.
setting
.
base
,
ApiResources
.
setting
.
fetch
),
{
name
:
"IsPrintLogo"
,
active
:
true
},
true
)
.
subscribe
(
(
response
:
Array
<
Setting
>
)
=>
{
if
(
response
&&
response
.
length
>
0
)
{
if
(
response
[
0
].
active
)
{
UtilHelper
.
removeWithOutLogoStyleFile
();
}
else
{
//UtilHelper.addWithOutLogoStyleFile();
}
callback
(
response
[
0
].
active
);
}
},
()
=>
{
callback
(
true
);
}
);
}
}
Presentation/Hims.Admin/src/app/shared/services/print.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
NotifyService
}
from
"./notify.service"
;
declare
let
qz
:
any
;
@
Injectable
()
export
class
PrintService
{
printer
:
any
;
printerName
:
any
;
isDotMatrixPrinting
:
boolean
;
dotMatrixStatus
:
string
;
constructor
(
private
readonly
notifyService
:
NotifyService
)
{
}
getPrinterName
=
()
=>
{
return
localStorage
.
getItem
(
"DotMatrixPrinterName"
);
}
setPrinterName
=
(
name
:
string
)
=>
{
localStorage
.
setItem
(
"DotMatrixPrinterName"
,
name
);
this
.
printerName
=
localStorage
.
getItem
(
"DotMatrixPrinterName"
);
}
getPrinters
=
(
callback
?:
Function
)
=>
{
qz
.
printers
.
find
().
then
((
data
:
Array
<
any
>
)
=>
{
callback
(
data
);
}).
catch
((
e
)
=>
{
callback
(
new
Array
<
any
>
());
this
.
notifyService
.
warning
(
e
);
});
}
getAvailablePrinters
=
(
callback
?:
Function
)
=>
{
if
(
!
qz
.
websocket
.
isActive
())
{
qz
.
websocket
.
connect
().
then
(()
=>
{
this
.
getPrinters
(
callback
);
}).
catch
((
e
)
=>
{
this
.
notifyService
.
warning
(
e
);
});
}
else
{
this
.
getPrinters
(
callback
);
}
}
private
findPrinter
(
callback
?:
Function
)
{
this
.
printerName
=
this
.
getPrinterName
();
if
(
!
this
.
printerName
)
{
this
.
notifyService
.
warning
(
"Please select printer."
);
callback
();
}
qz
.
printers
.
find
(
this
.
printerName
).
then
((
data
)
=>
{
this
.
printer
=
data
;
this
.
dotMatrixStatus
=
"Connected"
;
callback
();
}).
catch
((
e
)
=>
{
this
.
notifyService
.
warning
(
e
);
this
.
isDotMatrixPrinting
=
false
;
});
}
private
connect
(
callback
?:
Function
)
{
this
.
dotMatrixStatus
=
"Connecting..."
;
qz
.
websocket
.
connect
().
then
(()
=>
{
this
.
findPrinter
(()
=>
{
callback
();
});
}).
catch
((
e
)
=>
{
this
.
notifyService
.
warning
(
e
);
this
.
isDotMatrixPrinting
=
false
;
});
}
private
print
(
htmlToRender
:
any
,
configObj
:
any
,
callback
?:
Function
)
{
this
.
dotMatrixStatus
=
"Printing..."
;
const
data
=
[{
type
:
'pixel'
,
format
:
'html'
,
flavor
:
'plain'
,
data
:
htmlToRender
}];
const
config
=
qz
.
configs
.
create
(
null
,
configObj
);
if
(
!
this
.
printer
)
{
this
.
findPrinter
(()
=>
{
config
.
setPrinter
(
this
.
printer
);
qz
.
print
(
config
,
data
).
then
(()
=>
{
this
.
dotMatrixStatus
=
"Printed"
;
this
.
isDotMatrixPrinting
=
false
;
callback
();
}).
catch
((
e
)
=>
{
this
.
notifyService
.
warning
(
e
);
this
.
isDotMatrixPrinting
=
false
;
});
});
}
else
{
config
.
setPrinter
(
this
.
printer
);
qz
.
print
(
config
,
data
).
then
(()
=>
{
this
.
dotMatrixStatus
=
"Printed"
;
this
.
isDotMatrixPrinting
=
false
;
callback
();
}).
catch
((
e
)
=>
{
this
.
notifyService
.
warning
(
e
);
this
.
isDotMatrixPrinting
=
false
;
});
}
}
start
=
(
htmlToRender
:
any
,
config
:
any
,
callback
?:
Function
)
=>
{
this
.
dotMatrixStatus
=
"checking..."
;
this
.
isDotMatrixPrinting
=
true
;
try
{
if
(
!
qz
.
websocket
.
isActive
())
{
this
.
connect
(()
=>
{
this
.
print
(
htmlToRender
,
config
,
()
=>
{
this
.
isDotMatrixPrinting
=
false
;
callback
();
});
});
}
else
{
this
.
print
(
htmlToRender
,
()
=>
{
this
.
isDotMatrixPrinting
=
false
;
callback
();
});
}
}
catch
(
e
)
{
this
.
notifyService
.
warning
(
e
);
this
.
isDotMatrixPrinting
=
false
;
}
}
disconnect
=
()
=>
{
if
(
qz
.
websocket
.
isActive
())
{
qz
.
websocket
.
disconnect
();
}
}
}
Presentation/Hims.Admin/src/app/shared/services/queue.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
@
Injectable
()
export
class
QueueService
{
selectedProvider
:
BasicProvider
;
isInterval
:
any
;
}
export
interface
BasicProvider
{
name
:
string
;
id
:
number
;
}
Presentation/Hims.Admin/src/app/shared/services/redirect-appointment.service.ts
0 → 100644
View file @
71a17529
import
{
Injectable
}
from
"@angular/core"
;
import
{
BehaviorSubject
,
Observable
}
from
"rxjs"
;
@
Injectable
()
export
class
RedirectAppointmentService
{
private
source
=
new
BehaviorSubject
(
null
);
account
:
Observable
<
string
>
=
this
.
source
.
asObservable
();
set
(
accountId
:
string
)
{
this
.
source
.
next
(
accountId
);
}
}
Presentation/Hims.Admin/src/app/shared/services/resource.service.ts
0 → 100644
View file @
71a17529
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