mirror of https://github.com/akveo/blur-admin
parent
bfd1084fa0
commit
14e0373d62
@ -1,23 +1,106 @@
|
||||
<div class="wizard">
|
||||
<div class="wizard-navigation-container">
|
||||
<div ng-repeat="t in $baWizardController.tabs" class="wizard-navigation {{$baWizardController.tabNum == $index ? 'active' : ''}}" ng-click="$baWizardController.selectTab($index)">
|
||||
{{t.title}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="widgets">
|
||||
|
||||
|
||||
<div class="progress progress-wizard">
|
||||
<div class="progress-bar progress-bar-info active" role="progressbar"
|
||||
aria-valuemin="0" aria-valuemax="100" ng-style="{width: $baWizardController.progress + '%'}">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div ba-panel ba-panel-title="Form Wizard" ba-panel-class="with-scroll">
|
||||
<ba-wizard>
|
||||
<ba-wizard-step title="Personal info" form="vm.personalInfoForm">
|
||||
<form name="vm.personalInfoForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.personalInfoForm.username.$invalid && (vm.personalInfoForm.username.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleUsername1">Username</label>
|
||||
<input type="text" class="form-control" id="exampleUsername1" name="username" placeholder="Username" ng-model="vm.personalInfo.username" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': vm.personalInfoForm.email.$invalid && (vm.personalInfoForm.email.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputEmail1">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleInputEmail1" name="email" placeholder="Email" ng-model="vm.personalInfo.email" required>
|
||||
<span class="help-block error-block basic-block">Proper email required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" ng-class="{'has-error': vm.personalInfoForm.password.$invalid && (vm.personalInfoForm.password.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputPassword1">Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="Password" ng-model="vm.personalInfo.password" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': !vm.arePersonalInfoPasswordsEqual() && (vm.personalInfoForm.confirmPassword.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputConfirmPassword1">Confirm Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputConfirmPassword1" name="confirmPassword" placeholder="Confirm Password" ng-model="vm.personalInfo.confirmPassword" required>
|
||||
<span class="help-block error-block basic-block">Passwords should match</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-step>
|
||||
<ba-wizard-step title="Product Info" form="vm.productInfoForm">
|
||||
<form name="vm.productInfoForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.productInfoForm.productName.$invalid && (vm.productInfoForm.productName.$dirty || vm.productInfoForm.$submitted)}">
|
||||
<label for="productName">Product name</label>
|
||||
<input type="text" class="form-control" id="productName" name="productName" placeholder="Product name" ng-model="vm.productInfo.productName" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': vm.productInfoForm.productId.$invalid && (vm.productInfoForm.productId.$dirty || vm.productInfoForm.$submitted)}">
|
||||
<label for="productId">Product id</label>
|
||||
<input type="text" class="form-control" id="productId" name="productId" placeholder="productId" ng-model="vm.productInfo.productId" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="productName">Category</label>
|
||||
<select class="form-control" title="Category" selectpicker>
|
||||
<option selected>Electronics</option>
|
||||
<option>Toys</option>
|
||||
<option>Accessories</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-step>
|
||||
<ba-wizard-step title="Shipment" form="vm.addressForm">
|
||||
<form name="vm.addressForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.addressForm.address.$invalid && (vm.addressForm.address.$dirty || vm.addressForm.$submitted)}">
|
||||
<label for="productName">Shipment address</label>
|
||||
<input type="text" class="form-control" id="address" name="address" placeholder="Shipment address" ng-model="vm.shipment.address" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="productName">Shipment method</label>
|
||||
<select class="form-control" title="Category" selectpicker>
|
||||
<option selected>Fast & expensive</option>
|
||||
<option>Cheap & free</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Save shipment info</span>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-step>
|
||||
<ba-wizard-step title="Finish">
|
||||
<form class="form-horizontal" name="vm.finishForm" novalidate>
|
||||
Congratulations! You have successfully filled the form!
|
||||
</form>
|
||||
</ba-wizard-step>
|
||||
</ba-wizard>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="steps" ng-transclude></div>
|
||||
|
||||
<nav>
|
||||
<ul class="pager wizard-pager">
|
||||
<li class="previous"><button ng-disabled="$baWizardController.isFirstTab()" ng-click="$baWizardController.previousTab()" type="button" class=" btn btn-primary"><span aria-hidden="true">←</span> previous</button></li>
|
||||
<li class="next"> <button ng-disabled="$baWizardController.isLastTab()" ng-click="$baWizardController.nextTab()" type="button" class="btn btn-primary">next <span aria-hidden="true">→</span></button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
@ -1,106 +0,0 @@
|
||||
<div class="widgets">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div ba-panel ba-panel-title="Form Wizard" ba-panel-class="with-scroll">
|
||||
<ba-wizard>
|
||||
<ba-wizard-tab title="Personal info" form="vm.personalInfoForm">
|
||||
<form name="vm.personalInfoForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.personalInfoForm.username.$invalid && (vm.personalInfoForm.username.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleUsername1">Username</label>
|
||||
<input type="text" class="form-control" id="exampleUsername1" name="username" placeholder="Username" ng-model="vm.personalInfo.username" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': vm.personalInfoForm.email.$invalid && (vm.personalInfoForm.email.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputEmail1">Email address</label>
|
||||
<input type="email" class="form-control" id="exampleInputEmail1" name="email" placeholder="Email" ng-model="vm.personalInfo.email" required>
|
||||
<span class="help-block error-block basic-block">Proper email required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group" ng-class="{'has-error': vm.personalInfoForm.password.$invalid && (vm.personalInfoForm.password.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputPassword1">Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputPassword1" name="password" placeholder="Password" ng-model="vm.personalInfo.password" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': !vm.arePersonalInfoPasswordsEqual() && (vm.personalInfoForm.confirmPassword.$dirty || vm.personalInfoForm.$submitted)}">
|
||||
<label for="exampleInputConfirmPassword1">Confirm Password</label>
|
||||
<input type="password" class="form-control" id="exampleInputConfirmPassword1" name="confirmPassword" placeholder="Confirm Password" ng-model="vm.personalInfo.confirmPassword" required>
|
||||
<span class="help-block error-block basic-block">Passwords should match</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Product Info" form="vm.productInfoForm">
|
||||
<form name="vm.productInfoForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.productInfoForm.productName.$invalid && (vm.productInfoForm.productName.$dirty || vm.productInfoForm.$submitted)}">
|
||||
<label for="productName">Product name</label>
|
||||
<input type="text" class="form-control" id="productName" name="productName" placeholder="Product name" ng-model="vm.productInfo.productName" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{'has-error': vm.productInfoForm.productId.$invalid && (vm.productInfoForm.productId.$dirty || vm.productInfoForm.$submitted)}">
|
||||
<label for="productId">Product id</label>
|
||||
<input type="text" class="form-control" id="productId" name="productId" placeholder="productId" ng-model="vm.productInfo.productId" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="productName">Category</label>
|
||||
<select class="form-control" title="Category" selectpicker>
|
||||
<option selected>Electronics</option>
|
||||
<option>Toys</option>
|
||||
<option>Accessories</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Shipment" form="vm.addressForm">
|
||||
<form name="vm.addressForm" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group has-feedback"
|
||||
ng-class="{'has-error': vm.addressForm.address.$invalid && (vm.addressForm.address.$dirty || vm.addressForm.$submitted)}">
|
||||
<label for="productName">Shipment address</label>
|
||||
<input type="text" class="form-control" id="address" name="address" placeholder="Shipment address" ng-model="vm.shipment.address" required>
|
||||
<span class="help-block error-block basic-block">Required</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="productName">Shipment method</label>
|
||||
<select class="form-control" title="Category" selectpicker>
|
||||
<option selected>Fast & expensive</option>
|
||||
<option>Cheap & free</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="custom-checkbox">
|
||||
<input type="checkbox">
|
||||
<span>Save shipment info</span>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
<ba-wizard-tab title="Finish">
|
||||
<form class="form-horizontal" name="vm.finishForm" novalidate>
|
||||
Congratulations! You have successfully filled the form!
|
||||
</form>
|
||||
</ba-wizard-tab>
|
||||
</ba-wizard>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,17 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.theme.components')
|
||||
.directive('baWizard', baWizard);
|
||||
|
||||
/** @ngInject */
|
||||
function baWizard() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
templateUrl: 'app/theme/components/baWizard/baWizard.html',
|
||||
controllerAs: '$baWizardController',
|
||||
controller: 'baWizardCtrl'
|
||||
}
|
||||
}
|
||||
})();
|
@ -0,0 +1,22 @@
|
||||
<div class="wizard">
|
||||
<div class="wizard-navigation-container">
|
||||
<div ng-repeat="t in $baWizardController.tabs" class="wizard-navigation {{$baWizardController.tabNum == $index ? 'active' : ''}}" ng-click="$baWizardController.selectTab($index)">
|
||||
{{t.title}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="progress progress-wizard">
|
||||
<div class="progress-bar progress-bar-info active" role="progressbar"
|
||||
aria-valuemin="0" aria-valuemax="100" ng-style="{width: $baWizardController.progress + '%'}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="steps" ng-transclude></div>
|
||||
|
||||
<nav>
|
||||
<ul class="pager wizard-pager">
|
||||
<li class="previous"><button ng-disabled="$baWizardController.isFirstTab()" ng-click="$baWizardController.previousTab()" type="button" class=" btn btn-primary"><span aria-hidden="true">←</span> previous</button></li>
|
||||
<li class="next"> <button ng-disabled="$baWizardController.isLastTab()" ng-click="$baWizardController.nextTab()" type="button" class="btn btn-primary">next <span aria-hidden="true">→</span></button></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
@ -0,0 +1,54 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.theme.components')
|
||||
.controller('baWizardCtrl', baWizardCtrl);
|
||||
|
||||
/** @ngInject */
|
||||
function baWizardCtrl($scope) {
|
||||
var vm = this;
|
||||
vm.tabs = [];
|
||||
|
||||
vm.tabNum = 0;
|
||||
vm.progress = 0;
|
||||
|
||||
vm.addTab = function(tab) {
|
||||
tab.setPrev(vm.tabs[vm.tabs.length - 1]);
|
||||
vm.tabs.push(tab);
|
||||
vm.selectTab(0);
|
||||
};
|
||||
|
||||
$scope.$watch(angular.bind(vm, function () {return vm.tabNum;}), calcProgress);
|
||||
|
||||
vm.selectTab = function (tabNum) {
|
||||
vm.tabs[vm.tabNum].submit();
|
||||
if (vm.tabs[tabNum].isAvailiable()) {
|
||||
vm.tabNum = tabNum;
|
||||
vm.tabs.forEach(function (t, tIndex) {
|
||||
tIndex == vm.tabNum ? t.select(true) : t.select(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
vm.isFirstTab = function () {
|
||||
return vm.tabNum == 0;
|
||||
};
|
||||
|
||||
vm.isLastTab = function () {
|
||||
return vm.tabNum == vm.tabs.length - 1 ;
|
||||
};
|
||||
|
||||
vm.nextTab = function () {
|
||||
vm.selectTab(vm.tabNum + 1)
|
||||
};
|
||||
|
||||
vm.previousTab = function () {
|
||||
vm.selectTab(vm.tabNum - 1)
|
||||
};
|
||||
|
||||
function calcProgress() {
|
||||
vm.progress = ((vm.tabNum + 1) / vm.tabs.length) * 100;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -0,0 +1,58 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.theme.components')
|
||||
.directive('baWizardStep', baWizardStep);
|
||||
|
||||
/** @ngInject */
|
||||
function baWizardStep() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
require: '^baWizard',
|
||||
scope: {
|
||||
form: '='
|
||||
},
|
||||
templateUrl: 'app/theme/components/baWizard/baWizardStep.html',
|
||||
link: function($scope, $element, $attrs, wizard) {
|
||||
$scope.selected = true;
|
||||
|
||||
var tab = {
|
||||
title: $attrs.title,
|
||||
select: select,
|
||||
submit: submit,
|
||||
isComplete: isComplete,
|
||||
isAvailiable: isAvailiable,
|
||||
prevTab: undefined,
|
||||
setPrev: setPrev
|
||||
};
|
||||
|
||||
wizard.addTab(tab);
|
||||
|
||||
function select(isSelected) {
|
||||
if (isSelected) {
|
||||
$scope.selected = true;
|
||||
} else {
|
||||
$scope.selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
function submit() {
|
||||
$scope.form && $scope.form.$setSubmitted(true);
|
||||
}
|
||||
|
||||
function isComplete() {
|
||||
return $scope.form ? $scope.form.$valid : true;
|
||||
}
|
||||
|
||||
function isAvailiable() {
|
||||
return tab.prevTab ? tab.prevTab.isComplete() : true;
|
||||
}
|
||||
|
||||
function setPrev(pTab) {
|
||||
tab.prevTab = pTab;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
Loading…
Reference in new issue