mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
disable monthly payment if interval count == 1
This commit is contained in:
parent
2973dec6a7
commit
238d7af1ee
@ -84,7 +84,7 @@ const PlanCardComponent: React.FC<PlanCardProps> = ({ plan, userId, subscribedPl
|
||||
* Check if the plan is allowing a monthly payment schedule
|
||||
*/
|
||||
const canBeScheduled = (): boolean => {
|
||||
return plan.monthly_payment;
|
||||
return plan.monthly_payment && plan.interval_count !== 1;
|
||||
};
|
||||
/**
|
||||
* Callback triggered when the user select the plan
|
||||
|
@ -630,6 +630,7 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs',
|
||||
if (Auth.isAuthenticated()) {
|
||||
if ($scope.selectedPlan !== $scope.plan) {
|
||||
$scope.selectedPlan = $scope.plan;
|
||||
if ($scope.selectedPlan.monthly_payment && $scope.selectedPlan.interval_count === 1) { $scope.selectedPlan.monthly_payment = false; }
|
||||
$scope.schedule.requested_schedule = $scope.plan.monthly_payment;
|
||||
} else {
|
||||
$scope.selectedPlan = null;
|
||||
|
@ -132,7 +132,7 @@
|
||||
|
||||
<div class="input-group m-t-md">
|
||||
<label for="plan[monthly_payment]" class="control-label m-r-md">{{ 'app.shared.plan.monthly_payment' | translate }} *</label>
|
||||
<switch id="plan[monthly_payment]" disabled="plan.interval === 'week'" checked="plan.monthly_payment" on-change="toggleMonthlyPayment" class-name="'v-middle'" ng-if="plan && method != 'PATCH'"></switch>
|
||||
<switch id="plan[monthly_payment]" disabled="plan.interval === 'week' || plan.interval_count === 1" checked="plan.monthly_payment" on-change="toggleMonthlyPayment" class-name="'v-middle'" ng-if="plan && method != 'PATCH'"></switch>
|
||||
<span ng-if="method == 'PATCH'">{{ (plan.monthly_payment ? 'app.shared.buttons.yes' : 'app.shared.buttons.no') | translate }}</span>
|
||||
<input type="hidden" id="plan_monthly_input" name="plan[monthly_payment]" value="{{plan.monthly_payment}}" />
|
||||
<span class="help-block" translate>{{ 'app.shared.plan.monthly_payment_info' }}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user