From bfb1c1f007cac9fa9d2b78b1b340075130a39435 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 23 Aug 2023 18:43:10 +0200 Subject: [PATCH] wip terms accepted --- .../app/js/app/state/GroupTermsConditions.js | 8 ++- src/client/app/js/app/state/Home.js | 5 -- src/client/app/tmpl/group-terms.html | 58 ++++++++++++------- 3 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/client/app/js/app/state/GroupTermsConditions.js b/src/client/app/js/app/state/GroupTermsConditions.js index a727e58..2957b67 100644 --- a/src/client/app/js/app/state/GroupTermsConditions.js +++ b/src/client/app/js/app/state/GroupTermsConditions.js @@ -42,15 +42,17 @@ app.state.GroupTermsConditions = function() $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); + let accepted = $content.find( '[data-id="checkbox-terms-conditions-accept"]' ).first().is(":checked"); 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' ) ); + let msg = _lc( accepted ? 'GROUP_TERMS_ACCEPTED' : 'GROUP_TERMS_NOT_ACCEPTED'); + + $content.find( '[data-id="terms-accepted-note"]' ).first().text("(" + msg + ")"); + app.core.View.toastSuccess( msg ); }, function ( res ){ app.core.View.toastError( _lc( 'GENERAL_SERVER_ERROR' ) ); diff --git a/src/client/app/js/app/state/Home.js b/src/client/app/js/app/state/Home.js index b000388..9578a97 100644 --- a/src/client/app/js/app/state/Home.js +++ b/src/client/app/js/app/state/Home.js @@ -256,7 +256,6 @@ app.state.Home = function() 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++ ) @@ -672,7 +671,6 @@ app.state.Home = function() $modalRoot.on( 'click', '[data-type="rsvp-button-accept"]', function() { callSetAttendanceStatus( appId, "accepted", $(this).attr( 'data-child-profile-id' ) ); - console.log('accept'); //app.core.View.closeModal(); //renderAppointmentItem( appointment ); }); @@ -680,7 +678,6 @@ app.state.Home = function() $modalRoot.on( 'click', '[data-type="rsvp-button-recall"]', function() { callSetAttendanceStatus( appId, "declined", $(this).attr( 'data-child-profile-id' ) ); - console.log('decline'); //app.core.View.closeModal(); //renderAppointmentItem( appointment ); }); @@ -689,13 +686,11 @@ app.state.Home = function() { const $modalRoot = app.core.View.getModalContent(); $modalRoot.off( 'click', '[data-type="rsvp-button-accept"]' ); - console.log('onHide - 685'); renderAppointmentItem( getAppointment(appId) ); }, 'onConfirm' : function() { app.core.View.closeModal(); - console.log('onConfirm - 690'); } } ); diff --git a/src/client/app/tmpl/group-terms.html b/src/client/app/tmpl/group-terms.html index b62a5ee..89e5c40 100644 --- a/src/client/app/tmpl/group-terms.html +++ b/src/client/app/tmpl/group-terms.html @@ -1,4 +1,5 @@ <%=raw app.core.View.getTemplate( 'group-nav', { activeTab : 'terms', group : group, currentProfile : currentProfile } ) %> +<% var termsAccepted = currentProfile.getGroupData(group.getId()).terms_accepted == 1; %>
@@ -14,26 +15,43 @@
-

- <%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %> -

- - <% if ( group.getTermsConditionsActive() ) { %> - - <% } %> - -

- <%= _lc( 'GROUP_TERMS_ACTIVE_DESCRIPTION' ) %> +

+

+ <%= _lc( 'GROUP_TERMS_DESCRIPTION' ) %> +

+ + <% if ( group.getTermsConditionsActive() ) { %> +
+
+ + > + +

+ <%= _lc( 'GROUP_TERMS_ACTIVE_DESCRIPTION' ) %> +

+
+ <% } %> +