diff --git a/README.md b/README.md index f556ba1..85f54e0 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,6 @@ - info@coaching4dogs.xx (kein Admin-Account) - benny@probuddy.de - timo@tbuddy.de - - tretslag@gmail.com \ No newline at end of file + - tretslag@gmail.com +- `docker exec -it pb-php /bin/bash` +- SELECT * FROM profile WHERE JSON_CONTAINS( `teams_js`, '{"team_id":"75"}' ); \ No newline at end of file diff --git a/src/client/app/js/app/core/Dict.js b/src/client/app/js/app/core/Dict.js index b6964a5..ba385ed 100644 --- a/src/client/app/js/app/core/Dict.js +++ b/src/client/app/js/app/core/Dict.js @@ -541,7 +541,8 @@ app.core.Dict = { "APPOINTMENT_CATEGORIES_MISSING_FOR_ADMIN" : "Deinem Gruppenprofil wurden keine Kategorien zugewiesen. Bitte benachrichtige den Gruppeninhaber.", "NOTE_NO_SERIAL_APPOINTMENT_EDITING_AFTER_PUBLISHING" : "Hinweis: Serientermine können nach ihrer Veröffentlichung nur noch einzelnd bearbeitet werden.", "STATS_REPORTING" : 'Reporting', - 'STATS_PLANNING' : 'Planung' + 'STATS_PLANNING' : 'Planung', + "DO_YOU_REALLY_WANT_TO_DELETE_THIS_CONTRACT" : "Möchtest Du diesen Vertrag wirklich löschen?", }, "en" : { } diff --git a/src/client/manager/js/app/components/contract/ContractAppointmentAssignDualList.js b/src/client/manager/js/app/components/contract/ContractAppointmentAssignDualList.js index e119ee6..ef84a3a 100644 --- a/src/client/manager/js/app/components/contract/ContractAppointmentAssignDualList.js +++ b/src/client/manager/js/app/components/contract/ContractAppointmentAssignDualList.js @@ -12,6 +12,11 @@ const ContractAppointmentAssignDualList = { self.contracts = props.get( 'contracts'); self.attendedAppointments = props.get( 'attendedAppointments' ); + self.childObj = {}; + for (const prop in profile.child_profile_js) { + self.childObj[profile.child_profile_js[prop]['id']] = profile.child_profile_js[prop]['name']; + } + this.render( { profile : profile, @@ -131,6 +136,10 @@ const ContractAppointmentAssignDualList = { } aSubject += a.subject + ', ' + moment( a.start_dt ).format( 'DD.MM.YYYY' ); + if (a.attendee_child_id !== null) { + aSubject += ' (' + self.childObj[a.attendee_child_id] + ')'; + } + if ( self.selectedContractId && self.attendedAppointments[ aai ].contractId == self.selectedContractId ) { $select.append( diff --git a/src/client/manager/js/app/views/contract/ContractCharging.js b/src/client/manager/js/app/views/contract/ContractCharging.js index d3f9fd5..ef3b0d6 100644 --- a/src/client/manager/js/app/views/contract/ContractCharging.js +++ b/src/client/manager/js/app/views/contract/ContractCharging.js @@ -30,7 +30,6 @@ const ContractCharging = { break; } } - return m; } diff --git a/src/client/manager/js/app/views/contract/ContractEdit.js b/src/client/manager/js/app/views/contract/ContractEdit.js index fcf97a9..f504ea0 100644 --- a/src/client/manager/js/app/views/contract/ContractEdit.js +++ b/src/client/manager/js/app/views/contract/ContractEdit.js @@ -21,8 +21,7 @@ const ContractEdit = { self = this; self.contract = null; - - this.render( { groupId : groupId } ); + self.contractIsDeletable = false; app.rpc.call( 'Contract', @@ -32,11 +31,16 @@ const ContractEdit = { }, function( res ) { - if ( res && res.hasOwnProperty( 'data' ) && res.data.hasOwnProperty( 'contractData' ) ) + if ( res && res.hasOwnProperty( 'data' )) { - self.contract = self.createInstance( 'Contract', res.data.contractData ); + if ( res.data.hasOwnProperty( 'contractData' ) ) { + self.contract = self.createInstance( 'Contract', res.data.contractData ); + } + if ( res.data.hasOwnProperty( 'contractIsDeletable' ) ) { + self.contractIsDeletable = res.data.contractIsDeletable; + } } - + this.render( { groupId : groupId, contractIsDeletable: self.contractIsDeletable } ); const $compContractForm = self.createComponent( 'contract-form', $container.find( '[f-id="container-contract-form"]' ).first().get( 0 ), @@ -89,10 +93,69 @@ const ContractEdit = { } }); + if (self.contractIsDeletable) { + $container.find( '[data-id="btnDeleteContract"]').click( function() + { + + let $modalRoot = $container.find( '[data-id="modal-confirm-delete-contract"]' ).first(); + $modalRoot.find( '[data-id="section-confirm-delete-contract"]' ).first().show(); + $modalRoot.find( '[data-id="section-loader"]' ).first().hide(); + $modalRoot.on( 'shown.bs.modal', function() + { + $modalRoot.find( '[data-id="btnDelete"]' ).first().off( "click" ); + $modalRoot.find( '[data-id="btnDelete"]' ).first().click( function() + { + $(this).off( "click" ); + + $modalRoot.find( '[data-id="section-confirm-delete-contract"]' ).first().hide(); + $modalRoot.find( '[data-id="section-loader"]' ).first().show(); + + app.rpc.call( + 'Contract', + 'delete', + { + contractId : contractId + }, + function( resp ) + { + if ( resp && resp.hasOwnProperty( 'code' ) && resp.code == 200 ) + { + app.UI.toastSuccess( 'Vertrag wurde erfolgreich gelöscht.', 'Vertrag gelöscht' ); + if ( redirectPath ) + { + app.redirect( redirectPath ); + } + else + { + app.redirect( 'contract/list/' + groupId ); + } + } + else + { + app.UI.toastError( 'Der Vertrag konnte nicht gelöscht werden, ' + + 'da er entweder mindestens eine verknüpfte Verrechnung oder bereits ' + + 'eine Einzahlung stattgefunden hat', + 'Fehler' ); + } + $modalRoot.modal( 'hide' ); + } + ); + }); + }); + $modalRoot.on( 'hidden.bs.modal', function() + { + $modalRoot.modal( 'dispose' ); + }); + $modalRoot.modal( 'show' ); + } + ); + } + $container.find( '.sk-loading' ).toggleClass( 'sk-loading' ); }.bind ( this ) ); + }, destroy : function() diff --git a/src/client/manager/js/app/views/contract/contract-edit.html b/src/client/manager/js/app/views/contract/contract-edit.html index 175c69c..63669f3 100644 --- a/src/client/manager/js/app/views/contract/contract-edit.html +++ b/src/client/manager/js/app/views/contract/contract-edit.html @@ -40,10 +40,62 @@ href="javascript:history.back()"> Abbrechen + <% if ( true === contractIsDeletable ) { %> + + <% } %> + + +
\ No newline at end of file diff --git a/src/client/manager/js/app/views/contract/contract-master-data.html b/src/client/manager/js/app/views/contract/contract-master-data.html index 9cce9fb..95dd320 100644 --- a/src/client/manager/js/app/views/contract/contract-master-data.html +++ b/src/client/manager/js/app/views/contract/contract-master-data.html @@ -118,6 +118,49 @@ +