-
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 reactions module has been created. A connection between reactions…
… and sessions has been created
- Loading branch information
Showing
13 changed files
with
250 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 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
Large diffs are not rendered by default.
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 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
6 changes: 6 additions & 0 deletions
6
src/app/modules/conferencereaction/pages/reactions/reactions.component.html
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="Reactions" | ||
[columns]="columns" | ||
[config]="config" | ||
[rows]="rows" | ||
></wtable> |
Empty file.
116 changes: 116 additions & 0 deletions
116
src/app/modules/conferencereaction/pages/reactions/reactions.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 { ConferencereactionService, Conferencereaction } from "../../services/conferencereaction.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: "./reactions.component.html", | ||
styleUrls: ["./reactions.component.scss"], | ||
}) | ||
export class ReactionsComponent { | ||
sessionId = this._router.url.includes('/reactions/') ? this._router.url.replace('/reactions/', '') : ''; | ||
|
||
columns = ["name", "description"]; | ||
|
||
form: FormInterface = this._form.getForm("reactions", { | ||
formId: "reactions", | ||
title: "Reactions", | ||
components: [ | ||
{ | ||
name: "Text", | ||
key: "name", | ||
focused: true, | ||
fields: [ | ||
{ | ||
name: "Placeholder", | ||
value: "fill reactions title", | ||
}, | ||
{ | ||
name: "Label", | ||
value: "Title", | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "Text", | ||
key: "description", | ||
fields: [ | ||
{ | ||
name: "Placeholder", | ||
value: "fill reactions description", | ||
}, | ||
{ | ||
name: "Label", | ||
value: "Description", | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
|
||
config = { | ||
create: () => { | ||
this._form.modal<Conferencereaction>(this.form, { | ||
label: "Create", | ||
click: (created: unknown, close: () => void) => { | ||
if(this.sessionId) (created as Conferencereaction).session=this.sessionId | ||
|
||
this._sc.create(created as Conferencereaction); | ||
close(); | ||
}, | ||
}); | ||
}, | ||
update: (doc: Conferencereaction) => { | ||
this._form | ||
.modal<Conferencereaction>(this.form, [], doc) | ||
.then((updated: Conferencereaction) => { | ||
this._core.copy(updated, doc); | ||
this._sc.update(doc); | ||
}); | ||
}, | ||
delete: (doc: Conferencereaction) => { | ||
this._alert.question({ | ||
text: this._translate.translate( | ||
"Common.Are you sure you want to delete this Conferencereaction?" | ||
), | ||
buttons: [ | ||
{ | ||
text: this._translate.translate("Common.No"), | ||
}, | ||
{ | ||
text: this._translate.translate("Common.Yes"), | ||
callback: () => { | ||
this._sc.delete(doc); | ||
}, | ||
}, | ||
], | ||
}); | ||
}, | ||
buttons: [ | ||
{ | ||
icon: "cloud_download", | ||
click: (doc: Conferencereaction) => { | ||
this._form.modalUnique<Conferencereaction>("reactions", "url", doc); | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
get rows(): Conferencereaction[] { | ||
return this.sessionId | ||
?this._sc.reactionsBySessionId[this.sessionId] || [] | ||
:this._sc.conferencereactions; | ||
} | ||
|
||
constructor( | ||
private _translate: TranslateService, | ||
private _alert: AlertService, | ||
private _sc: ConferencereactionService, | ||
private _form: FormService, | ||
private _core: CoreService, | ||
private _router:Router | ||
) {} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/app/modules/conferencereaction/pages/reactions/reactions.module.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,29 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CoreModule } from 'src/app/core/core.module'; | ||
import { ReactionsComponent } from './reactions.component'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: ReactionsComponent | ||
}, | ||
{ | ||
path: ':reaction_id', | ||
component: ReactionsComponent | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(routes), | ||
CoreModule | ||
], | ||
declarations: [ | ||
ReactionsComponent | ||
], | ||
providers: [] | ||
|
||
}) | ||
|
||
export class ReactionsModule { } |
66 changes: 66 additions & 0 deletions
66
src/app/modules/conferencereaction/services/conferencereaction.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 Conferencereaction extends CrudDocument { | ||
name: string; | ||
description: string; | ||
session:string; | ||
} | ||
|
||
@Injectable({ | ||
providedIn: "root", | ||
}) | ||
export class ConferencereactionService extends CrudService<Conferencereaction> { | ||
_helper=inject(HelperService) | ||
|
||
conferencereactions: Conferencereaction[] = []; | ||
|
||
reactionsBySessionId:Record<string, Conferencereaction[]>={} | ||
setReactionsBySessionId=this._helper.createParentIdToChildrenIds<Conferencereaction[]>(this.reactionsBySessionId,this.conferencereactions,"session") | ||
|
||
constructor( | ||
_http: HttpService, | ||
_store: StoreService, | ||
_alert: AlertService, | ||
_core: CoreService | ||
) { | ||
super( | ||
{ | ||
name: "conferencereaction", | ||
}, | ||
_http, | ||
_store, | ||
_alert, | ||
_core | ||
); | ||
|
||
this.get().subscribe((conferencereactions: Conferencereaction[]) =>{ | ||
this.conferencereactions.push(...conferencereactions) | ||
|
||
this.setReactionsBySessionId() | ||
}); | ||
|
||
_core.on("conferencereaction_create").subscribe((conferencereaction: Conferencereaction) => { | ||
this.conferencereactions.push(conferencereaction); | ||
|
||
this.setReactionsBySessionId() | ||
}); | ||
|
||
_core.on("conferencereaction_delete").subscribe((conferencereaction: Conferencereaction) => { | ||
this.conferencereactions.splice( | ||
this.conferencereactions.findIndex((o) => o._id === conferencereaction._id), | ||
1 | ||
); | ||
|
||
this.setReactionsBySessionId() | ||
}); | ||
} | ||
} |
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