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
df9761a5
Commit
df9761a5
authored
Apr 03, 2025
by
achinta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add routine with file uploaded
parent
04bae104
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
355 additions
and
309 deletions
+355
-309
src/app/auth/login/login.component.scss
src/app/auth/login/login.component.scss
+5
-1
src/app/auth/service/auth.service.ts
src/app/auth/service/auth.service.ts
+1
-1
src/app/component-library/custom-table/custom-table.component.html
...omponent-library/custom-table/custom-table.component.html
+7
-1
src/app/component-library/custom-table/custom-table.component.ts
.../component-library/custom-table/custom-table.component.ts
+8
-1
src/app/component-library/dropdown/drop-down/drop-down.component.html
...onent-library/dropdown/drop-down/drop-down.component.html
+7
-7
src/app/component-library/file-input/file-input.component.html
...pp/component-library/file-input/file-input.component.html
+3
-19
src/app/component-library/file-input/file-input.component.ts
src/app/component-library/file-input/file-input.component.ts
+5
-0
src/app/mappers/transmission-mapper.service.ts
src/app/mappers/transmission-mapper.service.ts
+3
-0
src/app/portal/assignment/assignment/assignment.component.html
...pp/portal/assignment/assignment/assignment.component.html
+3
-2
src/app/portal/assignment/assignment/assignment.component.ts
src/app/portal/assignment/assignment/assignment.component.ts
+13
-21
src/app/portal/assignment/service/prepare-assignment-table-data.service.ts
...signment/service/prepare-assignment-table-data.service.ts
+6
-7
src/app/portal/data-source/interface/data.ts
src/app/portal/data-source/interface/data.ts
+7
-7
src/app/portal/exam/exam/exam.component.html
src/app/portal/exam/exam/exam.component.html
+4
-2
src/app/portal/exam/exam/exam.component.ts
src/app/portal/exam/exam/exam.component.ts
+9
-15
src/app/portal/exam/service/prepare-exam-table-data.service.ts
...pp/portal/exam/service/prepare-exam-table-data.service.ts
+6
-6
src/app/portal/routine/manage/manage.component.html
src/app/portal/routine/manage/manage.component.html
+55
-54
src/app/portal/routine/manage/manage.component.scss
src/app/portal/routine/manage/manage.component.scss
+10
-0
src/app/portal/routine/manage/manage.component.ts
src/app/portal/routine/manage/manage.component.ts
+149
-124
src/app/portal/routine/routine/routine.component.html
src/app/portal/routine/routine/routine.component.html
+4
-2
src/app/portal/routine/routine/routine.component.ts
src/app/portal/routine/routine/routine.component.ts
+12
-16
src/app/portal/routine/service/prepare-routine-table-data.service.ts
...tal/routine/service/prepare-routine-table-data.service.ts
+7
-6
src/app/portal/service/data-source.service.ts
src/app/portal/service/data-source.service.ts
+7
-0
src/app/raintree/interface/raintree-response.ts
src/app/raintree/interface/raintree-response.ts
+1
-0
src/app/raintree/transmission-message-handler/transmission-message-handler.ts
...nsmission-message-handler/transmission-message-handler.ts
+0
-1
src/app/raintree/transmission/file-upload-transmission.service.ts
...raintree/transmission/file-upload-transmission.service.ts
+1
-1
src/app/raintree/transmission/jwt.service.ts
src/app/raintree/transmission/jwt.service.ts
+13
-9
src/app/raintree/transmission/routine-transmission.service.ts
...app/raintree/transmission/routine-transmission.service.ts
+1
-0
src/app/raintree/transmission/transmission.service.ts
src/app/raintree/transmission/transmission.service.ts
+8
-6
No files found.
src/app/auth/login/login.component.scss
View file @
df9761a5
...
...
@@ -8,8 +8,12 @@
padding
:
20px
;
}
}
.logo_section
{
display
:
flex
;
justify-content
:
center
;
}
}
.login_wrapper
{
display
:
flex
;
justify-content
:
center
;
...
...
src/app/auth/service/auth.service.ts
View file @
df9761a5
...
...
@@ -54,7 +54,7 @@ export class AuthService {
public
getUserRole
():
string
{
return
this
.
localStorageGetItemByKey
(
'
role
'
);
return
this
.
localStorageGetItemByKey
(
'
role
_name
'
);
}
}
src/app/component-library/custom-table/custom-table.component.html
View file @
df9761a5
...
...
@@ -16,11 +16,17 @@
</button>
</ng-container>
<ng-container
*ngIf=
"item =='edit' && authService.getUserRole() !=
= 's
tudent'"
>
<ng-container
*ngIf=
"item =='edit' && authService.getUserRole() !=
'S
tudent'"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"edit(element)"
>
<span
class=
"material-symbols-outlined"
>
edit
</span>
</button>
</ng-container>
<ng-container
*ngIf=
"item =='delete' && authService.getUserRole() != 'Student'"
>
<button
class=
"view_button d_inline_block width_auto "
(click)=
"delete(element)"
>
<span
class=
"material-symbols-outlined"
>
delete
</span>
</button>
</ng-container>
}
}
</td>
...
...
src/app/component-library/custom-table/custom-table.component.ts
View file @
df9761a5
...
...
@@ -29,15 +29,18 @@ export class CustomTableComponent {
@
Output
()
emitEdit
:
EventEmitter
<
string
>
=
new
EventEmitter
<
string
>
();
@
Output
()
emitDelete
:
EventEmitter
<
string
>
=
new
EventEmitter
<
string
>
();
public
authService
=
inject
(
AuthService
);
// totalRecords: number = 3400;
// pageSize: number = 50;
public
ngOnInit
():
void
{
// console.log(this.data);
}
get
displayedColumns
():
string
[]
{
// console.log(this.data);
return
this
.
columns
.
map
(
col
=>
col
.
key
);
...
...
@@ -53,6 +56,10 @@ export class CustomTableComponent {
this
.
emitEdit
.
emit
(
data
);
}
public
delete
(
data
:
any
):
void
{
this
.
emitDelete
.
emit
(
data
);
}
onPageChanged
(
event
:
any
):
void
{
console
.
log
(
"
event
"
);
console
.
log
(
event
);
...
...
src/app/component-library/dropdown/drop-down/drop-down.component.html
View file @
df9761a5
...
...
@@ -5,4 +5,4 @@
<mat-option
[value]=
"option.value"
>
{{option.name}}
</mat-option>
}
</mat-select>
</mat-form-field>
\ No newline at end of file
</mat-form-field>
\ No newline at end of file
src/app/component-library/file-input/file-input.component.html
View file @
df9761a5
<!-- <mat-form-field style="width: 100%;" appearance="fill">
<mat-label>{{ label }}</mat-label>
<button mat-icon-button matPrefix (click)="fileInput.click()">
<mat-icon>attach_file</mat-icon>
</button>
<input type="file" multiple #fileInput (change)="onFileSelected($event)" style="display: none;" />
<mat-hint *ngIf="selectedFiles().length">
Selected: {{ selectedFiles().length }} file(s)
</mat-hint>
<mat-error *ngIf="!selectedFiles().length">This field is required</mat-error>
</mat-form-field> -->
<mat-form-field
style=
"width: 100%;"
>
<mat-label>
{{ label }}
</mat-label>
...
...
@@ -20,10 +6,8 @@
<mat-icon>
attach_file
</mat-icon>
</button>
<input
type=
"text"
readonly
matInput
/>
<input
type=
"file"
multiple
#f_input
(change)=
"onFileSelected($event)"
/>
<mat-hint
*ngIf=
"selectedFiles().length"
>
Selected: {{ selectedFiles().length }} file(s)
</mat-hint>
<input
type=
"text"
readonly
matInput
[value]=
"fileName"
/>
<input
type=
"file"
multiple
#f_input
(change)=
"onFileSelected($event)"
hidden
/>
<mat-error
*ngIf=
"!selectedFiles().length"
>
This field is required
</mat-error>
</mat-form-field>
\ No newline at end of file
src/app/component-library/file-input/file-input.component.ts
View file @
df9761a5
...
...
@@ -19,12 +19,17 @@ export class FileInputComponent {
@
Input
()
label
:
string
=
'
Upload Files
'
;
@
Output
()
filesChange
=
new
EventEmitter
<
File
[]
>
();
public
fileName
:
string
=
''
;
// Triggered when files are selected
onFileSelected
(
event
:
Event
):
void
{
const
input
=
event
.
target
as
HTMLInputElement
;
if
(
input
.
files
)
{
this
.
selectedFiles
.
set
(
Array
.
from
(
input
.
files
));
// Update the signal
this
.
filesChange
.
emit
(
this
.
selectedFiles
());
// Emit the event
console
.
log
(
input
.
files
[
0
].
name
);
this
.
fileName
=
input
.
files
[
0
].
name
}
}
}
src/app/mappers/transmission-mapper.service.ts
View file @
df9761a5
...
...
@@ -23,6 +23,9 @@ export class TransmissionMapperService {
public
static
readonly
SAVE_TRANSMISSION_URL
:
string
=
TransmissionMapperService
.
DEV_TRANSMISSION_URL
+
'
/webomagic/saveWebDataSourceFieldsBasedOnDataSourceType?
'
;
public
static
readonly
FILE_UPLOAD_TRANSMISSION_URL
:
string
=
TransmissionMapperService
.
DEV_TRANSMISSION_URL
+
'
/webomagic/uploadFile?
'
;
// 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 +
...
...
src/app/portal/assignment/assignment/assignment.component.html
View file @
df9761a5
<h3>
Assignments
</h3>
<div
class=
"custom_table"
>
<app-custom-table
[columns]=
"columns"
[data]=
"data"
(emit
Edit)=
"emitEdit
FromTable($event)"
(emit
Delete)=
"emitDelete
FromTable($event)"
(emitView)=
"emitViewFromTable($event)"
/>
</div>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
s
tudent'"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== '
S
tudent'"
>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addAssignment()"
...
...
src/app/portal/assignment/assignment/assignment.component.ts
View file @
df9761a5
...
...
@@ -33,12 +33,7 @@ export class AssignmentComponent implements OnInit {
public
authService
:
AuthService
)
{
}
public
columns
=
[
{
key
:
'
class_subject_subject_txt
'
,
label
:
'
Class
'
},
{
key
:
'
subject
'
,
label
:
'
Subject
'
},
{
key
:
'
section
'
,
label
:
'
Section
'
},
{
key
:
'
action
'
,
label
:
'
Action
'
},
];
public
columns
:
any
[]
=
[];
public
data
:
any
[]
=
[];
...
...
@@ -83,26 +78,23 @@ export class AssignmentComponent implements OnInit {
}
public
emit
Edit
FromTable
(
emitData
:
string
):
void
{
public
emit
Delete
FromTable
(
emitData
:
string
):
void
{
// rate ? rate.is_edit_enable = true : '';
// this._dialog.open(ManageComponent, {
// data: emitData,
// width: '98vw',
// height: 'auto',
// maxWidth: '70vw',
// maxHeight: '70vh',
// });
let
dialogRef
=
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
emitData
,
width
:
'
98vw
'
,
height
:
'
auto
'
,
maxWidth
:
'
70vw
'
,
maxHeight
:
'
70vh
'
,
});
alert
(
"
Have to Delete
"
);
// dialogRef.afterClosed().subscribe(data => {
// if (data)
// this._getScheduleOfRates();
// });
}
public
addAssignment
():
void
{
let
dialogRef
=
this
.
_dialog
.
open
(
ManageComponent
,
{
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
''
,
width
:
'
98vw
'
,
height
:
'
auto
'
,
...
...
src/app/portal/assignment/service/prepare-assignment-table-data.service.ts
View file @
df9761a5
...
...
@@ -13,28 +13,27 @@ export class PrepareAssignmentTableDataService {
let
dataArray
=
data
.
map
((
assignment
:
Assignment
)
=>
{
return
{
[
'
id
'
]:
assignment
.
id
,
[
'
subject
'
]:
assignment
.
class_subject_subject_txt
[
'
en
'
],
[
'
section_details
'
]:
assignment
.
section_details
[
'
en
'
],
[
'
session_name
'
]:
assignment
.
session_session_name
[
'
en
'
],
[
'
id
'
]:
assignment
.
id
,
[
'
action
'
]:
[
'
view
'
,
'
edit
'
]
[
'
assigned_on
'
]:
assignment
.
assigned_on
[
'
en
'
]
,
[
'
action
'
]:
[
'
view
'
,
'
delete
'
]
}
})
return
dataArray
;
// return [];
}
public
prepareMatTableColumn
():
any
[]
{
let
columnArray
=
[
{
key
:
'
section_details
'
,
label
:
'
Class
'
},
{
key
:
'
subject
'
,
label
:
'
Subject
'
},
{
key
:
'
section_details
'
,
label
:
'
Subject Details
'
},
{
key
:
'
session_name
'
,
label
:
'
Session Name
'
},
{
key
:
'
assigned_on
'
,
label
:
'
Date
'
},
{
key
:
'
action
'
,
label
:
'
Action
'
},
];
console
.
log
(
columnArray
);
return
columnArray
;
}
...
...
src/app/portal/data-source/interface/data.ts
View file @
df9761a5
...
...
@@ -5,15 +5,15 @@ export interface Data {
count
:
number
;
id
:
number
|
string
;
dataSourceName
:
string
;
websiteId
:
number
;
websiteId
?
:
number
;
type
:
string
;
foreignKeyMapping
:
any
;
foreignKeyMap
:
ForeignKeyMap
;
requiredPresentationField
:
string
;
foreignKeyMapping
?
:
any
;
foreignKeyMap
?
:
ForeignKeyMap
;
requiredPresentationField
?
:
string
;
favourite
:
boolean
;
icon
:
string
;
dependentFields
:
any
;
dsType
:
any
;
icon
?
:
string
;
dependentFields
?
:
any
;
dsType
?
:
any
;
[
index
:
string
]:
any
;
}
\ No newline at end of file
src/app/portal/exam/exam/exam.component.html
View file @
df9761a5
<h3>
Exam schedules
</h3>
<div
class=
"custom_table"
>
<app-custom-table
[columns]=
"columns"
[data]=
"data"
(emit
Edit)=
"emitEdit
FromTable($event)"
(emit
Delete)=
"emitDelete
FromTable($event)"
(emitView)=
"emitViewFromTable($event)"
/>
</div>
<div
class=
"add_btn"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== 'Student'"
>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addExam()"
...
...
src/app/portal/exam/exam/exam.component.ts
View file @
df9761a5
...
...
@@ -10,6 +10,8 @@ import { UrlConfigService } from '../../service/url-config.service';
import
{
DataSourceService
}
from
'
../../service/data-source.service
'
;
import
{
PrepareExamTableDataService
}
from
'
../service/prepare-exam-table-data.service
'
;
import
{
RaintreeResponse
}
from
'
../../../raintree/interface/raintree-response
'
;
import
{
AuthService
}
from
'
../../../auth/service/auth.service
'
;
import
{
MatDialogConfigService
}
from
'
../../service/mat-dialog-config.service
'
;
@
Component
({
selector
:
'
app-exam
'
,
...
...
@@ -27,7 +29,9 @@ export class ExamComponent {
private
_dialog
:
MatDialog
,
private
_examSchedule
:
ExamScheduleService
,
private
_urlConfig
:
UrlConfigService
,
private
_prepareExamTableData
:
PrepareExamTableDataService
private
_prepareExamTableData
:
PrepareExamTableDataService
,
private
_matDialogConfig
:
MatDialogConfigService
,
public
authService
:
AuthService
)
{
}
public
columns
:
any
=
[];
...
...
@@ -46,19 +50,9 @@ export class ExamComponent {
window
.
open
(
docLink
,
'
_blank
'
);
}
private
matModalConfig
=
{
width
:
'
98vw
'
,
height
:
'
auto
'
,
maxWidth
:
'
70vw
'
,
maxHeight
:
'
70vh
'
,
}
public
emitEditFromTable
(
emitData
:
string
):
void
{
public
emitDeleteFromTable
(
emitData
:
string
):
void
{
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
emitData
,
...
this
.
matModalConfig
});
alert
(
"
Should delete !!
"
)
}
...
...
@@ -66,7 +60,7 @@ export class ExamComponent {
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
''
,
...
this
.
matModalConfig
...
this
.
_matDialogConfig
.
matModalConfig
()
});
}
...
...
@@ -83,7 +77,7 @@ export class ExamComponent {
expand
:
false
,
isUniqueValueRequiredForFieldToDisplay
:
false
,
language
:
"
en
"
,
limit
:
10
,
limit
:
10
0
,
orderBy
:
"
ASC
"
,
page
:
1
,
roleBasedFiltering
:
true
...
...
src/app/portal/exam/service/prepare-exam-table-data.service.ts
View file @
df9761a5
...
...
@@ -14,11 +14,11 @@ export class PrepareExamTableDataService {
return
{
[
'
id
'
]:
schedule
.
id
,
[
'
Term
'
]:
schedule
.
Term
[
'
en
'
],
[
'
image
'
]:
schedule
.
image
[
'
en
'
],
[
'
details
'
]:
schedule
.
details
[
'
en
'
],
[
'
class_details
'
]:
schedule
.
class_details
[
'
en
'
],
[
'
action
'
]:
[
'
view
'
,
'
edit
'
]
[
'
details
'
]:
schedule
.
details
[
'
en
'
],
[
'
term
'
]:
schedule
.
Term
[
'
en
'
],
[
'
image
'
]:
schedule
.
image
[
'
en
'
],
[
'
action
'
]:
[
'
view
'
,
'
delete
'
]
}
})
...
...
@@ -29,9 +29,9 @@ export class PrepareExamTableDataService {
public
prepareMatTableColumn
():
any
[]
{
let
columnArray
=
[
{
key
:
'
Term
'
,
label
:
'
Term
'
},
{
key
:
'
details
'
,
label
:
'
Details
'
},
{
key
:
'
class_details
'
,
label
:
'
Class
'
},
{
key
:
'
term
'
,
label
:
'
Term
'
},
{
key
:
'
details
'
,
label
:
'
Details
'
},
{
key
:
'
action
'
,
label
:
'
Action
'
},
];
...
...
src/app/portal/routine/manage/manage.component.html
View file @
df9761a5
<!-- <h1> Hi Manage </h1> -->
<form
class=
"login_form"
[formGroup]=
"routineForm"
>
<div
class=
"container"
>
<form
class=
"routine_form"
[formGroup]=
"routineForm"
>
<div
class=
"mat_input_container"
>
<div
class=
"class_dropdown"
>
<app-drop-down
[dropDownData] =
"classDropDownData"
(emitDropDownData)=
"classOnChange($event)"
<div
class=
"class_dropdown mat_input"
>
<mat-form-field
class=
"full_width"
>
<mat-label>
Select Class
</mat-label>
<mat-select
formControlName=
"class"
>
@for (class of classDropDownData; track class) {
<mat-option
[value]=
"class.value"
>
{{class.name}}
</mat-option>
}
</mat-select>
<mat-error>
This field is required
</mat-error>
/>
</div>
<div
class=
"section_dropdown"
>
<app-drop-down
[dropDownData] =
"sectionDropDownData"
(emitDropDownData)=
"sectionOnChange($event)"
</mat-form-field>
/>
</div>
<div
class=
"details_field"
>
<div
class=
"section_dropdown mat_input"
>
<mat-form-field
class=
"full_width"
>
<span
class=
"material-symbols-outlined"
matPrefix
>
person
</span>
<input
matInput
placeholder=
"{{ 'Enter details' }}"
#input
formControlName=
"details"
/>
<mat-label>
Select Section
</mat-label>
<mat-select
formControlName=
"section"
>
@for (section of sectionDropDownData; track section) {
<mat-option
[value]=
"section.value"
>
{{section.name}}
</mat-option>
}
</mat-select>
<mat-error>
This field is required
</mat-error>
</mat-form-field>
</div>
<mat-form-field
style=
"width: 100%;"
>
<mat-label>
Schedule
</mat-label>
<button
mat-icon-button
matPrefix
(click)=
"f_input.click()"
>
<mat-icon>
attach_file
</mat-icon>
</button>
<input
type=
"text"
readonly
matInput
/>
<input
type=
"file"
multiple
hidden
#f_input
/>
<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-error>
This field is required
</mat-error>
</mat-form-field>
</div>
<div
class=
"file_upload mat_input"
>
<app-file-input
[label]=
"'Upload Document'"
(filesChange)=
"onFilesChanged($event)"
/>
<mat-error
*ngIf=
"!routineForm.value.schedule"
>
This field is required
</mat-error>
</div>
</div>
<div
class=
"add_btn"
>
<app-square-button
[buttonIcon]=
"''"
[buttonText]=
"'submit'"
(emitSquareButtonClick)=
"submitRoutine()"
/>
<app-square-button
[buttonIcon]=
"''"
[buttonText]=
"'submit'"
(emitSquareButtonClick)=
"submitRoutine()"
/>
</div>
</form>
\ No newline at end of file
</form>
</div>
\ No newline at end of file
src/app/portal/routine/manage/manage.component.scss
View file @
df9761a5
.container
{
padding
:
10px
;
}
.add_btn
{
float
:
right
;
}
.mat_input
{
margin-bottom
:
5px
;
}
src/app/portal/routine/manage/manage.component.ts
View file @
df9761a5
...
...
@@ -6,7 +6,6 @@ import { TransmissionMapperService } from "../../../mappers/transmission-mapper.
import
{
DataSourceService
}
from
"
../../service/data-source.service
"
;
import
{
classResponse
}
from
"
../../../raintree/interface/class-respons
"
;
import
{
UrlConfigService
}
from
"
../../service/url-config.service
"
;
import
{
DropDownComponent
}
from
"
../../../component-library/dropdown/drop-down/drop-down.component
"
;
import
{
Dropdown
}
from
"
../../../component-library/dropdown/interface/dropdown
"
;
import
{
StudentClass
}
from
"
../../data-source/interface/class
"
;
import
{
...
...
@@ -25,20 +24,25 @@ import { StudentSection } from "../../data-source/interface/section";
import
{
RoutineTransmissionService
}
from
"
../../../raintree/transmission/routine-transmission.service
"
;
import
{
AuthService
}
from
"
../../../auth/service/auth.service
"
;
import
{
RaintreeResponse
}
from
"
../../../raintree/interface/raintree-response
"
;
import
{
Routines
}
from
"
../interface/routine
"
;
import
{
Routine
,
Routine
s
}
from
"
../interface/routine
"
;
import
{
ForeignKeyMap
}
from
"
../../data-source/interface/foreignKeyMap
"
;
import
{
MatSelectModule
}
from
"
@angular/material/select
"
;
import
{
FileInputComponent
}
from
"
../../../component-library/file-input/file-input.component
"
;
import
{
FileUploadTransmissionService
}
from
"
../../../raintree/transmission/file-upload-transmission.service
"
;
import
{
ToasterService
}
from
"
../../../component-library/toaster/toaster.service
"
;
@
Component
({
selector
:
"
app-manage
"
,
imports
:
[
CommonModule
,
DropDownComponent
,
ReactiveFormsModule
,
MatFormFieldModule
,
MatInputModule
,
MatIconModule
,
SquareButtonComponent
,
],
MatSelectModule
,
FileInputComponent
],
templateUrl
:
"
./manage.component.html
"
,
styleUrl
:
"
./manage.component.scss
"
,
})
...
...
@@ -48,14 +52,19 @@ export class ManageComponent {
private
_classTransmission
:
ClassTransmissionService
,
private
_urlConfig
:
UrlConfigService
,
private
_routineTransmission
:
RoutineTransmissionService
,
private
_auth
:
AuthService
private
_auth
:
AuthService
,
private
_fileUpload
:
FileUploadTransmissionService
,
private
_toaster
:
ToasterService
)
{}
public
classDropDownData
:
Dropdown
[]
=
[];
public
sectionDropDownData
:
Dropdown
[]
=
[];
public
routineForm
=
new
FormGroup
({
details
:
new
FormControl
(
""
,
[
Validators
.
required
]),
class
:
new
FormControl
(
""
,
[
Validators
.
required
]),
section
:
new
FormControl
(
""
,
[
Validators
.
required
]),
routineType
:
new
FormControl
(
""
,
[
Validators
.
required
]),
schedule
:
new
FormControl
(
""
,
[
Validators
.
required
]),
});
ngOnInit
():
void
{
...
...
@@ -63,39 +72,58 @@ export class ManageComponent {
this
.
_getSection
();
}
public
classOnChange
(
value
:
string
)
{
console
.
log
(
value
);
}
public
onFilesChanged
(
files
:
File
[]):
void
{
console
.
log
(
'
Selected Files:
'
,
files
);
const
formData
=
new
FormData
();
files
.
forEach
(
file
=>
formData
.
append
(
'
file
'
,
file
,
file
.
name
));
this
.
_fileUpload
.
uploadFile
(
TransmissionMapperService
.
FILE_UPLOAD_TRANSMISSION_URL
+
`websiteId=
${
this
.
_auth
.
localStorageGetItemByKey
(
'
project_id
'
)}
`
,
formData
,
()
=>
{
},
()
=>
{
},
(
response
:
RaintreeResponse
)
=>
{
this
.
routineForm
.
value
.
schedule
=
`
${
TransmissionMapperService
.
DEV_TRANSMISSION_URL
}
/webomagic/getFile?fid=
${
response
[
'
data
'
]}
`
},
(
error
)
=>
{
console
.
log
(
error
);
},
()
=>
{
}
)
public
sectionOnChange
(
value
:
string
)
{
console
.
log
(
value
);
}
public
submitRoutine
():
void
{
// alert("Submit Clicked!!");
// console.log(this.routineFormPayload);
console
.
log
(
this
.
routineForm
.
value
)
// this._routineTransmission.submitRoutine(
if
(
this
.
routineForm
.
invalid
)
return
;
this
.
_routineTransmission
.
submitRoutine
(
//
TransmissionMapperService.SAVE_TRANSMISSION_URL + `websiteId=${this._auth.localStorageGetItemByKey('project_id')}`,
TransmissionMapperService
.
SAVE_TRANSMISSION_URL
+
`websiteId=
${
this
.
_auth
.
localStorageGetItemByKey
(
'
project_id
'
)}
`
,
// this.routineFormPayload
,
//
() => { },
//
() => { },
//
(response: RaintreeResponse) => {
this
.
_prepareRoutinePayload
()
,
()
=>
{
},
()
=>
{
},
(
response
:
RaintreeResponse
)
=>
{
// console.log(response);
this
.
_toaster
.
success
(
"
Routine added successfully
"
,
'
Done
'
);
window
.
location
.
reload
();
//
},
//
(error) => {
//
console.log(error);
},
(
error
)
=>
{
console
.
log
(
error
);
//
},
//
() => { }
//
);
},
()
=>
{
}
);
}
private
_getClasses
()
{
...
...
@@ -166,34 +194,36 @@ export class ManageComponent {
);
}
private
routineFormPayload
:
Routines
=
{
private
_prepareRoutinePayload
():
Routines
{
return
{
themeDataSourceFields
:
[
{
id
:
""
,
class
:
{
en
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
beng
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
hindi
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
en
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
},
section
:
{
en
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
beng
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
hindi
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
en
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
},
schedule
:
{
en
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
beng
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
hindi
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
en
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
},
details
:
{
en
:
"
test 1 c
"
,
beng
:
"
test 1 c
"
,
hindi
:
"
test 1 c
"
,
en
:
"
"
,
beng
:
"
"
,
hindi
:
"
"
,
},
session
:
{
en
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
beng
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
hindi
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
en
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
},
document
:
{
en
:
""
,
...
...
@@ -201,45 +231,45 @@ export class ManageComponent {
hindi
:
""
,
},
routine_type
:
{
en
:
"
class_routine
"
,
beng
:
"
class_routine
"
,
hindi
:
"
class_routine
"
,
en
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
},
},
],
dataSourceName
:
"
Routine
"
,
id
:
"
3021
"
,
type
:
"
1327
"
,
themeId
:
"
278
"
,
dataSourceName
:
DataSourceService
.
ROUTINE_DATA_SOURCE_NAME
,
id
:
`
${
DataSourceService
.
ROUTINE_DATA_SOURCE_ID
}
`
,
type
:
`
${
DataSourceService
.
ROUTINE_DATA_SOURCE_TYPE
}
`
,
themeId
:
`
${
this
.
_auth
.
localStorageGetItemByKey
(
'
project_id
'
)}
`
,
slideLst
:
null
,
heading
:
"
undefined
"
,
dataSourceTypeFieldsList
:
[
{
id
:
""
,
class
:
{
en
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
beng
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
hindi
:
"
48f353051f9d724f619491d4f0d0a8ec
"
,
en
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
class
}
`
,
},
section
:
{
en
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
beng
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
hindi
:
"
5d53b27058d1f6067a4b4bd1350a24d4
"
,
en
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
section
}
`
,
},
schedule
:
{
en
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
beng
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
hindi
:
"
BASE_URL/webomagic/getFile?fid=2910
"
,
en
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
schedule
}
`
,
},
details
:
{
en
:
"
test 1 c
"
,
beng
:
"
test 1 c
"
,
hindi
:
"
test 1 c
"
,
en
:
"
"
,
beng
:
"
"
,
hindi
:
"
"
,
},
session
:
{
en
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
beng
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
hindi
:
"
86af4d6b5675a82df4581f00c67f0c7f
"
,
en
:
"
"
,
beng
:
"
"
,
hindi
:
"
"
,
},
document
:
{
en
:
""
,
...
...
@@ -247,20 +277,15 @@ export class ManageComponent {
hindi
:
""
,
},
routine_type
:
{
en
:
"
class_routine
"
,
beng
:
"
class_routine
"
,
hindi
:
"
class_routine
"
,
en
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
beng
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
hindi
:
`
${
this
.
routineForm
.
value
.
routineType
}
`
,
},
},
],
count
:
10
,
websiteId
:
1
,
foreignKeyMapping
:
{},
foreignKeyMap
:
{}
as
ForeignKeyMap
,
requiredPresentationField
:
""
,
favourite
:
true
,
icon
:
""
,
dependentFields
:
{},
dsType
:
{}
count
:
0
,
favourite
:
true
};
}
}
src/app/portal/routine/routine/routine.component.html
View file @
df9761a5
<h3>
Routines
</h3>
<div
class=
"custom_table"
>
<app-custom-table
[columns]=
"columns"
[data]=
"data"
(emit
Edit)=
"emitEdit
FromTable($event)"
(emit
Delete)=
"emitDelete
FromTable($event)"
(emitView)=
"emitViewFromTable($event)"
/>
</div>
<div
class=
"add_btn"
>
<div
class=
"add_btn"
*ngIf=
"authService.getUserRole() !== 'Student'"
>
<app-square-button
[buttonIcon]=
"'add'"
(emitSquareButtonClick)=
"addRoutine()"
...
...
src/app/portal/routine/routine/routine.component.ts
View file @
df9761a5
...
...
@@ -9,13 +9,17 @@ import { SquareButtonComponent } from '../../../component-library/square-button/
import
{
MatDialog
}
from
'
@angular/material/dialog
'
;
import
{
ManageComponent
}
from
'
../manage/manage.component
'
;
import
{
PrepareRoutineTableDataService
}
from
'
../service/prepare-routine-table-data.service
'
;
import
{
CommonModule
}
from
'
@angular/common
'
;
import
{
AuthService
}
from
'
../../../auth/service/auth.service
'
;
import
{
MatDialogConfigService
}
from
'
../../service/mat-dialog-config.service
'
;
@
Component
({
selector
:
'
app-routine
'
,
standalone
:
true
,
imports
:
[
CustomTableComponent
,
SquareButtonComponent
SquareButtonComponent
,
CommonModule
],
templateUrl
:
'
./routine.component.html
'
,
styleUrl
:
'
./routine.component.scss
'
...
...
@@ -26,7 +30,9 @@ export class RoutineComponent {
private
_routineTransmission
:
RoutineTransmissionService
,
private
_urlConfig
:
UrlConfigService
,
private
_dialog
:
MatDialog
,
private
_prepareRoutineTableData
:
PrepareRoutineTableDataService
private
_prepareRoutineTableData
:
PrepareRoutineTableDataService
,
private
_matDialogConfig
:
MatDialogConfigService
,
public
authService
:
AuthService
)
{
}
public
columns
:
any
[]
=
[];
...
...
@@ -41,12 +47,9 @@ export class RoutineComponent {
}
public
addRoutine
():
void
{
let
dialogRef
=
this
.
_dialog
.
open
(
ManageComponent
,
{
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
''
,
width
:
'
98vw
'
,
height
:
'
auto
'
,
maxWidth
:
'
70vw
'
,
maxHeight
:
'
70vh
'
,
...
this
.
_matDialogConfig
.
matModalConfig
()
});
}
...
...
@@ -55,15 +58,8 @@ export class RoutineComponent {
window
.
open
(
docLink
,
'
_blank
'
);
}
public
emitEditFromTable
(
emitData
:
string
):
void
{
let
dialogRef
=
this
.
_dialog
.
open
(
ManageComponent
,
{
data
:
emitData
,
width
:
'
98vw
'
,
height
:
'
auto
'
,
maxWidth
:
'
70vw
'
,
maxHeight
:
'
70vh
'
,
});
public
emitDeleteFromTable
(
emitData
:
string
):
void
{
alert
(
"
Should delete the data
"
);
}
...
...
src/app/portal/routine/service/prepare-routine-table-data.service.ts
View file @
df9761a5
...
...
@@ -15,11 +15,12 @@ export class PrepareRoutineTableDataService {
return
{
[
'
id
'
]:
routine
.
id
,
[
'
session_session_name
'
]:
routine
.
session_session_name
?[
'
en
'
]:
''
,
[
'
class_details
'
]:
routine
.
class_details
?[
'
en
'
]:
''
,
[
'
section_details
'
]:
routine
.
section_details
?[
'
en
'
]:
''
,
[
'
schedule
'
]:
routine
.
schedule
[
'
en
'
],
[
'
action
'
]:
[
'
view
'
,
'
edit
'
]
[
'
session_session_name
'
]:
routine
.
session_session_name
?.
en
,
[
'
class_details
'
]:
routine
.
class_details
?.
en
,
[
'
section_details
'
]:
routine
.
section_details
?.
en
,
[
'
routine_type
'
]:
routine
.
routine_type
.
en
,
[
'
schedule
'
]:
routine
.
schedule
?.
en
,
[
'
action
'
]:
[
'
view
'
,
'
delete
'
,]
}
})
...
...
@@ -30,9 +31,9 @@ export class PrepareRoutineTableDataService {
public
prepareMatTableColumn
():
any
[]
{
let
columnArray
=
[
{
key
:
'
session_session_name
'
,
label
:
'
Session
'
},
{
key
:
'
class_details
'
,
label
:
'
Class
'
},
{
key
:
'
section_details
'
,
label
:
'
Section
'
},
{
key
:
'
routine_type
'
,
label
:
'
Type
'
},
{
key
:
'
action
'
,
label
:
'
Action
'
},
];
...
...
src/app/portal/service/data-source.service.ts
View file @
df9761a5
...
...
@@ -8,9 +8,16 @@ export class DataSourceService {
constructor
()
{
}
public
static
readonly
ASSIGNMENT_DATA_SOURCE_ID
:
number
=
3188
;
// FOR ROUTINE:
public
static
readonly
ROUTINE_DATA_SOURCE_ID
:
number
=
3021
;
public
static
readonly
ROUTINE_DATA_SOURCE_NAME
:
string
=
'
Routine
'
;
public
static
readonly
ROUTINE_DATA_SOURCE_TYPE
:
number
=
1327
;
public
static
readonly
CLASS_DATA_SOURCE_ID
:
number
=
3008
;
public
static
readonly
SECTION_DATA_SOURCE_ID
:
number
=
3013
;
public
static
readonly
EXAM_SCHEDULE_DATA_SOURCE_ID
:
number
=
3018
;
}
src/app/raintree/interface/raintree-response.ts
View file @
df9761a5
export
interface
RaintreeResponse
{
status_code
:
number
;
status
:
boolean
;
message
:
string
;
[
index
:
string
]:
any
;
}
src/app/raintree/transmission-message-handler/transmission-message-handler.ts
View file @
df9761a5
...
...
@@ -7,7 +7,6 @@ import { RaintreeResponse } from "../interface/raintree-response";
export
class
TransmissionMessageHandlerService
{
public
hasError
(
response
:
RaintreeResponse
):
boolean
{
console
.
log
(
response
);
let
hasError
:
boolean
=
false
;
let
successStatusCode
:
number
[]
=
[
200
,
201
]
...
...
src/app/raintree/transmission/file-upload-transmission.service.ts
View file @
df9761a5
...
...
@@ -16,7 +16,7 @@ export class FileUploadTransmissionService extends TransmissionService {
onFailure
:
(
error
:
string
)
=>
void
,
onComplete
:
()
=>
void
):
void
{
this
.
executePostPayload
(
this
.
execute
Form
PostPayload
(
url
,
payload
,
onPreExecute
,
...
...
src/app/raintree/transmission/jwt.service.ts
View file @
df9761a5
...
...
@@ -10,19 +10,23 @@ export class JWTService {
private
_auth
:
AuthService
)
{}
private
_jwtToken
:
string
|
null
=
null
;
private
_expirationDate
:
Date
|
null
=
null
;
private
_isExpired
:
boolean
|
null
=
null
;
private
_userId
:
string
=
this
.
_auth
.
localStorageGetItemByKey
(
'
user_id
'
);
private
_authorizationToken
:
string
=
localStorage
.
getItem
(
'
Bearer
'
)
||
''
;
public
injectToken
(
token
:
string
):
HttpHeaders
{
let
authorizationToken
:
string
=
localStorage
.
getItem
(
'
Bearer
'
)
||
''
;
let
userId
=
this
.
_auth
.
localStorageGetItemByKey
(
'
user_id
'
);
// TODO: check if token exist in Local storage and handle accordingly
public
injectToken
(
url
:
string
):
HttpHeaders
{
return
new
HttpHeaders
({
"
user-id
"
:
userId
,
"
apikey
"
:
authorizationToken
,
"
user-id
"
:
this
.
_
userId
,
"
apikey
"
:
this
.
_
authorizationToken
,
'
Content-Type
'
:
'
application/json
'
,
});
}
public
injectTokenForFormGroupPost
(
url
:
string
):
HttpHeaders
{
return
new
HttpHeaders
({
"
user-id
"
:
this
.
_userId
,
"
apikey
"
:
this
.
_authorizationToken
,
});
}
}
src/app/raintree/transmission/routine-transmission.service.ts
View file @
df9761a5
...
...
@@ -46,4 +46,5 @@ export class RoutineTransmissionService extends TransmissionService{
true
);
}
}
src/app/raintree/transmission/transmission.service.ts
View file @
df9761a5
...
...
@@ -93,11 +93,13 @@ export class TransmissionService {
onPreExecute
();
this
.
_http
.
post
<
RaintreeResponse
>
(
url
,
payload
,
{
headers
:
requiresAuthentication
?
this
.
_jwt
.
injectToken
(
url
)
:
undefined
,
})
.
post
<
RaintreeResponse
>
(
url
,
payload
,
{
headers
:
requiresAuthentication
?
this
.
_jwt
.
injectToken
(
url
)
:
undefined
,
}
)
.
pipe
(
catchError
(
this
.
_httpErrorHandler
.
intercept
))
.
subscribe
(
(
response
:
RaintreeResponse
)
=>
{
...
...
@@ -199,7 +201,7 @@ export class TransmissionService {
this
.
_http
.
post
<
RaintreeResponse
>
(
url
,
payload
,
{
headers
:
requiresAuthentication
?
this
.
_jwt
.
injectToken
(
url
)
?
this
.
_jwt
.
injectToken
ForFormGroupPost
(
url
)
:
undefined
,
})
.
pipe
(
catchError
(
this
.
_httpErrorHandler
.
intercept
))
...
...
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