Compare commits
No commits in common. "f8484959d663b6c6248810502d7ebfb83e01a385" and "f67232f55cc1ee98c61caa1539f91718302f3593" have entirely different histories.
f8484959d6
...
f67232f55c
3 changed files with 5 additions and 39 deletions
|
@ -21,23 +21,18 @@ class GrupoDeCompra extends Model
|
|||
return $this->hasMany('App\Subpedido');
|
||||
}
|
||||
|
||||
public function pedidosAprobados() {
|
||||
return $this->subpedidos->where('aprobado',1);
|
||||
}
|
||||
|
||||
public function exportarPlanillasAPdf() {
|
||||
$subpedidos = $this->pedidosAprobados();
|
||||
$subpedidos = $this->subpedidos;
|
||||
//generar pdf
|
||||
$mpdf = new Mpdf();
|
||||
$mpdf = new Mpdf();;
|
||||
foreach ($subpedidos as $subpedido) {
|
||||
$tabla = $subpedido->generarHTML();
|
||||
// agregar la tabla al pdf en una nueva página
|
||||
$mpdf->WriteHTML($tabla);
|
||||
$mpdf->AddPage();
|
||||
}
|
||||
$filename = $this->nombre . '.pdf';
|
||||
// imprimir el pdf
|
||||
$mpdf->Output($filename, "D");
|
||||
$mpdf->Output();
|
||||
}
|
||||
|
||||
//Asume que los productos están gruadados en orden de fila
|
||||
|
|
21
public/js/app.js
vendored
21
public/js/app.js
vendored
|
@ -3021,13 +3021,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
subpedidos: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hayAprobados: function hayAprobados() {
|
||||
return this.subpedidos.filter(function (sp) {
|
||||
return sp.aprobado;
|
||||
}).length > 0;
|
||||
}
|
||||
},
|
||||
beforeCreate: function beforeCreate() {
|
||||
var _this = this;
|
||||
|
||||
|
@ -6031,12 +6024,7 @@ var render = function () {
|
|||
"a",
|
||||
{
|
||||
staticClass: "button is-success",
|
||||
attrs: {
|
||||
href: _vm.hayAprobados
|
||||
? "/admin/exportar-pedido-a-csv/" + _vm.gdc
|
||||
: "#",
|
||||
disabled: !_vm.hayAprobados,
|
||||
},
|
||||
attrs: { href: "/admin/exportar-pedido-a-csv/" + _vm.gdc },
|
||||
},
|
||||
[
|
||||
_c("span", [
|
||||
|
@ -6051,12 +6039,7 @@ var render = function () {
|
|||
"a",
|
||||
{
|
||||
staticClass: "button is-info",
|
||||
attrs: {
|
||||
href: _vm.hayAprobados
|
||||
? "/admin/exportar-planillas-a-pdf/" + _vm.gdc
|
||||
: "#",
|
||||
disabled: !_vm.hayAprobados,
|
||||
},
|
||||
attrs: { href: "/admin/exportar-planillas-a-pdf/" + _vm.gdc },
|
||||
},
|
||||
[
|
||||
_c("span", [
|
||||
|
|
|
@ -37,16 +37,4 @@
|
|||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
@foreach($subpedido->productos as $producto)
|
||||
@if($producto->bono)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $producto->nombre }}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
{{ $producto->pivot->cantidad }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
|
|
Loading…
Add table
Reference in a new issue