@myclub_se/data-access 2.5.3 → 2.5.5

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.
Files changed (33) hide show
  1. package/esm2020/lib/api-models/api-booking-calendar-application-time.mjs +2 -0
  2. package/esm2020/lib/api-models/api-booking-calendar-slot.mjs +1 -1
  3. package/esm2020/lib/api-models/api-member-public-form.mjs +1 -1
  4. package/esm2020/lib/api-models/index.mjs +2 -1
  5. package/esm2020/lib/models/booking-calendar-application-time.mjs +34 -0
  6. package/esm2020/lib/models/booking-calendar-slot.mjs +3 -2
  7. package/esm2020/lib/models/index.mjs +2 -1
  8. package/esm2020/lib/models/member-public-form.mjs +5 -2
  9. package/esm2020/lib/services/activity.service.mjs +26 -4
  10. package/esm2020/lib/services/booking-calendar.service.mjs +194 -2
  11. package/esm2020/lib/services/factories/booking-calendar-application-time-factory.mjs +3 -0
  12. package/esm2020/lib/services/factories/booking-calendar-slot-factory.mjs +3 -2
  13. package/esm2020/lib/services/factories/index.mjs +3 -1
  14. package/esm2020/lib/services/factories/member-public-form-factory.mjs +10 -3
  15. package/fesm2015/myclub_se-data-access.mjs +272 -11
  16. package/fesm2015/myclub_se-data-access.mjs.map +1 -1
  17. package/fesm2020/myclub_se-data-access.mjs +272 -11
  18. package/fesm2020/myclub_se-data-access.mjs.map +1 -1
  19. package/lib/api-models/api-booking-calendar-application-time.d.ts +14 -0
  20. package/lib/api-models/api-booking-calendar-slot.d.ts +2 -0
  21. package/lib/api-models/api-member-public-form.d.ts +3 -0
  22. package/lib/api-models/index.d.ts +1 -0
  23. package/lib/models/booking-calendar-application-time.d.ts +30 -0
  24. package/lib/models/booking-calendar-slot.d.ts +3 -1
  25. package/lib/models/index.d.ts +1 -0
  26. package/lib/models/member-public-form.d.ts +4 -1
  27. package/lib/services/activity.service.d.ts +4 -2
  28. package/lib/services/booking-calendar.service.d.ts +20 -1
  29. package/lib/services/factories/booking-calendar-application-time-factory.d.ts +3 -0
  30. package/lib/services/factories/index.d.ts +2 -0
  31. package/package.json +1 -1
  32. package/esm2020/lib/types/booking-calendar-slot-reserved-time-type.mjs +0 -2
  33. package/lib/types/booking-calendar-slot-reserved-time-type.d.ts +0 -1
@@ -257,8 +257,41 @@ class BookingCalendar {
257
257
  }
258
258
  }
259
259
 
260
+ class BookingCalendarApplicationTime {
261
+ constructor(id, section_id, slot_id, team_id, end_time, section_name, start_time, team_name, location_zones_taken, applicant_comment, reviewer_comment, status) {
262
+ this.id = id;
263
+ this.section_id = section_id;
264
+ this.slot_id = slot_id;
265
+ this.team_id = team_id;
266
+ this.end_time = end_time;
267
+ this.section_name = section_name;
268
+ this.start_time = start_time;
269
+ this.team_name = team_name;
270
+ this.location_zones_taken = location_zones_taken;
271
+ this.applicant_comment = applicant_comment;
272
+ this.reviewer_comment = reviewer_comment;
273
+ this.status = status;
274
+ }
275
+ static asFormGroup(session) {
276
+ return new FormGroup({
277
+ id: new FormControl((session === null || session === void 0 ? void 0 : session.id) || ''),
278
+ section_id: new FormControl((session === null || session === void 0 ? void 0 : session.section_id) || ''),
279
+ slot_id: new FormControl((session === null || session === void 0 ? void 0 : session.slot_id) || '', Validators.required),
280
+ team_id: new FormControl((session === null || session === void 0 ? void 0 : session.team_id) || '', Validators.required),
281
+ end_time: new FormControl((session === null || session === void 0 ? void 0 : session.end_time) || '', Validators.required),
282
+ section_name: new FormControl((session === null || session === void 0 ? void 0 : session.section_name) || ''),
283
+ start_time: new FormControl((session === null || session === void 0 ? void 0 : session.start_time) || '', Validators.required),
284
+ team_name: new FormControl((session === null || session === void 0 ? void 0 : session.team_name) || ''),
285
+ location_zones_taken: new FormControl((session === null || session === void 0 ? void 0 : session.location_zones_taken) || 1, [Validators.min(1), Validators.required]),
286
+ applicant_comment: new FormControl((session === null || session === void 0 ? void 0 : session.applicant_comment) || null),
287
+ reviewer_comment: new FormControl((session === null || session === void 0 ? void 0 : session.reviewer_comment) || null),
288
+ status: new FormControl((session === null || session === void 0 ? void 0 : session.status) || ''),
289
+ });
290
+ }
291
+ }
292
+
260
293
  class BookingCalendarSlot {
261
- constructor(id, calendar_id, location_id, color, day, end_time, group_id, location_name, number_of_available_sessions, sessions, open_sessions, start_time, type, repeat, update_repeating, reserved_time_enabled, repeat_num, repeat_to_day, repeat_type, reserved_time, reserved_time_position) {
294
+ constructor(id, calendar_id, location_id, color, day, end_time, group_id, location_name, number_of_available_sessions, sessions, open_sessions, start_time, type, repeat, update_repeating, reserved_time_enabled, repeat_num, repeat_to_day, repeat_type, reserved_time, reserved_time_position, application_times) {
262
295
  this.id = id;
263
296
  this.calendar_id = calendar_id;
264
297
  this.location_id = location_id;
@@ -280,6 +313,7 @@ class BookingCalendarSlot {
280
313
  this.repeat_type = repeat_type;
281
314
  this.reserved_time = reserved_time;
282
315
  this.reserved_time_position = reserved_time_position;
316
+ this.application_times = application_times;
283
317
  }
284
318
  static asFormGroup(slot) {
285
319
  return new FormGroup({
@@ -1071,7 +1105,7 @@ class MemberActivityInvite {
1071
1105
  }
1072
1106
 
1073
1107
  class MemberPublicForm {
1074
- constructor(id, active_form, active_to, userToken, comment, dataprotection_policy_choice, dataprotection_policy_url, fields, full_text, has_nationality_field, max_members_per_team, max_registered_in_form_total, member_types, member_type_help_text, name, num_chars_birth_date, num_registered, role_help_text, roles, team_help_text, teams, url) {
1108
+ constructor(id, active_form, active_to, userToken, comment, dataprotection_policy_choice, dataprotection_policy_url, fields, full_text, has_nationality_field, max_members_per_team, max_registered_in_form_total, member_fields, member_types, member_type_help_text, name, num_chars_birth_date, num_registered, registered, register_family, role_help_text, roles, team_help_text, teams, url) {
1075
1109
  this.id = id;
1076
1110
  this.active_form = active_form;
1077
1111
  this.active_to = active_to;
@@ -1084,11 +1118,14 @@ class MemberPublicForm {
1084
1118
  this.has_nationality_field = has_nationality_field;
1085
1119
  this.max_members_per_team = max_members_per_team;
1086
1120
  this.max_registered_in_form_total = max_registered_in_form_total;
1121
+ this.member_fields = member_fields;
1087
1122
  this.member_types = member_types;
1088
1123
  this.member_type_help_text = member_type_help_text;
1089
1124
  this.name = name;
1090
1125
  this.num_chars_birth_date = num_chars_birth_date;
1091
1126
  this.num_registered = num_registered;
1127
+ this.registered = registered;
1128
+ this.register_family = register_family;
1092
1129
  this.role_help_text = role_help_text;
1093
1130
  this.roles = roles;
1094
1131
  this.team_help_text = team_help_text;
@@ -1424,6 +1461,10 @@ const activityInviteFactory = (apiActivityInvite) => new ActivityInvite(apiActiv
1424
1461
 
1425
1462
  const activityLocationFactory = (apiActivityLocation) => new ActivityLocation(apiActivityLocation.id, apiActivityLocation.club_id, apiActivityLocation.section_id, apiActivityLocation.active, apiActivityLocation.mun_location_city_area, apiActivityLocation.mun_location_name, apiActivityLocation.name);
1426
1463
 
1464
+ const activityLocationGroupFactory = (apiActivityLocationGroup) => {
1465
+ return new ActivityLocationGroup(apiActivityLocationGroup.id, apiActivityLocationGroup.club_id, apiActivityLocationGroup.section_id, apiActivityLocationGroup.active, apiActivityLocationGroup.name, apiActivityLocationGroup.locations && apiActivityLocationGroup.locations.length ? apiActivityLocationGroup.locations.map((apiActivityLocation) => activityLocationFactory(apiActivityLocation)) : []);
1466
+ };
1467
+
1427
1468
  const activitySettingsFactory = (apiActivitySettings) => new ActivitySettings(apiActivitySettings.day_options, apiActivitySettings.hour_options, apiActivitySettings.invite_group_options, apiActivitySettings.invite_settings_options, apiActivitySettings.max_attendance_options, apiActivitySettings.meet_up_time_options, apiActivitySettings.remind_receiver_options, apiActivitySettings.repeat_options, apiActivitySettings.repeat_type_options);
1428
1469
 
1429
1470
  const activityTypeFactory = (apiActivityType) => new ActivityType(apiActivityType.id, apiActivityType.club_id, apiActivityType.section_id, apiActivityType.active, apiActivityType.base_type, apiActivityType.name);
@@ -1440,9 +1481,11 @@ const authFactory = (apiAuth) => new Auth(apiAuth.id, apiAuth.name, apiAuth.club
1440
1481
 
1441
1482
  const bookingCalendarFactory = (apiBookingCalendar) => new BookingCalendar(apiBookingCalendar.id, apiBookingCalendar.club_id, apiBookingCalendar.section_id, apiBookingCalendar.team_id, apiBookingCalendar.club_name, apiBookingCalendar.color, apiBookingCalendar.name, apiBookingCalendar.section_name, apiBookingCalendar.team_name);
1442
1483
 
1484
+ const bookingCalendarApplicationTimeFactory = (apiBookingApplicationTime) => new BookingCalendarApplicationTime(apiBookingApplicationTime.id, apiBookingApplicationTime.section_id, apiBookingApplicationTime.slot_id, apiBookingApplicationTime.team_id, apiBookingApplicationTime.end_time, apiBookingApplicationTime.section_name, apiBookingApplicationTime.start_time, apiBookingApplicationTime.team_name, apiBookingApplicationTime.location_zones_taken, apiBookingApplicationTime.applicant_comment, apiBookingApplicationTime.reviewer_comment, apiBookingApplicationTime.status);
1485
+
1443
1486
  const bookingCalendarSlotSessionFactory = (apiBookingSlotSession) => new BookingCalendarSlotSession(apiBookingSlotSession.id, apiBookingSlotSession.section_id, apiBookingSlotSession.slot_id, apiBookingSlotSession.team_id, apiBookingSlotSession.end_time, apiBookingSlotSession.section_name, apiBookingSlotSession.start_time, apiBookingSlotSession.team_name, apiBookingSlotSession.is_overbooked, apiBookingSlotSession.type, apiBookingSlotSession.location_zones_taken, apiBookingSlotSession.slot_index);
1444
1487
 
1445
- const bookingCalendarSlotFactory = (apiBookingSlot) => new BookingCalendarSlot(apiBookingSlot.id, apiBookingSlot.calendar_id, apiBookingSlot.location_id, apiBookingSlot.color, apiBookingSlot.day, apiBookingSlot.end_time, apiBookingSlot.group_id, apiBookingSlot.location_name, apiBookingSlot.number_of_available_sessions, apiBookingSlot.sessions && apiBookingSlot.sessions.length ? apiBookingSlot.sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.open_sessions && apiBookingSlot.open_sessions.length ? apiBookingSlot.open_sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.start_time, apiBookingSlot.type, 'none', false, false, 6, format(new Date(), 'yyyy-MM-dd'), 'repeat_until', apiBookingSlot.reserved_time, apiBookingSlot.reserved_time_position);
1488
+ const bookingCalendarSlotFactory = (apiBookingSlot) => new BookingCalendarSlot(apiBookingSlot.id, apiBookingSlot.calendar_id, apiBookingSlot.location_id, apiBookingSlot.color, apiBookingSlot.day, apiBookingSlot.end_time, apiBookingSlot.group_id, apiBookingSlot.location_name, apiBookingSlot.number_of_available_sessions, apiBookingSlot.sessions && apiBookingSlot.sessions.length ? apiBookingSlot.sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.open_sessions && apiBookingSlot.open_sessions.length ? apiBookingSlot.open_sessions.map((apiBookingSlotSession) => bookingCalendarSlotSessionFactory(apiBookingSlotSession)) : [], apiBookingSlot.start_time, apiBookingSlot.type, 'none', false, false, 6, format(new Date(), 'yyyy-MM-dd'), 'repeat_until', apiBookingSlot.reserved_time, apiBookingSlot.reserved_time_position, apiBookingSlot.application_times && apiBookingSlot.application_times.length ? apiBookingSlot.application_times.map((apiBookingApplicationTime) => bookingCalendarApplicationTimeFactory(apiBookingApplicationTime)) : []);
1446
1489
 
1447
1490
  const bookingSettingsFactory = (apiBookingSettings) => new BookingSettings(apiBookingSettings.id, apiBookingSettings.club_id, apiBookingSettings.calendar_step, apiBookingSettings.calendar_min_time, apiBookingSettings.calendar_max_time, apiBookingSettings.require_team_on_closed_session);
1448
1491
 
@@ -1515,14 +1558,21 @@ const memberTypeFactory = (apiMemberType) => new MemberType(apiMemberType.id, ap
1515
1558
 
1516
1559
  const memberPublicFormFactory = (apiMemberPublicForm) => {
1517
1560
  const fields = new Map();
1561
+ const member_fields = new Map();
1562
+ if (apiMemberPublicForm.member_fields) {
1563
+ Object.entries(apiMemberPublicForm.member_fields)
1564
+ .forEach(([key, field]) => {
1565
+ member_fields.set(key, memberPublicFormFieldFactory(field));
1566
+ });
1567
+ }
1518
1568
  if (apiMemberPublicForm.fields) {
1519
1569
  Object.entries(apiMemberPublicForm.fields)
1520
1570
  .forEach(([key, field]) => {
1521
1571
  fields.set(key, memberPublicFormFieldFactory(field));
1522
1572
  });
1523
1573
  }
1524
- return new MemberPublicForm(apiMemberPublicForm.id, apiMemberPublicForm.active_from, apiMemberPublicForm.active_to, apiMemberPublicForm.user_token, apiMemberPublicForm.comment, apiMemberPublicForm.dataprotection_policy_choice, apiMemberPublicForm.dataprotection_policy_url, fields, apiMemberPublicForm.full_text, apiMemberPublicForm.has_nationality_field, apiMemberPublicForm.max_members_per_team, apiMemberPublicForm.max_registered_in_form_total, apiMemberPublicForm.member_types && apiMemberPublicForm.member_types.length ?
1525
- apiMemberPublicForm.member_types.map((memberType) => memberTypeFactory(memberType)) : [], apiMemberPublicForm.member_type_help_text, apiMemberPublicForm.name, apiMemberPublicForm.num_chars_birth_date, apiMemberPublicForm.num_registered, apiMemberPublicForm.role_help_text, apiMemberPublicForm.roles && apiMemberPublicForm.roles.length
1574
+ return new MemberPublicForm(apiMemberPublicForm.id, apiMemberPublicForm.active_from, apiMemberPublicForm.active_to, apiMemberPublicForm.user_token, apiMemberPublicForm.comment, apiMemberPublicForm.dataprotection_policy_choice, apiMemberPublicForm.dataprotection_policy_url, fields, apiMemberPublicForm.full_text, apiMemberPublicForm.has_nationality_field, apiMemberPublicForm.max_members_per_team, apiMemberPublicForm.max_registered_in_form_total, member_fields, apiMemberPublicForm.member_types && apiMemberPublicForm.member_types.length ?
1575
+ apiMemberPublicForm.member_types.map((memberType) => memberTypeFactory(memberType)) : [], apiMemberPublicForm.member_type_help_text, apiMemberPublicForm.name, apiMemberPublicForm.num_chars_birth_date, apiMemberPublicForm.num_registered, apiMemberPublicForm.registered, apiMemberPublicForm.register_family, apiMemberPublicForm.role_help_text, apiMemberPublicForm.roles && apiMemberPublicForm.roles.length
1526
1576
  ? apiMemberPublicForm.roles.map((role) => groupRoleFactory(role)) : [], apiMemberPublicForm.team_help_text, apiMemberPublicForm.teams && apiMemberPublicForm.teams.length
1527
1577
  ? apiMemberPublicForm.teams.map((team) => searchTeamFactory(team)) : [], apiMemberPublicForm.url);
1528
1578
  };
@@ -1619,10 +1669,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1619
1669
  }]
1620
1670
  }], ctorParameters: function () { return [{ type: ApiService }]; } });
1621
1671
 
1622
- const activityLocationGroupFactory = (apiActivityLocationGroup) => {
1623
- return new ActivityLocationGroup(apiActivityLocationGroup.id, apiActivityLocationGroup.club_id, apiActivityLocationGroup.section_id, apiActivityLocationGroup.active, apiActivityLocationGroup.name, apiActivityLocationGroup.locations && apiActivityLocationGroup.locations.length ? apiActivityLocationGroup.locations.map((apiActivityLocation) => activityLocationFactory(apiActivityLocation)) : []);
1624
- };
1625
-
1626
1672
  const MEMBER_ACTIVITY_INVITE_PATH = ':memberId/activities/:activityInviteId/';
1627
1673
  const MEMBER_ACTIVITY_INVITES_PATH = ':memberId/activities/';
1628
1674
  const MEMBER_CALENDAR_PATH = ':memberId/activities/calendar/';
@@ -1638,9 +1684,10 @@ const TEAM_ACTIVITY_SETTINGS_PATH = ':teamId/activities/settings/';
1638
1684
  const CLUB_ACTIVITY_SETTINGS_PATH = ':clubId/activities/settings/';
1639
1685
  const TEAM_ACTIVITY_TYPES_PATH = ':teamId/activities/types/';
1640
1686
  const TEAM_CALENDAR_PATH = ':teamId/activities/calendar/';
1641
- const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1642
1687
  const CLUB_ACTIVITY_LOCATIONS_PATH = ':clubId/activities/locations/';
1643
1688
  const CLUB_ACTIVITY_LOCATION_GROUPS_PATH = ':clubId/activities/locations/groups/';
1689
+ const TEAM_ACTIVITY_LOCATIONS_PATH = ':teamId/activities/locations/';
1690
+ const TEAM_ACTIVITY_LOCATION_GROUPS_PATH = ':teamId/activities/locations/groups/';
1644
1691
  class ActivityService {
1645
1692
  constructor(apiService) {
1646
1693
  this.apiService = apiService;
@@ -1733,6 +1780,12 @@ class ActivityService {
1733
1780
  this.activityLocationCollection = activityLocationCollection;
1734
1781
  }));
1735
1782
  }
1783
+ getActivityLocationGroups(role, clubOrTeamId) {
1784
+ if (role == Role.ClubAdmin) {
1785
+ return this.getClubActivityLocationGroups(clubOrTeamId);
1786
+ }
1787
+ return this.getTeamActivityLocationGroups(clubOrTeamId);
1788
+ }
1736
1789
  getClubActivityLocationGroups(clubId) {
1737
1790
  if (this.activityLocationGroupResponseDate && this.activityLocationGroupResponseDate > sub(new Date(), { hours: 1 })) {
1738
1791
  return of(this.activityLocationGroupCollection);
@@ -1743,6 +1796,16 @@ class ActivityService {
1743
1796
  this.activityLocationGroupCollection = activityLocationGroupCollection;
1744
1797
  }));
1745
1798
  }
1799
+ getTeamActivityLocationGroups(teamId) {
1800
+ if (this.activityLocationGroupResponseDate && this.activityLocationGroupResponseDate > sub(new Date(), { hours: 1 })) {
1801
+ return of(this.activityLocationGroupCollection);
1802
+ }
1803
+ return this.apiService
1804
+ .getCollection(activityLocationGroupFactory, Role.TeamAdmin, TEAM_ACTIVITY_LOCATION_GROUPS_PATH, { teamId }, { params: { limit: 'null' } }).pipe(tap((activityLocationGroupCollection) => {
1805
+ this.activityLocationGroupResponseDate = new Date();
1806
+ this.activityLocationGroupCollection = activityLocationGroupCollection;
1807
+ }));
1808
+ }
1746
1809
  getTeamActivityNew(teamId) {
1747
1810
  return this.apiService
1748
1811
  .getResource(activityFactory, Role.TeamAdmin, TEAM_ACTIVITY_NEW_PATH, { teamId });
@@ -1754,6 +1817,12 @@ class ActivityService {
1754
1817
  activityId
1755
1818
  }, { params: { limit: 'null' } });
1756
1819
  }
1820
+ getActivitySettings(role, clubOrTeamId) {
1821
+ if (role === Role.ClubAdmin) {
1822
+ return this.getClubActivitySettings(clubOrTeamId);
1823
+ }
1824
+ return this.getTeamActivitySettings(clubOrTeamId);
1825
+ }
1757
1826
  getTeamActivitySettings(teamId) {
1758
1827
  return this.apiService
1759
1828
  .getResource(activitySettingsFactory, Role.TeamAdmin, TEAM_ACTIVITY_SETTINGS_PATH, {
@@ -1861,6 +1930,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
1861
1930
  const CLUB_BOOKING_CALENDARS_PATH = ':clubId/activities/calendars/';
1862
1931
  const CLUB_BOOKING_CALENDAR_PATH = ':clubId/activities/calendars/:id/';
1863
1932
  const CLUB_BOOKING_CALENDAR_SLOTS_PATH = ':clubId/activities/slots/';
1933
+ const CLUB_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH = ':clubId/activities/slots/application-times/';
1864
1934
  const CLUB_BOOKING_CALENDAR_SLOTS_COPY_PATH = ':clubId/activities/slots/copy/';
1865
1935
  const CLUB_BOOKING_CALENDAR_SLOTS_CLEAR_PATH = ':clubId/activities/slots/clear/';
1866
1936
  const CLUB_BOOKING_CALENDAR_SLOT_PATH = ':clubId/activities/slots/:id/';
@@ -1868,6 +1938,15 @@ const CLUB_BOOKING_CALENDAR_REPEATABLE_SLOT_PATH = ':clubId/activities/slots/:id
1868
1938
  const CLUB_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':clubId/activities/sessions/';
1869
1939
  const CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':clubId/activities/sessions/:id/';
1870
1940
  const CLUB_BOOKING_SETTINGS_PATH = ':clubId/activities/booking-settings/';
1941
+ const CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':clubId/activities/application-times/:id/';
1942
+ const TEAM_BOOKING_CALENDARS_PATH = ':teamId/activities/calendars/';
1943
+ const TEAM_BOOKING_CALENDAR_SLOTS_PATH = ':teamId/activities/slots/';
1944
+ const TEAM_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH = ':teamId/activities/slots/application-times/';
1945
+ const TEAM_BOOKING_SETTINGS_PATH = ':teamId/activities/booking-settings/';
1946
+ const TEAM_BOOKING_CALENDAR_SLOT_SESSIONS_PATH = ':teamId/activities/sessions/';
1947
+ const TEAM_BOOKING_CALENDAR_SLOT_SESSION_PATH = ':teamId/activities/sessions/:id/';
1948
+ const TEAM_BOOKING_CALENDAR_APPLICATION_TIMES_PATH = ':teamId/activities/application-times/';
1949
+ const TEAM_BOOKING_CALENDAR_APPLICATION_TIME_PATH = ':teamId/activities/application-times/:id/';
1871
1950
  class BookingCalendarService {
1872
1951
  constructor(apiService) {
1873
1952
  this.apiService = apiService;
@@ -1880,6 +1959,12 @@ class BookingCalendarService {
1880
1959
  clubId,
1881
1960
  }, calendar);
1882
1961
  }
1962
+ getBookingCalendars(role, clubOrTeamId, name = null) {
1963
+ if (role == Role.ClubAdmin) {
1964
+ return this.getClubBookingCalendars(clubOrTeamId, name);
1965
+ }
1966
+ return this.getTeamBookingCalendars(clubOrTeamId, name);
1967
+ }
1883
1968
  getClubBookingCalendars(clubId, name = null) {
1884
1969
  const params = { limit: 'null' };
1885
1970
  if (name) {
@@ -1890,6 +1975,16 @@ class BookingCalendarService {
1890
1975
  params
1891
1976
  });
1892
1977
  }
1978
+ getTeamBookingCalendars(teamId, name = null) {
1979
+ const params = { limit: 'null' };
1980
+ if (name) {
1981
+ params['name'] = name;
1982
+ }
1983
+ return this.apiService
1984
+ .getCollection(bookingCalendarFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDARS_PATH, { teamId }, {
1985
+ params
1986
+ });
1987
+ }
1893
1988
  getClubBookingCalendar(clubId, id) {
1894
1989
  return this.apiService
1895
1990
  .getResource(bookingCalendarFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_PATH, { clubId, id });
@@ -1917,6 +2012,12 @@ class BookingCalendarService {
1917
2012
  clubId,
1918
2013
  }, slot);
1919
2014
  }
2015
+ getBookingCalendarSlots(role, clubOrTeamId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
2016
+ if (role == Role.ClubAdmin) {
2017
+ return this.getClubBookingCalendarSlots(clubOrTeamId, startDate, endDate, calendarIds, locationIds, teamIds, hasOpenSessions);
2018
+ }
2019
+ return this.getTeamBookingCalendarSlots(clubOrTeamId, startDate, endDate, calendarIds, locationIds, teamIds, hasOpenSessions);
2020
+ }
1920
2021
  getClubBookingCalendarSlots(clubId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
1921
2022
  const params = { limit: 'null' };
1922
2023
  if (startDate) {
@@ -1942,6 +2043,87 @@ class BookingCalendarService {
1942
2043
  params
1943
2044
  });
1944
2045
  }
2046
+ getTeamBookingCalendarSlots(teamId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
2047
+ const params = { limit: 'null' };
2048
+ if (startDate) {
2049
+ params['day__gte'] = startDate;
2050
+ }
2051
+ if (endDate) {
2052
+ params['day__lte'] = endDate;
2053
+ }
2054
+ if (calendarIds && calendarIds.length) {
2055
+ params['calendar_id'] = calendarIds.join(',');
2056
+ }
2057
+ if (locationIds && locationIds.length) {
2058
+ params['location_id'] = locationIds.join(',');
2059
+ }
2060
+ if (teamIds && teamIds.length) {
2061
+ params['team_id'] = teamIds.join(',');
2062
+ }
2063
+ if (typeof hasOpenSessions === 'boolean') {
2064
+ params['has_open_sessions'] = String(hasOpenSessions);
2065
+ }
2066
+ return this.apiService
2067
+ .getCollection(bookingCalendarSlotFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOTS_PATH, { teamId }, {
2068
+ params
2069
+ });
2070
+ }
2071
+ getBookingCalendarApplicationTimeSlots(role, clubOrTeamId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
2072
+ if (role == Role.ClubAdmin) {
2073
+ return this.getClubBookingCalendarApplicationTimeSlots(clubOrTeamId, startDate, endDate, calendarIds, locationIds, teamIds, hasOpenSessions);
2074
+ }
2075
+ return this.getTeamBookingCalendarApplicationTimeSlots(clubOrTeamId, startDate, endDate, calendarIds, locationIds, teamIds, hasOpenSessions);
2076
+ }
2077
+ getClubBookingCalendarApplicationTimeSlots(clubId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
2078
+ const params = { limit: 'null' };
2079
+ if (startDate) {
2080
+ params['day__gte'] = startDate;
2081
+ }
2082
+ if (endDate) {
2083
+ params['day__lte'] = endDate;
2084
+ }
2085
+ if (calendarIds && calendarIds.length) {
2086
+ params['calendar_id'] = calendarIds.join(',');
2087
+ }
2088
+ if (locationIds && locationIds.length) {
2089
+ params['location_id'] = locationIds.join(',');
2090
+ }
2091
+ if (teamIds && teamIds.length) {
2092
+ params['team_id'] = teamIds.join(',');
2093
+ }
2094
+ if (typeof hasOpenSessions === 'boolean') {
2095
+ params['has_open_sessions'] = String(hasOpenSessions);
2096
+ }
2097
+ return this.apiService
2098
+ .getCollection(bookingCalendarSlotFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH, { clubId }, {
2099
+ params
2100
+ });
2101
+ }
2102
+ getTeamBookingCalendarApplicationTimeSlots(teamId, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
2103
+ const params = { limit: 'null' };
2104
+ if (startDate) {
2105
+ params['day__gte'] = startDate;
2106
+ }
2107
+ if (endDate) {
2108
+ params['day__lte'] = endDate;
2109
+ }
2110
+ if (calendarIds && calendarIds.length) {
2111
+ params['calendar_id'] = calendarIds.join(',');
2112
+ }
2113
+ if (locationIds && locationIds.length) {
2114
+ params['location_id'] = locationIds.join(',');
2115
+ }
2116
+ if (teamIds && teamIds.length) {
2117
+ params['team_id'] = teamIds.join(',');
2118
+ }
2119
+ if (typeof hasOpenSessions === 'boolean') {
2120
+ params['has_open_sessions'] = String(hasOpenSessions);
2121
+ }
2122
+ return this.apiService
2123
+ .getCollection(bookingCalendarSlotFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOTS_APPLICATION_TIMES_PATH, { teamId }, {
2124
+ params
2125
+ });
2126
+ }
1945
2127
  copyClubBookingCalendarSlots(clubId, weekRelativeIndexes, onlyCopySlots = false, startDate = null, endDate = null, calendarIds = null, locationIds = null, teamIds = null, hasOpenSessions = null) {
1946
2128
  const params = { limit: 'null' };
1947
2129
  if (startDate) {
@@ -2027,6 +2209,12 @@ class BookingCalendarService {
2027
2209
  }
2028
2210
  // endregion
2029
2211
  // region Booking calendar slot session
2212
+ createBookingCalendarSlotSession(role, clubOrTeamId, session) {
2213
+ if (role === Role.ClubAdmin) {
2214
+ return this.createClubBookingCalendarSlotSession(clubOrTeamId, session);
2215
+ }
2216
+ return this.createTeamBookingCalendarSlotSession(clubOrTeamId, session);
2217
+ }
2030
2218
  createClubBookingCalendarSlotSession(clubId, session) {
2031
2219
  delete session.id;
2032
2220
  return this.apiService
@@ -2034,6 +2222,13 @@ class BookingCalendarService {
2034
2222
  clubId,
2035
2223
  }, session);
2036
2224
  }
2225
+ createTeamBookingCalendarSlotSession(teamId, session) {
2226
+ delete session.id;
2227
+ return this.apiService
2228
+ .postResource(bookingCalendarSlotSessionFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOT_SESSIONS_PATH, {
2229
+ teamId,
2230
+ }, session);
2231
+ }
2037
2232
  getClubBookingCalendarSlotSessions(clubId, startDate = null, endDate = null) {
2038
2233
  const params = { limit: 'null' };
2039
2234
  if (startDate) {
@@ -2051,6 +2246,12 @@ class BookingCalendarService {
2051
2246
  return this.apiService
2052
2247
  .getResource(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, { clubId, id });
2053
2248
  }
2249
+ updateBookingCalendarSlotSession(role, clubOrTeamId, session) {
2250
+ if (role === Role.ClubAdmin) {
2251
+ return this.updateClubBookingCalendarSlotSession(clubOrTeamId, session);
2252
+ }
2253
+ return this.updateTeamBookingCalendarSlotSession(clubOrTeamId, session);
2254
+ }
2054
2255
  updateClubBookingCalendarSlotSession(clubId, session) {
2055
2256
  return this.apiService
2056
2257
  .updateResource(bookingCalendarSlotSessionFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
@@ -2058,6 +2259,19 @@ class BookingCalendarService {
2058
2259
  id: session.id
2059
2260
  }, session);
2060
2261
  }
2262
+ updateTeamBookingCalendarSlotSession(teamId, session) {
2263
+ return this.apiService
2264
+ .updateResource(bookingCalendarSlotSessionFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
2265
+ teamId,
2266
+ id: session.id
2267
+ }, session);
2268
+ }
2269
+ deleteBookingCalendarSlotSession(role, clubOrTeamId, id) {
2270
+ if (role == Role.ClubAdmin) {
2271
+ return this.deleteClubBookingCalendarSlotSession(clubOrTeamId, id);
2272
+ }
2273
+ return this.deleteTeamBookingCalendarSlotSession(clubOrTeamId, id);
2274
+ }
2061
2275
  deleteClubBookingCalendarSlotSession(clubId, id) {
2062
2276
  return this.apiService
2063
2277
  .deleteResource(Role.ClubAdmin, CLUB_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
@@ -2065,18 +2279,65 @@ class BookingCalendarService {
2065
2279
  id
2066
2280
  });
2067
2281
  }
2282
+ deleteTeamBookingCalendarSlotSession(teamId, id) {
2283
+ return this.apiService
2284
+ .deleteResource(Role.TeamAdmin, TEAM_BOOKING_CALENDAR_SLOT_SESSION_PATH, {
2285
+ teamId,
2286
+ id
2287
+ });
2288
+ }
2068
2289
  // endregion
2069
2290
  // region Booking Setting
2291
+ getBookingSettings(role, clubOrTeamId) {
2292
+ if (role == Role.ClubAdmin) {
2293
+ return this.getClubBookingSettings(clubOrTeamId);
2294
+ }
2295
+ return this.getTeamBookingSettings(clubOrTeamId);
2296
+ }
2070
2297
  getClubBookingSettings(clubId) {
2071
2298
  return this.apiService
2072
2299
  .getResource(bookingSettingsFactory, Role.ClubAdmin, CLUB_BOOKING_SETTINGS_PATH, { clubId });
2073
2300
  }
2301
+ getTeamBookingSettings(teamId) {
2302
+ return this.apiService
2303
+ .getResource(bookingSettingsFactory, Role.TeamAdmin, TEAM_BOOKING_SETTINGS_PATH, { teamId });
2304
+ }
2074
2305
  updateClubBookingSettings(clubId, bookingSettings) {
2075
2306
  return this.apiService
2076
2307
  .updateResource(bookingSettingsFactory, Role.ClubAdmin, CLUB_BOOKING_SETTINGS_PATH, {
2077
2308
  clubId,
2078
2309
  }, bookingSettings);
2079
2310
  }
2311
+ // endregion
2312
+ // region Booking Calendar Application Times
2313
+ updateClubBookingCalendarApplicationTime(clubId, availableTime) {
2314
+ return this.apiService
2315
+ .updateResource(bookingCalendarApplicationTimeFactory, Role.ClubAdmin, CLUB_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
2316
+ clubId,
2317
+ id: availableTime.id
2318
+ }, availableTime);
2319
+ }
2320
+ createTeamBookingCalendarApplicationTime(teamId, availableTime) {
2321
+ delete availableTime.id;
2322
+ return this.apiService
2323
+ .postResource(bookingCalendarApplicationTimeFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_APPLICATION_TIMES_PATH, {
2324
+ teamId,
2325
+ }, availableTime);
2326
+ }
2327
+ updateTeamBookingCalendarApplicationTime(teamId, availableTime) {
2328
+ return this.apiService
2329
+ .updateResource(bookingCalendarApplicationTimeFactory, Role.TeamAdmin, TEAM_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
2330
+ teamId,
2331
+ id: availableTime.id
2332
+ }, availableTime);
2333
+ }
2334
+ deleteTeamBookingCalendarApplicationTime(teamId, id) {
2335
+ return this.apiService
2336
+ .deleteResource(Role.TeamAdmin, TEAM_BOOKING_CALENDAR_APPLICATION_TIME_PATH, {
2337
+ teamId,
2338
+ id
2339
+ });
2340
+ }
2080
2341
  }
2081
2342
  BookingCalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: BookingCalendarService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
2082
2343
  BookingCalendarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: BookingCalendarService, providedIn: 'root' });
@@ -3136,5 +3397,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImpo
3136
3397
  * Generated bundle index. Do not edit.
3137
3398
  */
3138
3399
 
3139
- export { APP, Activity, ActivityExtraMember, ActivityInvite, ActivityLocation, ActivityLocationGroup, ActivityService, ActivitySettings, ActivityType, Auth, AuthMember, AuthSection, AuthService, AuthTeam, AuthTeamSection, AuthenticatedGuard, Authentication, AuthenticationInterceptor, AuthenticationService, BookingCalendar, BookingCalendarService, BookingCalendarSlot, BookingCalendarSlotSession, BookingSettings, Calendar, CalendarEvent, Card, CardDeal, CardLogo, CardLogoUrls, CardMemberTicket, CardTheme, CardTicket, CardTicketLocation, Club, ClubImage, ClubSection, ClubService, Collection, ConstantService, Contact, CreditCard, DataAccessModule, Directory, Email, EmailService, Event, ExternalLink, ExternalLinkService, FileObject, FileService, GeneralImage, Giro, GroupRole, HandleGrantTokenGuard, HomeTeam, ImageUrls, InvoiceService, Member, MemberActivityInvite, MemberAttribute, MemberCard, MemberCardService, MemberContact, MemberFee, MemberFunction, MemberInvoice, MemberInvoiceRow, MemberPublicForm, MemberPublicFormField, MemberPublicFormFieldOption, MemberPublicFormService, MemberService, MemberTeam, MemberTeamThrough, MemberType, MemberValidationSettings, News, NewsService, Partner, PaymentAttempt, PaymentAttemptService, Role, SearchClub, SearchMember, SearchMemberCard, SearchMemberInvoice, SearchTeam, Section, SectionService, Swish, SwishQrCode, TeamService, Token, TokenService, USER_NOTIFICATIONS_PATH, UnpaidMemberInvoice, User, UserNotification, UserNotificationService, UserService, Zimpler };
3400
+ export { APP, Activity, ActivityExtraMember, ActivityInvite, ActivityLocation, ActivityLocationGroup, ActivityService, ActivitySettings, ActivityType, Auth, AuthMember, AuthSection, AuthService, AuthTeam, AuthTeamSection, AuthenticatedGuard, Authentication, AuthenticationInterceptor, AuthenticationService, BookingCalendar, BookingCalendarApplicationTime, BookingCalendarService, BookingCalendarSlot, BookingCalendarSlotSession, BookingSettings, Calendar, CalendarEvent, Card, CardDeal, CardLogo, CardLogoUrls, CardMemberTicket, CardTheme, CardTicket, CardTicketLocation, Club, ClubImage, ClubSection, ClubService, Collection, ConstantService, Contact, CreditCard, DataAccessModule, Directory, Email, EmailService, Event, ExternalLink, ExternalLinkService, FileObject, FileService, GeneralImage, Giro, GroupRole, HandleGrantTokenGuard, HomeTeam, ImageUrls, InvoiceService, Member, MemberActivityInvite, MemberAttribute, MemberCard, MemberCardService, MemberContact, MemberFee, MemberFunction, MemberInvoice, MemberInvoiceRow, MemberPublicForm, MemberPublicFormField, MemberPublicFormFieldOption, MemberPublicFormService, MemberService, MemberTeam, MemberTeamThrough, MemberType, MemberValidationSettings, News, NewsService, Partner, PaymentAttempt, PaymentAttemptService, Role, SearchClub, SearchMember, SearchMemberCard, SearchMemberInvoice, SearchTeam, Section, SectionService, Swish, SwishQrCode, TeamService, Token, TokenService, USER_NOTIFICATIONS_PATH, UnpaidMemberInvoice, User, UserNotification, UserNotificationService, UserService, Zimpler };
3140
3401
  //# sourceMappingURL=myclub_se-data-access.mjs.map