| @@ -240,7 +240,10 @@ app.core.Dict = { | |||||
| "EDIT_GROUP" : "Gruppe bearbeiten", | "EDIT_GROUP" : "Gruppe bearbeiten", | ||||
| "GROUP_NAME" : "Gruppenname", | "GROUP_NAME" : "Gruppenname", | ||||
| "GROUP_DESCRIPTION" : "Beschreibung", | "GROUP_DESCRIPTION" : "Beschreibung", | ||||
| "GROUP_TERMS": "Nutzungsbedingungn", | |||||
| "GROUP_TERMS": "Nutzungsbedingungen", | |||||
| "GROUP_TERMS_ACCEPT": "akzeptieren", | |||||
| "GROUP_TERMS_ACCEPTED": "Du hast die Nutzungsbedingungen akzeptiert", | |||||
| "GROUP_TERMS_NOT_ACCEPTED": "Du hast die Nutzungsbedingungen nicht akzeptiert", | |||||
| "GROUP_TERMS_DESCRIPTION": "Begrüßung und Nutzungsbedingungen", | "GROUP_TERMS_DESCRIPTION": "Begrüßung und Nutzungsbedingungen", | ||||
| "GROUP_TERMS_ACTIVE": "Nutzungsbedingungen aktiv", | "GROUP_TERMS_ACTIVE": "Nutzungsbedingungen aktiv", | ||||
| "GROUP_TERMS_ACTIVE_DESCRIPTION": "Wenn die Nutzungsbedingungen aktiv sind, müssen Gruppenmitglieder diese aktiv akzeptieren um weiter aktiv an Terminen teilnehmen zu können.", | "GROUP_TERMS_ACTIVE_DESCRIPTION": "Wenn die Nutzungsbedingungen aktiv sind, müssen Gruppenmitglieder diese aktiv akzeptieren um weiter aktiv an Terminen teilnehmen zu können.", | ||||
| @@ -27,7 +27,7 @@ app.state.GroupTermsConditions = function() | |||||
| app.core.View.setContent( | app.core.View.setContent( | ||||
| app.core.View.getTemplate( | app.core.View.getTemplate( | ||||
| 'group-setting', | |||||
| 'group-terms', | |||||
| { | { | ||||
| group: mGroup, | group: mGroup, | ||||
| currentProfile: app.model.SessionUser.getUserProfile() | currentProfile: app.model.SessionUser.getUserProfile() | ||||
| @@ -40,7 +40,23 @@ app.state.GroupTermsConditions = function() | |||||
| app.core.View.toastSuccess( _lc( 'CALENDER_LINK_COPIED' ) ); | app.core.View.toastSuccess( _lc( 'CALENDER_LINK_COPIED' ) ); | ||||
| }); | }); | ||||
| $content.find( '[data-id="checkbox-terms-conditions-accept"]' ).first().change( function() | |||||
| { | |||||
| let accepted = $content.find( '[data-id="checkbox-terms-conditions-accept"]' ).find('[data-id="checkbox-terms-conditions-accept"]').first().is(":checked"); | |||||
| console.log(accepted); | |||||
| app.core.Rpc.call( | |||||
| 'Profile', | |||||
| 'acceptTerms', | |||||
| { groupId: groupId, termsAccepted: accepted }, | |||||
| function( res ) | |||||
| { | |||||
| app.core.View.toastSuccess( _lc( accepted ? 'GROUP_TERMS_ACCEPTED' : 'GROUP_TERMS_NOT_ACCEPTED' ) ); | |||||
| }, | |||||
| function ( res ){ | |||||
| app.core.View.toastError( _lc( 'GENERAL_SERVER_ERROR' ) ); | |||||
| }); | |||||
| }); | |||||
| app.gui.PageLoader.hide(); | app.gui.PageLoader.hide(); | ||||
| } | } | ||||
| ); | ); | ||||
| @@ -17,22 +17,25 @@ | |||||
| <p> | <p> | ||||
| <strong><%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %></strong> | <strong><%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %></strong> | ||||
| </p> | </p> | ||||
| <textarea maxlength="4096" | |||||
| rows="5" | |||||
| class="form-control" | |||||
| disabled | |||||
| placeholder="<%= _lc( 'TEAM_DETAIL_TEAM_TERMS_PLACEHOLDER' ) %>"><%= group.getTermsConditions() ? group.getTermsConditions() : '' %></textarea> | |||||
| <% if ( group.getTermsConditionsActive() ) { %> | |||||
| <input type="checkbox" | |||||
| name="checkbox-terms-conditions-accept" | |||||
| data-id="checkbox-terms-conditions-accept" | |||||
| id="checkbox-terms-conditions-accept" | |||||
| class="custom-control-input" | |||||
| > | |||||
| <% } %> | |||||
| <label class="custom-control-label" | |||||
| for="checkbox-terms-conditions-accept"><%= _lc( 'GROUP_TERMS_ACTIVE' ) %></label> | |||||
| <p> | <p> | ||||
| <%= _lc( 'GROUP_TERMS_ACTIVE_DESCRIPTION' ) %> | |||||
| </p> | |||||
| <div class="form-group"> | |||||
| <input type="text" | |||||
| data-id="input-group-ical" | |||||
| class="form-control reverse pb_height-50" | |||||
| value="<%= app.core.App.getConfig( 'url' ) %>/ical/<%= group.getPublicId() %>/probuddy.ics" /> | |||||
| </div> | |||||
| <small><%= _lc( 'GROUP_TERMS_ACTIVE_DESCRIPTION' ) %></small> | |||||
| </div> | </div> | ||||
| <div class="card-footer"> | <div class="card-footer"> | ||||
| <button type="button" | |||||
| data-id="btn-copy-ical-group-link" | |||||
| class="btn btn-primary btn-sm"> | |||||
| <i class="fas fa-copy"></i> <%= _lc( 'BTN_COPY_LINK_TO_CLIPBOARD' ) %> | |||||
| </button> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -628,4 +628,24 @@ class TB_Server_Control_Profile { | |||||
| { | { | ||||
| return self::delete( $params ); | return self::delete( $params ); | ||||
| } | } | ||||
| public static function acceptTerms ( TB_Server_Core_RequestData $params ) | |||||
| { | |||||
| $resp = new TB_Server_Core_Response(); | |||||
| $groupId = $params->get( 'groupId' ); | |||||
| $termsAccepted = $params->get( 'termsAccepted' ); | |||||
| /** @var TB_Shared_Ent_TeamData_Profile $profile */ | |||||
| $profile = TB_Server_Core_Session::get()->getProfile(); | |||||
| if (!$profile->isInTeam($groupId)) { | |||||
| throw new \Exception( 'Profile not in team.' ); | |||||
| } | |||||
| $profile->setTermsConditionAccepted($groupId, $termsAccepted); | |||||
| $profile->save(); | |||||
| return $resp; | |||||
| } | |||||
| } | } | ||||