Viewing file: tiendanube_view.php (7.95 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<style> #content { margin: 0 auto;
width: auto; height: auto;
}
.content { min-height: 80px; padding: 15px; margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } #izquierda{ width:600px; height:40px; float: left; }
#derecha{
float: right; }
#th{ border-left: 1px solid #3c8dbc; }
.red { color: red; }
.black { color: black; } .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: 20px; padding: 4px 6px; margin-bottom: 10px; font-size: 24px; line-height: 20px; color: #555555; vertical-align: middle; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; }
[ng\:cloak], [ng-cloak], .ng-cloak { display: none; }
</style> <div class="content-wrapper" style="min-height: 946px;">
<div ng-app="MenuOperaciones" style="margin-left:20px;" ng-controller="MyCtrl"> <form method="post" enctype="multipart/form-data"> Subir Archivo Extension .CSV <input type="file" name="uploadFile" id="uploadFile" file-input="files" value="" /><br><br>
<button class="btn btn-warning btn-md" title="cargar" ng-click='procesarDatosExcel()' aria-label="Left Align"> <span class="glyphicon glyphicon-print"></span> </button> </form> <div class="content">
<div id="izquierda" align="left"> <input type="text" autofocus ng-model="search" ng-change="filter()" style="width: 600px;height :40px;" placeholder="BUSCAR" class="form-control" /> </div>
</div>
<!-- Main content --> <section class="content">
<div class="row"> <div class="col-md-12" ng-show="filteredItems > 0"> <table class="table table-striped table-bordered"> <thead> <th>PEDIDO <a ng-click="sort_by('nro_orden');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>correo <a ng-click="sort_by('correo');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>subtotal <a ng-click="sort_by('fecha');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>FECHA <a ng-click="sort_by('subtotal');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>total <a ng-click="sort_by('total');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>DESC <a ng-click="sort_by('descuento');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>SUBT <a ng-click="sort_by('subtotal');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>TOTAL <a ng-click="sort_by('nombre_cliente');"><i class="glyphicon glyphicon-sort"></i></a></th> <th>SALDO <a ng-click="sort_by('dni');"><i class="glyphicon glyphicon-sort"></i></a></th> </thead> <tbody> <tr ng-repeat="datosPed in filtered = (datosPedidos | filter:search) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit"> <td ><b>{{datosPed.nro_orden}}</b></td> <td><b>{{datosPed.correo}}</b></td> <td><b>{{datosPed.fecha}}</b></td> <td><b>{{datosPed.subtotal}}</b></td> <td><b>{{datosPed.total}}</b></td> <td><b>{{datosPed.nombre_cliente}} </b></td> <td><b>{{datosPed.dni}}</b></td>
</tr> </tbody> </table> </div> <div class="col-md-10" ng-show="filteredItems == 0"> <div class="col-md-10"> <h4>NO HAY PEDIDOS DISPONIBLES</h4> </div> </div> <div class="col-md-10" ng-show="filteredItems > 0"> <div class="col-md-4"> <h5>Obtenidos {{ filtered.length }} De {{ totalItems}} PEDIDOS </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="numeroCliente" id="numeroCliente" ng-model="model.numeroCliente" value="{{numeroCliente}}"> </input> <input type="hidden" name="numeroPedido" id="numeroPedido" ng-model="model.numeroPedido" value="{{numeroPedido}}"> </input>
<button class="btn btn-danger btn-md" title="subir" ng-click='procesarExcelPedidos(datosPedidos)' aria-label="Left Align"> <span class="glyphicon glyphicon-print"></span> </button> </div> </section><!-- /.content -->
</div>
</div>
<script type="text/javascript"> var app = angular.module('MenuOperaciones', ['ui.bootstrap']);
app.filter('startFrom', function() { return function(input, start) { if(input) { start = +start; //parse to int return input.slice(start); } return []; } });
app.directive("fileInput", function($parse){ return{ link: function($scope, element, attrs){ element.on("change", function(event){ var files = event.target.files; //console.log(files[0].name); $parse(attrs.fileInput).assign($scope, element[0].files); $scope.$apply(); }); } } });
app.controller('MyCtrl', function ($scope, $http, $location) { $scope.accion=''; $scope.numeroCliente=''; $scope.numeroPedido=''; $scope.datosPedidos=[]; $scope.reloadPage = function(){window.location.reload();}
$scope.currentPage = 1; //current page $scope.entryLimit = 20; //max no of items to display in a page $scope.procesarExcelPedidos = function(datosPedidos) { alert(datosPedidos);
$http({ url: "<?php echo site_url("tiendaNube/procesarOrdenes");?>", method: "POST", data: datosPedidos, }).success(function(data){ console.log(data)
});
}
$scope.procesarDatosExcel = function() {
var form_data = new FormData(); //usamos la directiva de angular.js para adjuntar archivos al form data angular.forEach($scope.files, function(file){ form_data.append('file', file); });
$http({ url: "<?php echo site_url("tiendaNube/procesarInputCSV");?>", method: "POST", data: form_data, headers: {'Content-Type': undefined}, }).success(function(data){ $scope.datosPedidos = data; $scope.filteredItems = $scope.datosPedidos.length; //Initially for no filter $scope.totalItems = $scope.datosPedidos.length;
});
}; $scope.setPage = function(pageNo) { $scope.currentPage = pageNo; }; $scope.sort_by = function(predicate) { $scope.predicate = predicate; $scope.reverse = !$scope.reverse; };
$scope.ponerDatos= function (id,numeroCliente,accion){ $scope.accion=accion; $scope.numeroCliente=numeroCliente; $scope.numeroPedido=id; }; $scope.confirm = function() {
if (confirm('Estas seguro de esta accion?')){ event.returnValue=true; } else{ event.returnValue=false; } }; });
</script>
|