-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The qnas module has been created. A connection between qnas and sessi…
…ons has been created
- Loading branch information
Showing
14 changed files
with
251 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wtable | ||
title="Qnas" | ||
[columns]="columns" | ||
[config]="config" | ||
[rows]="rows" | ||
></wtable> |
Empty file.
116 changes: 116 additions & 0 deletions
116
src/app/modules/conferenceqna/pages/qnas/qnas.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import { Component } from "@angular/core"; | ||
import { AlertService, CoreService } from "wacom"; | ||
import { ConferenceqnaService, Conferenceqna } from "../../services/conferenceqna.service"; | ||
import { FormService } from "src/app/core/modules/form/form.service"; | ||
import { TranslateService } from "src/app/core/modules/translate/translate.service"; | ||
import { FormInterface } from "src/app/core/modules/form/interfaces/form.interface"; | ||
import { Router } from "@angular/router"; | ||
|
||
@Component({ | ||
templateUrl: "./qnas.component.html", | ||
styleUrls: ["./qnas.component.scss"], | ||
}) | ||
export class QnasComponent { | ||
sessionId = this._router.url.includes('/qnas/') ? this._router.url.replace('/qnas/', '') : ''; | ||
|
||
columns = ["name", "description"]; | ||
|
||
form: FormInterface = this._form.getForm("qnas", { | ||
formId: "qnas", | ||
title: "Qnas", | ||
components: [ | ||
{ | ||
name: "Text", | ||
key: "name", | ||
focused: true, | ||
fields: [ | ||
{ | ||
name: "Placeholder", | ||
value: "fill qnas title", | ||
}, | ||
{ | ||
name: "Label", | ||
value: "Title", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "Text", | ||
key: "description", | ||
fields: [ | ||
{ | ||
name: "Placeholder", | ||
value: "fill qnas description", | ||
}, | ||
{ | ||
name: "Label", | ||
value: "Description", | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
|
||
config = { | ||
create: () => { | ||
this._form.modal<Conferenceqna>(this.form, { | ||
label: "Create", | ||
click: (created: unknown, close: () => void) => { | ||
if(this.sessionId) (created as Conferenceqna).session=this.sessionId | ||
|
||
this._sc.create(created as Conferenceqna); | ||
close(); | ||
}, | ||
}); | ||
}, | ||
update: (doc: Conferenceqna) => { | ||
this._form | ||
.modal<Conferenceqna>(this.form, [], doc) | ||
.then((updated: Conferenceqna) => { | ||
this._core.copy(updated, doc); | ||
this._sc.update(doc); | ||
}); | ||
}, | ||
delete: (doc: Conferenceqna) => { | ||
this._alert.question({ | ||
text: this._translate.translate( | ||
"Common.Are you sure you want to delete this Conferenceqna?" | ||
), | ||
buttons: [ | ||
{ | ||
text: this._translate.translate("Common.No"), | ||
}, | ||
{ | ||
text: this._translate.translate("Common.Yes"), | ||
callback: () => { | ||
this._sc.delete(doc); | ||
}, | ||
}, | ||
], | ||
}); | ||
}, | ||
buttons: [ | ||
{ | ||
icon: "cloud_download", | ||
click: (doc: Conferenceqna) => { | ||
this._form.modalUnique<Conferenceqna>("qnas", "url", doc); | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
get rows(): Conferenceqna[] { | ||
return this.sessionId | ||
?this._sc.qnasBySessionId[this.sessionId] || [] | ||
:this._sc.conferenceqnas; | ||
} | ||
|
||
constructor( | ||
private _translate: TranslateService, | ||
private _alert: AlertService, | ||
private _sc: ConferenceqnaService, | ||
private _form: FormService, | ||
private _core: CoreService, | ||
private _router:Router | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CoreModule } from 'src/app/core/core.module'; | ||
import { QnasComponent } from './qnas.component'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: QnasComponent | ||
}, | ||
{ | ||
path: ':qna_id', | ||
component: QnasComponent | ||
}, | ||
|
||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(routes), | ||
CoreModule | ||
], | ||
declarations: [ | ||
QnasComponent | ||
], | ||
providers: [] | ||
|
||
}) | ||
|
||
export class QnasModule { } |
66 changes: 66 additions & 0 deletions
66
src/app/modules/conferenceqna/services/conferenceqna.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { inject, Injectable } from "@angular/core"; | ||
import { HelperService } from "src/app/core/services/helper.service"; | ||
import { | ||
AlertService, | ||
CoreService, | ||
HttpService, | ||
StoreService, | ||
CrudService, | ||
CrudDocument, | ||
} from "wacom"; | ||
|
||
export interface Conferenceqna extends CrudDocument { | ||
name: string; | ||
description: string; | ||
session:string; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: "root", | ||
}) | ||
export class ConferenceqnaService extends CrudService<Conferenceqna> { | ||
_helper=inject(HelperService) | ||
|
||
conferenceqnas: Conferenceqna[] = []; | ||
|
||
qnasBySessionId:Record<string, Conferenceqna[]>={} | ||
setQnasBySessionId=this._helper.createParentIdToChildrenIds<Conferenceqna[]>(this.qnasBySessionId,this.conferenceqnas,"session") | ||
|
||
constructor( | ||
_http: HttpService, | ||
_store: StoreService, | ||
_alert: AlertService, | ||
_core: CoreService | ||
) { | ||
super( | ||
{ | ||
name: "conferenceqna", | ||
}, | ||
_http, | ||
_store, | ||
_alert, | ||
_core | ||
); | ||
|
||
this.get().subscribe((conferenceqnas: Conferenceqna[]) =>{ | ||
this.conferenceqnas.push(...conferenceqnas) | ||
|
||
this.setQnasBySessionId() | ||
}); | ||
|
||
_core.on("conferenceqna_create").subscribe((conferenceqna: Conferenceqna) => { | ||
this.conferenceqnas.push(conferenceqna); | ||
|
||
this.setQnasBySessionId() | ||
}); | ||
|
||
_core.on("conferenceqna_delete").subscribe((conferenceqna: Conferenceqna) => { | ||
this.conferenceqnas.splice( | ||
this.conferenceqnas.findIndex((o) => o._id === conferenceqna._id), | ||
1 | ||
); | ||
|
||
this.setQnasBySessionId() | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters