Commit 89aafe6a28f94ea42f6cd0d7a733a198d911b4b2
1 parent
e8a154788e
Exists in
master
and in
2 other branches
calcula extra
Showing
3 changed files
with
12 additions
and
6 deletions
Show diff stats
src/js/app.js
src/js/controller.js
1 | 1 | angular.module('focaBotoneraFacturador') |
2 | 2 | .controller('focaBotoneraFacturadorController', [ |
3 | 3 | '$scope', |
4 | - function($scope) { | |
4 | + '$window', | |
5 | + function($scope, $window) { | |
5 | 6 | this.$onInit = function() { |
6 | 7 | $scope.botones = $scope.$ctrl.botones; |
7 | 8 | |
8 | - for(var i = 0; i < $scope.$ctrl.extra; i++) { | |
9 | - $scope.botones.push(''); | |
9 | + if($window.innerWidth > 576) { | |
10 | + while(($scope.botones.length % 12) !== 0) { | |
11 | + $scope.botones.push(''); | |
12 | + } | |
13 | + }else { | |
14 | + while(($scope.botones.length % 3) !== 0) { | |
15 | + $scope.botones.push(''); | |
16 | + } | |
10 | 17 | } |
11 | 18 | }; |
12 | 19 |
src/views/botonera-facturador.html
1 | 1 | <div |
2 | 2 | class="col-4 col-sm-2 px-1 py-1 m-auto m-md-0" |
3 | 3 | ng-repeat="boton in botones track by $index" |
4 | - ng-class="{'d-none d-md-grid': boton == ''}"> | |
4 | + ng-class="{'d-md-grid': boton == ''}"> | |
5 | 5 | <button |
6 | 6 | type="button" |
7 | 7 | class="btn btn-default btn-block btn-xs text-center py-1 rounded border border-light" |