feat(support): add new offerings (#3608)

* feat(support): add new offerings

* feat(support): refactor for simplicity

* feat(support): rename for clarity
pull/3621/head
itsconquest 2020-03-16 11:35:55 +13:00 committed by GitHub
parent bfdb4dba12
commit d022853059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 11 deletions

View File

@ -3,8 +3,10 @@
<div class="blocklist-item-box">
<!-- extension-image -->
<span class="blocklist-item-logo">
<img class="blocklist-item-logo" ng-if="$ctrl.model.Id == 1" src="../../../../../assets/images/support_1.png" />
<img class="blocklist-item-logo" ng-if="$ctrl.model.Id == 2" src="../../../../../assets/images/support_2.png" />
<img class="blocklist-item-logo" ng-if="$ctrl.model.Id == 1 || $ctrl.model.Id == 2 || $ctrl.model.Id == 3"
src="../../../../../assets/images/support_1.png" />
<img class="blocklist-item-logo" ng-if="$ctrl.model.Id == 4 || $ctrl.model.Id == 5"
src="../../../../../assets/images/support_2.png" />
</span>
<!-- !extension-image -->
<!-- extension-details -->

View File

@ -45,15 +45,19 @@
</div>
<div style="margin-top: 10px; margin-bottom: 95px;">
<label for="endpoint_count" class="col-sm-7 control-label text-left" style="margin-top: 7px;">Hosts</label>
<label for="endpoint_count" class="col-sm-7 control-label text-left"
style="margin-top: 7px;">Hosts</label>
<div class="col-sm-5">
<input type="number" class="form-control" ng-model="formValues.hostCount" id="endpoint_count" placeholder="10" min="10">
<input type="number" class="form-control" ng-model="formValues.hostCount" id="endpoint_count"
placeholder="{{ state.placeholder }}" min="{{ state.minHosts }}">
</div>
</div>
<div style="margin-top: 15px;" >
<a href="https://portainer.io/checkout/?add-to-cart={{ product.ProductId }}&quantity={{ formValues.hostCount }}" target="_blank">
<button ng-disabled="!formValues.hostCount || formValues.hostCount < 10" class="btn btn-primary btn-sm" style="width: 100%; margin-left: 0;">Buy</button>
<div style="margin-top: 15px;">
<a href="https://portainer.io/checkout/?add-to-cart={{ product.ProductId }}&quantity={{ formValues.hostCount }}"
target="_blank">
<button ng-disabled="isBuyButtonEnabled()" class="btn btn-primary btn-sm"
style="width: 100%; margin-left: 0;">Buy</button>
</a>
</div>
@ -81,4 +85,4 @@
</rd-widget-body>
</rd-widget>
</div>
</div>
</div>

View File

@ -1,14 +1,40 @@
angular.module('portainer.app')
.controller('SupportProductController', ['$scope', '$transition$',
function($scope, $transition$) {
function ($scope, $transition$) {
$scope.formValues = {
hostCount: 10
hostCount: 0
};
$scope.state = {
minHosts: 0,
placeholder: 0
};
$scope.isBuyButtonEnabled = function () {
return !$scope.formValues.hostCount || ($scope.formValues.hostCount < $scope.state.minHosts);
};
function initView() {
$scope.product = $transition$.params().product;
if ($scope.product.Id == 1) {
$scope.formValues.hostCount = 1;
$scope.state.minHosts = 1;
$scope.state.placeholder = 1;
}
if ($scope.product.Id == 2 || $scope.product.Id == 3) {
$scope.formValues.hostCount = 4;
$scope.state.minHosts = 4;
$scope.state.placeholder = 4;
}
if ($scope.product.Id == 4 || $scope.product.Id == 5) {
$scope.formValues.hostCount = 10;
$scope.state.minHosts = 10;
$scope.state.placeholder = 10;
}
}
initView();
}]);
}
]);