| @@ -252,6 +252,10 @@ app.core.Controller = (function(){ | |||
| { | |||
| app.core.StateManager.switchTo( new app.state.GroupLeave(), r.params ); | |||
| }); | |||
| rlite.add( 'group/:groupId/terms', function( r ) | |||
| { | |||
| app.core.StateManager.switchTo( new app.state.GroupTermsConditions(), r.params ); | |||
| }); | |||
| // stop: group(s) | |||
| // start: profile | |||
| @@ -240,6 +240,7 @@ app.core.Dict = { | |||
| "EDIT_GROUP" : "Gruppe bearbeiten", | |||
| "GROUP_NAME" : "Gruppenname", | |||
| "GROUP_DESCRIPTION" : "Beschreibung", | |||
| "GROUP_TERMS": "Nutzungsbedingungn", | |||
| "GROUP_TERMS_DESCRIPTION": "Begrüßung und Nutzungsbedingungen", | |||
| "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.", | |||
| @@ -17,7 +17,7 @@ app.model.Group = function( data, memberData ) | |||
| category = data.category, | |||
| description = data.description || null, | |||
| termsConditions = data.terms_conditions || null, | |||
| termsConditionsActive = data.terms_conditions_active === 1, | |||
| termsConditionsActive = data.terms_conditions_active == 1, | |||
| contactInformation = data.contact_information || null, | |||
| emblemUrl = data.emblem_url || null, | |||
| emblem_cloud_id = data.emblem_cloud_id || null, | |||
| @@ -0,0 +1,50 @@ | |||
| /** | |||
| * (c) by aheadware.com | |||
| */ | |||
| var app = app || {}; | |||
| app.state = app.state || {}; | |||
| app.state.GroupTermsConditions = function() | |||
| { | |||
| var state = app.core.StateManager.createState( 'group-terms-conditions' ); | |||
| state.onEnter = function( p ) | |||
| { | |||
| var $content = app.core.View.getContent(), | |||
| groupId = p.groupId; | |||
| app.gui.PageLoader.show(); | |||
| app.core.Rpc.call( | |||
| 'Team', | |||
| 'getDetails', | |||
| { teamId : groupId }, | |||
| function( res ) | |||
| { | |||
| var mGroup = new app.model.Group(res.team), | |||
| currentProfile = null; | |||
| app.core.View.setContent( | |||
| app.core.View.getTemplate( | |||
| 'group-setting', | |||
| { | |||
| group: mGroup, | |||
| currentProfile: app.model.SessionUser.getUserProfile() | |||
| }) | |||
| ); | |||
| $content.find( '[data-id="btn-copy-ical-group-link"]' ).first().click( function() | |||
| { | |||
| app.util.Helper.copyInputToClipboard( $content.find( '[data-id="input-group-ical"]' ).first() ); | |||
| app.core.View.toastSuccess( _lc( 'CALENDER_LINK_COPIED' ) ); | |||
| }); | |||
| app.gui.PageLoader.hide(); | |||
| } | |||
| ); | |||
| }; | |||
| return state; | |||
| }; | |||
| @@ -228,6 +228,7 @@ app.state.Home = function() | |||
| filter = this.getStateSetting( 'filter' ), | |||
| isBackButton = app.core.StateManager.isPreviousState(), | |||
| scrollY = +this.getStateSetting( 'scrollY' ); | |||
| groupsTermsNotAccepted = []; | |||
| // For paging | |||
| self.currentPage = 1; | |||
| @@ -251,6 +252,12 @@ app.state.Home = function() | |||
| for ( var ui = 0; ui < userGroups.length; ui++ ) | |||
| { | |||
| let groupData = app.model.SessionUser.getUserProfile().getGroupData(userGroups[ ui ].id)[0]; | |||
| if (userGroups[ ui ].getTermsConditionsActive() && !groupData.terms_accepted) { | |||
| groupsTermsNotAccepted.push(userGroups[ ui ]); | |||
| } | |||
| console.log(groupsTermsNotAccepted); | |||
| gcgIds = userGroups[ ui ].getCourseCategories(); | |||
| for ( var gci = 0; gci < gcgIds.length; gci++ ) | |||
| { | |||
| @@ -1066,7 +1073,17 @@ app.state.Home = function() | |||
| sessionStorage.removeItem("g_ids_popup_shown"); | |||
| } | |||
| if (showPopup) { | |||
| if (groupsTermsNotAccepted.length > 0) { | |||
| // Show terms not accepted popup | |||
| app.core.View.showModal({ | |||
| title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), | |||
| body: app.core.View.getTemplate('home-modal-terms-not-accepted', {}), | |||
| hideButtons: true, | |||
| hideCloseBtn: true, | |||
| prohibitCloseModal: true, | |||
| }); | |||
| } else if (showPopup) { | |||
| app.core.View.showModal({ | |||
| title: _lc('HOME_MODAL_NOT_ACTIVATED_TITLE'), | |||
| body: app.core.View.getTemplate('home-modal-not-activated', { groupName: groupName }), | |||
| @@ -1082,15 +1099,6 @@ app.state.Home = function() | |||
| window.location.href = $(this).attr("href"); | |||
| }); | |||
| } | |||
| app.core.View.showModal({ | |||
| title: _lc('HOME_MODAL_TERMS_NOT_ACCEPTED_TITLE'), | |||
| body: app.core.View.getTemplate('home-modal-terms-not-accepted', {}), | |||
| hideButtons: true, | |||
| hideCloseBtn: true, | |||
| prohibitCloseModal: true, | |||
| }); | |||
| } | |||
| ); | |||
| }; | |||
| @@ -28,4 +28,10 @@ | |||
| </a> | |||
| </li> | |||
| <% } %> | |||
| <li class="nav-item"> | |||
| <a class="nav-link <%= ( activeTab == 'terms' ) ? 'active' : '' %>" | |||
| href="#/group/<%= group.getId() %>/terms"> | |||
| <%= _lc( 'GROUP_TERMS' ) %> | |||
| </a> | |||
| </li> | |||
| </ul> | |||
| @@ -0,0 +1,39 @@ | |||
| <%=raw app.core.View.getTemplate( 'group-nav', { activeTab : 'terms', group : group, currentProfile : currentProfile } ) %> | |||
| <div class="row"> | |||
| <div class="col-sm-12"> | |||
| <div class="card"> | |||
| <div class="team-header"> | |||
| <div class="pb_cover_v3 overflow-hidden cover-bg-indigo cover-bg-opacity-8 text-left pb_gradient_v1 pb_slant-white-small" | |||
| style="overflow: hidden; background: url(./img-system/<%= group.getBackgroundImgUrl() %>); background-position: center;background-repeat: no-repeat;background-size: cover;height: 135px;"> | |||
| </div> | |||
| <div class="team-logo" | |||
| style="position: relative"> | |||
| <img src="<%= group.getEmblemUrl() %>" | |||
| style="width: 128px; height: 128px; top: -64px; margin: auto; border: 4px solid white;z-index: 11; padding: 0; " | |||
| class="card-img-overlay"/> | |||
| </div> | |||
| </div> | |||
| <div class="card-body"> | |||
| <p> | |||
| <strong><%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %></strong> | |||
| </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> | |||
| </div> | |||
| <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> | |||