
Hello Forum,
we plan to organize our "CEO-Roadshow" for our employees with Dynamics Marketing, Event-management. Our CEO is speaking on several Sites and as the places are limited, sometimes also several times a day on one site to our employees.
How can we now make sure that the employee can register only to one "session"? Is there a way that the employee sees on the Event-registration-Site how many places are available / booked?
Thanks for any help
Kind Regards
Frieso
Hi Frieso,
We can achieve your requirement that only allow 1 session registration, just need to add some custom code at front-end.(Event website is built with Angular.)
1. Disable registration button in side panel.
file: session-cart.component.html
path: src\app\components\event\session-cart
In footer container,
* add a span element, it will only display when there are more than 1 session are added.
Only 1 session is allowed to registration
* add a new custom condition: "sessionCartCount() > 1" to the disable attribute of registration button, link the new condition with the existing one by "OR" operator.
[disabled="sessionCartCount() == 0 || sessionCartCount() > 1"
Result:
One sessions is added.
Two sessions are added.(the registration button is gray out and disabled)
2. Disable registration button on home page.
file: event.component.ts
path: src\app\components\event
* Initialize a variable to store sessionCount before ngOnInit function
public sessionCount = 0;
* statement 1 will assign session count to the custom variable at beginning, statement 2 will make the variable value could change when we add/remove session to/from cart.(they should be after this.route.queryParamMap... statement)
> this.sessionCount = this.sessionCartService.getSessionCartForEvent(this.readableEventId).length;
> this.subscribeToSessionCartCount();
* The session counting function has been provided by MS, so we just need to import it.(Add the function after ngOnInit function.)
private subscribeToSessionCartCount() {
this.sessionCartService.sessionCartChange.subscribe(
sessionCart => (this.sessionCount = sessionCart.length)
);
}
Then we should edit home page HTML.
file: event.component.html
path: src\app\components\event
* We still add a notification text at first.(inside register-container element)
<span *ngIf="sessionCount > 1" style="color: black;">Only 1 session is allowed to registration</span><br>
* Add the custom condition to disable the second button on condition.(The second one is for session enabled event.)
[disabled="sessionCount > 1"
Result:
If we add two sessions, the registration button on home page will also be disabled.
In theory, your second requirement that show how many places are booked for employees could be also achieved by code,
but it's more complex that the first requirement, thus more paragraphs are required to post each step and operation.
You could try to complete it by yourself with Angular tutorial or developers in your team.
Regards,
Clofly