From 61ad461226b1535440d34d068eeaa325dc4769eb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 12 Sep 2023 18:25:41 +0200 Subject: [PATCH] wip appointments blocked when inactive --- src/client/app/js/app/core/Dict.js | 12 +- src/client/app/js/app/model/Appointment.js | 8 +- src/client/app/js/app/model/Group.js | 6 + .../app/js/app/state/GroupDetailEdit.js | 1 + src/client/app/js/app/state/Home.js | 43 +- src/client/app/tmpl/auth-login.html | 3 +- src/client/app/tmpl/group-detail-edit.html | 14 + .../app/tmpl/home-appointment-item.html | 486 +++++++++--------- src/client/app/tmpl/home.html | 30 +- .../control/TB_Server_Control_Appointment.php | 2 + .../server/control/TB_Server_Control_Auth.php | 2 +- .../server/control/TB_Server_Control_Team.php | 3 +- .../TB_Shared_Ent_TeamData_Appointment.php | 12 +- .../TB_Shared_Ent_TeamData_Profile.php | 8 +- .../teamdata/TB_Shared_Ent_TeamData_Team.php | 1 + ...ofile.php => 1addActiveStateToProfile.php} | 0 ...am.php => 2addDbTermsConditionsToTeam.php} | 0 ...ile.php => 3addTermsAcceptedToProfile.php} | 0 tools/patches/4addDbNewUsersActive.php | 18 + 19 files changed, 363 insertions(+), 286 deletions(-) rename tools/patches/{addActiveStateToProfile.php => 1addActiveStateToProfile.php} (100%) rename tools/patches/{addTermsConditionsToTeam.php => 2addDbTermsConditionsToTeam.php} (100%) rename tools/patches/{addTermsAcceptedToProfile.php => 3addTermsAcceptedToProfile.php} (100%) create mode 100644 tools/patches/4addDbNewUsersActive.php diff --git a/src/client/app/js/app/core/Dict.js b/src/client/app/js/app/core/Dict.js index 2ce1455..649eda3 100644 --- a/src/client/app/js/app/core/Dict.js +++ b/src/client/app/js/app/core/Dict.js @@ -240,6 +240,8 @@ app.core.Dict = { "EDIT_GROUP" : "Gruppe bearbeiten", "GROUP_NAME" : "Gruppenname", "GROUP_DESCRIPTION" : "Beschreibung", + "GROUP_NEW_USERS_ACTIVE": "Erweiterte Sicherheit", + "GROUP_NEW_USERS_ACTIVE_CHECKBOX": "Hiermit deaktiviere ich die erweiterte Sicherheit im Anmeldeprozess und setze alle neuen Teilnehmer automatisch auf aktiv.", "GROUP_TERMS": "Nutzungsbedingungen", "GROUP_TERMS_ACCEPT": "akzeptieren", "GROUP_TERMS_ACCEPTED": "Du hast die Nutzungsbedingungen akzeptiert", @@ -420,14 +422,13 @@ app.core.Dict = { "REGISTRATION_INCOMPLETE" : "Validierung fehlgeschlagen.", "REGISTRATION_INCOMPLETE_INFO" : "Bitte melde dich beim ProBuddy Support Team.", "REGISTRATION_EMAIL_PROVIDED" : "Du hast dich mit folgender Emailadresse registriert:", - "REGISTRATION_SUCCESS_EMAIL_CHECK_NOTE" : "Bitte prüfe, ob du die Emailadresse korrekt eingetragen hast bzw. ob es auch die richtige Emailadresse ist! Sollte die Emailadresse nicht korrekt sein, logge dich erneut mit der nicht korrekten Emailadresse ein. Nach dem Login hast die die Möglichkeit die Emailadresse zu ändern.", - "REGISTRATION_EMAIL_CHECK_NOTE" : "Bitte prüfe, ob du die Emailadresse korrekt eingetragen hast bzw. ob es auch die richtige Emailadresse ist!", - "REGISTRATION_EMAIL_CHANGE_NOTE" : "Du hast hier die Möglichkeit deine, noch nicht validierte, Emailadresse zu ändern. Wenn du deine Emailadresse geändert hast, versuche dich mit deiner neuen Emailadresse einzuloggen. Danach wirst du eine neue Verifizierungs-Email erhalten.", + "REGISTRATION_SUCCESS_EMAIL_CHECK_NOTE" : "Bitte prüfe, ob du die Emailadresse korrekt eingetragen hast bzw. ob diese korrekt ist! Sollte die Emailadresse nicht korrekt sein, logge dich dennoch erneut mit dieser Emailadresse ein. Nach dem Login hast die die Möglichkeit die Emailadresse zu ändern.", + "REGISTRATION_EMAIL_CHECK_NOTE" : "Ist diese Adresse korrekt? Sonst kannst Du Sie hier nochmals korrigieren, danach wird eine neue Verifizierungsmail versendet.", "REGISTRATION_EMAIL_CHANGE_BTN" : "Email ändern", "REGISTRATION_EMAIL_CHANGED_SUCCESS" : "Deine Emailadresse wurde erfolgreich geändert.", "REGISTRATION_EMAIL_CHANGED_SUCCESS_INFO" : "Deine Emailadresse wurde erfolgreich geändert. Gehe nun zurück zum Login und versuche nun dich mit deiner neuen Emailadresse einzuloggen, um eine neue Verifizierungsmail zu erhalten.", "ACCOUNT_NOT_VALIDATED" : "Email noch nicht validiert!", - "ACCOUNT_NOT_VALIDATED_DESCRIPTION" : "Bitte validiere zunächst deine Email Adresse. Wir haben dir gerade erneut einen Validierungslink per Mail zugeschickt. Bitte schau in deinem Postfach nach (ggf. auch im Spam-Ordner) und klicke auf den Button.", + "ACCOUNT_NOT_VALIDATED_DESCRIPTION" : "Bitte validiere zunächst deine Email Adresse. Wir haben dir gerade einen Validierungslink per Mail zugeschickt. Bitte schau in deinem Postfach nach (ggf. auch im Spam-Ordner) und klicke auf den Button.", "LOGIN_FIRSTNAME" : "Vorname", "LOGIN_LASTNAME" : "Nachname", "DELETION_GROUP_OWNER_INFO_HEADLINE" : "Informationen zur Löschung deines Profils", @@ -582,6 +583,9 @@ app.core.Dict = { "HOME_MODAL_NOT_ACTIVATED_BUTTON" : "Profil vervollständigen", "HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE" : "Nutzungsbedingungen akzeptieren", "HOME_MODAL_TERMS_NOT_ACCEPTED_TEXT" : "Folgende Gruppen haben Nutzungsbedingungen, die Du noch akzeptieren musst, um auf Deine Termine zugreifen zu können.", + "HOME_GROUPS_NOT_ACTIVE_TEXT1" : "Dein Profil ist für folgende Gruppen nicht aktiviert: ", + "HOME_GROUPS_NOT_ACTIVE_TEXT2" : "Deswegen kannst Du noch nicht zu Terminen zusagen oder Termindetails sehen. Bitte wende Dich an Deinen Gruppeninhaber oder Admin.", + "HOME_GROUPS_NOT_ACTIVE_BTN" : "Zur Gruppenübersicht", }, "en" : { } diff --git a/src/client/app/js/app/model/Appointment.js b/src/client/app/js/app/model/Appointment.js index b01769d..35dbc1c 100644 --- a/src/client/app/js/app/model/Appointment.js +++ b/src/client/app/js/app/model/Appointment.js @@ -31,7 +31,8 @@ app.model.Appointment = function( appData, attendees, attendeeProfiles ) mStart = app.util.Helper.getMomentFromUTCTime( data.start_dt ), mEnd = app.util.Helper.getMomentFromUTCTime( data.end_dt ), mDeadline = app.util.Helper.getMomentFromUTCTime( data.deadline_dt ), - mDeadlineReject = app.util.Helper.getMomentFromUTCTime( data.deadline_reject_dt ); + mDeadlineReject = app.util.Helper.getMomentFromUTCTime( data.deadline_reject_dt ), + v_profile_can_attend = data.v_profile_can_attend || null; // Process attendee data in order to fix correct status date for ( var ai = 0; ai < attendees.length; ai++ ) @@ -730,6 +731,11 @@ app.model.Appointment = function( appData, attendees, attendeeProfiles ) return cName; }; + this.getVProfileCanAttend = function () + { + return v_profile_can_attend; + } + }; app.model.Appointment.ENUM_VISIBLE_FOR_ALL = 'ALL'; diff --git a/src/client/app/js/app/model/Group.js b/src/client/app/js/app/model/Group.js index 589cafb..f9b5bfa 100644 --- a/src/client/app/js/app/model/Group.js +++ b/src/client/app/js/app/model/Group.js @@ -19,6 +19,7 @@ app.model.Group = function( data, memberData ) termsConditions = data.terms_conditions || null, termsConditionsActive = data.terms_conditions_active == 1, contactInformation = data.contact_information || null, + newUsersActive = data.new_users_active == 1, emblemUrl = data.emblem_url || null, emblem_cloud_id = data.emblem_cloud_id || null, memberData = memberData || null, @@ -118,6 +119,11 @@ app.model.Group = function( data, memberData ) return contactInformation; }; + this.getNewUsersActive = function() + { + return newUsersActive; + }; + /** * * @returns {*} diff --git a/src/client/app/js/app/state/GroupDetailEdit.js b/src/client/app/js/app/state/GroupDetailEdit.js index aabcbc1..8876204 100644 --- a/src/client/app/js/app/state/GroupDetailEdit.js +++ b/src/client/app/js/app/state/GroupDetailEdit.js @@ -41,6 +41,7 @@ app.state.GroupDetailEdit = function() description: app.util.Helper.trim($form.find('[data-id="textarea-team-description"]').first().val()), termsConditions: app.util.Helper.trim($form.find('[data-id="textarea-team-terms-conditions"]').first().val()), termsConditionsActive: $form.find('[data-id="checkbox-team-terms-conditions-active"]').first().is(":checked"), + newUsersActive: $form.find('[data-id="checkbox-new-users-active"]').first().is(":checked"), contactInformation: app.util.Helper.trim($form.find('[data-id="textarea-team-contactinformation"]').first().val()), industry: $form.find('[data-id="select-team-industry"]').first().val() }, diff --git a/src/client/app/js/app/state/Home.js b/src/client/app/js/app/state/Home.js index 9622434..898931b 100644 --- a/src/client/app/js/app/state/Home.js +++ b/src/client/app/js/app/state/Home.js @@ -227,8 +227,9 @@ app.state.Home = function() self = this, filter = this.getStateSetting( 'filter' ), isBackButton = app.core.StateManager.isPreviousState(), - scrollY = +this.getStateSetting( 'scrollY' ); - groupsTermsNotAccepted = []; + scrollY = +this.getStateSetting( 'scrollY' ), + groupsTermsNotAccepted = [], + groupsNotActiveString = ""; // For paging self.currentPage = 1; @@ -258,6 +259,10 @@ app.state.Home = function() groupsTermsNotAccepted.push(group); } + if (groupData.status !== 'active') { + groupsNotActiveString += groupsNotActiveString === "" ? group.getName() : (" ," + group.getName()); + } + gcgIds = userGroups[ ui ].getCourseCategories(); for ( var gci = 0; gci < gcgIds.length; gci++ ) { @@ -465,7 +470,8 @@ app.state.Home = function() { appointments : pager.pageElements, pager : pager, - filter : filter + filter : filter, + groupsNotActiveString: groupsNotActiveString, } ) ); @@ -1068,37 +1074,36 @@ app.state.Home = function() sessionStorage.removeItem("g_ids_popup_shown"); } - if (groupsTermsNotAccepted.length > 0) { - // Show terms not accepted popup + if (showPopup) { app.core.View.showModal({ - title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), - body: app.core.View.getTemplate('home-modal-terms-not-accepted', { groups: groupsTermsNotAccepted }), + title: _lc('HOME_MODAL_NOT_ACTIVATED_TITLE'), + body: app.core.View.getTemplate('home-modal-not-activated', { groupName: groupName }), hideButtons: true, hideCloseBtn: true, - prohibitCloseModal: true, + cancelButtonText: _lc('HOME_MODAL_NOT_ACTIVATED_BUTTON') }); - $("body").on( 'click', '[data-type="group-accept-link"]', function() + $("body").on( 'click', '[data-id="not-activated"]', function(e) { - var groupId = $(this).data('group-id'); - window.location.hash = "#/group/" + groupId + "/terms"; + e.preventDefault(); app.core.View.closeModal(); + window.location.href = $(this).attr("href"); }); - - } else if (showPopup) { + } else if (groupsTermsNotAccepted.length > 0) { + // Show terms not accepted popup app.core.View.showModal({ - title: _lc('HOME_MODAL_NOT_ACTIVATED_TITLE'), - body: app.core.View.getTemplate('home-modal-not-activated', { groupName: groupName }), + title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), + body: app.core.View.getTemplate('home-modal-terms-not-accepted', { groups: groupsTermsNotAccepted }), hideButtons: true, hideCloseBtn: true, - cancelButtonText: _lc('HOME_MODAL_NOT_ACTIVATED_BUTTON') + prohibitCloseModal: true, }); - $("body").on( 'click', '[data-id="not-activated"]', function(e) + $("body").on( 'click', '[data-type="group-accept-link"]', function() { - e.preventDefault(); + var groupId = $(this).data('group-id'); + window.location.hash = "#/group/" + groupId + "/terms"; app.core.View.closeModal(); - window.location.href = $(this).attr("href"); }); } } diff --git a/src/client/app/tmpl/auth-login.html b/src/client/app/tmpl/auth-login.html index fc86146..19e27ef 100644 --- a/src/client/app/tmpl/auth-login.html +++ b/src/client/app/tmpl/auth-login.html @@ -78,8 +78,7 @@

- <%=raw _lc( 'REGISTRATION_EMAIL_CHECK_NOTE' ) %>
- <%=raw _lc( 'REGISTRATION_EMAIL_CHANGE_NOTE' ) %> + <%=raw _lc( 'REGISTRATION_EMAIL_CHECK_NOTE' ) %>

<%=raw _lc( 'REGISTRATION_EMAIL_CHANGED_SUCCESS_INFO' ) %> diff --git a/src/client/app/tmpl/group-detail-edit.html b/src/client/app/tmpl/group-detail-edit.html index 679440a..39a7419 100644 --- a/src/client/app/tmpl/group-detail-edit.html +++ b/src/client/app/tmpl/group-detail-edit.html @@ -85,6 +85,20 @@ class="form-control" placeholder="<%= _lc( 'TEAM_DETAIL_TEAMDESCRIPTION_PLACEHOLDER' ) %>"><%= group.getDescription() ? group.getDescription() : '' %> +

+ +
+ + > + +
+
-
+ <% if ( a.getVProfileCanAttend() ) { %> +
-
+
- <% if ( a.isDraft() ) { %> + <% if ( a.isDraft() ) { %> -
-
- -
-
+
+
+ +
+
- <% } else { %> + <% } else { %> -
"> - -
+
"> + +
-
-
- -
-
+
+
+ +
+
-
"> -
-
- - - - +
"> +
+
+ + + + +
-
-
+ -
"> -
-
- - - - +
"> +
+
+ + + + +
-
-
+ - <% } %> + <% } %> +
-
+ <% } %>
-
-
-
- <% if ( a.isCancelled() ) { %> -
- <%= _lc( 'APPOINTMENT_HAS_BEEN_CANCELLED' ) %> -
- <% } else if ( !a.hasStarted() && a.isDeadlineOver() ) { %> -
- <%= _lc( 'DEADLINE_IS_OVER' ) %> -
- <% } else if ( a.isMaxAttendeesExceeded() ) { %> - <% var waitingPosition = a.getWaitingPositionForProfileId( app.model.SessionUser.getProfileId() ); %> -
- <% if ( waitingPosition > 0 ) { %> - <%= _lc( 'WAITING_LIST_USER_POSITION', [ waitingPosition ] ) %> - <% } else { %> - <%= _lc( 'BOOKED_OUT_ONLY_WAITING_LIST_AVAILABLE' ) %> - <% } %> -
- <% } else { %> -
- <% } %> -
-
-
-
- - - - - - - - - - - - - - - - - - - - - -
- <%= _lc( 'DEADLINEREJECTTIME' ) %> - - <%= mDeadlineReject.format( 'DD.MMM' ) %> <%= mDeadlineReject.format( 'HH:mm' ) %> Uhr -
- <%= _lc( 'DEADLINETIME' ) %> - - <%= mDeadline.format( 'DD.MMM' ) %> <%= mDeadline.format( 'HH:mm' ) %> Uhr -
- Abrechnungsfaktor - - <%= ('' + a.getPriceFactor().toFixed(2)).replace( '.', ',' ) %> -
- <%= _lc( 'LOCATION' ) %> - - <%=raw a.getLocation() ? a.getLocation() : ( '' + _lc( 'APPOINTMENT_NO_LOCATION' ) + '' ) %> -
- <%= _lc( 'DETAILS' ) %> - - <%=raw a.getComment() ? a.getComment() : ( '' + _lc( 'APPOINTMENT_NO_COMMENT' ) + '' ) %> -
+ <% if ( a.getVProfileCanAttend() ) { %> +
+
+
+ <% if ( a.isCancelled() ) { %> +
+ <%= _lc( 'APPOINTMENT_HAS_BEEN_CANCELLED' ) %> +
+ <% } else if ( !a.hasStarted() && a.isDeadlineOver() ) { %> +
+ <%= _lc( 'DEADLINE_IS_OVER' ) %> +
+ <% } else if ( a.isMaxAttendeesExceeded() ) { %> + <% var waitingPosition = a.getWaitingPositionForProfileId( app.model.SessionUser.getProfileId() ); %> +
+ <% if ( waitingPosition > 0 ) { %> + <%= _lc( 'WAITING_LIST_USER_POSITION', [ waitingPosition ] ) %> + <% } else { %> + <%= _lc( 'BOOKED_OUT_ONLY_WAITING_LIST_AVAILABLE' ) %> + <% } %> +
+ <% } else { %> +
+ <% } %> +
-
- - - - <% let ad, m, cp; %> - <% ad = a.getAttendeeDataByStatus( "accepted" ); %> - + +
- <%= _lc( 'ACCEPTANCE' ) %> (<%= a.getNumAttendeesAccepted() %>) - - <% if ( ad.length > 0 ) { %> +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ <%= _lc( 'DEADLINEREJECTTIME' ) %> + + <%= mDeadlineReject.format( 'DD.MMM' ) %> <%= mDeadlineReject.format( 'HH:mm' ) %> Uhr +
+ <%= _lc( 'DEADLINETIME' ) %> + + <%= mDeadline.format( 'DD.MMM' ) %> <%= mDeadline.format( 'HH:mm' ) %> Uhr +
+ Abrechnungsfaktor + + <%= ('' + a.getPriceFactor().toFixed(2)).replace( '.', ',' ) %> +
+ <%= _lc( 'LOCATION' ) %> + + <%=raw a.getLocation() ? a.getLocation() : ( '' + _lc( 'APPOINTMENT_NO_LOCATION' ) + '' ) %> +
+ <%= _lc( 'DETAILS' ) %> + + <%=raw a.getComment() ? a.getComment() : ( '' + _lc( 'APPOINTMENT_NO_COMMENT' ) + '' ) %> +
+
+
+ + + + <% let ad, m, cp; %> + <% ad = a.getAttendeeDataByStatus( "accepted" ); %> + - - - - <% ad = a.getAttendeeDataByStatus( "waiting" ); %> - + + + + <% ad = a.getAttendeeDataByStatus( "waiting" ); %> + - - - - <% ad = a.getAttendeeDataByStatus( "declined" ); %> - + + + + <% ad = a.getAttendeeDataByStatus( "declined" ); %> + - -
+ <%= _lc( 'ACCEPTANCE' ) %> (<%= a.getNumAttendeesAccepted() %>) + + <% if ( ad.length > 0 ) { %> - <% for ( let ai = 0; ai < ad.length; ai++ ) { %> - <%= ai > 0 ? ' - ' : '' %> - <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> - <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> + <% for ( let ai = 0; ai < ad.length; ai++ ) { %> + <%= ai > 0 ? ' - ' : '' %> + <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> + <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> - <% if ( m ) { %> - <%= m.getName( a.getTeamId() ) %> - <% if ( cp ) { %> - [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% if ( m ) { %> + <%= m.getName( a.getTeamId() ) %> + <% if ( cp ) { %> + [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% } %> + <% } else { %> + Gelöscht <% } %> - <% } else { %> - Gelöscht <% } %> - <% } %> - <% } %> -
- <%= _lc( 'WAITINGLIST' ) %> (<%= a.hasWaitingList() ? a.getNumAttendeesWaiting() : '0' %>) - - <% if ( ad.length > 0 ) { %> - <% for ( let ai = 0; ai < ad.length; ai++ ) { %> - <%= ai > 0 ? ' - ' : '' %> - <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> - <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> + <% } %> +
+ <%= _lc( 'WAITINGLIST' ) %> (<%= a.hasWaitingList() ? a.getNumAttendeesWaiting() : '0' %>) + + <% if ( ad.length > 0 ) { %> + <% for ( let ai = 0; ai < ad.length; ai++ ) { %> + <%= ai > 0 ? ' - ' : '' %> + <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> + <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> - <% if ( m ) { %> - <%= m.getName( a.getTeamId() ) %> - <% if ( cp ) { %> - [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% if ( m ) { %> + <%= m.getName( a.getTeamId() ) %> + <% if ( cp ) { %> + [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% } %> + <% } else { %> + Gelöscht <% } %> - <% } else { %> - Gelöscht <% } %> - <% } %> - <% } %> -
- Absagen (<%= a.getProfileIdsDeclined().length %>) - - <% if ( ad.length > 0 ) { %> - <% for ( let ai = 0; ai < ad.length; ai++ ) { %> - <%= ai > 0 ? ' - ' : '' %> - <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> - <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> - <% if ( m ) { %> - <%= m.getName( a.getTeamId() ) %> - <% if ( cp ) { %> - [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% } %> +
+ Absagen (<%= a.getProfileIdsDeclined().length %>) + + <% if ( ad.length > 0 ) { %> + <% for ( let ai = 0; ai < ad.length; ai++ ) { %> + <%= ai > 0 ? ' - ' : '' %> + <% m = homeState.getMemberByGroupAndProfileId( a.getTeamId(), ad[ ai ].profile_id ); %> + <% cp = m ? m.getChildProfileById( ad[ ai ].profile_child_id ) : null; %> + <% if ( m ) { %> + <%= m.getName( a.getTeamId() ) %> + <% if ( cp ) { %> + [<%=raw m.getChildProfileHtmlTagById( cp.id ) %>] + <% } %> + <% } else { %> + Gelöscht <% } %> - <% } else { %> - Gelöscht <% } %> - <% } %> - <% } %> -
+ <% } %> +
+
-
-
-
- <% if ( false === a.isDraft() ) { %> - - - - <% } %> - <% if ( app.model.SessionUser.canAdministrateTeam( a.getTeamId() ) ) { %> +
+
+ <% if ( false === a.isDraft() ) { %> + + + + <% } %> + <% if ( app.model.SessionUser.canAdministrateTeam( a.getTeamId() ) ) { %> - <% if ( a.isDraft() ) { %> + <% if ( a.isDraft() ) { %> - + - + - + - <% } %> + <% } %> - <% if ( a.isCancelled() || a.isDraft() || a.isOver() ) { %> + <% if ( a.isCancelled() || a.isDraft() || a.isOver() ) { %> - + - <% } else { %> + <% } else { %> - + - <% } %> + <% } %> - <% } %> + <% } %> +
-
+ <% } %>
\ No newline at end of file diff --git a/src/client/app/tmpl/home.html b/src/client/app/tmpl/home.html index 97d1e80..5ac30ac 100644 --- a/src/client/app/tmpl/home.html +++ b/src/client/app/tmpl/home.html @@ -1,6 +1,20 @@ <% var data = this.stash; %> <% var currentUser = app.model.SessionUser.getUserProfile(); %> <% var groupsOwner = currentUser.getGroupsByRole( 'trainer' ), groupDataOwner = groupsOwner.length >= 1 ? groupsOwner[ 0 ] : null; %> + +<% if ( "" !== groupsNotActiveString ) { %> +
+
+
+ + <%= _lc( 'HOME_GROUPS_NOT_ACTIVE_TEXT1' ) %><%= groupsNotActiveString %>
+ <%= _lc( 'HOME_GROUPS_NOT_ACTIVE_TEXT2' ) %> + <%= _lc( 'HOME_GROUPS_NOT_ACTIVE_BTN' ) %> +
+
+
+<% } %> + <% if ( 0 === appointments.length ) { %>

@@ -36,17 +50,15 @@ <% } else { %> - <% if ( true === currentUser.isOlderThanTwoWeeks() && false === currentUser.hasValidAddressData() ) { %> - -
-
-
-  Bitte vervollständigen Sie Ihre Adressdaten. Adressdaten hinterlegen + <% if ( true === currentUser.isOlderThanTwoWeeks() && false === currentUser.hasValidAddressData() ) { %> +
+
+
+  Bitte vervollständigen Sie Ihre Adressdaten. Adressdaten hinterlegen +
-
- - <% } %> + <% } %> <% var monthHeader = null, weekHeader = null, currentMonth, currentWeek, currentWeekMoment, a, mStart, mEnd, mDeadline; %> diff --git a/src/server/server/control/TB_Server_Control_Appointment.php b/src/server/server/control/TB_Server_Control_Appointment.php index 31058d0..37a102b 100644 --- a/src/server/server/control/TB_Server_Control_Appointment.php +++ b/src/server/server/control/TB_Server_Control_Appointment.php @@ -936,6 +936,8 @@ class TB_Server_Control_Appointment { continue; } + $appointment->v_profile_can_attend = $appointment->isAttendableByProfile($profile); + array_push( $accessibleAppointments, $appointment ); // Add attendee information diff --git a/src/server/server/control/TB_Server_Control_Auth.php b/src/server/server/control/TB_Server_Control_Auth.php index bc22b6b..c8efa26 100644 --- a/src/server/server/control/TB_Server_Control_Auth.php +++ b/src/server/server/control/TB_Server_Control_Auth.php @@ -297,7 +297,7 @@ class TB_Server_Control_Auth } // Create team data - $profile->joinTeam( $team->id ); + $profile->joinTeam( $team ); $profile->save(); if ( 0 == $account->is_validated ) diff --git a/src/server/server/control/TB_Server_Control_Team.php b/src/server/server/control/TB_Server_Control_Team.php index e51c9a9..6e41b29 100644 --- a/src/server/server/control/TB_Server_Control_Team.php +++ b/src/server/server/control/TB_Server_Control_Team.php @@ -642,6 +642,7 @@ class TB_Server_Control_Team { $team->description = _xss( $params->get( 'description' ) ); $team->terms_conditions = _xss( $params->get( 'termsConditions' ) ); $team->terms_conditions_active = $params->get( 'termsConditionsActive' ) === true ? 1 : 0; + $team->new_users_active = $params->get( 'newUsersActive' ) === true ? 1 : 0; $team->contact_information = _xss( $params->get( 'contactInformation' ) ); $team->save(); @@ -1091,7 +1092,7 @@ class TB_Server_Control_Team { throw new \Exception( 'Group not found.' ); } - $sessionProfile->joinTeam( $team->id ); + $sessionProfile->joinTeam( $team ); $sessionProfile->save(); $resp->addData( 'profile', $sessionProfile ); diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php index 3b69fdf..ca3d6f8 100644 --- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php +++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php @@ -23,6 +23,7 @@ * @property string|null $comment * @property integer $price_factor * @property string $state + * @property string $v_profile_can_attend */ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row { @@ -380,15 +381,18 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row } } } + return $isVisible; + } - // Check if user is not approved in group yet + public function isAttendableByProfile( TB_Shared_Ent_TeamData_Profile $profile ) + { $profileTeamData = $profile->getTeamsData($this->team_id); + // Check if user is not approved in group yet if ($profileTeamData['status'] === TB_Shared_Ent_TeamData_Profile::STATUS_NOT_APPROVED || $profileTeamData['status'] === TB_Shared_Ent_TeamData_Profile::STATUS_INACTIVE) { - $isVisible = false; + return false; } - - return $isVisible; + return true; } /** diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php index 0d2b92e..637f4e1 100644 --- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php +++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php @@ -490,12 +490,12 @@ class TB_Shared_Ent_TeamData_Profile extends Francis_Db_Row { /** * @param $teamId */ - public function joinTeam( $teamId ) + public function joinTeam( TB_Shared_Ent_TeamData_Team $team ) { // Note: right now - all joins are with role PLAYER only $role = TB_Shared_Ent_TeamData_Profile::ROLE_PLAYER; - if ( $this->isInTeam( $teamId ) ) + if ( $this->isInTeam( $team->id ) ) { return; } @@ -506,11 +506,11 @@ class TB_Shared_Ent_TeamData_Profile extends Francis_Db_Row { $teamsJson = array(); } $teamsJson[] = array( - 'team_id' => $teamId, + 'team_id' => $team->id, 'role' => TB_Shared_Ent_TeamData_Profile::ROLE_PLAYER, 'is_anonymous' => 0, 'join_dt' => TB_Server_Utils_Helper::getUTCNowDateTime(), - 'status' => self::STATUS_NOT_APPROVED, + 'status' => $team->new_users_active ? self::STATUS_ACTIVE : self::STATUS_NOT_APPROVED, 'terms_accepted' => 0 ); diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php index 260b67a..1f5804c 100644 --- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php +++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Team.php @@ -14,6 +14,7 @@ * @property string|NULL $contact_information * @property string|NULL $terms_conditions * @property bool $terms_conditions_active + * @property bool $new_users_active * @property string $emblem_url * @property string $emblem_cloud_id * @property array|null $course_categories_js diff --git a/tools/patches/addActiveStateToProfile.php b/tools/patches/1addActiveStateToProfile.php similarity index 100% rename from tools/patches/addActiveStateToProfile.php rename to tools/patches/1addActiveStateToProfile.php diff --git a/tools/patches/addTermsConditionsToTeam.php b/tools/patches/2addDbTermsConditionsToTeam.php similarity index 100% rename from tools/patches/addTermsConditionsToTeam.php rename to tools/patches/2addDbTermsConditionsToTeam.php diff --git a/tools/patches/addTermsAcceptedToProfile.php b/tools/patches/3addTermsAcceptedToProfile.php similarity index 100% rename from tools/patches/addTermsAcceptedToProfile.php rename to tools/patches/3addTermsAcceptedToProfile.php diff --git a/tools/patches/4addDbNewUsersActive.php b/tools/patches/4addDbNewUsersActive.php new file mode 100644 index 0000000..2924a4c --- /dev/null +++ b/tools/patches/4addDbNewUsersActive.php @@ -0,0 +1,18 @@ +query( $sql ); + + echo "DONE..."; +} + +patch_addTermsConditionsToTeam(); \ No newline at end of file