Commit e9839860 authored by achinta's avatar achinta

wip: routine submit form

parent 43e90da7
......@@ -3,7 +3,7 @@ import { ForeignKeyMap } from "./foreignKeyMap";
// Data Interface
export interface Data {
count: number;
id: number;
id: number | string;
dataSourceName: string;
websiteId: number;
type: string;
......@@ -15,4 +15,5 @@ export interface Data {
dependentFields: any;
dsType: any;
[index:string]: any;
}
\ No newline at end of file
// LocalizedField Interface (replaces repeated language-specific fields)
export interface LocalizedField {
default: string;
default?: string;
beng: string;
hindi: string;
en: string;
......
......@@ -3,7 +3,7 @@
flex-direction: column;
height: 100%;
justify-content: space-between;
position: relative;
// position: relative;
}
.sidebar_navigation_container a {
......
......@@ -4,6 +4,7 @@ import { LocalizedField } from "../../data-source/interface/localizedField";
// ThemeDataSourceField Interface
export interface Routines extends Data {
themeDataSourceFields: Routine[];
dataSourceTypeFieldsList?: Routine[]
}
// ThemeDataSourceField Interface
......@@ -16,8 +17,8 @@ export interface Routine {
session: LocalizedField;
document: LocalizedField;
routine_type: LocalizedField;
session_session_name: LocalizedField;
class_details: LocalizedField;
section_details: LocalizedField;
session_session_name?: LocalizedField;
class_details?: LocalizedField;
section_details?: LocalizedField;
}
import { CommonModule } from '@angular/common';
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ClassTransmissionService } from '../../../raintree/transmission/class-transmission.service';
import { TransmissionMapperService } from '../../../mappers/transmission-mapper.service';
import { DataSourceService } from '../../service/data-source.service';
import { classResponse } from '../../../raintree/interface/class-respons';
import { UrlConfigService } from '../../service/url-config.service';
import { CommonModule } from "@angular/common";
import { Component, Inject } from "@angular/core";
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
import { ClassTransmissionService } from "../../../raintree/transmission/class-transmission.service";
import { TransmissionMapperService } from "../../../mappers/transmission-mapper.service";
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 { FormControl, FormControlName, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { Dropdown } from "../../../component-library/dropdown/interface/dropdown";
import { StudentClass } from "../../data-source/interface/class";
import {
FormControl,
FormControlName,
FormGroup,
ReactiveFormsModule,
Validators,
} from "@angular/forms";
import { MatFormFieldModule } from "@angular/material/form-field";
import { MatInputModule } from "@angular/material/input";
import { MatIconModule } from "@angular/material/icon";
import { SquareButtonComponent } from '../../../component-library/square-button/square-button.component';
import { SectionResponse } from '../../../raintree/interface/section-respons';
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 { SquareButtonComponent } from "../../../component-library/square-button/square-button.component";
import { SectionResponse } from "../../../raintree/interface/section-respons";
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";
@Component({
selector: 'app-manage',
selector: "app-manage",
imports: [
CommonModule,
DropDownComponent,
......@@ -29,30 +36,28 @@ import { RaintreeResponse } from '../../../raintree/interface/raintree-response'
MatFormFieldModule,
MatInputModule,
MatIconModule,
SquareButtonComponent
SquareButtonComponent,
],
templateUrl: './manage.component.html',
styleUrl: './manage.component.scss'
templateUrl: "./manage.component.html",
styleUrl: "./manage.component.scss",
})
export class ManageComponent {
constructor(
@Inject(MAT_DIALOG_DATA) public data: any,
private _classTransmission: ClassTransmissionService,
private _urlConfig: UrlConfigService,
private _routineTransmission:RoutineTransmissionService,
private _routineTransmission: RoutineTransmissionService,
private _auth: AuthService
) { }
) {}
public classDropDownData: Dropdown[] = []
public sectionDropDownData: Dropdown[] = []
public classDropDownData: Dropdown[] = [];
public sectionDropDownData: Dropdown[] = [];
public routineForm = new FormGroup({
details: new FormControl('', [Validators.required])
})
details: new FormControl("", [Validators.required]),
});
ngOnInit(): void {
this._getClasses();
this._getSection();
}
......@@ -66,8 +71,9 @@ export class ManageComponent {
}
public submitRoutine(): void {
// alert("Submit Clicked!!");
console.log(this.routineFormPayload);
alert("Submit Clicked!!")
// this._routineTransmission.submitRoutine(
// TransmissionMapperService.SAVE_TRANSMISSION_URL + `websiteId=${this._auth.localStorageGetItemByKey('project_id')}`,
......@@ -88,11 +94,10 @@ export class ManageComponent {
// );
}
private _getClasses() {
this._classTransmission.getClasses(
TransmissionMapperService.GET_TRANSMISSION_URL + this._urlConfig.generateDatasourceConfigUrl({
TransmissionMapperService.GET_TRANSMISSION_URL +
this._urlConfig.generateDatasourceConfigUrl({
aggregationOnUniqueFld: false,
datasourceId: DataSourceService.CLASS_DATA_SOURCE_ID,
dontIncludeForeignKey: false,
......@@ -102,29 +107,31 @@ export class ManageComponent {
limit: 100,
orderBy: "ASC",
page: 1,
roleBasedFiltering: true
roleBasedFiltering: true,
}),
() => { },
(response) => { },
() => {},
(response) => {},
(response: classResponse) => {
this.classDropDownData = response.data['themeDataSourceFields'].map((sClass: StudentClass) => {
this.classDropDownData = response.data["themeDataSourceFields"].map(
(sClass: StudentClass) => {
return {
['name']: sClass.details['en'],
['value']: sClass.id
["name"]: sClass.details["en"],
["value"]: sClass.id,
};
}
})
);
},
(error) => {
console.log(error);
},
() => { }
)
() => {}
);
}
private _getSection(){
private _getSection() {
this._classTransmission.getSection(
TransmissionMapperService.GET_TRANSMISSION_URL + this._urlConfig.generateDatasourceConfigUrl({
TransmissionMapperService.GET_TRANSMISSION_URL +
this._urlConfig.generateDatasourceConfigUrl({
aggregationOnUniqueFld: false,
datasourceId: DataSourceService.SECTION_DATA_SOURCE_ID,
dontIncludeForeignKey: false,
......@@ -134,114 +141,113 @@ export class ManageComponent {
limit: 100,
orderBy: "ASC",
page: 1,
roleBasedFiltering: true
roleBasedFiltering: true,
}),
() => { },
(response) => { },
() => {},
(response) => {},
(response: SectionResponse) => {
this.sectionDropDownData = response.data['themeDataSourceFields'].map((sSection: StudentSection) => {
this.sectionDropDownData = response.data["themeDataSourceFields"].map(
(sSection: StudentSection) => {
return {
['name']: sSection.section['en'],
['value']: sSection.id
["name"]: sSection.section["en"],
["value"]: sSection.id,
};
}
})
);
},
(error) => {
console.log(error);
},
() => { }
)
() => {}
);
}
private routineFormPayload =
{
"themeDataSourceFields": [
private routineFormPayload:Routines = {
themeDataSourceFields: [
{
"id": "",
"class": {
"en": "48f353051f9d724f619491d4f0d0a8ec",
"beng": "48f353051f9d724f619491d4f0d0a8ec",
"hindi": "48f353051f9d724f619491d4f0d0a8ec"
},
"section": {
"en": "5d53b27058d1f6067a4b4bd1350a24d4",
"beng": "5d53b27058d1f6067a4b4bd1350a24d4",
"hindi": "5d53b27058d1f6067a4b4bd1350a24d4"
},
"schedule": {
"en": "BASE_URL/webomagic/getFile?fid=2910",
"beng": "BASE_URL/webomagic/getFile?fid=2910",
"hindi": "BASE_URL/webomagic/getFile?fid=2910"
},
"details": {
"en": "test 1 c",
"beng": "test 1 c",
"hindi": "test 1 c"
},
"session": {
"en": "86af4d6b5675a82df4581f00c67f0c7f",
"beng": "86af4d6b5675a82df4581f00c67f0c7f",
"hindi": "86af4d6b5675a82df4581f00c67f0c7f"
},
"document": {
"en": "",
"beng": "",
"hindi": ""
},
"routine_type": {
"en": "class_routine",
"beng": "class_routine",
"hindi": "class_routine"
}
}
id: "",
class: {
en: "48f353051f9d724f619491d4f0d0a8ec",
beng: "48f353051f9d724f619491d4f0d0a8ec",
hindi: "48f353051f9d724f619491d4f0d0a8ec",
},
section: {
en: "5d53b27058d1f6067a4b4bd1350a24d4",
beng: "5d53b27058d1f6067a4b4bd1350a24d4",
hindi: "5d53b27058d1f6067a4b4bd1350a24d4",
},
schedule: {
en: "BASE_URL/webomagic/getFile?fid=2910",
beng: "BASE_URL/webomagic/getFile?fid=2910",
hindi: "BASE_URL/webomagic/getFile?fid=2910",
},
details: {
en: "test 1 c",
beng: "test 1 c",
hindi: "test 1 c",
},
session: {
en: "86af4d6b5675a82df4581f00c67f0c7f",
beng: "86af4d6b5675a82df4581f00c67f0c7f",
hindi: "86af4d6b5675a82df4581f00c67f0c7f",
},
document: {
en: "",
beng: "",
hindi: "",
},
routine_type: {
en: "class_routine",
beng: "class_routine",
hindi: "class_routine",
},
},
],
"dataSourceName": "Routine",
"id": "3021",
"type": "1327",
"themeId": "278",
"slideLst": null,
"heading": "undefined",
"dataSourceTypeFieldsList": [
dataSourceName: "Routine",
id: "3021",
type: "1327",
themeId: "278",
slideLst: null,
heading: "undefined",
dataSourceTypeFieldsList: [
{
"id": "",
"class": {
"en": "48f353051f9d724f619491d4f0d0a8ec",
"beng": "48f353051f9d724f619491d4f0d0a8ec",
"hindi": "48f353051f9d724f619491d4f0d0a8ec"
},
"section": {
"en": "5d53b27058d1f6067a4b4bd1350a24d4",
"beng": "5d53b27058d1f6067a4b4bd1350a24d4",
"hindi": "5d53b27058d1f6067a4b4bd1350a24d4"
},
"schedule": {
"en": "BASE_URL/webomagic/getFile?fid=2910",
"beng": "BASE_URL/webomagic/getFile?fid=2910",
"hindi": "BASE_URL/webomagic/getFile?fid=2910"
},
"details": {
"en": "test 1 c",
"beng": "test 1 c",
"hindi": "test 1 c"
},
"session": {
"en": "86af4d6b5675a82df4581f00c67f0c7f",
"beng": "86af4d6b5675a82df4581f00c67f0c7f",
"hindi": "86af4d6b5675a82df4581f00c67f0c7f"
},
"document": {
"en": "",
"beng": "",
"hindi": ""
},
"routine_type": {
"en": "class_routine",
"beng": "class_routine",
"hindi": "class_routine"
}
}
]
}
id: "",
class: {
en: "48f353051f9d724f619491d4f0d0a8ec",
beng: "48f353051f9d724f619491d4f0d0a8ec",
hindi: "48f353051f9d724f619491d4f0d0a8ec",
},
section: {
en: "5d53b27058d1f6067a4b4bd1350a24d4",
beng: "5d53b27058d1f6067a4b4bd1350a24d4",
hindi: "5d53b27058d1f6067a4b4bd1350a24d4",
},
schedule: {
en: "BASE_URL/webomagic/getFile?fid=2910",
beng: "BASE_URL/webomagic/getFile?fid=2910",
hindi: "BASE_URL/webomagic/getFile?fid=2910",
},
details: {
en: "test 1 c",
beng: "test 1 c",
hindi: "test 1 c",
},
session: {
en: "86af4d6b5675a82df4581f00c67f0c7f",
beng: "86af4d6b5675a82df4581f00c67f0c7f",
hindi: "86af4d6b5675a82df4581f00c67f0c7f",
},
document: {
en: "",
beng: "",
hindi: "",
},
routine_type: {
en: "class_routine",
beng: "class_routine",
hindi: "class_routine",
},
},
],
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment