Viewing file: orden_new_view.php (11.62 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<style> .h1, .h2, .h3, h1, h2, h3 { margin-top: 0px; margin-bottom: 10px; } select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input { display: inline-block; height: 40px; padding: 4px 6px; margin-bottom: 10px; font-size: 14px; line-height: 20px; color: #555555; vertical-align: middle; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } @media (min-width: 768px) .modal-dialog { width: auto; margin: 30px auto; } ul, ol { padding: 0; margin: 0 0 10px 5px; } #searchResult{ list-style: none; padding: 0px; width: 500px; position: relative; z-index: 1000; margin: 0; } #searchResult li{ background: lavender; padding: 4px; margin-bottom: 1px; } #searchResult li:nth-child(even){ background: cadetblue; color: white; } #searchResult li:hover{ cursor: pointer; } input[type=text]{ padding: 5px; width: auto; letter-spacing: 1px; } #izquierda{ width:50%; height:40px; float: left; } #derecha{ width:50%; height:40px; float: right; margin-top: 20px; } </style> <div class="content-wrapper"> <br> <div style="margin-left:60px;"> <b style="font-family: Arial; font-size: 18pt;height: 40px;">ORDEN DE IMPRESION: </b> <input ng-model='numeroOrden' style="font-family: Arial; font-size: 20pt;height: 30px;" type="text" name="numeroOrden" id="numeroOrden" value="<?php echo ($nroOrden)?>" readonly> <br><br> <b style="font-family: Arial; font-size: 18pt;height: 40px;">USUARIO: </b> <input ng-model='usuario' style="font-family: Arial; font-size: 20pt;height: 30px;" type="text" name="usuario" id="usuario" value="<?php echo ($usuario)?>" readonly> </div> <br><br> <div ng-app="myApp" ng-controller="MyCtrl"> <div class="container"> <div class="row"> <div id="izquierda" align="left"> <div >BUSQUEDA ARTICULO: <input type="text" autofocus style="width: 500px;" ng-model='searchText' ng-keyup='fechArticulos()' ng-click='searchboxClicked($event);' ng-change="filter()" placeholder="Buscar..." class="form-control" /> <ul class="container" id='searchResult' > <li ng-click='setValue($index,$event)' ng-repeat="result in searchResult" > {{ result.nombre }} </li> </ul> </div> </div> <div id="derecha" align="left"> <button type="button" class="btn btn-success" aria-label="Left Align" ng-click='ingresarItem(searchText);' > <span class="glyphicon glyphicon-plus"></span> AGREGAR ARTICULO </button> </div> </div> <br><br> <br> <form ng-submit="confirm()" action="<?php echo base_url()?>pedido/guardarOrden/" method="post"> <h1>ARTICULOS AGREGADOS A LA ORDEN DE IMPRESION</h1> <br> <div class="row"> <div class="col-md-12" ng-show="filteredItems > 0"> <input type="text" ng-model="search" ng-change="filter()" style="width: 600px;height :40px;" placeholder="BUSCAR ARTICULO AGREGADO" class="form-control" /> <table class="table table-striped table-bordered" cellspacing="0" cellpadding="3" border="0" style="width:100%;border-collapse:collapse;"> <tr ng-repeat="block in filtered = (list | filter:search) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit"> <td style="width:33%;" ng-repeat="empl in block"> <?php //error_reporting(E_ALL); /* $nombre ="{{empl.nombre_producto}}".".jpg"; $fileT=RUTA.$nombre; $nombre2="ZS66259-1".".jpg"; $test=RUTA.$nombre2; if(file_exists($test)){ $archFoto="{{empl.nombre_producto}}".".jpg"; }else{ $archFoto="nodisp.jpg"; } */ ?> <img id="imagen" ng-src="../../../../imagenesAlmazen_new/{{empl.nombre_producto}}.jpg" style="width:200px; height:150px;" > <br><br> <input type='image' src="<?php echo site_url("productos/crear?text=". empl.nombre_producto );?>" style="width:200px; height:100px;"> <button type="button" class="btn btn-danger" aria-label="Left Align" ng-click='borrarItem(empl.nombre_producto);' > <span class="glyphicon glyphicon-minus"></span> BORRAR </button> <br> <b style="padding-left:30px;"> {{empl.nombre_producto}}</b> </td> </tr> </table> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY ORDENES DISPONIBLES</h4> </div> </div> <div class="col-md-10" ng-show="filteredItems > 0"> <div class="col-md-4"> <h5>DISPONE De {{ totalItems}} ARTICULOS AGREGADOS </h5> </div> <div class="col-md-8" pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div> </div> <input type="hidden" name="accion" id="accion" ng-init="tipoOp = '0'" ng-model="model.accion" value="{{accion}}"> </input> <input type="hidden" name="orden" id="orden" ng-init="tipoOp = '0'" ng-model="model.orden" value="{{orden}}"> </input> </div> <br><br> <div class="col-md-12" align="center"> <input class="btn btn-info btn-lg" type="submit" value="VOLVER" ng-click='volver();' > <input class="btn btn-success btn-lg" type="submit" name="guardar" id="guardar" value="GUARDAR ORDEN" ng-click='guardarOrden();' > </div> </form> <br><br> <br><br> </div> </div> <script type="text/javascript"> var app = angular.module('myApp', ['ui.bootstrap']); app.filter('startFrom', function() { return function(input, start) { if(input) { start = +start; //parse to int return input.slice(start); } return []; } }); app.controller('MyCtrl', function ($scope, $http, $modal) { $scope.accion=''; $scope.articulo=""; $scope.orden=document.getElementById('numeroOrden').value; $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; // Set value to search box $scope.setValue = function(index,$event){ $scope.searchText = $scope.searchResult[index].nombre; $scope.searchResult = {}; $event.stopPropagation(); }; $scope.searchboxClicked = function($event){ $event.stopPropagation(); }; $scope.containerClicked = function(){ $scope.searchResult = {}; }; $scope.toRows = function(arr, total){ var i = 0, rows = []; while(i < arr.length){ i % total == 0 && rows.push([]); rows[rows.length-1].push(arr[i++]) } return rows; }; $scope.refresh=function(){ $http({ url: "<?php echo site_url("pedido/getItemsOrdenImpresion");?>", method: "GET", params: {orden: "<?php echo ($nroOrden);?>"} }).success(function(data){ $scope.list = data; $scope.currentPage = 1; //current page $scope.entryLimit = 3; //max no of items to display in a page $scope.filteredItems = $scope.list.length; //Initially for no filter $scope.totalItems = $scope.list.length; $scope.list = $scope.toRows($scope.list, 3); }); }; $http({ url: "<?php echo site_url("pedido/getItemsOrdenImpresion");?>", method: "GET", params: {orden: "<?php echo ($nroOrden);?>"} }).success(function(data){ $scope.list = data; $scope.currentPage = 1; //current page $scope.entryLimit = 3; //max no of items to display in a page $scope.filteredItems = $scope.list.length; //Initially for no filter $scope.totalItems = $scope.list.length; $scope.list = $scope.toRows($scope.list, 3); }); $scope.volver = function(){ $scope.accion='1'; }; $scope.guardarOrden = function(){ $scope.accion='2'; }; $scope.fechArticulos =function(){ var searchText_len = $scope.searchText.trim().length; // Check search text length if(searchText_len > 0){ var dato=$scope.searchText; $http({ method: 'POST', url: '<?php echo site_url("productos/autoCompleteArticulos");?>', data: {searchText:dato} }).then(function successCallback(response) { $scope.searchResult = response.data; }); }else{ $scope.searchResult = {}; } }; $scope.ingresarItem = function(articulo){ var orden = document.getElementById('numeroOrden'); if(articulo !=null){ $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/registrarDetalleOrdenImpresion");?>', data: {orden:orden.value,articulo:articulo}, success:function(data){ $('#searchText').val(null); // document.getElementById('searchText').value=""; //registro el cambio en la tabla $scope.refresh(); }, error: function () { alert("Error al registrar articulo"); } }); }else{ alert("DEBE INGRESAR UN ITEM EN EL CAMPO DE BUSQUEDA!");} }; $scope.borrarItem = function(articulo){ var orden = document.getElementById('numeroOrden'); if(articulo !=null){ $.ajax({ type: 'POST', url: '<?php echo site_url("pedido/borrarDetalleOrdenImpresion");?>', data: {orden:orden.value,articulo:articulo}, success:function(data){ //registro el cambio en la tabla $scope.refresh(); }, error: function () { alert("Error al eliminar articulo"); } }); }else{ alert("DEBE INGRESAR UN ITEM EN EL CAMPO DE BUSQUEDA!");} }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; }; //modal para mostrar datos $scope.animationsEnabled = true; $scope.confirm = function() { if (confirm('Estas seguro de esta accion?')){ event.returnValue=true; } else{ event.returnValue=false; } }; $scope.toggleAnimation = function () { $scope.animationsEnabled = !$scope.animationsEnabled; }; }); </script>
|