@sneat/extensions-schedulus-shared 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/components/calendar/calendar-base.component.js +83 -0
- package/esm2022/lib/components/calendar/calendar-base.component.js.map +1 -0
- package/esm2022/lib/components/calendar/calendar-brief.component.js +57 -0
- package/esm2022/lib/components/calendar/calendar-brief.component.js.map +1 -0
- package/esm2022/lib/components/calendar/calendar-component-types.js +2 -0
- package/esm2022/lib/components/calendar/calendar-component-types.js.map +1 -0
- package/esm2022/lib/components/calendar/calendar-state.service.js +90 -0
- package/esm2022/lib/components/calendar/calendar-state.service.js.map +1 -0
- package/esm2022/lib/components/calendar/calendar.component.js +284 -0
- package/esm2022/lib/components/calendar/calendar.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.js +45 -0
- package/esm2022/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-base.component.js +26 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-base.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-card.component.js +67 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-card.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-tab.component.js +74 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-tab.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-title.component.js +27 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day-title.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day.component.js +129 -0
- package/esm2022/lib/components/calendar/components/calendar-day/calendar-day.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.component.js +162 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.js +17 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/calendar-filter.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/contacts-filter.component.js +95 -0
- package/esm2022/lib/components/calendar/components/calendar-filter/contacts-filter.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-card.component.js +50 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-card.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-tab.component.js +18 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-tab.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-title.component.js +15 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week-title.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week.component.js +78 -0
- package/esm2022/lib/components/calendar/components/calendar-week/calendar-week.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.js +66 -0
- package/esm2022/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/day-slot-item/day-slot-item.component.js +93 -0
- package/esm2022/lib/components/calendar/components/day-slot-item/day-slot-item.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/day-slot-item/slot-context-menu.component.js +324 -0
- package/esm2022/lib/components/calendar/components/day-slot-item/slot-context-menu.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.js +36 -0
- package/esm2022/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/singles-tab/single-happenings-list.component.js +65 -0
- package/esm2022/lib/components/calendar/components/singles-tab/single-happenings-list.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/singles-tab/singles-tab.component.js +106 -0
- package/esm2022/lib/components/calendar/components/singles-tab/singles-tab.component.js.map +1 -0
- package/esm2022/lib/components/calendar/components/timing-badge/timing-badge.component.js +25 -0
- package/esm2022/lib/components/calendar/components/timing-badge/timing-badge.component.js.map +1 -0
- package/esm2022/lib/components/calendar/weekday.js +2 -0
- package/esm2022/lib/components/calendar/weekday.js.map +1 -0
- package/esm2022/lib/components/calendar-core.js +64 -0
- package/esm2022/lib/components/calendar-core.js.map +1 -0
- package/esm2022/lib/components/calendar-filter.service.js +28 -0
- package/esm2022/lib/components/calendar-filter.service.js.map +1 -0
- package/esm2022/lib/components/calendar-slots.js +30 -0
- package/esm2022/lib/components/calendar-slots.js.map +1 -0
- package/esm2022/lib/components/happening-base.component.js +188 -0
- package/esm2022/lib/components/happening-base.component.js.map +1 -0
- package/esm2022/lib/components/happening-card/happening-card.component.js +69 -0
- package/esm2022/lib/components/happening-card/happening-card.component.js.map +1 -0
- package/esm2022/lib/components/happening-component-base-params.js +37 -0
- package/esm2022/lib/components/happening-component-base-params.js.map +1 -0
- package/esm2022/lib/components/happening-form/happening-form.component.js +348 -0
- package/esm2022/lib/components/happening-form/happening-form.component.js.map +1 -0
- package/esm2022/lib/components/happening-form/happening-price-form/happening-price-modal.component.js +161 -0
- package/esm2022/lib/components/happening-form/happening-price-form/happening-price-modal.component.js.map +1 -0
- package/esm2022/lib/components/happening-form/happening-prices/happening-prices.component.js +142 -0
- package/esm2022/lib/components/happening-form/happening-prices/happening-prices.component.js.map +1 -0
- package/esm2022/lib/components/happening-participants/happening-participants.component.js +195 -0
- package/esm2022/lib/components/happening-participants/happening-participants.component.js.map +1 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-form.component.js +505 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-form.component.js.map +1 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-modal.component.js +140 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-modal.component.js.map +1 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-modal.service.js +47 -0
- package/esm2022/lib/components/happening-slot-form/happening-slot-modal.service.js.map +1 -0
- package/esm2022/lib/components/happening-slot-participants/happening-slot-participants.component.js +74 -0
- package/esm2022/lib/components/happening-slot-participants/happening-slot-participants.component.js.map +1 -0
- package/esm2022/lib/components/happening-slots/happening-slots.component.js +130 -0
- package/esm2022/lib/components/happening-slots/happening-slots.component.js.map +1 -0
- package/esm2022/lib/components/index.js +20 -0
- package/esm2022/lib/components/index.js.map +1 -0
- package/esm2022/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.js +68 -0
- package/esm2022/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.js.map +1 -0
- package/esm2022/lib/components/start-end-datetime-form/start-end-datetime-form.component.js +377 -0
- package/esm2022/lib/components/start-end-datetime-form/start-end-datetime-form.component.js.map +1 -0
- package/esm2022/lib/components/start-end-datetime-form/time-selector.component.js +92 -0
- package/esm2022/lib/components/start-end-datetime-form/time-selector.component.js.map +1 -0
- package/esm2022/lib/components/swipeable-base.component.js +112 -0
- package/esm2022/lib/components/swipeable-base.component.js.map +1 -0
- package/esm2022/lib/components/swipeable-ui.js +64 -0
- package/esm2022/lib/components/swipeable-ui.js.map +1 -0
- package/esm2022/lib/components/week.js +2 -0
- package/esm2022/lib/components/week.js.map +1 -0
- package/esm2022/lib/components/weekday-functions.js +13 -0
- package/esm2022/lib/components/weekday-functions.js.map +1 -0
- package/esm2022/lib/components/weekdays/weekdays-form-base.js +72 -0
- package/esm2022/lib/components/weekdays/weekdays-form-base.js.map +1 -0
- package/esm2022/lib/index.js +3 -0
- package/esm2022/lib/index.js.map +1 -0
- package/esm2022/lib/modals/happening-title-modal/happening-title-modal.component.js +87 -0
- package/esm2022/lib/modals/happening-title-modal/happening-title-modal.component.js.map +1 -0
- package/esm2022/lib/services/calendar-data-provider.js +271 -0
- package/esm2022/lib/services/calendar-data-provider.js.map +1 -0
- package/esm2022/lib/services/calendar-day.js +179 -0
- package/esm2022/lib/services/calendar-day.js.map +1 -0
- package/esm2022/lib/services/calendar-day.service.js +37 -0
- package/esm2022/lib/services/calendar-day.service.js.map +1 -0
- package/esm2022/lib/services/calendar-nav.service.js +36 -0
- package/esm2022/lib/services/calendar-nav.service.js.map +1 -0
- package/esm2022/lib/services/calendar-space.js +152 -0
- package/esm2022/lib/services/calendar-space.js.map +1 -0
- package/esm2022/lib/services/calendar-types.js +52 -0
- package/esm2022/lib/services/calendar-types.js.map +1 -0
- package/esm2022/lib/services/calendarium-services.module.js +16 -0
- package/esm2022/lib/services/calendarium-services.module.js.map +1 -0
- package/esm2022/lib/services/calendarium-space.service.js +16 -0
- package/esm2022/lib/services/calendarium-space.service.js.map +1 -0
- package/esm2022/lib/services/happening.service.js +225 -0
- package/esm2022/lib/services/happening.service.js.map +1 -0
- package/esm2022/lib/services/index.js +6 -0
- package/esm2022/lib/services/index.js.map +1 -0
- package/esm2022/sneat-extensions-schedulus-shared.js +5 -0
- package/esm2022/sneat-extensions-schedulus-shared.js.map +1 -0
- package/index.d.ts +1 -0
- package/lib/components/calendar/calendar-base.component.d.ts +23 -0
- package/lib/components/calendar/calendar-brief.component.d.ts +11 -0
- package/lib/components/calendar/calendar-component-types.d.ts +1 -0
- package/lib/components/calendar/calendar-state.service.d.ts +15 -0
- package/lib/components/calendar/calendar.component.d.ts +32 -0
- package/lib/components/calendar/components/calendar-add-buttons/calendar-add-buttons.component.d.ts +13 -0
- package/lib/components/calendar/components/calendar-day/calendar-day-base.component.d.ts +10 -0
- package/lib/components/calendar/components/calendar-day/calendar-day-card.component.d.ts +17 -0
- package/lib/components/calendar/components/calendar-day/calendar-day-tab.component.d.ts +19 -0
- package/lib/components/calendar/components/calendar-day/calendar-day-title.component.d.ts +10 -0
- package/lib/components/calendar/components/calendar-day/calendar-day.component.d.ts +30 -0
- package/lib/components/calendar/components/calendar-filter/calendar-filter.component.d.ts +39 -0
- package/lib/components/calendar/components/calendar-filter/calendar-filter.d.ts +10 -0
- package/lib/components/calendar/components/calendar-filter/contacts-filter.component.d.ts +20 -0
- package/lib/components/calendar/components/calendar-week/calendar-week-card.component.d.ts +15 -0
- package/lib/components/calendar/components/calendar-week/calendar-week-tab.component.d.ts +9 -0
- package/lib/components/calendar/components/calendar-week/calendar-week-title.component.d.ts +7 -0
- package/lib/components/calendar/components/calendar-week/calendar-week.component.d.ts +20 -0
- package/lib/components/calendar/components/calendar-weekday/calendar-weekday.component.d.ts +23 -0
- package/lib/components/calendar/components/day-slot-item/day-slot-item.component.d.ts +19 -0
- package/lib/components/calendar/components/day-slot-item/slot-context-menu.component.d.ts +40 -0
- package/lib/components/calendar/components/recurrings-tab/recurrings-tab.component.d.ts +15 -0
- package/lib/components/calendar/components/singles-tab/single-happenings-list.component.d.ts +22 -0
- package/lib/components/calendar/components/singles-tab/singles-tab.component.d.ts +29 -0
- package/lib/components/calendar/components/timing-badge/timing-badge.component.d.ts +17 -0
- package/lib/components/calendar/weekday.d.ts +7 -0
- package/lib/components/calendar-core.d.ts +10 -0
- package/lib/components/calendar-filter.service.d.ts +8 -0
- package/lib/components/calendar-slots.d.ts +5 -0
- package/lib/components/happening-base.component.d.ts +46 -0
- package/lib/components/happening-card/happening-card.component.d.ts +11 -0
- package/lib/components/happening-component-base-params.d.ts +16 -0
- package/lib/components/happening-form/happening-form.component.d.ts +52 -0
- package/lib/components/happening-form/happening-price-form/happening-price-modal.component.d.ts +29 -0
- package/lib/components/happening-form/happening-prices/happening-prices.component.d.ts +16 -0
- package/lib/components/happening-participants/happening-participants.component.d.ts +24 -0
- package/lib/components/happening-slot-form/happening-slot-form.component.d.ts +76 -0
- package/lib/components/happening-slot-form/happening-slot-modal.component.d.ts +26 -0
- package/lib/components/happening-slot-form/happening-slot-modal.service.d.ts +18 -0
- package/lib/components/happening-slot-participants/happening-slot-participants.component.d.ts +19 -0
- package/lib/components/happening-slots/happening-slots.component.d.ts +28 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/start-end-dates-range-form/start-end-dates-range-form.component.d.ts +16 -0
- package/lib/components/start-end-datetime-form/start-end-datetime-form.component.d.ts +53 -0
- package/lib/components/start-end-datetime-form/time-selector.component.d.ts +15 -0
- package/lib/components/swipeable-base.component.d.ts +25 -0
- package/lib/components/swipeable-ui.d.ts +24 -0
- package/lib/components/week.d.ts +4 -0
- package/lib/components/weekday-functions.d.ts +3 -0
- package/lib/components/weekdays/weekdays-form-base.d.ts +31 -0
- package/lib/index.d.ts +2 -0
- package/lib/modals/happening-title-modal/happening-title-modal.component.d.ts +24 -0
- package/lib/services/calendar-data-provider.d.ts +33 -0
- package/lib/services/calendar-day.d.ts +45 -0
- package/lib/services/calendar-day.service.d.ts +18 -0
- package/lib/services/calendar-nav.service.d.ts +14 -0
- package/lib/services/calendar-space.d.ts +23 -0
- package/lib/services/calendar-types.d.ts +10 -0
- package/lib/services/calendarium-services.module.d.ts +6 -0
- package/lib/services/calendarium-space.service.d.ts +8 -0
- package/lib/services/happening.service.d.ts +99 -0
- package/lib/services/index.d.ts +5 -0
- package/package.json +26 -0
- package/sneat-extensions-schedulus-shared.d.ts +5 -0
- package/tsconfig.lib.prod.tsbuildinfo +1 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed } from '@angular/core';
|
|
2
|
+
import { IonButton, IonButtons, IonCard, IonIcon, IonItem, IonLabel, IonText, } from '@ionic/angular/standalone';
|
|
3
|
+
import { LongMonthNamePipe } from '@sneat/components';
|
|
4
|
+
import { SelectedContactsPipe } from '@sneat/contactus-shared';
|
|
5
|
+
import { getRelatedItemIDs } from '@sneat/dto';
|
|
6
|
+
import { WdToWeekdayPipe } from '@sneat/mod-schedulus-core';
|
|
7
|
+
import { ClassName } from '@sneat/ui';
|
|
8
|
+
import { HappeningBaseComponent } from '../happening-base.component';
|
|
9
|
+
import { HappeningSlotsComponent } from '../happening-slots/happening-slots.component';
|
|
10
|
+
import { ContactsAsBadgesComponent } from '@sneat/contactus-shared';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
export class HappeningCardComponent extends HappeningBaseComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.$relatedContactIDs = computed(() => {
|
|
16
|
+
const happening = this.$happening();
|
|
17
|
+
if (!happening) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
return getRelatedItemIDs(happening.dbo?.related || happening.brief?.related, 'contactus', 'contacts');
|
|
21
|
+
}, ...(ngDevMode ? [{ debugName: "$relatedContactIDs" }] : []));
|
|
22
|
+
this.$hasRelatedContacts = computed(() => !!this.$relatedContactIDs()?.length, ...(ngDevMode ? [{ debugName: "$hasRelatedContacts" }] : []));
|
|
23
|
+
}
|
|
24
|
+
removeContact(contact) {
|
|
25
|
+
// console.log('removeContact()', contact);
|
|
26
|
+
const [space, happening] = this.spaceAndHappening();
|
|
27
|
+
if (!space || !happening) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const request = {
|
|
31
|
+
spaceID: space.id,
|
|
32
|
+
happeningID: happening.id,
|
|
33
|
+
contact: { id: contact.id },
|
|
34
|
+
};
|
|
35
|
+
this.happeningService.removeParticipant(request).subscribe({
|
|
36
|
+
next: () => {
|
|
37
|
+
this.changeDetectorRef.markForCheck();
|
|
38
|
+
},
|
|
39
|
+
error: this.errorLogger.logErrorHandler('Failed to remove member from happening'),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
43
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: HappeningCardComponent, isStandalone: true, selector: "sneat-happening-card", providers: [
|
|
44
|
+
{ provide: ClassName, useValue: 'HappeningCardComponent' },
|
|
45
|
+
...HappeningBaseComponent.providers,
|
|
46
|
+
], usesInheritance: true, ngImport: i0, template: "<ion-card [class.deleting]=\"deleting\">\n <ion-item\n color=\"light\"\n class=\"sneat-no-end-padding\"\n tappable=\"true\"\n (click)=\"goHappening($event)\"\n >\n <ion-label>\n @if (date) {\n <b>{{ wd | wdToWeekday }}</b\n >, {{ date.getDate() }} {{ date.getMonth() | longMonthName }}\n —\n }\n\n <ion-text color=\"primary\" style=\"font-weight: bold\">\n {{\n $happening().brief?.title || $happening().dbo?.title || \"Loading...\"\n }}\n </ion-text>\n <!--\t\t\t<p *ngIf='Object.keys(happening?.dto?.participants || {}).length'>-->\n <!--\t\t\t\t<ion-badge-->\n <!--\t\t\t\t\tcolor='medium'-->\n <!--\t\t\t\t\tstyle='margin-right: 0.5em'-->\n <!--\t\t\t\t\t*ngFor='-->\n <!--\t\t\t\t\t\tlet participant of Object.keys( happening?.dto?.participants || {})-->\n <!--\t\t\t\t\t'-->\n <!--\t\t\t\t>-->\n <!--\t\t\t\t\t{{ participant }}-->\n <!--\t\t\t\t</ion-badge>-->\n <!--\t\t\t</p>-->\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"delete($event)\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n <sneat-happening-slots [happening]=\"$happening()\" />\n <!--\t<sneat-happening-slot-->\n <!--\t\t[slot]=\"slot\"-->\n <!--\t\t[happening]=\"happening\"-->\n <!--\t\t*ngFor=\"-->\n <!--\t\t\tlet slot of happening?.dbo?.slots || happening?.brief?.slots || [];-->\n <!--\t\t\ttrackBy: index-->\n <!--\t\t\"-->\n <!--\t/>-->\n <ion-item>\n <ion-label color=\"medium\">\n @if ($hasRelatedContacts()) {\n <sneat-contacts-as-badges\n [$contacts]=\"\n $relatedContactIDs()\n | selectedContacts: $contactusSpace()?.dbo?.contacts\n \"\n (deleteContact)=\"removeContact($event)\"\n />\n } @else {\n Nobody assigned\n }\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button color=\"tertiary\" (click)=\"selectMembers($event)\">\n <ion-icon name=\"person-add-outline\" slot=\"start\" />\n <ion-label>Add</ion-label>\n </ion-button>\n </ion-buttons>\n </ion-item>\n <!--\t<ion-card-content>-->\n <!--\t\tSome note here?-->\n <!--\t</ion-card-content>-->\n</ion-card>\n", styles: [".deleting{text-decoration:line-through;opacity:.5}\n"], dependencies: [{ kind: "component", type: IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: HappeningSlotsComponent, selector: "sneat-happening-slots", inputs: ["happening", "wd"], outputs: ["slotSelected", "happeningChange"] }, { kind: "component", type: ContactsAsBadgesComponent, selector: "sneat-contacts-as-badges", inputs: ["$contacts", "color", "showDelete"], outputs: ["deleteContact"] }, { kind: "pipe", type: WdToWeekdayPipe, name: "wdToWeekday" }, { kind: "pipe", type: LongMonthNamePipe, name: "longMonthName" }, { kind: "pipe", type: SelectedContactsPipe, name: "selectedContacts" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
47
|
+
}
|
|
48
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningCardComponent, decorators: [{
|
|
49
|
+
type: Component,
|
|
50
|
+
args: [{ providers: [
|
|
51
|
+
{ provide: ClassName, useValue: 'HappeningCardComponent' },
|
|
52
|
+
...HappeningBaseComponent.providers,
|
|
53
|
+
], imports: [
|
|
54
|
+
IonText,
|
|
55
|
+
WdToWeekdayPipe,
|
|
56
|
+
IonLabel,
|
|
57
|
+
IonCard,
|
|
58
|
+
IonItem,
|
|
59
|
+
IonButtons,
|
|
60
|
+
IonButton,
|
|
61
|
+
IonIcon,
|
|
62
|
+
HappeningSlotsComponent,
|
|
63
|
+
ContactsAsBadgesComponent,
|
|
64
|
+
LongMonthNamePipe,
|
|
65
|
+
SelectedContactsPipe,
|
|
66
|
+
SelectedContactsPipe,
|
|
67
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'sneat-happening-card', template: "<ion-card [class.deleting]=\"deleting\">\n <ion-item\n color=\"light\"\n class=\"sneat-no-end-padding\"\n tappable=\"true\"\n (click)=\"goHappening($event)\"\n >\n <ion-label>\n @if (date) {\n <b>{{ wd | wdToWeekday }}</b\n >, {{ date.getDate() }} {{ date.getMonth() | longMonthName }}\n —\n }\n\n <ion-text color=\"primary\" style=\"font-weight: bold\">\n {{\n $happening().brief?.title || $happening().dbo?.title || \"Loading...\"\n }}\n </ion-text>\n <!--\t\t\t<p *ngIf='Object.keys(happening?.dto?.participants || {}).length'>-->\n <!--\t\t\t\t<ion-badge-->\n <!--\t\t\t\t\tcolor='medium'-->\n <!--\t\t\t\t\tstyle='margin-right: 0.5em'-->\n <!--\t\t\t\t\t*ngFor='-->\n <!--\t\t\t\t\t\tlet participant of Object.keys( happening?.dto?.participants || {})-->\n <!--\t\t\t\t\t'-->\n <!--\t\t\t\t>-->\n <!--\t\t\t\t\t{{ participant }}-->\n <!--\t\t\t\t</ion-badge>-->\n <!--\t\t\t</p>-->\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"delete($event)\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n <sneat-happening-slots [happening]=\"$happening()\" />\n <!--\t<sneat-happening-slot-->\n <!--\t\t[slot]=\"slot\"-->\n <!--\t\t[happening]=\"happening\"-->\n <!--\t\t*ngFor=\"-->\n <!--\t\t\tlet slot of happening?.dbo?.slots || happening?.brief?.slots || [];-->\n <!--\t\t\ttrackBy: index-->\n <!--\t\t\"-->\n <!--\t/>-->\n <ion-item>\n <ion-label color=\"medium\">\n @if ($hasRelatedContacts()) {\n <sneat-contacts-as-badges\n [$contacts]=\"\n $relatedContactIDs()\n | selectedContacts: $contactusSpace()?.dbo?.contacts\n \"\n (deleteContact)=\"removeContact($event)\"\n />\n } @else {\n Nobody assigned\n }\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button color=\"tertiary\" (click)=\"selectMembers($event)\">\n <ion-icon name=\"person-add-outline\" slot=\"start\" />\n <ion-label>Add</ion-label>\n </ion-button>\n </ion-buttons>\n </ion-item>\n <!--\t<ion-card-content>-->\n <!--\t\tSome note here?-->\n <!--\t</ion-card-content>-->\n</ion-card>\n", styles: [".deleting{text-decoration:line-through;opacity:.5}\n"] }]
|
|
68
|
+
}], ctorParameters: () => [] });
|
|
69
|
+
//# sourceMappingURL=happening-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happening-card.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/happening-card/happening-card.component.ts","../../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/happening-card/happening-card.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,GACR,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;;AA4BpE,MAAM,OAAO,sBAAuB,SAAQ,sBAAsB;IAiBhE;QACE,KAAK,EAAE,CAAC;QAjBS,uBAAkB,GAAG,QAAQ,CAAC,GAAG,EAAE;YACpD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YACpC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,OAAO,iBAAiB,CACtB,SAAS,CAAC,GAAG,EAAE,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAClD,WAAW,EACX,UAAU,CACX,CAAC;QACJ,CAAC,8DAAC,CAAC;QAEgB,wBAAmB,GAAG,QAAQ,CAC/C,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,MAAM,+DAC1C,CAAC;IAIF,CAAC;IAES,aAAa,CAAC,OAA0B;QAChD,2CAA2C;QAC3C,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACpD,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;YACzB,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAA6B;YACxC,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,WAAW,EAAE,SAAS,CAAC,EAAE;YACzB,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE;SAC5B,CAAC;QACF,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC;YACzD,IAAI,EAAE,GAAG,EAAE;gBACT,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC;YACxC,CAAC;YACD,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,CACrC,wCAAwC,CACzC;SACF,CAAC,CAAC;IACL,CAAC;8GAxCU,sBAAsB;kGAAtB,sBAAsB,mEAxBtB;YACT,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,EAAE;YAC1D,GAAG,sBAAsB,CAAC,SAAS;SACpC,iDC1BH,uxEAuEA,8GD1CI,OAAO,gFAEP,QAAQ,6FACR,OAAO,yLACP,OAAO,0NACP,UAAU,8EACV,SAAS,oPACT,OAAO,2JACP,uBAAuB,6IACvB,yBAAyB,0IARzB,eAAe,+CASf,iBAAiB,iDACjB,oBAAoB;;2FAOX,sBAAsB;kBA1BlC,SAAS;gCAEG;wBACT,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,wBAAwB,EAAE;wBAC1D,GAAG,sBAAsB,CAAC,SAAS;qBACpC,WAEQ;wBACP,OAAO;wBACP,eAAe;wBACf,QAAQ;wBACR,OAAO;wBACP,OAAO;wBACP,UAAU;wBACV,SAAS;wBACT,OAAO;wBACP,uBAAuB;wBACvB,yBAAyB;wBACzB,iBAAiB;wBACjB,oBAAoB;wBACpB,oBAAoB;qBACrB,mBACgB,uBAAuB,CAAC,MAAM,YACrC,sBAAsB","sourcesContent":["import { ChangeDetectionStrategy, Component, computed } from '@angular/core';\nimport {\n IonButton,\n IonButtons,\n IonCard,\n IonIcon,\n IonItem,\n IonLabel,\n IonText,\n} from '@ionic/angular/standalone';\nimport { LongMonthNamePipe } from '@sneat/components';\nimport { IContactWithBrief } from '@sneat/contactus-core';\nimport { SelectedContactsPipe } from '@sneat/contactus-shared';\nimport { getRelatedItemIDs } from '@sneat/dto';\nimport { WdToWeekdayPipe } from '@sneat/mod-schedulus-core';\nimport { ClassName } from '@sneat/ui';\nimport { HappeningBaseComponent } from '../happening-base.component';\nimport { IHappeningContactRequest } from '../../services/happening.service';\nimport { HappeningSlotsComponent } from '../happening-slots/happening-slots.component';\nimport { ContactsAsBadgesComponent } from '@sneat/contactus-shared';\n\n@Component({\n styleUrls: ['happening-card.component.scss'],\n providers: [\n { provide: ClassName, useValue: 'HappeningCardComponent' },\n ...HappeningBaseComponent.providers,\n ],\n ...HappeningBaseComponent.metadata,\n imports: [\n IonText,\n WdToWeekdayPipe,\n IonLabel,\n IonCard,\n IonItem,\n IonButtons,\n IonButton,\n IonIcon,\n HappeningSlotsComponent,\n ContactsAsBadgesComponent,\n LongMonthNamePipe,\n SelectedContactsPipe,\n SelectedContactsPipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'sneat-happening-card',\n templateUrl: 'happening-card.component.html',\n})\nexport class HappeningCardComponent extends HappeningBaseComponent {\n protected readonly $relatedContactIDs = computed(() => {\n const happening = this.$happening();\n if (!happening) {\n return [];\n }\n return getRelatedItemIDs(\n happening.dbo?.related || happening.brief?.related,\n 'contactus',\n 'contacts',\n );\n });\n\n protected readonly $hasRelatedContacts = computed<boolean>(\n () => !!this.$relatedContactIDs()?.length,\n );\n\n public constructor() {\n super();\n }\n\n protected removeContact(contact: IContactWithBrief): void {\n // console.log('removeContact()', contact);\n const [space, happening] = this.spaceAndHappening();\n if (!space || !happening) {\n return;\n }\n const request: IHappeningContactRequest = {\n spaceID: space.id,\n happeningID: happening.id,\n contact: { id: contact.id },\n };\n this.happeningService.removeParticipant(request).subscribe({\n next: () => {\n this.changeDetectorRef.markForCheck();\n },\n error: this.errorLogger.logErrorHandler(\n 'Failed to remove member from happening',\n ),\n });\n }\n}\n","<ion-card [class.deleting]=\"deleting\">\n <ion-item\n color=\"light\"\n class=\"sneat-no-end-padding\"\n tappable=\"true\"\n (click)=\"goHappening($event)\"\n >\n <ion-label>\n @if (date) {\n <b>{{ wd | wdToWeekday }}</b\n >, {{ date.getDate() }} {{ date.getMonth() | longMonthName }}\n —\n }\n\n <ion-text color=\"primary\" style=\"font-weight: bold\">\n {{\n $happening().brief?.title || $happening().dbo?.title || \"Loading...\"\n }}\n </ion-text>\n <!--\t\t\t<p *ngIf='Object.keys(happening?.dto?.participants || {}).length'>-->\n <!--\t\t\t\t<ion-badge-->\n <!--\t\t\t\t\tcolor='medium'-->\n <!--\t\t\t\t\tstyle='margin-right: 0.5em'-->\n <!--\t\t\t\t\t*ngFor='-->\n <!--\t\t\t\t\t\tlet participant of Object.keys( happening?.dto?.participants || {})-->\n <!--\t\t\t\t\t'-->\n <!--\t\t\t\t>-->\n <!--\t\t\t\t\t{{ participant }}-->\n <!--\t\t\t\t</ion-badge>-->\n <!--\t\t\t</p>-->\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button (click)=\"delete($event)\">\n <ion-icon name=\"close-outline\" />\n </ion-button>\n </ion-buttons>\n </ion-item>\n <sneat-happening-slots [happening]=\"$happening()\" />\n <!--\t<sneat-happening-slot-->\n <!--\t\t[slot]=\"slot\"-->\n <!--\t\t[happening]=\"happening\"-->\n <!--\t\t*ngFor=\"-->\n <!--\t\t\tlet slot of happening?.dbo?.slots || happening?.brief?.slots || [];-->\n <!--\t\t\ttrackBy: index-->\n <!--\t\t\"-->\n <!--\t/>-->\n <ion-item>\n <ion-label color=\"medium\">\n @if ($hasRelatedContacts()) {\n <sneat-contacts-as-badges\n [$contacts]=\"\n $relatedContactIDs()\n | selectedContacts: $contactusSpace()?.dbo?.contacts\n \"\n (deleteContact)=\"removeContact($event)\"\n />\n } @else {\n Nobody assigned\n }\n </ion-label>\n <ion-buttons slot=\"end\">\n <ion-button color=\"tertiary\" (click)=\"selectMembers($event)\">\n <ion-icon name=\"person-add-outline\" slot=\"start\" />\n <ion-label>Add</ion-label>\n </ion-button>\n </ion-buttons>\n </ion-item>\n <!--\t<ion-card-content>-->\n <!--\t\tSome note here?-->\n <!--\t</ion-card-content>-->\n</ion-card>\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Injectable, NgModule, inject } from '@angular/core';
|
|
2
|
+
import { CalendariumSpaceService } from '../services/calendarium-space.service';
|
|
3
|
+
import { SpaceComponentBaseParams } from '@sneat/space-components';
|
|
4
|
+
import { HappeningService } from '../services/happening.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class HappeningComponentBaseParams {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.spaceParams = inject(SpaceComponentBaseParams);
|
|
9
|
+
this.happeningService = inject(HappeningService);
|
|
10
|
+
this.calendariumSpaceService = inject(CalendariumSpaceService);
|
|
11
|
+
}
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParams, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParams }); }
|
|
14
|
+
}
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParams, decorators: [{
|
|
16
|
+
type: Injectable
|
|
17
|
+
}] });
|
|
18
|
+
export class HappeningComponentBaseParamsModule {
|
|
19
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParamsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
20
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParamsModule }); }
|
|
21
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParamsModule, providers: [
|
|
22
|
+
HappeningComponentBaseParams,
|
|
23
|
+
SpaceComponentBaseParams,
|
|
24
|
+
CalendariumSpaceService,
|
|
25
|
+
] }); }
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningComponentBaseParamsModule, decorators: [{
|
|
28
|
+
type: NgModule,
|
|
29
|
+
args: [{
|
|
30
|
+
providers: [
|
|
31
|
+
HappeningComponentBaseParams,
|
|
32
|
+
SpaceComponentBaseParams,
|
|
33
|
+
CalendariumSpaceService,
|
|
34
|
+
],
|
|
35
|
+
}]
|
|
36
|
+
}] });
|
|
37
|
+
//# sourceMappingURL=happening-component-base-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happening-component-base-params.js","sourceRoot":"","sources":["../../../../../../../../libs/extensions/schedulus/shared/src/lib/components/happening-component-base-params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;;AAGjE,MAAM,OAAO,4BAA4B;IADzC;QAEW,gBAAW,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;QAC/C,qBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC5C,4BAAuB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;KACpE;8GAJY,4BAA4B;kHAA5B,4BAA4B;;2FAA5B,4BAA4B;kBADxC,UAAU;;AAcX,MAAM,OAAO,kCAAkC;8GAAlC,kCAAkC;+GAAlC,kCAAkC;+GAAlC,kCAAkC,aANlC;YACT,4BAA4B;YAC5B,wBAAwB;YACxB,uBAAuB;SACxB;;2FAEU,kCAAkC;kBAP9C,QAAQ;mBAAC;oBACR,SAAS,EAAE;wBACT,4BAA4B;wBAC5B,wBAAwB;wBACxB,uBAAuB;qBACxB;iBACF","sourcesContent":["import { Injectable, NgModule, inject } from '@angular/core';\nimport { CalendariumSpaceService } from '../services/calendarium-space.service';\nimport { SpaceComponentBaseParams } from '@sneat/space-components';\nimport { HappeningService } from '../services/happening.service';\n\n@Injectable()\nexport class HappeningComponentBaseParams {\n readonly spaceParams = inject(SpaceComponentBaseParams);\n readonly happeningService = inject(HappeningService);\n readonly calendariumSpaceService = inject(CalendariumSpaceService);\n}\n\n@NgModule({\n providers: [\n HappeningComponentBaseParams,\n SpaceComponentBaseParams,\n CalendariumSpaceService,\n ],\n})\nexport class HappeningComponentBaseParamsModule {}\n"]}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, computed, effect, EventEmitter, inject, input, Input, Output, signal, ViewChild, } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup, ReactiveFormsModule, Validators, } from '@angular/forms';
|
|
3
|
+
import { ModalController, NavController, IonButton, IonCard, IonCardContent, IonCardHeader, IonIcon, IonInput, IonItem, IonItemGroup, IonLabel, IonSegment, IonSegmentButton, IonSpinner, IonCardSubtitle, IonButtons, IonTextarea, IonGrid, IonRow, IonCol, } from '@ionic/angular/standalone';
|
|
4
|
+
import { RoutingState } from '@sneat/core';
|
|
5
|
+
import { mergeValuesWithIDs, } from '@sneat/mod-schedulus-core';
|
|
6
|
+
import { SpaceComponentBaseParams } from '@sneat/space-components';
|
|
7
|
+
import { takeUntil } from 'rxjs';
|
|
8
|
+
import { HappeningTitleModalComponent } from '../../modals/happening-title-modal/happening-title-modal.component';
|
|
9
|
+
import { HappeningParticipantsComponent } from '../happening-participants/happening-participants.component';
|
|
10
|
+
import { HappeningSlotFormComponent } from '../happening-slot-form/happening-slot-form.component';
|
|
11
|
+
import { HappeningSlotsComponent } from '../happening-slots/happening-slots.component';
|
|
12
|
+
import { HappeningPricesComponent } from './happening-prices/happening-prices.component';
|
|
13
|
+
import { HappeningService, HappeningServiceModule, } from '../../services/happening.service';
|
|
14
|
+
import { WithSpaceInput } from '@sneat/space-services';
|
|
15
|
+
import * as i0 from "@angular/core";
|
|
16
|
+
import * as i1 from "@angular/forms";
|
|
17
|
+
export class HappeningFormComponent extends WithSpaceInput {
|
|
18
|
+
async editTitle(event) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
const modal = await this.modalController.create({
|
|
22
|
+
component: HappeningTitleModalComponent,
|
|
23
|
+
componentProps: {
|
|
24
|
+
happening: this.$happening(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
await modal.present();
|
|
28
|
+
// const title = (event as CustomEvent).detail.value;
|
|
29
|
+
// this.happeningTitle.setValue(title);
|
|
30
|
+
// const happening = this.$happening();
|
|
31
|
+
// if (happening.brief) {
|
|
32
|
+
// this.happeningChange.emit({
|
|
33
|
+
// ...happening,
|
|
34
|
+
// brief: { ...happening.brief, title },
|
|
35
|
+
// });
|
|
36
|
+
// }
|
|
37
|
+
}
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
41
|
+
this.happeningService = inject(HappeningService);
|
|
42
|
+
this.params = inject(SpaceComponentBaseParams);
|
|
43
|
+
this.$happening = input.required(...(ngDevMode ? [{ debugName: "$happening" }] : []));
|
|
44
|
+
this.$happeningID = computed(() => this.$happening().id, ...(ngDevMode ? [{ debugName: "$happeningID" }] : []));
|
|
45
|
+
this.$mode = computed(() => this.$happeningID() ? 'edit' : 'create', ...(ngDevMode ? [{ debugName: "$mode" }] : []));
|
|
46
|
+
this.$hasDescription = computed(() => this.$happening().dbo?.description, ...(ngDevMode ? [{ debugName: "$hasDescription" }] : []));
|
|
47
|
+
this.happeningChange = new EventEmitter();
|
|
48
|
+
this.navController = inject(NavController);
|
|
49
|
+
this.$isCreating = signal(false, ...(ngDevMode ? [{ debugName: "$isCreating" }] : []));
|
|
50
|
+
this.$isCancelling = signal(false, ...(ngDevMode ? [{ debugName: "$isCancelling" }] : []));
|
|
51
|
+
this.$isDeleting = signal(false, ...(ngDevMode ? [{ debugName: "$isDeleting" }] : []));
|
|
52
|
+
this.$slots = computed(() => {
|
|
53
|
+
const happening = this.$happening();
|
|
54
|
+
return happening.brief
|
|
55
|
+
? mergeValuesWithIDs(happening.brief.slots)
|
|
56
|
+
: undefined;
|
|
57
|
+
}, ...(ngDevMode ? [{ debugName: "$slots" }] : []));
|
|
58
|
+
this.happeningTitle = new FormControl('', Validators.required);
|
|
59
|
+
// protected onTitleChange(event: Event): void {
|
|
60
|
+
// console.log('onTitleChange()', event);
|
|
61
|
+
// }
|
|
62
|
+
this.modalController = inject(ModalController);
|
|
63
|
+
this.happeningType = new FormControl('recurring', Validators.required);
|
|
64
|
+
this.happeningForm = new FormGroup({
|
|
65
|
+
title: this.happeningTitle,
|
|
66
|
+
});
|
|
67
|
+
this.isToDo = false;
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
69
|
+
this.onHappeningTitleChanged = () => { };
|
|
70
|
+
const routingState = inject(RoutingState);
|
|
71
|
+
this.happeningTitle.registerOnChange(this.onHappeningTitleChanged);
|
|
72
|
+
this.hasNavHistory = routingState.hasHistory();
|
|
73
|
+
effect(() => {
|
|
74
|
+
const happening = this.$happening();
|
|
75
|
+
const happeningType = happening?.brief?.type;
|
|
76
|
+
if (happeningType) {
|
|
77
|
+
this.happeningType.setValue(happeningType);
|
|
78
|
+
}
|
|
79
|
+
if (happening.brief?.title && this.happeningTitle.untouched) {
|
|
80
|
+
this.happeningTitle.setValue(happening?.brief?.title);
|
|
81
|
+
// this.changeDetectorRef.markForCheck();
|
|
82
|
+
// this.slots = this?.happening?.brief?.slots || [];
|
|
83
|
+
}
|
|
84
|
+
// this.changeDetectorRef.markForCheck();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
ngAfterViewInit() {
|
|
88
|
+
// console.log('HappeningFormComponent.ngAfterViewInit()');
|
|
89
|
+
this.setFocusToInput(this.titleInput);
|
|
90
|
+
}
|
|
91
|
+
onHappeningTypeChanged(event) {
|
|
92
|
+
const happeningType = event.detail.value;
|
|
93
|
+
let happening = this.$happening();
|
|
94
|
+
happening = {
|
|
95
|
+
...happening,
|
|
96
|
+
brief: {
|
|
97
|
+
...(happening.brief || {
|
|
98
|
+
type: happeningType,
|
|
99
|
+
status: 'draft',
|
|
100
|
+
kind: 'activity',
|
|
101
|
+
title: '',
|
|
102
|
+
}),
|
|
103
|
+
type: happeningType,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
this.happeningChange.emit(happening);
|
|
107
|
+
// const setSlots = (slots?: IHappeningSlot[]) => {
|
|
108
|
+
// if (slots && this.happening?.brief) {
|
|
109
|
+
// this.happening = {
|
|
110
|
+
// ...this.happening,
|
|
111
|
+
// brief: {
|
|
112
|
+
// ...this.happening.brief,
|
|
113
|
+
// slots,
|
|
114
|
+
// },
|
|
115
|
+
// };
|
|
116
|
+
// }
|
|
117
|
+
// };
|
|
118
|
+
//
|
|
119
|
+
// switch (happeningType) {
|
|
120
|
+
// case 'single':
|
|
121
|
+
// setSlots(this.happening?.brief?.slots);
|
|
122
|
+
// break;
|
|
123
|
+
// case 'recurring':
|
|
124
|
+
// setSlots(this.happening?.brief?.slots);
|
|
125
|
+
// break;
|
|
126
|
+
// }
|
|
127
|
+
}
|
|
128
|
+
onTitleEnter(_event) {
|
|
129
|
+
this.changeDetectorRef.markForCheck();
|
|
130
|
+
}
|
|
131
|
+
onTitleChanged(event) {
|
|
132
|
+
if (event.detail.value === this.titleInput?.value) {
|
|
133
|
+
this.happeningTitle.reset();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
ionViewDidEnter() {
|
|
137
|
+
if (!this.titleInput) {
|
|
138
|
+
this.errorLogger.logError(new Error('titleInput is not initialized'));
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
this.titleInput
|
|
142
|
+
.setFocus()
|
|
143
|
+
.catch(this.errorLogger.logErrorHandler('failed to set focus to title input'));
|
|
144
|
+
}
|
|
145
|
+
// onAddSlotModalDismissed(): void {
|
|
146
|
+
// console.log('NewHappeningPage.onAddSlotModalDismissed()');
|
|
147
|
+
// if (!this.titleInput?.value) {
|
|
148
|
+
// if (this.titleInput) {
|
|
149
|
+
// setTimeout(() => {
|
|
150
|
+
// this.titleInput?.setFocus().catch(this.logErrorHandler('failed to set focus to title input'));
|
|
151
|
+
// }, 50);
|
|
152
|
+
// } else {
|
|
153
|
+
// console.warn('View child #titleInput is not initialized');
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// }
|
|
157
|
+
onSlotAdded(_slot) {
|
|
158
|
+
this.happeningForm.markAllAsTouched();
|
|
159
|
+
}
|
|
160
|
+
onHappeningChanged(happening) {
|
|
161
|
+
// this.happening = happening;
|
|
162
|
+
this.happeningForm.markAllAsTouched(); // TODO: Document why we need it and if we can remove it
|
|
163
|
+
this.happeningChange.emit(happening);
|
|
164
|
+
}
|
|
165
|
+
formIsValid() {
|
|
166
|
+
if (!this.happeningForm.valid) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
return !!this.$slots()?.length;
|
|
170
|
+
}
|
|
171
|
+
makeHappeningDto() {
|
|
172
|
+
const space = this.$space();
|
|
173
|
+
if (!space) {
|
|
174
|
+
throw new Error('!this.team');
|
|
175
|
+
}
|
|
176
|
+
const happening = this.$happening();
|
|
177
|
+
if (!happening) {
|
|
178
|
+
throw new Error('!this.happening');
|
|
179
|
+
}
|
|
180
|
+
if (!happening.brief) {
|
|
181
|
+
throw new Error('!this.happening.brief');
|
|
182
|
+
}
|
|
183
|
+
const activityFormValue = this.happeningForm.value;
|
|
184
|
+
const dto = {
|
|
185
|
+
...happening.dbo,
|
|
186
|
+
...happening.brief,
|
|
187
|
+
spaceIDs: [space.id], // TODO: should be already in this.happening.brief
|
|
188
|
+
title: activityFormValue.title || '', // TODO: should be already in this.happening.brief
|
|
189
|
+
};
|
|
190
|
+
// switch (dto.type) {
|
|
191
|
+
// case 'recurring':
|
|
192
|
+
// // dto.slots = this.slots.map(slot => ({ ...slot, repeats: 'weekly', id: slot.id || newRandomId({ len: 5 }) }));
|
|
193
|
+
// break;
|
|
194
|
+
// case 'single':
|
|
195
|
+
// if (!this.singleSlot) {
|
|
196
|
+
// throw new Error('timing is not set');
|
|
197
|
+
// }
|
|
198
|
+
// dto.slots = [{
|
|
199
|
+
// ...this.singleSlot,
|
|
200
|
+
// id: 'once',
|
|
201
|
+
// repeats: 'once',
|
|
202
|
+
// }];
|
|
203
|
+
// break;
|
|
204
|
+
// default:
|
|
205
|
+
// throw new Error('unknown happening type: ' + dto.type);
|
|
206
|
+
// }
|
|
207
|
+
return dto;
|
|
208
|
+
}
|
|
209
|
+
submit() {
|
|
210
|
+
if (this.$happening()?.id) {
|
|
211
|
+
alert('editing existing happening is not implemented yet');
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
//Create happening
|
|
215
|
+
this.createHappening();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
createHappening() {
|
|
219
|
+
const space = this.$space();
|
|
220
|
+
if (!space) {
|
|
221
|
+
this.errorLogger.logError(new Error('!space context'));
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
// this.happeningForm.markAsTouched();
|
|
226
|
+
// if (!this.happeningForm.valid) {
|
|
227
|
+
// alert('title is a required field');
|
|
228
|
+
// // if (!this.happeningForm.controls['title'].valid) {
|
|
229
|
+
// // this.titleInput?.setFocus()
|
|
230
|
+
// // .catch(this.logErrorHandler('failed to set focus to title input after happening found to be not valid'));
|
|
231
|
+
// // }
|
|
232
|
+
// return;
|
|
233
|
+
// }
|
|
234
|
+
this.$isCreating.set(true);
|
|
235
|
+
let happening = this.makeHappeningDto();
|
|
236
|
+
switch (happening.type) {
|
|
237
|
+
case 'single':
|
|
238
|
+
happening = {
|
|
239
|
+
...happening,
|
|
240
|
+
slots: Object.fromEntries(Object.entries(happening.slots || {}).map(([id, data]) => [
|
|
241
|
+
id,
|
|
242
|
+
{ ...data, repeats: 'once' },
|
|
243
|
+
])),
|
|
244
|
+
};
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
this.happeningService
|
|
248
|
+
.createHappening({ spaceID: space.id, happening })
|
|
249
|
+
.pipe(takeUntil(this.destroyed$))
|
|
250
|
+
.subscribe({
|
|
251
|
+
next: () => {
|
|
252
|
+
if (this.hasNavHistory) {
|
|
253
|
+
this.navController
|
|
254
|
+
.pop()
|
|
255
|
+
.catch(this.errorLogger.logErrorHandler('failed to pop back after creating a happening'));
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.params.spaceNavService
|
|
259
|
+
.navigateBackToSpacePage(space, 'calendar')
|
|
260
|
+
.catch(this.errorLogger.logErrorHandler('failed to navigate to space calendar after creating a happening'));
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
error: (err) => {
|
|
264
|
+
this.$isCreating.set(false);
|
|
265
|
+
this.errorLogger.logError(err, 'API request failed to create new happening');
|
|
266
|
+
},
|
|
267
|
+
complete: () => {
|
|
268
|
+
this.$isCreating.set(false);
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
catch (e) {
|
|
273
|
+
this.$isCreating.set(false);
|
|
274
|
+
this.errorLogger.logError(e, 'failed to create new happening');
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
cancel() {
|
|
278
|
+
const space = this.$space();
|
|
279
|
+
const happening = this.$happening();
|
|
280
|
+
const request = {
|
|
281
|
+
spaceID: space.id || '',
|
|
282
|
+
happeningID: happening.id || '',
|
|
283
|
+
};
|
|
284
|
+
this.$isCancelling.set(true);
|
|
285
|
+
this.happeningService.cancelHappening(request).subscribe({
|
|
286
|
+
next: () => this.$isCancelling.set(false),
|
|
287
|
+
error: (err) => {
|
|
288
|
+
this.errorLogger.logError(err, 'failed to cancel happening');
|
|
289
|
+
this.$isCancelling.set(false);
|
|
290
|
+
},
|
|
291
|
+
// complete: () => this.isCancelling.set(false), -- TODO(help-wanted): Why is not working?
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
delete() {
|
|
295
|
+
this.$isDeleting.set(true);
|
|
296
|
+
this.happeningService.deleteHappening(this.$happening()).subscribe({
|
|
297
|
+
next: () => this.$isDeleting.set(false),
|
|
298
|
+
error: (err) => {
|
|
299
|
+
this.errorLogger.logError(err, 'failed to delete happening');
|
|
300
|
+
this.$isDeleting.set(false);
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
305
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: HappeningFormComponent, isStandalone: true, selector: "sneat-happening-form", inputs: { $happening: { classPropertyName: "$happening", publicName: "$happening", isSignal: true, isRequired: true, transformFunction: null }, wd: { classPropertyName: "wd", publicName: "wd", isSignal: false, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { happeningChange: "happeningChange" }, viewQueries: [{ propertyName: "titleInput", first: true, predicate: ["titleInput"], descendants: true, static: true }, { propertyName: "happeningSlotsComponent", first: true, predicate: ["happeningSlotsComponent"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"happeningForm\" (ngSubmit)=\"submit()\">\n @if ($mode() === \"create\") {\n <ion-segment\n class=\"ion-padding-horizontal\"\n [formControl]=\"happeningType\"\n (ionChange)=\"onHappeningTypeChanged($event)\"\n >\n <ion-segment-button value=\"recurring\" [disabled]=\"!!$happening().id\">\n Recurring\n </ion-segment-button>\n <ion-segment-button value=\"single\" [disabled]=\"!!$happening().id\">\n One-timer\n </ion-segment-button>\n </ion-segment>\n }\n\n <ion-card>\n <ion-item\n class=\"sneat-tiny-end-padding\"\n [lines]=\"happeningTitle.value ? 'none' : undefined\"\n >\n @switch ($mode()) {\n @case (\"edit\") {\n @if ($happening().dbo) {\n <ion-label (click)=\"editTitle($event)\" style=\"font-weight: bold\">\n {{ $happening().dbo?.title }}\n </ion-label>\n } @else {\n <ion-spinner\n color=\"medium\"\n name=\"lines-small\"\n slot=\"start\"\n title=\"Loading...\"\n />\n <ion-label>Loading...</ion-label>\n }\n <ion-buttons slot=\"end\">\n <ion-button\n color=\"medium\"\n (click)=\"editTitle($event)\"\n [disabled]=\"!$happeningID()\"\n >\n <ion-icon name=\"create-outline\" slot=\"start\" />\n <ion-label>Edit</ion-label>\n </ion-button>\n </ion-buttons>\n }\n @case (\"create\") {\n <ion-input\n placeholder=\"Title\"\n style=\"font-weight: bold\"\n #titleInput\n [formControl]=\"happeningTitle\"\n (keyup.enter)=\"onTitleEnter($event)\"\n (ionChange)=\"onTitleChanged($event)\"\n type=\"text\"\n />\n }\n }\n </ion-item>\n @if (!happeningTitle.value) {\n <ion-item>\n <ion-label color=\"medium\">\n Enter above the name of the event.\n </ion-label>\n </ion-item>\n }\n @if ($mode() === \"edit\") {\n <ion-grid class=\"ion-grid-layout\">\n <ion-row>\n <ion-col [size]=\"$hasDescription() ? 12 : 6\">\n <ion-item>\n <ion-textarea\n label=\"Summary\"\n labelPlacement=\"stacked\"\n placeholder=\"none\"\n auto-grow=\"true\"\n readonly=\"true\"\n [value]=\"$happening().dbo?.summary\"\n />\n </ion-item>\n </ion-col>\n <ion-col [size]=\"$hasDescription() ? 12 : 6\">\n <ion-item lines=\"none\">\n {{ $happening().dbo?.description }}\n </ion-item>\n </ion-col>\n </ion-row>\n </ion-grid>\n }\n </ion-card>\n\n @if (happeningTitle.value) {\n <ion-card>\n <ion-item-group>\n @if (!$slots()?.length) {\n <sneat-happening-slot-form\n mode=\"in-form\"\n [wd]=\"wd\"\n [date]=\"date\"\n [$happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n (slotAdded)=\"onSlotAdded($event)\"\n />\n }\n @if ($happening().id || $slots()?.length) {\n <sneat-happening-slots\n #happeningSlotsComponent\n [happening]=\"$happening()\"\n [wd]=\"wd\"\n />\n }\n <!--\t\t\t<sneat-single-slot-form-->\n <!--\t\t\t\t[happening]=\"happening\"-->\n <!--\t\t\t\t[style.display]=\"happeningType === 'single' ? 'block' : 'none'\"-->\n <!--\t\t\t\t(happeningSlotChange)=\"onSingleSlotChanged($event)\"-->\n <!--\t\t\t>-->\n <!--\t\t\t\t<!– hide with [style.display] to preserve input values if tab switched back and forth –>-->\n <!--\t\t\t</sneat-single-slot-form>-->\n </ion-item-group>\n </ion-card>\n\n @if ($happening().id || $happening().brief?.slots) {\n <ng-container>\n <sneat-happening-pricing\n [happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n />\n\n <sneat-happening-participants\n [$space]=\"$space()\"\n [$happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n />\n\n <ion-card>\n @if (!formIsValid()) {\n <ion-item>\n <ion-label color=\"danger\">\n <ul>\n @if (\n happeningForm.touched &&\n happeningForm.controls[\"title\"].errors\n ) {\n <li>\n @if (isToDo) {\n Task title is required.\n } @else {\n Please enter a required \"Title\" field at top of the\n page.\n }\n </li>\n }\n @if (\n happeningType.value === \"recurring\" && !$slots()?.length\n ) {\n <li>\n <p>\n At least 1 slot should be specified for a recurring\n happening.\n </p>\n <ion-button>Add slot</ion-button>\n </li>\n }\n </ul>\n </ion-label>\n </ion-item>\n }\n <!--\t\t\t\t@if (weekdaysForm.touched && weekdaysForm.errors && weekdaysForm.errors['required']) {-->\n <!--\t\t\t\t\t<ion-item color=\"danger\" *ngIf=\"\">-->\n <!--\t\t\t\t\t\t{{ weekdaysForm.errors['required'] }}-->\n <!--\t\t\t\t\t</ion-item>-->\n <!--\t\t\t\t}-->\n\n @if (!$happening().id) {\n <div class=\"ion-padding\">\n <ion-button\n [disabled]=\"$isCreating()\"\n [color]=\"formIsValid() ? 'primary' : 'medium'\"\n size=\"large\"\n (click)=\"submit()\"\n >\n @if (isToDo) {\n <ion-label>Add task</ion-label>\n } @else {\n @switch (happeningType.value) {\n @case (\"recurring\") {\n <ion-label>Create recurring happening</ion-label>\n }\n @case (\"single\") {\n <ion-label>Create one-timer happening</ion-label>\n }\n }\n }\n @if ($isCreating()) {\n <ion-spinner slot=\"end\" class=\"ion-margin-horizontal\" />\n }\n </ion-button>\n </div>\n }\n </ion-card>\n </ng-container>\n }\n }\n</form>\n\n@if ($happening().id) {\n <ion-card>\n <ion-card-header>\n <!--\t\t<ion-card-title>Danger zone</ion-card-title>-->\n <ion-card-subtitle>Actions in red are irrevocable</ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n @if ($happening().brief?.status !== \"canceled\") {\n <ion-button\n color=\"warning\"\n [disabled]=\"$isCancelling()\"\n (click)=\"cancel()\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\" />\n <ion-label>Cancel & Archive</ion-label>\n <ion-icon name=\"archive-outline\" slot=\"end\" />\n </ion-button>\n }\n <ion-button color=\"danger\" (click)=\"delete()\" [disabled]=\"$isDeleting()\">\n @if ($isDeleting()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n } @else {\n <ion-icon name=\"close-circle-outline\" slot=\"start\" />\n }\n <ion-label>Delete</ion-label>\n </ion-button>\n </ion-card-content>\n </ion-card>\n}\n", dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: HappeningServiceModule }, { kind: "component", type: HappeningParticipantsComponent, selector: "sneat-happening-participants", inputs: ["$happening"], outputs: ["happeningChange"] }, { kind: "component", type: HappeningPricesComponent, selector: "sneat-happening-pricing", inputs: ["happening"], outputs: ["happeningChange"] }, { kind: "component", type: HappeningSlotFormComponent, selector: "sneat-happening-slot-form", inputs: ["$happening", "mode", "slot", "wd", "date", "isToDo"], outputs: ["slotAdded", "happeningChange", "eventTimesChanged"] }, { kind: "component", type: HappeningSlotsComponent, selector: "sneat-happening-slots", inputs: ["happening", "wd"], outputs: ["slotSelected", "happeningChange"] }, { kind: "component", type: IonSegment, selector: "ion-segment", inputs: ["color", "disabled", "mode", "scrollable", "selectOnFocus", "swipeGesture", "value"] }, { kind: "component", type: IonSegmentButton, selector: "ion-segment-button", inputs: ["contentId", "disabled", "layout", "mode", "type", "value"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonItemGroup, selector: "ion-item-group" }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonCardHeader, selector: "ion-card-header", inputs: ["color", "mode", "translucent"] }, { kind: "component", type: IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: IonCardSubtitle, selector: "ion-card-subtitle", inputs: ["color", "mode"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }, { kind: "component", type: IonGrid, selector: "ion-grid", inputs: ["fixed"] }, { kind: "component", type: IonRow, selector: "ion-row" }, { kind: "component", type: IonCol, selector: "ion-col", inputs: ["offset", "offsetLg", "offsetMd", "offsetSm", "offsetXl", "offsetXs", "pull", "pullLg", "pullMd", "pullSm", "pullXl", "pullXs", "push", "pushLg", "pushMd", "pushSm", "pushXl", "pushXs", "size", "sizeLg", "sizeMd", "sizeSm", "sizeXl", "sizeXs"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
306
|
+
}
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: HappeningFormComponent, decorators: [{
|
|
308
|
+
type: Component,
|
|
309
|
+
args: [{ imports: [
|
|
310
|
+
ReactiveFormsModule,
|
|
311
|
+
HappeningServiceModule,
|
|
312
|
+
HappeningParticipantsComponent,
|
|
313
|
+
HappeningPricesComponent,
|
|
314
|
+
HappeningSlotFormComponent,
|
|
315
|
+
HappeningSlotsComponent,
|
|
316
|
+
IonSegment,
|
|
317
|
+
IonSegmentButton,
|
|
318
|
+
IonCard,
|
|
319
|
+
IonItem,
|
|
320
|
+
IonLabel,
|
|
321
|
+
IonInput,
|
|
322
|
+
IonItemGroup,
|
|
323
|
+
IonButton,
|
|
324
|
+
IonCardHeader,
|
|
325
|
+
IonCardContent,
|
|
326
|
+
IonIcon,
|
|
327
|
+
IonSpinner,
|
|
328
|
+
IonCardSubtitle,
|
|
329
|
+
IonButtons,
|
|
330
|
+
IonTextarea,
|
|
331
|
+
IonGrid,
|
|
332
|
+
IonRow,
|
|
333
|
+
IonCol,
|
|
334
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'sneat-happening-form', template: "<form [formGroup]=\"happeningForm\" (ngSubmit)=\"submit()\">\n @if ($mode() === \"create\") {\n <ion-segment\n class=\"ion-padding-horizontal\"\n [formControl]=\"happeningType\"\n (ionChange)=\"onHappeningTypeChanged($event)\"\n >\n <ion-segment-button value=\"recurring\" [disabled]=\"!!$happening().id\">\n Recurring\n </ion-segment-button>\n <ion-segment-button value=\"single\" [disabled]=\"!!$happening().id\">\n One-timer\n </ion-segment-button>\n </ion-segment>\n }\n\n <ion-card>\n <ion-item\n class=\"sneat-tiny-end-padding\"\n [lines]=\"happeningTitle.value ? 'none' : undefined\"\n >\n @switch ($mode()) {\n @case (\"edit\") {\n @if ($happening().dbo) {\n <ion-label (click)=\"editTitle($event)\" style=\"font-weight: bold\">\n {{ $happening().dbo?.title }}\n </ion-label>\n } @else {\n <ion-spinner\n color=\"medium\"\n name=\"lines-small\"\n slot=\"start\"\n title=\"Loading...\"\n />\n <ion-label>Loading...</ion-label>\n }\n <ion-buttons slot=\"end\">\n <ion-button\n color=\"medium\"\n (click)=\"editTitle($event)\"\n [disabled]=\"!$happeningID()\"\n >\n <ion-icon name=\"create-outline\" slot=\"start\" />\n <ion-label>Edit</ion-label>\n </ion-button>\n </ion-buttons>\n }\n @case (\"create\") {\n <ion-input\n placeholder=\"Title\"\n style=\"font-weight: bold\"\n #titleInput\n [formControl]=\"happeningTitle\"\n (keyup.enter)=\"onTitleEnter($event)\"\n (ionChange)=\"onTitleChanged($event)\"\n type=\"text\"\n />\n }\n }\n </ion-item>\n @if (!happeningTitle.value) {\n <ion-item>\n <ion-label color=\"medium\">\n Enter above the name of the event.\n </ion-label>\n </ion-item>\n }\n @if ($mode() === \"edit\") {\n <ion-grid class=\"ion-grid-layout\">\n <ion-row>\n <ion-col [size]=\"$hasDescription() ? 12 : 6\">\n <ion-item>\n <ion-textarea\n label=\"Summary\"\n labelPlacement=\"stacked\"\n placeholder=\"none\"\n auto-grow=\"true\"\n readonly=\"true\"\n [value]=\"$happening().dbo?.summary\"\n />\n </ion-item>\n </ion-col>\n <ion-col [size]=\"$hasDescription() ? 12 : 6\">\n <ion-item lines=\"none\">\n {{ $happening().dbo?.description }}\n </ion-item>\n </ion-col>\n </ion-row>\n </ion-grid>\n }\n </ion-card>\n\n @if (happeningTitle.value) {\n <ion-card>\n <ion-item-group>\n @if (!$slots()?.length) {\n <sneat-happening-slot-form\n mode=\"in-form\"\n [wd]=\"wd\"\n [date]=\"date\"\n [$happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n (slotAdded)=\"onSlotAdded($event)\"\n />\n }\n @if ($happening().id || $slots()?.length) {\n <sneat-happening-slots\n #happeningSlotsComponent\n [happening]=\"$happening()\"\n [wd]=\"wd\"\n />\n }\n <!--\t\t\t<sneat-single-slot-form-->\n <!--\t\t\t\t[happening]=\"happening\"-->\n <!--\t\t\t\t[style.display]=\"happeningType === 'single' ? 'block' : 'none'\"-->\n <!--\t\t\t\t(happeningSlotChange)=\"onSingleSlotChanged($event)\"-->\n <!--\t\t\t>-->\n <!--\t\t\t\t<!– hide with [style.display] to preserve input values if tab switched back and forth –>-->\n <!--\t\t\t</sneat-single-slot-form>-->\n </ion-item-group>\n </ion-card>\n\n @if ($happening().id || $happening().brief?.slots) {\n <ng-container>\n <sneat-happening-pricing\n [happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n />\n\n <sneat-happening-participants\n [$space]=\"$space()\"\n [$happening]=\"$happening()\"\n (happeningChange)=\"onHappeningChanged($event)\"\n />\n\n <ion-card>\n @if (!formIsValid()) {\n <ion-item>\n <ion-label color=\"danger\">\n <ul>\n @if (\n happeningForm.touched &&\n happeningForm.controls[\"title\"].errors\n ) {\n <li>\n @if (isToDo) {\n Task title is required.\n } @else {\n Please enter a required \"Title\" field at top of the\n page.\n }\n </li>\n }\n @if (\n happeningType.value === \"recurring\" && !$slots()?.length\n ) {\n <li>\n <p>\n At least 1 slot should be specified for a recurring\n happening.\n </p>\n <ion-button>Add slot</ion-button>\n </li>\n }\n </ul>\n </ion-label>\n </ion-item>\n }\n <!--\t\t\t\t@if (weekdaysForm.touched && weekdaysForm.errors && weekdaysForm.errors['required']) {-->\n <!--\t\t\t\t\t<ion-item color=\"danger\" *ngIf=\"\">-->\n <!--\t\t\t\t\t\t{{ weekdaysForm.errors['required'] }}-->\n <!--\t\t\t\t\t</ion-item>-->\n <!--\t\t\t\t}-->\n\n @if (!$happening().id) {\n <div class=\"ion-padding\">\n <ion-button\n [disabled]=\"$isCreating()\"\n [color]=\"formIsValid() ? 'primary' : 'medium'\"\n size=\"large\"\n (click)=\"submit()\"\n >\n @if (isToDo) {\n <ion-label>Add task</ion-label>\n } @else {\n @switch (happeningType.value) {\n @case (\"recurring\") {\n <ion-label>Create recurring happening</ion-label>\n }\n @case (\"single\") {\n <ion-label>Create one-timer happening</ion-label>\n }\n }\n }\n @if ($isCreating()) {\n <ion-spinner slot=\"end\" class=\"ion-margin-horizontal\" />\n }\n </ion-button>\n </div>\n }\n </ion-card>\n </ng-container>\n }\n }\n</form>\n\n@if ($happening().id) {\n <ion-card>\n <ion-card-header>\n <!--\t\t<ion-card-title>Danger zone</ion-card-title>-->\n <ion-card-subtitle>Actions in red are irrevocable</ion-card-subtitle>\n </ion-card-header>\n <ion-card-content>\n @if ($happening().brief?.status !== \"canceled\") {\n <ion-button\n color=\"warning\"\n [disabled]=\"$isCancelling()\"\n (click)=\"cancel()\"\n >\n <ion-icon name=\"close-outline\" slot=\"start\" />\n <ion-label>Cancel & Archive</ion-label>\n <ion-icon name=\"archive-outline\" slot=\"end\" />\n </ion-button>\n }\n <ion-button color=\"danger\" (click)=\"delete()\" [disabled]=\"$isDeleting()\">\n @if ($isDeleting()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n } @else {\n <ion-icon name=\"close-circle-outline\" slot=\"start\" />\n }\n <ion-label>Delete</ion-label>\n </ion-button>\n </ion-card-content>\n </ion-card>\n}\n" }]
|
|
335
|
+
}], ctorParameters: () => [], propDecorators: { $happening: [{ type: i0.Input, args: [{ isSignal: true, alias: "$happening", required: true }] }], wd: [{
|
|
336
|
+
type: Input
|
|
337
|
+
}], date: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}], happeningChange: [{
|
|
340
|
+
type: Output
|
|
341
|
+
}], titleInput: [{
|
|
342
|
+
type: ViewChild,
|
|
343
|
+
args: ['titleInput', { static: true }]
|
|
344
|
+
}], happeningSlotsComponent: [{
|
|
345
|
+
type: ViewChild,
|
|
346
|
+
args: ['happeningSlotsComponent', { static: false }]
|
|
347
|
+
}] } });
|
|
348
|
+
//# sourceMappingURL=happening-form.component.js.map
|