1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

use plant.base_name instands of plan.name

This commit is contained in:
Du Peng 2021-09-14 16:35:18 +02:00
parent a9901fccb2
commit 1c54e54c17
17 changed files with 19 additions and 24 deletions

View File

@ -956,14 +956,14 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui
});
$scope.tagsName = localizedList(tags);
if ($scope.isOnlySubscriptions && $scope.selectedPlans.length > 0) {
$scope.plansName = localizedList($scope.selectedPlans);
$scope.plansName = localizedList($scope.selectedPlans, 'base_name');
}
};
const localizedList = function (items) {
const localizedList = function (items, attr = 'name') {
if (items.length === 0) return `<span class="text-gray text-italic">${_t('app.admin.calendar.none')}</span>`;
const names = items.map(function (i) { return $sce.trustAsHtml(`<strong>${i.name}</strong>`); });
const names = items.map(function (i) { return $sce.trustAsHtml(`<strong>${i[attr]}</strong>`); });
if (items.length > 1) return names.slice(0, -1).join(', ') + ` ${_t('app.admin.calendar.and')} ` + names[names.length - 1];
return names[0];

View File

@ -115,7 +115,7 @@
<div class="font-sbold">{{::g.name}}</div>
<ul class="m-n" ng-repeat="plan in g.plans">
<li>
{{::plan.name}}
{{::plan.base_name}}
<span class="btn btn-warning btn-xs" ng-click="removePlan(plan)" ><i class="fa fa-times red"></i></span>
</li>
</ul>

View File

@ -149,7 +149,7 @@
<div ng-repeat="group in plansClassifiedByGroup">
<div class="text-center font-sbold">{{::group.name}}</div>
<label class="checkbox m-l-md" ng-repeat="plan in group.plans">
<input type="checkbox" ng-click="toggleSelectPlan(plan)" ng-model="selectedPlansBinding[plan.id]"> {{::plan.name}}</span>
<input type="checkbox" ng-click="toggleSelectPlan(plan)" ng-model="selectedPlansBinding[plan.id]"> {{::plan.base_name}}</span>
</label>
</div>
</div>

View File

@ -37,7 +37,7 @@
<div ng-repeat="group in slot.plansGrouped">
<div class="font-sbold">{{::group.name}}</div>
<ul class="m-n" ng-repeat="plan in group.plans">
<li>{{::plan.name}}</li>
<li>{{::plan.base_name}}</li>
</ul>
</div>
</div>

View File

@ -11,7 +11,7 @@
<div ng-repeat="group in slot.plansGrouped">
<div class="font-sbold">{{::group.name}}</div>
<ul class="m-n" ng-repeat="plan in group.plans">
<li>{{::plan.name}}</li>
<li>{{::plan.base_name}}</li>
</ul>
</div>
</div>

View File

@ -24,7 +24,7 @@ class CartItem::Subscription < CartItem::BaseItem
end
def name
@plan.name
@plan.base_name
end
def to_object

View File

@ -132,6 +132,6 @@ class Plan < ApplicationRecord
end
def update_gateway_product
PaymentGatewayService.new.create_or_update_product(Plan.name, id)
PaymentGatewayService.new.create_or_update_product(Plan.base_name, id)
end
end

View File

@ -57,7 +57,7 @@ class Subscription < ApplicationRecord
operator_profile_id: operator_profile_id,
total: 0
)
invoice.invoice_items.push InvoiceItem.new(amount: 0, description: plan.name, object: od)
invoice.invoice_items.push InvoiceItem.new(amount: 0, description: plan.base_name, object: od)
invoice.save
if save

View File

@ -175,7 +175,7 @@ class InvoicesService
invoice.invoice_items.push InvoiceItem.new(
amount: payment_details[:elements][:plan],
description: subscription.plan.name,
description: subscription.plan.base_name,
object: subscription,
main: main
)

View File

@ -249,7 +249,7 @@ class PaymentScheduleService
invoice.invoice_items.push InvoiceItem.new(
amount: payment_details[:subscription],
description: subscription.plan.name,
description: subscription.plan.base_name,
object: subscription,
main: main
)

View File

@ -57,6 +57,7 @@ json.array!(@members) do |member|
json.plan do
json.id member.subscription.plan.id
json.name member.subscription.plan.name
json.base_name member.subscription.plan.base_name
json.interval member.subscription.plan.interval
json.amount member.subscription.plan.amount ? (member.subscription.plan.amount / 100.0) : 0
end

View File

@ -1,5 +1,4 @@
json.title notification.notification_type
json.description t('.subscription_PLAN_has_been_subscribed_by_USER_html',
PLAN: notification.attached_object.plan.name,
PLAN: notification.attached_object.plan.base_name,
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))

View File

@ -1,9 +1,8 @@
json.title notification.notification_type
json.description _t('.subscription_PLAN_of_the_member_USER_has_been_extended_FREE_until_DATE_html',
{
PLAN: notification.attached_object.plan.name,
PLAN: notification.attached_object.plan.base_name,
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
FREE: notification.get_meta_data(:free_days).to_s,
DATE: I18n.l(notification.attached_object.expired_at.to_date)
}) # messageFormat

View File

@ -1,4 +1,3 @@
json.title notification.notification_type
json.description t('.you_have_subscribed_to_PLAN_html',
PLAN: notification.attached_object.plan.name)
PLAN: notification.attached_object.plan.base_name)

View File

@ -1,4 +1,3 @@
json.title notification.notification_type
json.description t('.your_subscription_PLAN_was_successfully_cancelled_html',
PLAN: notification.attached_object.plan.name)
PLAN: notification.attached_object.plan.base_name)

View File

@ -1,8 +1,7 @@
json.title notification.notification_type
json.description _t('.your_subscription_PLAN_has_been_extended_FREE_until_DATE_html',
{
PLAN: notification.attached_object.plan.name,
PLAN: notification.attached_object.plan.base_name,
FREE: notification.get_meta_data(:free_days).to_s,
DATE: I18n.l(notification.attached_object.expired_at.to_date)
}) # messageFormat

View File

@ -1,7 +1,6 @@
json.title notification.notification_type
json.description t('.subscription_partner_PLAN_has_been_subscribed_by_USER_html',
{
PLAN: notification.attached_object.plan.name,
PLAN: notification.attached_object.plan.base_name,
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user')
}) # messageFormat