mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
prevent allowing payment schedules w/ plans < 1 month
This commit is contained in:
parent
2827104f16
commit
b48a2738ec
@ -7,4 +7,4 @@ import { IApplication } from '../../models/application';
|
||||
|
||||
declare var Application: IApplication;
|
||||
|
||||
Application.Components.component('switch', react2angular(Switch, ['checked', 'onChange', 'id', 'className']));
|
||||
Application.Components.component('switch', react2angular(Switch, ['checked', 'onChange', 'id', 'className', 'disabled']));
|
||||
|
@ -182,6 +182,14 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal',
|
||||
};
|
||||
|
||||
/* PRIVATE SCOPE */
|
||||
const initialize = function () {
|
||||
$scope.$watch(scope => scope.plan.interval,
|
||||
(newValue, oldValue) => {
|
||||
if (newValue === 'week') { $scope.plan.monthly_payment = false; }
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously updates the given property with the new provided value
|
||||
* @param property {string}
|
||||
@ -194,6 +202,7 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal',
|
||||
}, 50);
|
||||
};
|
||||
|
||||
initialize();
|
||||
return new PlanController($scope, groups, prices, partners, CSRF, _t);
|
||||
}
|
||||
]);
|
||||
|
@ -121,7 +121,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]" 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'" 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…
x
Reference in New Issue
Block a user