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
7b70909f
Commit
7b70909f
authored
Apr 11, 2025
by
achinta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: date-range in assignment
parent
44642347
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
410 additions
and
217 deletions
+410
-217
src/app/component-library/date-range/date-range.component.html
...pp/component-library/date-range/date-range.component.html
+10
-0
src/app/component-library/date-range/date-range.component.scss
...pp/component-library/date-range/date-range.component.scss
+0
-0
src/app/component-library/date-range/date-range.component.spec.ts
...component-library/date-range/date-range.component.spec.ts
+23
-0
src/app/component-library/date-range/date-range.component.ts
src/app/component-library/date-range/date-range.component.ts
+36
-0
src/app/mappers/transmission-mapper.service.ts
src/app/mappers/transmission-mapper.service.ts
+1
-21
src/app/portal/assignment/assignment/assignment.component.html
...pp/portal/assignment/assignment/assignment.component.html
+18
-12
src/app/portal/assignment/assignment/assignment.component.scss
...pp/portal/assignment/assignment/assignment.component.scss
+6
-1
src/app/portal/assignment/assignment/assignment.component.ts
src/app/portal/assignment/assignment/assignment.component.ts
+45
-12
src/app/portal/assignment/manage/manage.component.ts
src/app/portal/assignment/manage/manage.component.ts
+6
-6
src/app/portal/navigation/model/sidebar/menu.ts
src/app/portal/navigation/model/sidebar/menu.ts
+3
-2
src/app/portal/portal-dashboard/portal-dashboard.component.ts
...app/portal/portal-dashboard/portal-dashboard.component.ts
+3
-2
src/app/portal/routine/interface/routine-table.ts
src/app/portal/routine/interface/routine-table.ts
+1
-1
src/app/portal/routine/interface/routine.ts
src/app/portal/routine/interface/routine.ts
+2
-1
src/app/portal/routine/manage/manage.component.html
src/app/portal/routine/manage/manage.component.html
+12
-8
src/app/portal/routine/manage/manage.component.ts
src/app/portal/routine/manage/manage.component.ts
+125
-108
src/app/portal/routine/routine.routes.ts
src/app/portal/routine/routine.routes.ts
+1
-1
src/app/portal/routine/routine/routine.component.ts
src/app/portal/routine/routine/routine.component.ts
+39
-13
src/app/portal/routine/service/prepare-routine-table-data.service.ts
...tal/routine/service/prepare-routine-table-data.service.ts
+3
-2
src/app/portal/service/data-source.service.ts
src/app/portal/service/data-source.service.ts
+6
-0
src/app/portal/service/url-config.service.ts
src/app/portal/service/url-config.service.ts
+70
-27
No files found.
src/app/component-library/date-range/date-range.component.html
0 → 100644
View file @
7b70909f
<mat-form-field>
<mat-label>
Enter a date range
</mat-label>
<mat-date-range-input
[formGroup]=
"range"
[rangePicker]=
"picker"
>
<input
formControlName=
"start"
matStartDate
placeholder=
"Start date"
(dateChange)=
"onDateChange()"
>
<input
formControlName=
"end"
matEndDate
placeholder=
"End date"
(dateChange)=
"onDateChange()"
>
</mat-date-range-input>
<mat-hint>
MM/DD/YYYY – MM/DD/YYYY
</mat-hint>
<mat-datepicker-toggle
matIconSuffix
[for]=
"picker"
></mat-datepicker-toggle>
<mat-date-range-picker
#picker
></mat-date-range-picker>
</mat-form-field>
src/app/component-library/date-range/date-range.component.scss
0 → 100644
View file @
7b70909f
src/app/component-library/date-range/date-range.component.spec.ts
0 → 100644
View file @
7b70909f
import
{
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
DateRangeComponent
}
from
'
./date-range.component
'
;
describe
(
'
DateRangeComponent
'
,
()
=>
{
let
component
:
DateRangeComponent
;
let
fixture
:
ComponentFixture
<
DateRangeComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
imports
:
[
DateRangeComponent
]
})
.
compileComponents
();
fixture
=
TestBed
.
createComponent
(
DateRangeComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'
should create
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/component-library/date-range/date-range.component.ts
0 → 100644
View file @
7b70909f
import
{
CommonModule
}
from
'
@angular/common
'
;
import
{
Component
,
signal
}
from
'
@angular/core
'
;
import
{
FormControl
,
FormGroup
,
FormsModule
,
ReactiveFormsModule
}
from
'
@angular/forms
'
;
import
{
provideNativeDateAdapter
}
from
'
@angular/material/core
'
;
import
{
MatDatepickerModule
}
from
'
@angular/material/datepicker
'
;
import
{
MatFormFieldModule
}
from
'
@angular/material/form-field
'
;
import
{
MatInputModule
}
from
'
@angular/material/input
'
;
@
Component
({
selector
:
'
app-date-range
'
,
imports
:
[
CommonModule
,
MatInputModule
,
MatDatepickerModule
,
ReactiveFormsModule
,
MatFormFieldModule
,
FormsModule
],
standalone
:
true
,
templateUrl
:
'
./date-range.component.html
'
,
styleUrl
:
'
./date-range.component.scss
'
,
providers
:
[
provideNativeDateAdapter
()],
})
export
class
DateRangeComponent
{
public
startDate
=
signal
<
string
[]
>
([]);
public
range
=
new
FormGroup
({
start
:
new
FormControl
<
Date
|
null
>
(
null
),
end
:
new
FormControl
<
Date
|
null
>
(
null
),
});
public
onDateChange
():
void
{
// this.startDate.update(startDate => [...startDate ,this.range.value.start])
}
}
src/app/mappers/transmission-mapper.service.ts
View file @
7b70909f
...
...
@@ -29,24 +29,4 @@ export class TransmissionMapperService {
public
static
readonly
DELETE_RECORD_TRANSMISSION_URL
:
string
=
TransmissionMapperService
.
DEV_TRANSMISSION_URL
+
'
/webomagic/deleteWebsiteDataSourceFieldsBasedOnDataSourceType?
'
;
// aggregationOnUniqueFld=false&datasourceId=3188&dontIncludeForeignKey=false&expand=false&isUniqueValueRequiredForFieldToDisplay=false&language=en&limit=10&orderBy=ASC&page=1&user_id=206&roleBasedFiltering=true
// public static readonly SCHEDULE_OF_RATES_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL +
// '/schedule-of-rates/get-all';
// public static readonly SCHEDULE_OF_RATES_ADD_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL + '/schedule-of-rates/add';
// public static readonly SCHEDULE_OF_RATES_UPDATE_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL +
// '/schedule-of-rates/update';
// public static readonly SCHEDULE_OF_RATE_TYPE_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL +
// '/schedule-of-rate-type/get-all';
// public static readonly AUDIT_LOG_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL + '/entry-log/get';
// public static readonly AUDIT_LOG_COUNT_TRANSMISSION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL + '/entry-log/count';
// public static readonly CHARTS_OF_ACCOUNT_TRANSMISION_URL: string =
// TransmissionMapperService.DEV_TRANSMISSION_URL +
// '/chart-of-account/get-all?head_type=income&get_only_head=false&get_nested_preview=true&page=1&page_size=100';
}
src/app/portal/assignment/assignment/assignment.component.html
View file @
7b70909f
<h3>
Assignments
</h3>
<div
class=
"date_range_picker"
>
<mat-form-field>
<mat-label>
Enter a date range
</mat-label>
<mat-date-range-input
[formGroup]=
"range"
[rangePicker]=
"picker"
>
<input
formControlName=
"start"
matStartDate
placeholder=
"Start date"
(dateChange)=
"onDateChange()"
>
<input
formControlName=
"end"
matEndDate
placeholder=
"End date"
(dateChange)=
"onDateChange()"
>
</mat-date-range-input>
<mat-hint>
MM/DD/YYYY – MM/DD/YYYY
</mat-hint>
<mat-datepicker-toggle
matIconSuffix
[for]=
"picker"
></mat-datepicker-toggle>
<mat-date-range-picker
#picker
></mat-date-range-picker>
</mat-form-field>
</div>
<div
class=
"custom_table"
>
<app-custom-table
[columns]=
"columns"
[data]=
"data"
(emitDelete)=
"emitDeleteFromTable($event)"
(emitView)=
"emitViewFromTable($event)"
/>
<app-custom-table
[columns]=
"columns"
[data]=
"data"
(emitDelete)=
"emitDeleteFromTable($event)"
(emitView)=
"emitViewFromTable($event)"
/>
</div>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== 'Parent'"
>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addAssignment()"
/>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addAssignment()"
/>
</div>
<!-- <app-mat-confirm-dialog /> -->
\ No newline at end of file
src/app/portal/assignment/assignment/assignment.component.scss
View file @
7b70909f
...
...
@@ -5,3 +5,8 @@
padding
:
0px
15px
;
margin
:
auto
;
}
.date_range_picker
{
margin-bottom
:
20px
;
}
src/app/portal/assignment/assignment/assignment.component.ts
View file @
7b70909f
...
...
@@ -9,7 +9,7 @@ import { UrlConfigService } from '../../service/url-config.service';
import
{
PrepareAssignmentTableDataService
}
from
'
../service/prepare-assignment-table-data.service
'
;
import
{
DataSourceService
}
from
'
../../service/data-source.service
'
;
import
{
AuthService
}
from
'
../../../auth/service/auth.service
'
;
import
{
CommonModule
}
from
'
@angular/common
'
;
import
{
CommonModule
,
DatePipe
}
from
'
@angular/common
'
;
import
{
RaintreeResponse
}
from
'
../../../raintree/interface/raintree-response
'
;
import
{
MatDialogConfigService
}
from
'
../../service/mat-dialog-config.service
'
;
import
{
DeleteRecordTransmissionService
}
from
'
../../../raintree/transmission/delete-record-transmission.service
'
;
...
...
@@ -17,17 +17,25 @@ import { ToasterService } from '../../../component-library/toaster/toaster.servi
import
{
CustomTableColumn
}
from
'
../../../component-library/interface/custom-table-column
'
;
import
{
AssignmentTable
}
from
'
../interface/assignment-table
'
;
import
{
MatConfirmDialogComponent
}
from
"
../../../component-library/mat-confirm-dialog/mat-confirm-dialog.component
"
;
import
{
RoleMapperService
}
from
'
../../../mappers/role-mapper.service
'
;
import
{
MatFormFieldModule
}
from
'
@angular/material/form-field
'
;
import
{
MatDatepickerModule
}
from
'
@angular/material/datepicker
'
;
import
{
FormControl
,
FormGroup
,
FormsModule
,
ReactiveFormsModule
}
from
'
@angular/forms
'
;
import
{
provideNativeDateAdapter
}
from
'
@angular/material/core
'
;
@
Component
({
selector
:
'
app-assignment
'
,
imports
:
[
CustomTableComponent
,
CommonModule
,
SquareButtonComponent
],
SquareButtonComponent
,
MatFormFieldModule
,
MatDatepickerModule
,
ReactiveFormsModule
],
standalone
:
true
,
templateUrl
:
'
./assignment.component.html
'
,
styleUrl
:
'
./assignment.component.scss
'
styleUrl
:
'
./assignment.component.scss
'
,
providers
:
[
provideNativeDateAdapter
(),
provideNativeDateAdapter
(),
DatePipe
],
})
export
class
AssignmentComponent
implements
OnInit
{
...
...
@@ -38,10 +46,16 @@ export class AssignmentComponent implements OnInit {
private
_prepareAssignmentTableData
:
PrepareAssignmentTableDataService
,
public
matConfig
:
MatDialogConfigService
,
public
authService
:
AuthService
,
private
_deleteTransmission
:
DeleteRecordTransmissionService
,
private
_toaster
:
ToasterService
private
_deleteTransmission
:
DeleteRecordTransmissionService
,
private
_toaster
:
ToasterService
,
private
_datePipe
:
DatePipe
,
)
{
}
public
range
=
new
FormGroup
({
start
:
new
FormControl
<
Date
|
null
>
(
null
),
end
:
new
FormControl
<
Date
|
null
>
(
null
),
});
public
columns
:
CustomTableColumn
[]
=
[];
public
data
:
AssignmentTable
[]
=
[];
...
...
@@ -59,6 +73,19 @@ export class AssignmentComponent implements OnInit {
}
private
_getAssignments
():
void
{
// fieldName: assigned_on,assigned_on
// operators: gt,lt
// fieldValues: hhfj,nfw
let
dateRangeFieldname
=
''
;
let
dateRangeFieldOperator
=
''
;
let
dateRangeFieldValue
=
''
;
if
(
this
.
range
.
value
.
start
&&
this
.
range
.
value
.
end
){
dateRangeFieldname
=
'
assigned_on,assigned_on
'
;
dateRangeFieldOperator
=
'
ge,le
'
;
dateRangeFieldValue
=
`
${
this
.
_datePipe
.
transform
(
this
.
range
.
value
.
start
,
'
yyyy-MM-dd
'
)}
,
${
this
.
_datePipe
.
transform
(
this
.
range
.
value
.
end
,
'
yyyy-MM-dd
'
)}
`
}
this
.
_assignmentTransmission
.
getAssignment
(
TransmissionMapperService
.
GET_TRANSMISSION_URL
+
this
.
_urlConfig
.
generateDatasourceConfigUrl
({
...
...
@@ -71,9 +98,9 @@ export class AssignmentComponent implements OnInit {
limit
:
100
,
orderBy
:
"
ASC
"
,
page
:
1
,
fieldName
:
this
.
_urlConfig
.
getFiledNameFilter
(
'
assignment
'
)
,
operators
:
this
.
_urlConfig
.
getFieldOperatorFilter
(
'
assignment
'
)
,
fieldValues
:
this
.
_urlConfig
.
getFieldValuesFilter
(
'
assignment
'
)
,
fieldName
:
`
${
this
.
_urlConfig
.
getFiledNameFilter
(
'
assignment
'
)}
,
${
dateRangeFieldname
}
`
,
operators
:
`
${
this
.
_urlConfig
.
getFieldOperatorFilter
(
'
assignment
'
)}
,
${
dateRangeFieldOperator
}
`
,
fieldValues
:
`
${
this
.
_urlConfig
.
getFieldValuesFilter
(
'
assignment
'
)}
,
${
dateRangeFieldValue
}
`
,
// this.authService.localStorageGetItemByKey("user_id"),
}),
()
=>
{
},
...
...
@@ -129,4 +156,10 @@ export class AssignmentComponent implements OnInit {
});
}
public
onDateChange
():
void
{
if
(
this
.
range
.
value
.
start
&&
this
.
range
.
value
.
end
)
this
.
_getAssignments
();
}
}
src/app/portal/assignment/manage/manage.component.ts
View file @
7b70909f
...
...
@@ -60,11 +60,10 @@ export class ManageComponent {
public
sectionDropDownData
:
Dropdown
[]
=
[];
public
assignmentForm
=
new
FormGroup
({
// class: new FormControl("", [Validators.required]),
section
:
new
FormControl
(
""
,
[
Validators
.
required
]),
subject
:
new
FormControl
(
""
,
[
Validators
.
required
]),
lastDate
:
new
FormControl
(
""
,
[
Validators
.
required
]),
document
:
new
FormControl
(
""
),
document
:
new
FormControl
(
""
,
[
Validators
.
required
])
});
ngOnInit
():
void
{
// this._getClasses();
...
...
@@ -88,7 +87,8 @@ export class ManageComponent {
()
=>
{
},
(
response
:
RaintreeResponse
)
=>
{
this
.
assignmentForm
.
value
.
document
=
`
${
TransmissionMapperService
.
DEV_TRANSMISSION_URL
}
/webomagic/getFile?fid=
${
response
[
'
data
'
]}
`
this
.
assignmentForm
.
get
(
'
document
'
)?.
setValue
(
`
${
TransmissionMapperService
.
DEV_TRANSMISSION_URL
}
/webomagic/getFile?fid=
${
response
[
'
data
'
]}
`
)
this
.
_toaster
.
success
(
response
.
message
,
'
Ok
'
)
},
(
error
)
=>
{
...
...
@@ -269,9 +269,9 @@ export class ManageComponent {
hindi
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
user_id
'
)}
`
,
},
session
:
{
en
:
'
86af4d6b5675a82df4581f00c67f0c7f
'
,
beng
:
'
86af4d6b5675a82df4581f00c67f0c7f
'
,
hindi
:
'
86af4d6b5675a82df4581f00c67f0c7f
'
,
en
:
`
${
DataSourceService
.
SESSION_ID
}
`
,
beng
:
`
${
DataSourceService
.
SESSION_ID
}
`
,
hindi
:
`
${
DataSourceService
.
SESSION_ID
}
`
,
},
school
:
{
en
:
`
${
localStorage
.
getItem
(
'
school_id
'
)}
`
,
...
...
src/app/portal/navigation/model/sidebar/menu.ts
View file @
7b70909f
...
...
@@ -53,7 +53,7 @@ export class Menu {
id
:
4
,
title
:
'
Routine
'
,
icon
:
'
routine
'
,
route
:
RequestMapperService
.
ROUTINE_URL
,
route
:
RequestMapperService
.
ROUTINE_URL
+
'
/class
'
,
selected
:
false
,
roles
:
[
RoleMapperService
.
TEACHER_ROLE
,
RoleMapperService
.
STUDENT_ROLE
...
...
@@ -65,7 +65,8 @@ export class Menu {
id
:
5
,
title
:
'
Exam
'
,
icon
:
'
book_3
'
,
route
:
RequestMapperService
.
EXAM_URL
,
// route: RequestMapperService.EXAM_URL,
route
:
RequestMapperService
.
ROUTINE_URL
+
'
/exam
'
,
selected
:
false
,
roles
:
[
RoleMapperService
.
TEACHER_ROLE
,
RoleMapperService
.
STUDENT_ROLE
...
...
src/app/portal/portal-dashboard/portal-dashboard.component.ts
View file @
7b70909f
...
...
@@ -38,9 +38,10 @@ export class PortalDashboardComponent implements OnInit {
public
assignmentUrl
=
`/
${
RequestMapperService
.
PORTAL_URL
}
/
${
RequestMapperService
.
ASSIGNMENT_URL
}
`
;
public
routineUrl
=
`/
${
RequestMapperService
.
PORTAL_URL
}
/
${
RequestMapperService
.
ROUTINE_URL
}
`
;
public
routineUrl
=
`/
${
RequestMapperService
.
PORTAL_URL
}
/
${
RequestMapperService
.
ROUTINE_URL
}
/class
`
;
public
examUrl
=
`/
${
RequestMapperService
.
PORTAL_URL
}
/
${
RequestMapperService
.
EXAM_URL
}
`
;
public
examUrl
=
`/
${
RequestMapperService
.
PORTAL_URL
}
/
${
RequestMapperService
.
ROUTINE_URL
}
/exam`
;
// public examUrl = `/${RequestMapperService.PORTAL_URL}/${RequestMapperService.EXAM_URL}/exam`;
public
selectedStudent
:
string
=
''
;
...
...
src/app/portal/routine/interface/routine-table.ts
View file @
7b70909f
...
...
@@ -5,6 +5,6 @@ export interface RoutineTable {
class_details
?:
string
;
section_details
?:
string
;
routine_type
:
string
;
schedule
:
string
;
document
:
string
action
:
string
[]
}
\ No newline at end of file
src/app/portal/routine/interface/routine.ts
View file @
7b70909f
...
...
@@ -12,7 +12,6 @@ export interface Routine {
id
:
string
;
class
:
LocalizedField
;
section
:
LocalizedField
;
schedule
:
LocalizedField
;
details
:
LocalizedField
;
session
:
LocalizedField
;
document
:
LocalizedField
;
...
...
@@ -20,5 +19,7 @@ export interface Routine {
session_session_name
?:
LocalizedField
;
class_details
?:
LocalizedField
;
section_details
?:
LocalizedField
;
school
:
LocalizedField
;
school_school_Name
?:
LocalizedField
;
}
src/app/portal/routine/manage/manage.component.html
View file @
7b70909f
...
...
@@ -2,7 +2,7 @@
<div
class=
"container"
>
<form
class=
"routine_form"
[formGroup]=
"routineForm"
>
<div
class=
"mat_input_container"
>
<div
class=
"class_dropdown mat_input"
>
<
!-- <
div class="class_dropdown mat_input">
<mat-form-field class="full_width">
<mat-label>Select Class</mat-label>
<mat-select formControlName="class">
...
...
@@ -14,12 +14,12 @@
</mat-form-field>
</div>
</div>
-->
<div
class=
"section_dropdown mat_input"
>
<mat-form-field
class=
"full_width"
>
<mat-label>
Select Section
</mat-label>
<mat-select
formControlName=
"section"
>
<mat-select
formControlName=
"section"
(selectionChange)=
"onSectionChange()"
>
@for (section of sectionDropDownData; track section) {
<mat-option
[value]=
"section.value"
>
{{section.name}}
</mat-option>
}
...
...
@@ -31,11 +31,15 @@
<div
class=
"routine_type_dropdown mat_input"
>
<mat-form-field
class=
"full_width"
>
<mat-label>
Select Type
</mat-label>
<mat-select
formControlName=
"routineType"
>
<mat-option
value=
"class_routine"
>
Class Routine
</mat-option>
<mat-option
value=
"exam_routine"
>
Exam Routine
</mat-option>
</mat-select>
<mat-label>
Details
</mat-label>
<input
type=
"text"
matInput
placeholder=
"Routine details"
#input
formControlName=
"details"
>
<mat-error>
This field is required
</mat-error>
</mat-form-field>
...
...
src/app/portal/routine/manage/manage.component.ts
View file @
7b70909f
This diff is collapsed.
Click to expand it.
src/app/portal/routine/routine.routes.ts
View file @
7b70909f
...
...
@@ -6,7 +6,7 @@ import { Menu } from "../navigation/model/sidebar/menu";
export
const
ROUTINE_ROUTES
:
Routes
=
[
{
path
:
RequestMapperService
.
ROUTINE_URL
,
path
:
`
${
RequestMapperService
.
ROUTINE_URL
}
/:type`
,
loadComponent
:
()
=>
import
(
'
./routine/routine.component
'
...
...
src/app/portal/routine/routine/routine.component.ts
View file @
7b70909f
import
{
Component
}
from
'
@angular/core
'
;
import
{
Component
,
inject
}
from
'
@angular/core
'
;
import
{
RoutineTransmissionService
}
from
'
../../../raintree/transmission/routine-transmission.service
'
;
import
{
TransmissionMapperService
}
from
'
../../../mappers/transmission-mapper.service
'
;
import
{
DataSourceService
}
from
'
../../service/data-source.service
'
;
...
...
@@ -16,6 +16,7 @@ import { DeleteRecordTransmissionService } from '../../../raintree/transmission/
import
{
ToasterService
}
from
'
../../../component-library/toaster/toaster.service
'
;
import
{
RoutineTable
}
from
'
../interface/routine-table
'
;
import
{
CustomTableColumn
}
from
'
../../../component-library/interface/custom-table-column
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
@
Component
({
selector
:
'
app-routine
'
,
...
...
@@ -38,29 +39,53 @@ export class RoutineComponent {
private
_matDialogConfig
:
MatDialogConfigService
,
private
_deleteTransmission
:
DeleteRecordTransmissionService
,
private
_toaster
:
ToasterService
,
public
authService
:
AuthService
public
authService
:
AuthService
,
)
{
}
public
columns
:
CustomTableColumn
[]
=
[];
public
data
:
RoutineTable
[]
=
[];
ngOnInit
():
void
{
public
routineType
:
string
=
''
;
public
route
=
inject
(
ActivatedRoute
);
public
ngOnInit
():
void
{
this
.
columns
=
this
.
_prepareRoutineTableData
.
prepareMatTableColumn
();
this
.
_getRoutines
();
this
.
routineType
=
this
.
route
.
snapshot
.
paramMap
.
get
(
'
type
'
)
as
string
;
this
.
_getRoutines
(
this
.
routineType
);
this
.
onRoutesChange
()
}
public
onRoutesChange
(){
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
const
newRoutineType
=
params
.
get
(
'
type
'
);
if
(
newRoutineType
!==
this
.
routineType
)
{
this
.
routineType
=
newRoutineType
as
string
;
this
.
_getRoutines
(
this
.
routineType
);
}
});
}
public
addRoutine
():
void
{
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
''
,
data
:
this
.
routineType
,
...
this
.
_matDialogConfig
.
matModalConfig
()
});
}
public
emitViewFromTable
(
emitData
:
RoutineTable
)
{
let
docLink
=
emitData
.
schedule
.
replace
(
'
BASE_URL
'
,
TransmissionMapperService
.
DEV_TRANSMISSION_URL
);
let
docLink
=
emitData
.
document
.
replace
(
'
BASE_URL
'
,
TransmissionMapperService
.
DEV_TRANSMISSION_URL
);
window
.
open
(
docLink
,
'
_blank
'
);
}
...
...
@@ -77,8 +102,8 @@ export class RoutineComponent {
(
response
)
=>
{
},
(
response
:
RaintreeResponse
)
=>
{
this
.
_toaster
.
success
(
"
Routine is deleted successfully
"
,
'
o
k
'
);
this
.
_getRoutines
();
this
.
_toaster
.
success
(
"
Routine is deleted successfully
"
,
'
O
k
'
);
this
.
_getRoutines
(
this
.
routineType
);
},
(
error
)
=>
{
console
.
log
(
error
);
...
...
@@ -88,20 +113,21 @@ export class RoutineComponent {
}
private
_getRoutines
():
void
{
private
_getRoutines
(
routineType
:
string
):
void
{
this
.
_routineTransmission
.
getRoutine
(
TransmissionMapperService
.
GET_TRANSMISSION_URL
+
this
.
_urlConfig
.
generateDatasourceConfigUrl
({
aggregationOnUniqueFld
:
false
,
datasourceId
:
DataSourceService
.
ROUTINE_DATA_SOURCE_ID
,
dontIncludeForeignKey
:
false
,
expand
:
fals
e
,
expand
:
tru
e
,
isUniqueValueRequiredForFieldToDisplay
:
false
,
language
:
"
en
"
,
limit
:
10
,
orderBy
:
"
ASC
"
,
page
:
1
,
roleBasedFiltering
:
true
fieldName
:
`
${
this
.
_urlConfig
.
getFiledNameFilter
(
'
routine
'
)}
,routine_type`
,
operators
:
`
${
this
.
_urlConfig
.
getFieldOperatorFilter
(
'
routine
'
)}
,eq`
,
fieldValues
:
`
${
this
.
_urlConfig
.
getFieldValuesFilter
(
'
routine
'
)}
,
${
routineType
===
'
class
'
?
'
class_routine
'
:
'
exam_routine
'
}
`
,
}),
()
=>
{
},
(
response
)
=>
{
},
...
...
src/app/portal/routine/service/prepare-routine-table-data.service.ts
View file @
7b70909f
...
...
@@ -20,8 +20,9 @@ export class PrepareRoutineTableDataService {
session_session_name
:
routine
.
session_session_name
?.
en
,
class_details
:
routine
.
class_details
?.
en
,
section_details
:
routine
.
section_details
?.
en
,
document
:
routine
.
document
.
en
,
routine_type
:
routine
.
routine_type
.
en
,
schedule
:
routine
.
schedule
.
en
,
details
:
routine
.
details
[
'
en
'
]
,
action
:
[
'
view
'
,
'
delete
'
]
}
})
...
...
@@ -35,7 +36,7 @@ export class PrepareRoutineTableDataService {
let
columnArray
=
[
{
key
:
'
class_details
'
,
label
:
'
Class
'
},
{
key
:
'
section_details
'
,
label
:
'
Section
'
},
{
key
:
'
routine_type
'
,
label
:
'
Type
'
},
{
key
:
'
details
'
,
label
:
'
Details
'
},
{
key
:
'
action
'
,
label
:
'
Action
'
},
];
...
...
src/app/portal/service/data-source.service.ts
View file @
7b70909f
...
...
@@ -33,4 +33,10 @@ export class DataSourceService {
public
static
readonly
SECTION_DATA_SOURCE_ID
:
number
=
3013
;
public
static
readonly
CLASS_SECTION_SUBJECT_DATA_SOURCE_ID
:
number
=
3016
;
public
static
readonly
SESSION_ID
:
string
=
'
86af4d6b5675a82df4581f00c67f0c7f
'
;
}
src/app/portal/service/url-config.service.ts
View file @
7b70909f
import
{
inject
,
Injectable
}
from
'
@angular/core
'
;
import
{
AuthService
}
from
'
../../auth/service/auth.service
'
;
import
{
DataSourceService
}
from
'
./data-source.service
'
;
@
Injectable
({
providedIn
:
'
root
'
...
...
@@ -16,9 +17,9 @@ export class UrlConfigService {
public
getFiledNameFilter
(
type
:
string
):
string
{
let
fieldName
=
''
;
// let fieldValues = '';
// let fieldOperator = ''
if
(
type
===
'
assignment
'
)
{
switch
(
type
)
{
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
...
...
@@ -29,14 +30,30 @@ export class UrlConfigService {
fieldName
=
"
school,section_class,section
"
;
}
break
;
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
fieldName
=
"
session,school,section_teacher
"
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
fieldName
=
"
section,session,school
"
;
}
break
;
}
return
fieldName
;
}
public
getFieldOperatorFilter
(
type
:
string
):
string
{
let
fieldOperator
=
''
if
(
type
===
'
assignment
'
)
{
switch
(
type
)
{
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
...
...
@@ -47,6 +64,19 @@ export class UrlConfigService {
fieldOperator
=
'
eq,eq,eq
'
;
}
break
;
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
fieldOperator
=
"
eq,eq,eq
"
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
fieldOperator
=
"
eq,eq,eq
"
;
}
break
;
}
return
fieldOperator
;
...
...
@@ -56,7 +86,8 @@ export class UrlConfigService {
let
fieldValues
=
''
;
if
(
type
===
'
assignment
'
)
{
switch
(
type
)
{
case
'
assignment
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
...
...
@@ -64,10 +95,22 @@ export class UrlConfigService {
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_school_id
'
)}
,
${
localStorage
.
getItem
(
'
student_class_id
'
)}
,
${
localStorage
.
getItem
(
'
student_section_id
'
)}
`
;
}
break
;
case
'
routine
'
:
if
(
this
.
authService
.
getUserRole
()
===
'
Teacher
'
)
{
fieldValues
=
`
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
school_id
'
)}
,
${
this
.
authService
.
localStorageGetItemByKey
(
'
user_id
'
)}
`
;
}
else
if
(
this
.
authService
.
getUserRole
()
===
'
Parent
'
)
{
fieldValues
=
`
${
localStorage
.
getItem
(
'
student_section_id
'
)}
,
${
DataSourceService
.
SESSION_ID
}
,
${
localStorage
.
getItem
(
'
student_school_id
'
)}
`
;
}
break
;
}
return
fieldValues
;
...
...
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