mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-01 21:52:19 +01:00
(wip) admin confirm payment of reservation pre-registration
This commit is contained in:
parent
92d1a07819
commit
a437fc24ee
@ -436,7 +436,7 @@ Application.Controllers.controller('AdminEventsController', ['$scope', '$state',
|
|||||||
/**
|
/**
|
||||||
* Controller used in the reservations listing page for a specific event
|
* Controller used in the reservations listing page for a specific event
|
||||||
*/
|
*/
|
||||||
Application.Controllers.controller('ShowEventReservationsController', ['$scope', 'eventPromise', 'reservationsPromise', 'dialogs', 'SlotsReservation', 'growl', '_t', function ($scope, eventPromise, reservationsPromise, dialogs, SlotsReservation, growl, _t) {
|
Application.Controllers.controller('ShowEventReservationsController', ['$scope', 'eventPromise', 'reservationsPromise', 'dialogs', 'SlotsReservation', 'growl', '_t', 'Price', 'Wallet', '$uibModal', function ($scope, eventPromise, reservationsPromise, dialogs, SlotsReservation, growl, _t, Price, Wallet, $uibModal) {
|
||||||
// retrieve the event from the ID provided in the current URL
|
// retrieve the event from the ID provided in the current URL
|
||||||
$scope.event = eventPromise;
|
$scope.event = eventPromise;
|
||||||
|
|
||||||
@ -487,6 +487,71 @@ Application.Controllers.controller('ShowEventReservationsController', ['$scope',
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mkCartItems = function (reservation, coupon) {
|
||||||
|
return {
|
||||||
|
customer_id: reservation.user_id,
|
||||||
|
items: [{
|
||||||
|
reservation: {
|
||||||
|
...reservation,
|
||||||
|
slots_reservations_attributes: reservation.slots_reservations_attributes.map(sr => ({ slot_id: sr.slot_id }))
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
coupon_code: ((coupon ? coupon.code : undefined)),
|
||||||
|
payment_method: ''
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.payReservation = function (reservation) {
|
||||||
|
$uibModal.open({
|
||||||
|
templateUrl: '/admin/events/pay_reservation_modal.html',
|
||||||
|
size: 'sm',
|
||||||
|
resolve: {
|
||||||
|
reservation () {
|
||||||
|
return reservation;
|
||||||
|
},
|
||||||
|
price () {
|
||||||
|
return Price.compute(mkCartItems(reservation)).$promise;
|
||||||
|
},
|
||||||
|
wallet () {
|
||||||
|
return Wallet.getWalletByUser({ user_id: reservation.user_id }).$promise;
|
||||||
|
},
|
||||||
|
cartItems () {
|
||||||
|
return mkCartItems(reservation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
controller: ['$scope', '$uibModalInstance', 'reservation', 'price', 'wallet', 'cartItems', 'helpers', '$filter', '_t',
|
||||||
|
function ($scope, $uibModalInstance, reservation, price, wallet, cartItems, helpers, $filter, _t) {
|
||||||
|
// User's wallet amount
|
||||||
|
$scope.wallet = wallet;
|
||||||
|
|
||||||
|
// Price
|
||||||
|
$scope.price = price.price;
|
||||||
|
|
||||||
|
// Cart items
|
||||||
|
$scope.cartItems = cartItems;
|
||||||
|
|
||||||
|
// price to pay
|
||||||
|
$scope.amount = helpers.getAmountToPay(price.price, wallet.amount);
|
||||||
|
|
||||||
|
// Reservation
|
||||||
|
$scope.reservation = reservation;
|
||||||
|
|
||||||
|
$scope.coupon = { applied: null };
|
||||||
|
|
||||||
|
// Button label
|
||||||
|
if ($scope.amount > 0) {
|
||||||
|
$scope.validButtonName = _t('app.admin.event_reservations.confirm_payment_of_html', { ROLE: $scope.currentUser.role, AMOUNT: $filter('currency')($scope.amount) });
|
||||||
|
} else {
|
||||||
|
if ((price.price > 0) && ($scope.walletAmount === 0)) {
|
||||||
|
$scope.validButtonName = _t('app.admin.event_reservations.confirm_payment_of_html', { ROLE: $scope.currentUser.role, AMOUNT: $filter('currency')(price.price) });
|
||||||
|
} else {
|
||||||
|
$scope.validButtonName = _t('app.shared.buttons.confirm');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
<div class="modal-header">
|
||||||
|
<img ng-src="{{logoBlack.custom_asset_file_attributes.attachment_url}}" alt="{{logo.custom_asset_file_attributes.attachment}}" class="modal-logo"/>
|
||||||
|
<h1 translate ng-show="reservation">{{ 'app.admin.event_reservations.confirm_payment' }}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
|
||||||
|
<div class="row">
|
||||||
|
<wallet-info current-user="currentUser"
|
||||||
|
cart="cartItems"
|
||||||
|
price="price"
|
||||||
|
wallet="wallet"/>
|
||||||
|
</div>
|
||||||
|
<coupon show="true" coupon="coupon.applied" total="price.price_without_coupon" user-id="{{reservation.user_id}}"></coupon>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-info" ng-click="ok()" ng-disabled="attempting" ng-bind-html="validButtonName"></button>
|
||||||
|
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
|
||||||
|
</div>
|
@ -55,7 +55,7 @@
|
|||||||
<button class="btn btn-default" ng-click="validateReservation(reservation)" ng-if="!isValidated(reservation) && !isCancelled(reservation)" translate>
|
<button class="btn btn-default" ng-click="validateReservation(reservation)" ng-if="!isValidated(reservation) && !isCancelled(reservation)" translate>
|
||||||
{{ 'app.admin.event_reservations.validate' }}
|
{{ 'app.admin.event_reservations.validate' }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-default" ng-if="isValidated(reservation) && !isCancelled(reservation)" translate>
|
<button class="btn btn-default" ng-click="payReservation(reservation)" ng-if="isValidated(reservation) && !isCancelled(reservation)" translate>
|
||||||
{{ 'app.admin.event_reservations.pay' }}
|
{{ 'app.admin.event_reservations.pay' }}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
@ -195,7 +195,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-show="currentUser.role == 'admin'" class="m-t">
|
<div ng-show="currentUser.role == 'admin' && !event.pre_registration" class="m-t">
|
||||||
<label for="offerSlot" class="control-label m-r" translate>{{ 'app.public.events_show.make_a_gift_of_this_reservation' }}</label>
|
<label for="offerSlot" class="control-label m-r" translate>{{ 'app.public.events_show.make_a_gift_of_this_reservation' }}</label>
|
||||||
<input bs-switch
|
<input bs-switch
|
||||||
ng-model="event.offered"
|
ng-model="event.offered"
|
||||||
@ -217,7 +217,10 @@
|
|||||||
<a class="pull-right m-t-xs text-u-l ng-scope" ng-click="cancelReserve($event)" ng-show="reserve.toReserve" translate>{{ 'app.shared.buttons.cancel' }}</a>
|
<a class="pull-right m-t-xs text-u-l ng-scope" ng-click="cancelReserve($event)" ng-show="reserve.toReserve" translate>{{ 'app.shared.buttons.cancel' }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="reserveSuccess" class="alert alert-success">{{ 'app.public.events_show.thank_you_your_payment_has_been_successfully_registered' | translate }}<br>
|
<div ng-if="reserveSuccess && !event.pre_registration" class="alert alert-success">{{ 'app.public.events_show.thank_you_your_payment_has_been_successfully_registered' | translate }}<br>
|
||||||
|
{{ 'app.public.events_show.you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'app.public.events_show.dashboard' }}</a>
|
||||||
|
</div>
|
||||||
|
<div ng-if="reserveSuccess && event.pre_registration" class="alert alert-success">{{ 'app.public.events_show.thank_you_your_pre_registration_has_been_successfully_saved' | translate }}<br>
|
||||||
{{ 'app.public.events_show.you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'app.public.events_show.dashboard' }}</a>
|
{{ 'app.public.events_show.you_can_find_your_reservation_s_details_on_your_' | translate }} <a ui-sref="app.logged.dashboard.invoices" translate>{{ 'app.public.events_show.dashboard' }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
|
<div class="m-t-sm" ng-if="reservations && !reserve.toReserve" ng-repeat="reservation in reservations">
|
||||||
@ -257,7 +260,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</uib-alert>
|
</uib-alert>
|
||||||
|
|
||||||
<coupon show="reserve.totalSeats > 0 && ctrl.member" coupon="coupon.applied" total="reserve.totalNoCoupon" user-id="{{ctrl.member.id}}"></coupon>
|
<coupon show="reserve.totalSeats > 0 && ctrl.member && !event.pre_registration" coupon="coupon.applied" total="reserve.totalNoCoupon" user-id="{{ctrl.member.id}}"></coupon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ json.slots_reservations_attributes reservation.slots_reservations do |sr|
|
|||||||
json.id sr.id
|
json.id sr.id
|
||||||
json.canceled_at sr.canceled_at&.iso8601
|
json.canceled_at sr.canceled_at&.iso8601
|
||||||
json.validated_at sr.validated_at&.iso8601
|
json.validated_at sr.validated_at&.iso8601
|
||||||
|
json.slot_id sr.slot_id
|
||||||
json.slot_attributes do
|
json.slot_attributes do
|
||||||
json.id sr.slot_id
|
json.id sr.slot_id
|
||||||
json.start_at sr.slot.start_at.iso8601
|
json.start_at sr.slot.start_at.iso8601
|
||||||
|
@ -651,6 +651,8 @@ en:
|
|||||||
do_you_really_want_to_validate_this_reservation_this_apply_to_all_booked_tickets: "Do you really want to validate this reservation? This apply to ALL booked tickets."
|
do_you_really_want_to_validate_this_reservation_this_apply_to_all_booked_tickets: "Do you really want to validate this reservation? This apply to ALL booked tickets."
|
||||||
reservation_was_successfully_validated: "Reservation was successfully validated."
|
reservation_was_successfully_validated: "Reservation was successfully validated."
|
||||||
validation_failed: "Validation failed."
|
validation_failed: "Validation failed."
|
||||||
|
confirm_payment: "Confirm payment"
|
||||||
|
confirm_payment_of_html: "{ROLE, select, admin{Cash} other{Pay}}: {AMOUNT}" #(contexte : validate a payment of $20,00)
|
||||||
events_settings:
|
events_settings:
|
||||||
title: "Settings"
|
title: "Settings"
|
||||||
generic_text_block: "Editorial text block"
|
generic_text_block: "Editorial text block"
|
||||||
|
@ -651,6 +651,8 @@ fr:
|
|||||||
do_you_really_want_to_validate_this_reservation_this_apply_to_all_booked_tickets: "Êtes vous sur de vouloir valider cette réservation? Ceci s'applique à TOUTES les places réservées."
|
do_you_really_want_to_validate_this_reservation_this_apply_to_all_booked_tickets: "Êtes vous sur de vouloir valider cette réservation? Ceci s'applique à TOUTES les places réservées."
|
||||||
reservation_was_successfully_validated: "La réservation a bien été validé."
|
reservation_was_successfully_validated: "La réservation a bien été validé."
|
||||||
validation_failed: "La validation a échoué."
|
validation_failed: "La validation a échoué."
|
||||||
|
confirm_payment: "Confirmer le paiement"
|
||||||
|
confirm_payment_of_html: "{ROLE, select, admin{Encaisser} other{Payer}} : {AMOUNT}" #(contexte : validate a payment of $20,00)
|
||||||
events_settings:
|
events_settings:
|
||||||
title: "Paramètres"
|
title: "Paramètres"
|
||||||
generic_text_block: "Bloc de texte rédactionnel"
|
generic_text_block: "Bloc de texte rédactionnel"
|
||||||
|
@ -330,6 +330,7 @@ en:
|
|||||||
ticket: "{NUMBER, plural, one{ticket} other{tickets}}"
|
ticket: "{NUMBER, plural, one{ticket} other{tickets}}"
|
||||||
make_a_gift_of_this_reservation: "Make a gift of this reservation"
|
make_a_gift_of_this_reservation: "Make a gift of this reservation"
|
||||||
thank_you_your_payment_has_been_successfully_registered: "Thank you. Your payment has been successfully registered!"
|
thank_you_your_payment_has_been_successfully_registered: "Thank you. Your payment has been successfully registered!"
|
||||||
|
thank_you_your_pre_registration_has_been_successfully_saved: "Thank you. Your pre-registration has been successfully saved!"
|
||||||
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
|
you_can_find_your_reservation_s_details_on_your_: "You can find your reservation's details on your"
|
||||||
dashboard: "dashboard"
|
dashboard: "dashboard"
|
||||||
you_booked_DATE: "You booked ({DATE}):"
|
you_booked_DATE: "You booked ({DATE}):"
|
||||||
|
@ -330,6 +330,7 @@ fr:
|
|||||||
ticket: "{NUMBER, plural, =0{place} one{place} other{places}}"
|
ticket: "{NUMBER, plural, =0{place} one{place} other{places}}"
|
||||||
make_a_gift_of_this_reservation: "Offrir cette réservation"
|
make_a_gift_of_this_reservation: "Offrir cette réservation"
|
||||||
thank_you_your_payment_has_been_successfully_registered: "Merci. Votre paiement a bien été pris en compte !"
|
thank_you_your_payment_has_been_successfully_registered: "Merci. Votre paiement a bien été pris en compte !"
|
||||||
|
thank_you_your_pre_registration_has_been_successfully_saved: "Merci. Votre pré-inscription a bien été pris en compte !"
|
||||||
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
|
you_can_find_your_reservation_s_details_on_your_: "Vous pouvez retrouver le détail de votre réservation sur votre"
|
||||||
dashboard: "tableau de bord"
|
dashboard: "tableau de bord"
|
||||||
you_booked_DATE: "Vous avez réservé ({DATE}) :"
|
you_booked_DATE: "Vous avez réservé ({DATE}) :"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user