1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

[ongoing] send a coupon to a user

This commit is contained in:
Sylvain 2016-08-16 11:33:10 +02:00
parent 396d7b4df7
commit 3253290860
6 changed files with 56 additions and 3 deletions

View File

@ -341,6 +341,23 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
##
# Open a modal allowing to select an user and send him the details of the provided coupon
# @param coupon {Object} The coupon to send
##
$scope.sendCouponToUser = (coupon) ->
$uibModal.open
templateUrl: '<%= asset_path "admin/pricing/sendCoupon.html" %>'
resolve:
coupon: -> coupon
size: 'md'
controller: ['$scope', '$uibModalInstance', 'Coupon', 'coupon', ($scope, $uibModalInstance, Coupon, coupon) ->
$scope.coupon = coupon
$scope.ok = ->
$uibModalInstance.close(user)
]
### PRIVATE SCOPE ###
##

View File

@ -735,7 +735,7 @@ angular.module('application.router', ['ui.router']).
TrainingsPricing.query().$promise
]
translations: [ 'Translations', (Translations) ->
Translations.query('app.admin.pricing').$promise
Translations.query(['app.admin.pricing', 'app.shared.member_select', 'app.shared.coupon']).$promise
]
trainingsPromise: ['Training', (Training) ->
Training.query().$promise

View File

@ -18,6 +18,7 @@
<td>{{coupon.usages}}</td>
<td translate>{{coupon.status}}</td>
<td>
<button type="button" class="btn btn-default" ng-click="sendCouponToUser(coupon)"><i class="fa fa-send-o"></i> </button>
<button type="button" class="btn btn-default" ui-sref="app.admin.coupons_edit({id:coupon.id})"><i class="fa fa-pencil-square-o"></i></button>
<button type="button" class="btn btn-danger" ng-click="deleteCoupon(coupons, coupon.id)"><i class="fa fa-trash"></i></button>
</td>

View File

@ -0,0 +1,31 @@
<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>{{ 'send_a_coupon' }}</h1>
</div>
<div class="">
<div class="well m-b-n">
<select-member></select-member>
<div class="widget panel b-a m">
<div class="panel-heading b-b small">
<h3 class="panel-title" translate>{{ 'coupon' }}</h3>
</div>
<div class="widget-content no-bg auto wrapper">
<table>
<thead>
<tr><th style="width:60%"></th></tr>
</thead>
<tbody>
<tr><td translate>{{'code'}}</td><td>{{coupon.code}}</td></tr>
<tr><td translate>{{'percent_off'}}</td><td>{{coupon.percent_off}} %</td></tr>
<tr><td translate>{{'validity_per_user'}}</td><td translate>{{coupon.validity_per_user}}</td></tr>
<tr><td translate>{{'valid_until'}}</td><td>{{coupon.valid_until | amDateFormat:'L'}}</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer no-padder">
<button class="btn btn-valid btn-warning btn-block p-l btn-lg text-u-c r-b" ng-click="ok()" translate>{{ 'confirm' }}</button>
</div>

View File

@ -113,7 +113,7 @@ en:
back_to_monitoring: "Back to monitoring"
pricing:
# subscriptions, prices and credits management
# subscriptions, prices, credits and coupons management
pricing_management: "Pricing management"
list_of_the_subscription_plans: "List of the subscription plans"
beware_the_subscriptions_are_disabled_on_this_application: "Beware, the subscriptions are disabled on this application."
@ -158,6 +158,8 @@ en:
coupon_was_successfully_deleted: "Coupon was successfully deleted."
unable_to_delete_the_specified_coupon_already_in_use: "Unable to delete the specified coupon: it is already used with some invoices."
unable_to_delete_the_specified_coupon_an_unexpected_error_occurred: "Unable to delete the specified coupon: an unexpected error occurred."
send_a_coupon: "Send a coupon"
coupon: "Coupon"
coupons_new:
# ajouter un code promotionnel

View File

@ -113,7 +113,7 @@ fr:
back_to_monitoring: "Retour au suivi"
pricing:
# gestion des abonnements, des tarifs et des crédits
# gestion des abonnements, des tarifs, des crédits et des codes promo
pricing_management: "Gestion de la tarification"
list_of_the_subscription_plans: "Liste des formules d'abonnements"
beware_the_subscriptions_are_disabled_on_this_application: "Attention, les abonnements sont désactivés sur cette application."
@ -158,6 +158,8 @@ fr:
coupon_was_successfully_deleted: "Le code promotionnel a bien été supprimé."
unable_to_delete_the_specified_coupon_already_in_use: "Impossible de supprimer le code promotionnel : il est utilisé dans des factures."
unable_to_delete_the_specified_coupon_an_unexpected_error_occurred: "Impossible de supprimer le code promotionnel : une erreur inattendue s'est produite."
send_a_coupon: "Envoyer un code promo"
coupon: "Code promo"
coupons_new:
# ajouter un code promotionnel