Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
Lamarts mobile app angular
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Arko Dey Bhowmick
Lamarts mobile app angular
Commits
4d7c10e4
Commit
4d7c10e4
authored
Jun 13, 2025
by
achinta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change: login in system
parent
f1c552fe
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
378 additions
and
108 deletions
+378
-108
src/app/auth/guard/verify-role.guard.ts
src/app/auth/guard/verify-role.guard.ts
+2
-2
src/app/auth/interface/user-profile.ts
src/app/auth/interface/user-profile.ts
+3
-1
src/app/auth/login/login.component.html
src/app/auth/login/login.component.html
+28
-19
src/app/auth/login/login.component.scss
src/app/auth/login/login.component.scss
+4
-0
src/app/auth/login/login.component.ts
src/app/auth/login/login.component.ts
+121
-32
src/app/auth/service/auth.service.ts
src/app/auth/service/auth.service.ts
+22
-9
src/app/auth/service/send-otp.service.spec.ts
src/app/auth/service/send-otp.service.spec.ts
+16
-0
src/app/auth/service/send-otp.service.ts
src/app/auth/service/send-otp.service.ts
+58
-0
src/app/component-library/custom-table/custom-table.component.html
...omponent-library/custom-table/custom-table.component.html
+2
-2
src/app/mappers/request-mapper.service.ts
src/app/mappers/request-mapper.service.ts
+5
-0
src/app/mappers/role-mapper.service.ts
src/app/mappers/role-mapper.service.ts
+1
-1
src/app/portal/assignment/assignment/assignment.component.html
...pp/portal/assignment/assignment/assignment.component.html
+1
-1
src/app/portal/assignment/interface/assignment.ts
src/app/portal/assignment/interface/assignment.ts
+1
-1
src/app/portal/assignment/manage/manage.component.ts
src/app/portal/assignment/manage/manage.component.ts
+10
-10
src/app/portal/exam/exam/exam.component.html
src/app/portal/exam/exam/exam.component.html
+1
-1
src/app/portal/portal-dashboard/interface/students.ts
src/app/portal/portal-dashboard/interface/students.ts
+10
-3
src/app/portal/portal-dashboard/portal-dashboard.component.html
...p/portal/portal-dashboard/portal-dashboard.component.html
+1
-1
src/app/portal/portal-dashboard/portal-dashboard.component.ts
...app/portal/portal-dashboard/portal-dashboard.component.ts
+48
-6
src/app/portal/routine/manage/manage.component.ts
src/app/portal/routine/manage/manage.component.ts
+1
-1
src/app/portal/routine/routine/routine.component.html
src/app/portal/routine/routine/routine.component.html
+1
-1
src/app/portal/service/url-config.service.ts
src/app/portal/service/url-config.service.ts
+16
-15
src/app/raintree/transmission/auth-transmission.service.ts
src/app/raintree/transmission/auth-transmission.service.ts
+21
-0
src/app/raintree/transmission/transmission.service.ts
src/app/raintree/transmission/transmission.service.ts
+5
-2
No files found.
src/app/auth/guard/verify-role.guard.ts
View file @
4d7c10e4
...
@@ -13,8 +13,8 @@ export const verifyRoleGuard: CanActivateFn = (
...
@@ -13,8 +13,8 @@ export const verifyRoleGuard: CanActivateFn = (
const
requiredRoles
:
string
[]
=
route
.
data
[
'
roles
'
]
as
string
[];
const
requiredRoles
:
string
[]
=
route
.
data
[
'
roles
'
]
as
string
[];
const
userRole
:
string
=
localStorage
.
getItem
(
'
role
'
)
||
''
;
const
userRole
:
string
=
localStorage
.
getItem
(
'
role
'
)
||
''
;
//
console.log('requiredRoles=>',requiredRoles);
console
.
log
(
'
requiredRoles=>
'
,
requiredRoles
);
//
console.log('userRole=>',userRole);
console
.
log
(
'
userRole=>
'
,
userRole
);
// return true;
// return true;
if
(
userRole
&&
isRoleValid
(
requiredRoles
,
userRole
)
)
return
true
;
if
(
userRole
&&
isRoleValid
(
requiredRoles
,
userRole
)
)
return
true
;
...
...
src/app/auth/interface/user-profile.ts
View file @
4d7c10e4
...
@@ -3,7 +3,9 @@ export interface UserProfile {
...
@@ -3,7 +3,9 @@ export interface UserProfile {
name
:
string
;
name
:
string
;
project_id
:
number
;
project_id
:
number
;
role_name
:
string
;
role_name
:
string
;
user_id
:
number
;
user_id
:
string
;
user_type
:
string
;
user_type
:
string
;
username
:
string
;
username
:
string
;
phone
:
string
;
logged_id
:
string
}
}
src/app/auth/login/login.component.html
View file @
4d7c10e4
...
@@ -2,59 +2,68 @@
...
@@ -2,59 +2,68 @@
<div
class=
"top_yellow_line"
></div>
<div
class=
"top_yellow_line"
></div>
<div
class=
"logo_section"
>
<div
class=
"logo_section"
>
<img
class=
"login_logo"
[ngSrc]=
"loggedSchoolLogo"
alt=
"Logo"
width=
"80"
height=
"80"
/>
<img
class=
"login_logo"
[ngSrc]=
"loggedSchoolLogo"
alt=
"Logo"
width=
"80"
height=
"80"
/>
<p>
La Martiniere for Girls
</p>
<p>
{{schoolHeader}}
</p>
</div>
</div>
<div
class=
"top_blue_line"
></div>
<div
class=
"top_blue_line"
></div>
<div
class=
"NumberOtp"
>
<div
class=
"NumberOtp"
>
<div
class=
"login_outer"
>
<div
class=
"login_outer"
>
<div
class=
"phone_section"
>
<div
class=
"phone_section"
>
<form
class=
"login_form"
[formGroup]=
"loginForm"
>
<h5>
Welcome
</h5>
<h5>
Welcome
</h5>
<mat-radio-group
aria-label=
"Select an option"
formControlName=
"role"
>
<mat-radio-button
value=
"student"
>
Student
</mat-radio-button>
<mat-radio-button
value=
"EDITOR"
>
Teacher
</mat-radio-button>
</mat-radio-group>
<p>
Enter your username and password to continue
</p>
<p>
Enter your username and password to continue
</p>
<form
class=
"login_form"
[formGroup]=
"loginForm"
>
<div
class=
"mat_input_container"
>
<div
class=
"mat_input_container"
[ngClass]=
"{'d-none': otpSend}"
>
<mat-form-field
class=
"full_width"
>
<mat-form-field
class=
"full_width"
>
<span
class=
"material-symbols-outlined"
matPrefix
>
<span
class=
"material-symbols-outlined"
matPrefix
>
person
person
</span>
</span>
<input
class=
"inputStyle"
matInput
placeholder=
"{{ 'Enter your number' }}"
#input
formControlName=
"email"
/>
<input
class=
"inputStyle"
matInput
placeholder=
"{{ 'Enter your number' }}"
#input
formControlName=
"phoneNo"
/>
</mat-form-field>
</mat-form-field>
<ng-container
<ng-container
*ngIf=
"loginForm.controls.email.invalid && loginForm.controls.email.dirty || loginForm.controls.email.invalid && loginForm.controls.email.touched"
>
*ngIf=
"loginForm.controls.phoneNo.invalid && loginForm.controls.phoneNo.dirty || loginForm.controls.phoneNo.invalid && loginForm.controls.phoneNo.touched"
>
<span
class=
"error_text"
*ngIf=
"loginForm.controls.email.hasError('required')"
>
This field is required
<span
class=
"error_text"
*ngIf=
"loginForm.controls.phoneNo.hasError('required')"
>
This field is
</span>
required
</span>
<span
class=
"error_text"
*ngIf=
"loginForm.controls.phoneNo.hasError('pattern')"
>
Phone number must be 10
digits.
</span>
</ng-container>
</ng-container>
</div>
</div>
<app-rounded-button-full-width
[buttonText]=
"'Send otp'"
[enableThrottling]=
"true"
(onClickEventEmitter)=
"sendOtp()"
[ngClass]=
"{'d-none': otpSend}"
/>
<div
class=
"mat_input_container"
>
<div
class=
"mat_input_container"
[ngClass]=
"{'d-none': !otpSend}"
>
<mat-form-field
class=
"full_width"
>
<mat-form-field
class=
"full_width"
>
<span
class=
"material-symbols-outlined"
matPrefix
>
lock
</span>
<span
class=
"material-symbols-outlined"
matPrefix
>
lock
</span>
<input
matInput
placeholder=
"{{ 'Enter
your
OTP' }}"
[type]=
"hidePassword ? 'password' : 'text'"
<input
matInput
placeholder=
"{{ 'Enter OTP' }}"
[type]=
"hidePassword ? 'password' : 'text'"
formControlName=
"
password
"
/>
formControlName=
"
otp
"
/>
<span
class=
"material-symbols-outlined pointer"
matSuffix
(click)=
"hidePassword = !hidePassword"
>
<span
class=
"material-symbols-outlined pointer"
matSuffix
(click)=
"hidePassword = !hidePassword"
>
{{ hidePassword ? "visibility_off" : "visibility" }}
{{ hidePassword ? "visibility_off" : "visibility" }}
</span>
</span>
<!-- <mat-hint *ngIf="!passwordInput.value">Enter your password</mat-hint> -->
<!-- <mat-hint *ngIf="!passwordInput.value">Enter your password</mat-hint> -->
</mat-form-field>
</mat-form-field>
<ng-container
<ng-container
*ngIf=
"loginForm.controls.
password.invalid && loginForm.controls.password.dirty || loginForm.controls.password.invalid && loginForm.controls.password
.touched"
>
*ngIf=
"loginForm.controls.
otp.invalid && loginForm.controls.otp.dirty || loginForm.controls.otp.invalid && loginForm.controls.otp
.touched"
>
<span
class=
"error_text"
*ngIf=
"loginForm.controls.
password.hasError('required')"
>
Password is required
<span
class=
"error_text"
*ngIf=
"loginForm.controls.
otp.hasError('required')"
>
Otp is required
</span>
</span>
<
span
class=
"error_text"
*ngIf=
"loginForm.controls.otp.hasError('pattern')"
>
OTP must be 4 digits
<
/span>
</ng-container>
</ng-container>
</div>
</div>
<app-rounded-button-full-width
[buttonText]=
"'Sign in'"
[buttonIconName]=
"'login'"
[enableThrottling]=
"true"
<app-rounded-button-full-width
[buttonText]=
"'Sign in'"
[buttonIconName]=
"'login'"
[enableThrottling]=
"true"
(onClickEventEmitter)=
"authenticate()"
/>
(onClickEventEmitter)=
"authenticate()"
[ngClass]=
"{'d-none': !otpSend}"
/>
</form>
</form>
<div
class=
"error_txt"
*ngIf=
"errorMessage"
>
<!-- <div class="error_txt" *ngIf="errorMessage">
<!-- <span class="api_error_message">{{errorMessage}}</span> -->
<span class="api_error_message">fdgsgs</span>
<span class="api_error_message">fdgsgs</span>
</div>
</div>
-->
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/app/auth/login/login.component.scss
View file @
4d7c10e4
...
@@ -152,3 +152,7 @@
...
@@ -152,3 +152,7 @@
}
}
}
}
}
}
.d-none
{
display
:
none
;
}
\ No newline at end of file
src/app/auth/login/login.component.ts
View file @
4d7c10e4
...
@@ -13,7 +13,11 @@ import { AbstractControl, FormControl, FormGroup, ReactiveFormsModule, Validator
...
@@ -13,7 +13,11 @@ import { AbstractControl, FormControl, FormGroup, ReactiveFormsModule, Validator
import
{
TransmissionMessageHandlerService
}
from
'
../../raintree/transmission-message-handler/transmission-message-handler
'
;
import
{
TransmissionMessageHandlerService
}
from
'
../../raintree/transmission-message-handler/transmission-message-handler
'
;
import
{
UserProfile
}
from
'
../interface/user-profile
'
;
import
{
UserProfile
}
from
'
../interface/user-profile
'
;
import
{
ToasterService
}
from
'
../../component-library/toaster/toaster.service
'
;
import
{
ToasterService
}
from
'
../../component-library/toaster/toaster.service
'
;
import
{
UrlConfigService
}
from
'
../../portal/service/url-config.service
'
;
import
{
DataSourceService
}
from
'
../../portal/service/data-source.service
'
;
import
{
MatRadioModule
}
from
'
@angular/material/radio
'
;
import
{
RoleMapperService
}
from
'
../../mappers/role-mapper.service
'
;
import
{
SendOtpService
}
from
'
../service/send-otp.service
'
;
@
Component
({
@
Component
({
selector
:
'
app-login
'
,
selector
:
'
app-login
'
,
imports
:
[
imports
:
[
...
@@ -23,7 +27,8 @@ import { ToasterService } from '../../component-library/toaster/toaster.service'
...
@@ -23,7 +27,8 @@ import { ToasterService } from '../../component-library/toaster/toaster.service'
MatFormFieldModule
,
MatFormFieldModule
,
MatInputModule
,
MatInputModule
,
CommonModule
,
CommonModule
,
ReactiveFormsModule
ReactiveFormsModule
,
MatRadioModule
],
],
templateUrl
:
'
./login.component.html
'
,
templateUrl
:
'
./login.component.html
'
,
styleUrl
:
'
./login.component.scss
'
styleUrl
:
'
./login.component.scss
'
...
@@ -32,34 +37,60 @@ export class LoginComponent implements OnInit {
...
@@ -32,34 +37,60 @@ export class LoginComponent implements OnInit {
public
errorMessage
:
string
=
''
;
public
errorMessage
:
string
=
''
;
public
loggedSchoolLogo
:
string
=
''
;
public
loggedSchoolLogo
:
string
=
''
;
public
schoolHeader
:
string
=
''
;
public
otpSend
:
boolean
=
false
;
constructor
(
constructor
(
private
_toaster
:
ToasterService
,
private
_toaster
:
ToasterService
,
private
_authService
:
AuthService
,
private
_authService
:
AuthService
,
private
_authTransmissionService
:
AuthTransmissionService
,
private
_authTransmissionService
:
AuthTransmissionService
,
private
_urlConfig
:
UrlConfigService
,
private
_optService
:
SendOtpService
,
private
_transmissionMessageHandler
:
TransmissionMessageHandlerService
)
{
private
_transmissionMessageHandler
:
TransmissionMessageHandlerService
)
{
}
}
public
hidePassword
:
boolean
=
true
;
public
hidePassword
:
boolean
=
true
;
public
loginForm
=
new
FormGroup
({
public
loginForm
=
new
FormGroup
({
email
:
new
FormControl
(
''
,
[
Validators
.
required
]),
phoneNo
:
new
FormControl
(
'
6290861931
'
,
[
password
:
new
FormControl
(
''
,
[
Validators
.
required
]),
Validators
.
required
,
Validators
.
pattern
(
/^
\d{10}
$/
)
]),
otp
:
new
FormControl
(
'
1234
'
,
[
Validators
.
required
,
Validators
.
pattern
(
/^
\d{4}
$/
)
]),
role
:
new
FormControl
(
'
student
'
,
[
Validators
.
required
])
});
});
public
ngOnInit
():
void
{
public
ngOnInit
():
void
{
this
.
loggedSchoolLogo
=
this
.
_authService
.
getLoggedSchoolLogo
();
this
.
loggedSchoolLogo
=
this
.
_authService
.
getLoggedSchoolLogo
();
this
.
schoolHeader
=
this
.
_authService
.
getSchoolHeader
()
}
}
public
authenticate
():
void
{
public
authenticate
():
void
{
if
(
this
.
loginForm
.
invalid
)
return
;
if
(
this
.
loginForm
.
invalid
)
return
;
let
loginFormPayload
:
Auth
=
this
.
loginForm
.
value
as
Auth
;
// let loginFormPayload: Auth = this.loginForm.value as Auth;
if
(
!
this
.
_optService
.
matchOtp
(
Number
(
this
.
loginForm
.
value
.
otp
))){
this
.
_toaster
.
error
(
'
Otp is not matched
'
);
this
.
otpSend
=
!
this
.
otpSend
;
return
;
}
this
.
_getUserDetails
();
}
this
.
_authTransmissionService
.
getAuthToken
(
private
_autoLogin
(
userInfo
:
any
){
let
loginFormPayload
=
{
'
email
'
:
'
achinta@hotmail.com
'
,
'
password
'
:
'
P@$$w0rd
'
}
this
.
_authTransmissionService
.
getAuthToken
(
TransmissionMapperService
.
LOGIN_TRANSMISSION_URL
,
TransmissionMapperService
.
LOGIN_TRANSMISSION_URL
,
loginFormPayload
,
loginFormPayload
,
...
@@ -73,9 +104,21 @@ export class LoginComponent implements OnInit {
...
@@ -73,9 +104,21 @@ export class LoginComponent implements OnInit {
return
;
return
;
};
};
let
user_data
=
{
apiKey
:
`
${
response
[
'
data
'
].
apiKey
}
`
,
name
:
`
${
userInfo
.
name
[
'
en
'
]}
`
,
project_id
:
response
[
'
data
'
].
project_id
,
role_name
:
`
${
this
.
loginForm
.
value
.
role
}
`
,
user_id
:
response
[
'
data
'
].
user_id
,
user_type
:
response
[
'
data
'
].
user_type
,
username
:
`
${
userInfo
.
name
[
'
en
'
]}
`
,
phone
:
`
${
userInfo
.
phone
[
'
en
'
]}
`
,
logged_id
:
`
${
userInfo
.
id
}
`
}
this
.
_authService
.
storeJwtTokenInLocalStorage
(
response
[
'
data
'
].
apiKey
);
this
.
_authService
.
storeJwtTokenInLocalStorage
(
response
[
'
data
'
].
apiKey
);
// this._getUserProfile();
// this._getUserProfile();
this
.
_authService
.
prepareLoginProcess
(
response
[
'
data
'
]
);
this
.
_authService
.
prepareLoginProcess
(
user_data
);
this
.
_toaster
.
success
(
'
Successfully Logged in
'
,
'
Done
'
)
this
.
_toaster
.
success
(
'
Successfully Logged in
'
,
'
Done
'
)
},
},
...
@@ -88,23 +131,69 @@ export class LoginComponent implements OnInit {
...
@@ -88,23 +131,69 @@ export class LoginComponent implements OnInit {
);
);
}
}
private
_getUserProfile
():
void
{
// private _getUserProfile(): void {
this
.
_authTransmissionService
.
getUserProfile
(
// this._authTransmissionService.getUserProfile(
TransmissionMapperService
.
USER_PROFILE_TRANSMISSION_URL
,
// TransmissionMapperService.USER_PROFILE_TRANSMISSION_URL,
// () => { },
// (response) => { },
// (response: UserProfile) => {
// if (!response) {
// this.errorMessage = 'something went wrong';
// return;
// };
// this._authService.prepareLoginProcess(response);
// },
// () => { }, () => { }
// )
// }
private
_getUserDetails
()
{
this
.
_authTransmissionService
.
getUser
(
TransmissionMapperService
.
GET_TRANSMISSION_URL
+
this
.
_urlConfig
.
generateDatasourceConfigUrl
({
aggregationOnUniqueFld
:
false
,
datasourceId
:
`
${
this
.
loginForm
.
get
(
'
role
'
)?.
value
===
RoleMapperService
.
TEACHER_ROLE
?
DataSourceService
.
TEACHER_DATA_SOURCE_ID
:
DataSourceService
.
STUDENT_DATA_SOURCE_ID
}
`,
dontIncludeForeignKey: false,
expand: true,
access: 'PUBLIC',
isUniqueValueRequiredForFieldToDisplay: false,
language: "en",
limit: 100,
orderBy: "DESC",
page: 1,
fieldName: "user_name",
operators: "eq",
fieldValues: `
$
{
this
.
loginForm
.
get
(
'
phoneNo
'
)?.
value
}
`,
// this.authService.localStorageGetItemByKey("user_id"),
}),
() => { },
() => { },
(response) => { },
(response) => { },
(
response
:
UserProfile
)
=>
{
(response: RaintreeResponse) => {
let userInfo = response['data'].themeDataSourceFields[0];
if
(
!
response
)
{
if
(!userInfo
) {
this
.
errorMessage
=
'
something went wrong
'
;
this.
_toaster.error('Invalid user','Ok')
;
return;
return;
}
;
}
this
.
_authService
.
prepareLoginProcess
(
response
);
this._autoLogin(userInfo);
},
(error) => {
console.log(error);
},
},
()
=>
{
}
,
()
=>
{
}
() => { }
)
)
}
public sendOtp(): void {
this.otpSend = this._optService.sendOtp(Number(this.loginForm.value.phoneNo));
// console.log(otp);
// this.otpSend = !this.otpSend;
}
}
}
}
src/app/auth/service/auth.service.ts
View file @
4d7c10e4
...
@@ -4,6 +4,8 @@ import { isPlatformBrowser } from '@angular/common';
...
@@ -4,6 +4,8 @@ import { isPlatformBrowser } from '@angular/common';
import
{
Router
}
from
'
@angular/router
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
RequestMapperService
}
from
'
../../mappers/request-mapper.service
'
;
import
{
RequestMapperService
}
from
'
../../mappers/request-mapper.service
'
;
import
{
LogoutService
}
from
'
../../portal/navigation/service/logout.service
'
;
import
{
LogoutService
}
from
'
../../portal/navigation/service/logout.service
'
;
import
{
Student
}
from
'
../../portal/portal-dashboard/interface/students
'
;
import
{
RoleMapperService
}
from
'
../../mappers/role-mapper.service
'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'
root
'
providedIn
:
'
root
'
...
@@ -31,7 +33,7 @@ export class AuthService {
...
@@ -31,7 +33,7 @@ export class AuthService {
if
(
this
.
isBrowser
)
{
if
(
this
.
isBrowser
)
{
localStorage
.
setItem
(
'
isLoggedIn
'
,
'
true
'
);
localStorage
.
setItem
(
'
isLoggedIn
'
,
'
true
'
);
// TODO: This is for temporary
// TODO: This is for temporary
if
(
userProfileData
.
role_name
===
'
Teacher
'
)
{
if
(
userProfileData
.
role_name
===
RoleMapperService
.
TEACHER_ROLE
)
{
localStorage
.
setItem
(
'
role
'
,
'
EDITOR
'
);
localStorage
.
setItem
(
'
role
'
,
'
EDITOR
'
);
}
else
{
}
else
{
...
@@ -48,7 +50,7 @@ export class AuthService {
...
@@ -48,7 +50,7 @@ export class AuthService {
localStorage
.
setItem
(
'
userProfile
'
,
JSON
.
stringify
(
userProfileData
));
localStorage
.
setItem
(
'
userProfile
'
,
JSON
.
stringify
(
userProfileData
));
}
}
public
localStorageGetItemByKey
(
key
:
string
):
string
{
public
localStorageGetItemByKey
(
key
:
string
):
string
{
const
localStorageItem
=
JSON
.
parse
(
localStorage
.
getItem
(
'
userProfile
'
)
!
);
const
localStorageItem
=
JSON
.
parse
(
localStorage
.
getItem
(
'
userProfile
'
)
!
);
...
@@ -60,13 +62,24 @@ export class AuthService {
...
@@ -60,13 +62,24 @@ export class AuthService {
return
this
.
localStorageGetItemByKey
(
'
role_name
'
);
return
this
.
localStorageGetItemByKey
(
'
role_name
'
);
}
}
public
getLoggedSchoolLogo
():
string
{
public
getLoggedSchoolLogo
():
string
{
let
logged_school
=
localStorage
.
getItem
(
'
logged_school
'
);
let
logged_school
=
localStorage
.
getItem
(
'
logged_school
'
);
let
logo
=
''
;
let
logo
=
''
;
if
(
logged_school
===
'
boys
'
)
logo
=
'
./assets/image/b_logo.png
'
;
if
(
logged_school
===
'
boys
'
)
logo
=
'
./assets/image/b_logo.png
'
;
if
(
logged_school
===
'
girls
'
)
logo
=
'
./assets/image/g_logo.png
'
;
if
(
logged_school
===
'
girls
'
)
logo
=
'
./assets/image/g_logo.png
'
;
return
logo
;
return
logo
;
}
}
public
getSchoolHeader
(){
let
logged_school
=
localStorage
.
getItem
(
'
logged_school
'
);
let
text
=
''
if
(
logged_school
===
'
boys
'
)
text
=
'
La Martiniere for Boys
'
;
if
(
logged_school
===
'
girls
'
)
text
=
'
La Martiniere for Girls
'
;
return
text
;
}
public
getUserName
()
{
return
this
.
localStorageGetItemByKey
(
'
phone
'
);
}
}
}
src/app/auth/service/send-otp.service.spec.ts
0 → 100644
View file @
4d7c10e4
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
SendOtpService
}
from
'
./send-otp.service
'
;
describe
(
'
SendOtpService
'
,
()
=>
{
let
service
:
SendOtpService
;
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
SendOtpService
);
});
it
(
'
should be created
'
,
()
=>
{
expect
(
service
).
toBeTruthy
();
});
});
src/app/auth/service/send-otp.service.ts
0 → 100644
View file @
4d7c10e4
import
{
inject
,
Injectable
}
from
'
@angular/core
'
;
import
{
ToasterService
}
from
'
../../component-library/toaster/toaster.service
'
;
import
{
RequestMapperService
}
from
'
../../mappers/request-mapper.service
'
;
import
{
AuthTransmissionService
}
from
'
../../raintree/transmission/auth-transmission.service
'
;
import
{
RaintreeResponse
}
from
'
../../raintree/interface/raintree-response
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
SendOtpService
{
constructor
()
{
}
private
_toaster
=
inject
(
ToasterService
);
private
_authTransmissionService
=
inject
(
AuthTransmissionService
);
private
_otp
:
number
=
0
;
public
sendOtp
(
phone
:
number
):
boolean
{
this
.
_otp
=
Math
.
floor
(
1000
+
Math
.
random
()
*
9000
);
let
otpUrl
=
RequestMapperService
.
OTP_URL
;
this
.
_otp
=
1234
;
const
makeOtpUrl
=
otpUrl
.
replace
(
"
[NUMBER]
"
,
String
(
phone
))
.
replace
(
"
[OTP]
"
,
String
(
this
.
_otp
))
console
.
log
(
makeOtpUrl
);
// this._prepareToSendOtp(makeOtpUrl);
// https://103.229.250.200/smpp/sendsms?username=lmccao&password=sms@2023&to=6290861931&from=LMCCAO&text=7556%20is%20the%20OTP%20to%20create%20new%20password.%20For%20any%20assistance,%20please%20call%20033-4040-6607.%0A%0ABursar-cum-Assistant%20Secretary,%0ALa%20Martiniere%20Schools
this
.
_toaster
.
success
(
'
Otp send successfully
'
,
'
Ok
'
)
return
true
;
}
public
matchOtp
(
otpByUser
:
number
):
boolean
{
return
this
.
_otp
===
otpByUser
;
}
private
_prepareToSendOtp
(
url
:
string
)
{
this
.
_authTransmissionService
.
executeBasicGet
(
url
,
()
=>
{
},
()
=>
{
},
(
response
)
=>
{
console
.
log
(
response
);
},
(
error
)
=>
{
console
.
log
(
error
);
},
()
=>
{
}
);
}
}
src/app/component-library/custom-table/custom-table.component.html
View file @
4d7c10e4
...
@@ -16,13 +16,13 @@
...
@@ -16,13 +16,13 @@
</button>
</button>
</ng-container>
</ng-container>
<ng-container
*ngIf=
"item =='edit' && authService.getUserRole() !== '
Par
ent'"
>
<ng-container
*ngIf=
"item =='edit' && authService.getUserRole() !== '
stud
ent'"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"edit(element)"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"edit(element)"
>
<span
class=
"material-symbols-outlined"
>
edit
</span>
<span
class=
"material-symbols-outlined"
>
edit
</span>
</button>
</button>
</ng-container>
</ng-container>
<ng-container
*ngIf=
"item =='delete' && authService.getUserRole() !== '
Par
ent'"
>
<ng-container
*ngIf=
"item =='delete' && authService.getUserRole() !== '
stud
ent'"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"delete(element)"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"delete(element)"
>
<span
class=
"material-symbols-outlined"
>
delete
</span>
<span
class=
"material-symbols-outlined"
>
delete
</span>
</button>
</button>
...
...
src/app/mappers/request-mapper.service.ts
View file @
4d7c10e4
...
@@ -28,4 +28,9 @@ export class RequestMapperService {
...
@@ -28,4 +28,9 @@ export class RequestMapperService {
public
static
readonly
PROFILE_URL
:
string
=
'
profile
'
;
public
static
readonly
PROFILE_URL
:
string
=
'
profile
'
;
public
static
readonly
CHANGE_PASSWORD_URL
:
string
=
'
update-password
'
;
public
static
readonly
CHANGE_PASSWORD_URL
:
string
=
'
update-password
'
;
// Otp url
public
static
readonly
OTP_URL
:
string
=
'
https://103.229.250.200/smpp/sendsms?username=lmccao&password=sms@2023&to=[NUMBER]&from=LMCCAO&text=[OTP]%20is%20the%20OTP%20to%20create%20new%20password.%20For%20any%20assistance,%20please%20call%20033-4040-6607.%0A%0ABursar-cum-Assistant%20Secretary,%0ALa%20Martiniere%20Schools
'
;
}
}
src/app/mappers/role-mapper.service.ts
View file @
4d7c10e4
...
@@ -8,7 +8,7 @@ export class RoleMapperService {
...
@@ -8,7 +8,7 @@ export class RoleMapperService {
// NOTE:: this will be same value which is come from backend role
// NOTE:: this will be same value which is come from backend role
public
static
readonly
TEACHER_ROLE
:
string
=
'
EDITOR
'
;
public
static
readonly
TEACHER_ROLE
:
string
=
'
EDITOR
'
;
public
static
readonly
STUDENT_ROLE
:
string
=
'
Par
ent
'
;
public
static
readonly
STUDENT_ROLE
:
string
=
'
stud
ent
'
;
public
static
get
getAllRole
():
string
[]
{
public
static
get
getAllRole
():
string
[]
{
return
[
return
[
...
...
src/app/portal/assignment/assignment/assignment.component.html
View file @
4d7c10e4
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
(emitView)=
"emitViewFromTable($event)"
/>
(emitView)=
"emitViewFromTable($event)"
/>
</div>
</div>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
Par
ent'"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
stud
ent'"
>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addAssignment()"
/>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addAssignment()"
/>
</div>
</div>
<!-- <app-mat-confirm-dialog /> -->
<!-- <app-mat-confirm-dialog /> -->
\ No newline at end of file
src/app/portal/assignment/interface/assignment.ts
View file @
4d7c10e4
...
@@ -21,6 +21,6 @@ export interface Assignment {
...
@@ -21,6 +21,6 @@ export interface Assignment {
section_details
?:
LocalizedField
;
section_details
?:
LocalizedField
;
subject_subject_name
?:
LocalizedField
;
subject_subject_name
?:
LocalizedField
;
class_subject_subject_txt
?:
LocalizedField
;
class_subject_subject_txt
?:
LocalizedField
;
assigned_by
_teacher
:
LocalizedField
;
assigned_by
:
LocalizedField
;
}
}
src/app/portal/assignment/manage/manage.component.ts
View file @
4d7c10e4
...
@@ -180,7 +180,7 @@ export class ManageComponent {
...
@@ -180,7 +180,7 @@ export class ManageComponent {
page
:
1
,
page
:
1
,
fieldName
:
"
subject_teacher,section
"
,
fieldName
:
"
subject_teacher,section
"
,
operators
:
"
eq,eq
"
,
operators
:
"
eq,eq
"
,
fieldValues
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
"
user
_id
"
)}
,
${
sectionId
}
`
fieldValues
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
"
logged
_id
"
)}
,
${
sectionId
}
`
}),
}),
()
=>
{
},
()
=>
{
},
(
response
)
=>
{
},
(
response
)
=>
{
},
...
@@ -216,7 +216,7 @@ export class ManageComponent {
...
@@ -216,7 +216,7 @@ export class ManageComponent {
page
:
1
,
page
:
1
,
fieldName
:
"
teacher
"
,
fieldName
:
"
teacher
"
,
operators
:
"
eq
"
,
operators
:
"
eq
"
,
fieldValues
:
this
.
_auth
.
localStorageGetItemByKey
(
"
user
_id
"
)
fieldValues
:
this
.
_auth
.
localStorageGetItemByKey
(
"
logged
_id
"
)
}),
}),
()
=>
{
},
()
=>
{
},
(
response
)
=>
{
},
(
response
)
=>
{
},
...
@@ -269,10 +269,10 @@ export class ManageComponent {
...
@@ -269,10 +269,10 @@ export class ManageComponent {
beng
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
beng
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
hindi
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
hindi
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
},
},
assigned_by
_teacher
:
{
assigned_by
:
{
en
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
en
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
beng
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
beng
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
hindi
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
hindi
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
},
},
session
:
{
session
:
{
en
:
`
${
DataSourceService
.
SESSION_ID
}
`
,
en
:
`
${
DataSourceService
.
SESSION_ID
}
`
,
...
@@ -320,10 +320,10 @@ export class ManageComponent {
...
@@ -320,10 +320,10 @@ export class ManageComponent {
beng
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
beng
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
hindi
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
hindi
:
`
${
this
.
assignmentForm
.
value
.
subject
}
`
,
},
},
assigned_by
_teacher
:
{
assigned_by
:
{
en
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
en
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
beng
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
beng
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
hindi
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
,
hindi
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
,
},
},
session
:
{
session
:
{
en
:
'
86af4d6b5675a82df4581f00c67f0c7f
'
,
en
:
'
86af4d6b5675a82df4581f00c67f0c7f
'
,
...
...
src/app/portal/exam/exam/exam.component.html
View file @
4d7c10e4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
/>
/>
</div>
</div>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
Par
ent'"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
stud
ent'"
>
<app-square-button
<app-square-button
[buttonIcon]=
"'add'"
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addExam()"
(emitSquareButtonClick)=
"addExam()"
...
...
src/app/portal/portal-dashboard/interface/students.ts
View file @
4d7c10e4
...
@@ -10,16 +10,23 @@ export interface Students extends Data {
...
@@ -10,16 +10,23 @@ export interface Students extends Data {
export
interface
Student
{
export
interface
Student
{
id
:
string
;
id
:
string
;
name
:
LocalizedField
;
name
:
LocalizedField
;
parent_user
:
LocalizedField
;
user_name
:
LocalizedField
;
class
:
LocalizedField
;
class
:
LocalizedField
;
class_className
:
LocalizedField
;
section_details
:
LocalizedField
;
section
:
LocalizedField
;
section
:
LocalizedField
;
section_class
:
LocalizedField
;
section_class_className
:
LocalizedField
;
section_class_details
:
LocalizedField
;
email
:
LocalizedField
;
email
:
LocalizedField
;
phone
:
LocalizedField
;
phone
:
LocalizedField
;
address
:
LocalizedField
;
address
:
LocalizedField
;
user_type
:
LocalizedField
;
school
:
LocalizedField
;
school
:
LocalizedField
;
school_school_Name
:
LocalizedField
;
school_school_Name
:
LocalizedField
;
class_details
:
LocalizedField
;
class_details
:
LocalizedField
;
section_details
:
LocalizedField
;
dob
:
LocalizedField
;
fathers_name
:
LocalizedField
;
mothers_name
:
LocalizedField
;
reg_no
:
LocalizedField
;
}
}
src/app/portal/portal-dashboard/portal-dashboard.component.html
View file @
4d7c10e4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
class=
"portal_dashboard_container"
>
<div
class=
"portal_dashboard_container"
>
<div
class=
"portal_dashboard_inner"
>
<div
class=
"portal_dashboard_inner"
>
<div
class=
"portal_card_container"
>
<div
class=
"portal_card_container"
>
@if (authService.getUserRole() === '
Par
ent') {
@if (authService.getUserRole() === '
stud
ent') {
<div
class=
"student_dropdown"
>
<div
class=
"student_dropdown"
>
<mat-form-field
class=
"full_width"
>
<mat-form-field
class=
"full_width"
>
<mat-label
>
Select Student
</mat-label>
<mat-label
>
Select Student
</mat-label>
...
...
src/app/portal/portal-dashboard/portal-dashboard.component.ts
View file @
4d7c10e4
...
@@ -14,6 +14,7 @@ import { DropDown } from '../../component-library/dropdown/interface/drop-down';
...
@@ -14,6 +14,7 @@ import { DropDown } from '../../component-library/dropdown/interface/drop-down';
import
{
Student
}
from
'
./interface/students
'
;
import
{
Student
}
from
'
./interface/students
'
;
import
{
Dropdown
}
from
'
../../component-library/dropdown/interface/dropdown
'
;
import
{
Dropdown
}
from
'
../../component-library/dropdown/interface/dropdown
'
;
import
{
TeacherTransmissionService
}
from
'
../../raintree/transmission/teacher-transmission.service
'
;
import
{
TeacherTransmissionService
}
from
'
../../raintree/transmission/teacher-transmission.service
'
;
import
{
RoleMapperService
}
from
'
../../mappers/role-mapper.service
'
;
@
Component
({
@
Component
({
selector
:
'
app-portal-dashboard
'
,
selector
:
'
app-portal-dashboard
'
,
...
@@ -54,8 +55,11 @@ export class PortalDashboardComponent implements OnInit {
...
@@ -54,8 +55,11 @@ export class PortalDashboardComponent implements OnInit {
public
ngOnInit
():
void
{
public
ngOnInit
():
void
{
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
&&
this
.
_getStudentByParentId
();
// (this.authService.getUserRole() === 'Parent') && this._getStudentByParentId();
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
&&
this
.
_getTeacherDetails
();
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
&&
this
.
_getTeacherDetails
();
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
&&
this
.
_getStudentByParentId
();
}
}
...
@@ -65,8 +69,46 @@ export class PortalDashboardComponent implements OnInit {
...
@@ -65,8 +69,46 @@ export class PortalDashboardComponent implements OnInit {
this
.
_setSetStudentInfoInLocalStorage
(
selectedStudentInfo
as
Student
);
this
.
_setSetStudentInfoInLocalStorage
(
selectedStudentInfo
as
Student
);
}
}
// FOR STUDENT LOGIN
private
_getStudentByPhone
()
{
this
.
studentTransmission
.
getStudents
(
TransmissionMapperService
.
GET_TRANSMISSION_URL
+
this
.
_urlConfig
.
generateDatasourceConfigUrl
({
aggregationOnUniqueFld
:
false
,
datasourceId
:
DataSourceService
.
STUDENT_DATA_SOURCE_ID
,
dontIncludeForeignKey
:
false
,
expand
:
true
,
access
:
'
PUBLIC
'
,
isUniqueValueRequiredForFieldToDisplay
:
false
,
language
:
"
en
"
,
limit
:
100
,
orderBy
:
"
DESC
"
,
page
:
1
,
fieldName
:
"
user_name
"
,
operators
:
"
eq
"
,
fieldValues
:
`
${
this
.
authService
.
getUserName
()}
`
,
}),
()
=>
{
},
(
response
)
=>
{
},
(
response
:
RaintreeResponse
)
=>
{
this
.
students
=
response
[
'
data
'
].
themeDataSourceFields
;
this
.
selectedStudent
=
this
.
students
[
0
].
id
;
this
.
_setSetStudentInfoInLocalStorage
(
this
.
students
[
0
]);
},
(
error
)
=>
{
console
.
log
(
error
);
},
()
=>
{
}
)
}
// FOR PARENT LOGIN
// FOR PARENT LOGIN
private
_getStudentByParentId
()
{
private
_getStudentByParentId
()
{
this
.
studentTransmission
.
getStudents
(
this
.
studentTransmission
.
getStudents
(
...
@@ -81,9 +123,9 @@ export class PortalDashboardComponent implements OnInit {
...
@@ -81,9 +123,9 @@ export class PortalDashboardComponent implements OnInit {
orderBy
:
"
ASC
"
,
orderBy
:
"
ASC
"
,
page
:
1
,
page
:
1
,
roleBasedFiltering
:
true
,
roleBasedFiltering
:
true
,
fieldName
:
"
parent_user
"
,
fieldName
:
"
user_name
"
,
operators
:
"
eq
"
,
operators
:
"
eq
"
,
fieldValues
:
this
.
authService
.
localStorageGetItemByKey
(
"
user_id
"
)
fieldValues
:
`
${
this
.
authService
.
getUserName
()}
`
}),
}),
()
=>
{
},
()
=>
{
},
(
response
)
=>
{
},
(
response
)
=>
{
},
...
@@ -137,9 +179,9 @@ export class PortalDashboardComponent implements OnInit {
...
@@ -137,9 +179,9 @@ export class PortalDashboardComponent implements OnInit {
orderBy
:
"
ASC
"
,
orderBy
:
"
ASC
"
,
page
:
1
,
page
:
1
,
roleBasedFiltering
:
true
,
roleBasedFiltering
:
true
,
fieldName
:
"
user
"
,
fieldName
:
"
user
_name
"
,
operators
:
"
eq
"
,
operators
:
"
eq
"
,
fieldValues
:
this
.
authService
.
localStorageGetItemByKey
(
"
user_id
"
)
fieldValues
:
`
${
this
.
authService
.
getUserName
()}
`
}),
}),
()
=>
{
},
()
=>
{
},
(
response
)
=>
{
},
(
response
)
=>
{
},
...
...
src/app/portal/routine/manage/manage.component.ts
View file @
4d7c10e4
...
@@ -188,7 +188,7 @@ export class ManageComponent {
...
@@ -188,7 +188,7 @@ export class ManageComponent {
page: 1,
page: 1,
fieldName: "teacher",
fieldName: "teacher",
operators: "eq",
operators: "eq",
fieldValues: this._auth.localStorageGetItemByKey("
user
_id")
fieldValues: this._auth.localStorageGetItemByKey("
logged
_id")
}),
}),
() => { },
() => { },
(response) => { },
(response) => { },
...
...
src/app/portal/routine/routine/routine.component.html
View file @
4d7c10e4
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
/>
/>
</div>
</div>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
Par
ent'"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
stud
ent'"
>
<app-square-button
<app-square-button
[buttonIcon]=
"'add'"
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addRoutine()"
(emitSquareButtonClick)=
"addRoutine()"
...
...
src/app/portal/service/url-config.service.ts
View file @
4d7c10e4
import
{
inject
,
Injectable
}
from
'
@angular/core
'
;
import
{
inject
,
Injectable
}
from
'
@angular/core
'
;
import
{
AuthService
}
from
'
../../auth/service/auth.service
'
;
import
{
AuthService
}
from
'
../../auth/service/auth.service
'
;
import
{
DataSourceService
}
from
'
./data-source.service
'
;
import
{
DataSourceService
}
from
'
./data-source.service
'
;
import
{
RoleMapperService
}
from
'
../../mappers/role-mapper.service
'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'
root
'
providedIn
:
'
root
'
...
@@ -21,11 +22,11 @@ export class UrlConfigService {
...
@@ -21,11 +22,11 @@ export class UrlConfigService {
switch
(
type
)
{
switch
(
type
)
{
case
'
assignment
'
:
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldName
=
"
assigned_by
_teacher
"
;
fieldName
=
"
assigned_by
"
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldName
=
"
school,section_class,section
"
;
fieldName
=
"
school,section_class,section
"
;
...
@@ -33,11 +34,11 @@ export class UrlConfigService {
...
@@ -33,11 +34,11 @@ export class UrlConfigService {
break
;
break
;
case
'
routine
'
:
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldName
=
"
session,school,section_teacher
"
;
fieldName
=
"
session,school,section_teacher
"
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldName
=
"
section,session,school
"
;
fieldName
=
"
section,session,school
"
;
}
}
...
@@ -55,11 +56,11 @@ export class UrlConfigService {
...
@@ -55,11 +56,11 @@ export class UrlConfigService {
switch
(
type
)
{
switch
(
type
)
{
case
'
assignment
'
:
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldOperator
=
'
eq
'
;
fieldOperator
=
'
eq
'
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldOperator
=
'
eq,eq,eq
'
;
fieldOperator
=
'
eq,eq,eq
'
;
...
@@ -67,11 +68,11 @@ export class UrlConfigService {
...
@@ -67,11 +68,11 @@ export class UrlConfigService {
break
;
break
;
case
'
routine
'
:
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldOperator
=
"
eq,eq,eq
"
;
fieldOperator
=
"
eq,eq,eq
"
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldOperator
=
"
eq,eq,eq
"
;
fieldOperator
=
"
eq,eq,eq
"
;
}
}
...
@@ -89,11 +90,11 @@ export class UrlConfigService {
...
@@ -89,11 +90,11 @@ export class UrlConfigService {
switch
(
type
)
{
switch
(
type
)
{
case
'
assignment
'
:
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldValues
=
`
${
this
.
authService
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
;
fieldValues
=
`
${
this
.
authService
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_school_id
'
)}
,
${
localStorage
.
getItem
(
'
student_class_id
'
)}
,
${
localStorage
.
getItem
(
'
student_section_id
'
)}
`
;
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_school_id
'
)}
,
${
localStorage
.
getItem
(
'
student_class_id
'
)}
,
${
localStorage
.
getItem
(
'
student_section_id
'
)}
`
;
...
@@ -101,11 +102,11 @@ export class UrlConfigService {
...
@@ -101,11 +102,11 @@ export class UrlConfigService {
break
;
break
;
case
'
routine
'
:
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
TEACHER_ROLE
)
{
fieldValues
=
`
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
school_id
'
)}
,
${
this
.
authService
.
localStorageGetItemByKey
(
'
user
_id
'
)}
`
;
fieldValues
=
`
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
school_id
'
)}
,
${
this
.
authService
.
localStorageGetItemByKey
(
'
logged
_id
'
)}
`
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
}
else
if
(
this
.
authService
.
getUserRole
()
===
RoleMapperService
.
STUDENT_ROLE
)
{
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_section_id
'
)}
,
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
student_school_id
'
)}
`
;
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_section_id
'
)}
,
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
student_school_id
'
)}
`
;
}
}
...
...
src/app/raintree/transmission/auth-transmission.service.ts
View file @
4d7c10e4
...
@@ -57,6 +57,7 @@ export class AuthTransmissionService extends TransmissionService {
...
@@ -57,6 +57,7 @@ export class AuthTransmissionService extends TransmissionService {
)
)
}
}
public
changePassword
(
public
changePassword
(
url
:
string
,
url
:
string
,
payload
:
any
,
payload
:
any
,
...
@@ -79,4 +80,24 @@ export class AuthTransmissionService extends TransmissionService {
...
@@ -79,4 +80,24 @@ export class AuthTransmissionService extends TransmissionService {
)
)
}
}
public
getUser
(
url
:
string
,
onPreExecute
:
()
=>
void
,
onPostExecute
:
(
response
:
RaintreeResponse
)
=>
void
,
onSuccess
:
(
response
:
RaintreeResponse
)
=>
void
,
onFailure
:
(
error
:
string
)
=>
void
,
onComplete
:
()
=>
void
):
void
{
this
.
executePostPayload
(
url
,
{},
onPreExecute
,
onPostExecute
,
onSuccess
,
onFailure
,
onComplete
,
false
);
}
}
}
src/app/raintree/transmission/transmission.service.ts
View file @
4d7c10e4
...
@@ -25,13 +25,16 @@ export class TransmissionService {
...
@@ -25,13 +25,16 @@ export class TransmissionService {
onPostExecute
:
(
response
:
string
)
=>
void
,
onPostExecute
:
(
response
:
string
)
=>
void
,
onSuccess
:
(
response
:
string
)
=>
void
,
onSuccess
:
(
response
:
string
)
=>
void
,
onFailure
:
(
error
:
string
)
=>
void
,
onFailure
:
(
error
:
string
)
=>
void
,
onComplete
:
()
=>
void
onComplete
:
()
=>
void
,
requiresAuthentication
=
false
):
void
{
):
void
{
onPreExecute
();
onPreExecute
();
this
.
_http
this
.
_http
.
get
<
RaintreeResponse
>
(
url
,
{
.
get
<
RaintreeResponse
>
(
url
,
{
headers
:
this
.
_jwt
.
injectToken
(
url
),
headers
:
requiresAuthentication
?
this
.
_jwt
.
injectToken
(
url
)
:
undefined
,
})
})
.
pipe
(
catchError
(
this
.
_httpErrorHandler
.
intercept
))
.
pipe
(
catchError
(
this
.
_httpErrorHandler
.
intercept
))
.
subscribe
(
.
subscribe
(
...
...
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