Commit 4fea86788cd3de1ac2d5fe7717f8316befb1ea61
1 parent
aae07507bb
Exists in
master
calendario bootstrap
Showing
2 changed files
with
10 additions
and
2 deletions
Show diff stats
src/js/controller.js
1 | angular.module('focaCabeceraFacturador') | 1 | angular.module('focaCabeceraFacturador') |
2 | .controller('focaCabeceraFacturadorController', [ | 2 | .controller('focaCabeceraFacturadorController', [ |
3 | '$scope', | 3 | '$scope', |
4 | '$filter', | 4 | '$filter', |
5 | function($scope, $filter) { | 5 | function($scope, $filter) { |
6 | 6 | ||
7 | $scope.showCabecera = true; | 7 | $scope.showCabecera = true; |
8 | $scope.cabecera = []; | 8 | $scope.cabecera = []; |
9 | $scope.dateOptions = { | ||
10 | maxDate: new Date() | ||
11 | }; | ||
9 | 12 | ||
10 | $scope.$on('addCabecera', function(event, data) { | 13 | $scope.$on('addCabecera', function(event, data) { |
11 | var propiedad = $filter('filter')($scope.cabecera, {label: data.label}, true); | 14 | var propiedad = $filter('filter')($scope.cabecera, {label: data.label}, true); |
12 | if(propiedad.length === 1) { | 15 | if(propiedad.length === 1) { |
13 | propiedad[0].valor = data.valor; | 16 | propiedad[0].valor = data.valor; |
14 | }else { | 17 | }else { |
15 | $scope.cabecera.push({label: data.label, valor: data.valor}); | 18 | $scope.cabecera.push({label: data.label, valor: data.valor}); |
16 | } | 19 | } |
17 | }); | 20 | }); |
18 | 21 | ||
19 | $scope.$on('removeCabecera', function(event, data) { | 22 | $scope.$on('removeCabecera', function(event, data) { |
20 | var propiedad = $filter('filter')($scope.cabecera, {label: data}, true); | 23 | var propiedad = $filter('filter')($scope.cabecera, {label: data}, true); |
21 | if(propiedad.length === 1) { | 24 | if(propiedad.length === 1) { |
22 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 25 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
23 | } | 26 | } |
24 | }); | 27 | }); |
25 | 28 | ||
26 | $scope.$on('cleanCabecera', function() { | 29 | $scope.$on('cleanCabecera', function() { |
27 | $scope.cabecera = []; | 30 | $scope.cabecera = []; |
28 | }); | 31 | }); |
29 | 32 | ||
30 | }]); | 33 | }]); |
31 | 34 |
src/views/cabecera.html
1 | <form name="formCrearNota"> | 1 | <form name="formCrearNota"> |
2 | <div class="row"> | 2 | <div class="row"> |
3 | <div class="col-md-10 col-lg-12"> | 3 | <div class="col-md-10 col-lg-12"> |
4 | <div class="row panel-informativo"> | 4 | <div class="row panel-informativo"> |
5 | <div class="col-12"> | 5 | <div class="col-12"> |
6 | <div class="row titulares"> | 6 | <div class="row titulares"> |
7 | <div class="col-12 col-sm nota-pedido border border-left-0 border-white align-middle"> | 7 | <div class="col-12 col-sm nota-pedido border border-left-0 border-white align-middle"> |
8 | <h5 class="mb-0">{{$ctrl.titulo}}</h5> | 8 | <h5 class="mb-0">{{$ctrl.titulo}}</h5> |
9 | </div> | 9 | </div> |
10 | <div class="col-12 col-sm numero-pedido text-center text-md-left border border-white align-middle" | 10 | <div class="col-12 col-sm numero-pedido text-center text-md-left border border-white align-middle" |
11 | ng-if="$ctrl.numero">Nº {{$ctrl.numero}} | 11 | ng-if="$ctrl.numero">Nº {{$ctrl.numero}} |
12 | <button | 12 | <button |
13 | class="btn btn-xs btn-outline-light float-right" | 13 | class="btn btn-xs btn-outline-light float-right" |
14 | type="button" | 14 | type="button" |
15 | ng-click="$ctrl.busqueda()" | 15 | ng-click="$ctrl.busqueda()" |
16 | ng-if="$ctrl.busqueda" | 16 | ng-if="$ctrl.busqueda" |
17 | > | 17 | > |
18 | <i class="fa fa-search"></i> | 18 | <i class="fa fa-search"></i> |
19 | </button> | 19 | </button> |
20 | </div> | 20 | </div> |
21 | <div class="col-7 col-sm border border-white align-middle"> | 21 | <div class="col-7 col-sm border border-white align-middle"> |
22 | Fecha: | 22 | Fecha: |
23 | <span | 23 | <span |
24 | ng-show="!datepickerAbierto" | 24 | ng-show="!datepickerAbierto" |
25 | ng-bind="$ctrl.fecha | date:'dd/MM/yyyy'" | 25 | ng-bind="$ctrl.fecha | date:'dd/MM/yyyy'" |
26 | ng-click="datepickerAbierto = true" | 26 | ng-click="datepickerAbierto = true" |
27 | > | 27 | > |
28 | </span> | 28 | </span> |
29 | <input | 29 | <input |
30 | ng-show="datepickerAbierto" | 30 | ng-show="datepickerAbierto" |
31 | type="date" | 31 | type="text" |
32 | ng-model="$ctrl.fecha" | 32 | ng-model="$ctrl.fecha" |
33 | ng-change="datepickerAbierto = false" | 33 | ng-change="datepickerAbierto = false" |
34 | ng-blur="datepickerAbierto = false" | 34 | ng-blur="datepickerAbierto = false" |
35 | class="form-control form-control-sm col-8 float-right" | 35 | class="form-control form-control-sm col-8 float-right" |
36 | foca-focus="datepickerAbierto" | 36 | foca-focus="datepickerAbierto" |
37 | hasta-hoy | 37 | uib-datepicker-popup="dd/MM/yyyy" |
38 | show-button-bar="false" | ||
39 | is-open="datepickerOpen" | ||
40 | on-open-focus="false" | ||
41 | ng-focus="datepickerOpen = true" | ||
42 | datepicker-options="dateOptions" | ||
38 | /> | 43 | /> |
39 | </div> | 44 | </div> |
40 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> | 45 | <div class="col-5 col-sm border border-white border-right-0 align-middle"> |
41 | Hora: | 46 | Hora: |
42 | <span | 47 | <span |
43 | ng-show="!datepickerAbierto" | 48 | ng-show="!datepickerAbierto" |
44 | ng-bind="$ctrl.fecha | date:'HH:mm'" | 49 | ng-bind="$ctrl.fecha | date:'HH:mm'" |
45 | ng-click="datepickerAbierto = true" | 50 | ng-click="datepickerAbierto = true" |
46 | > | 51 | > |
47 | </span> | 52 | </span> |
48 | </div> | 53 | </div> |
49 | </div> | 54 | </div> |
50 | <div class="row py-2"> | 55 | <div class="row py-2"> |
51 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 56 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
52 | <span class="label" ng-bind="cab.label"></span> | 57 | <span class="label" ng-bind="cab.label"></span> |
53 | <span class="valor" ng-bind="cab.valor"></span> | 58 | <span class="valor" ng-bind="cab.valor"></span> |
54 | </div> | 59 | </div> |
55 | <a | 60 | <a |
56 | class="btn col-12 btn-secondary d-sm-none" | 61 | class="btn col-12 btn-secondary d-sm-none" |
57 | ng-show="cabecera.length > 0" | 62 | ng-show="cabecera.length > 0" |
58 | ng-click="showCabecera = !showCabecera" | 63 | ng-click="showCabecera = !showCabecera" |
59 | > | 64 | > |
60 | <i | 65 | <i |
61 | class="fa fa-chevron-down" | 66 | class="fa fa-chevron-down" |
62 | ng-hide="showCabecera" | 67 | ng-hide="showCabecera" |
63 | aria-hidden="true" | 68 | aria-hidden="true" |
64 | > | 69 | > |
65 | </i> | 70 | </i> |
66 | <i | 71 | <i |
67 | class="fa fa-chevron-up" | 72 | class="fa fa-chevron-up" |
68 | ng-show="showCabecera" | 73 | ng-show="showCabecera" |
69 | aria-hidden="true"> | 74 | aria-hidden="true"> |
70 | </i> | 75 | </i> |
71 | </a> | 76 | </a> |
72 | </div> | 77 | </div> |
73 | </div> | 78 | </div> |
74 | </div> | 79 | </div> |
75 | </div> | 80 | </div> |
76 | </div> | 81 | </div> |
77 | </form> | 82 | </form> |
78 | 83 |