funcion/devoluciones #28
					 25 changed files with 1071 additions and 610 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -12,3 +12,4 @@ npm-debug.log
 | 
				
			||||||
yarn-error.log
 | 
					yarn-error.log
 | 
				
			||||||
.idea
 | 
					.idea
 | 
				
			||||||
/resources/csv/exports/*.csv
 | 
					/resources/csv/exports/*.csv
 | 
				
			||||||
 | 
					/public
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,10 +13,17 @@ use League\Csv\Reader;
 | 
				
			||||||
class GrupoDeCompra extends Model
 | 
					class GrupoDeCompra extends Model
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public $timestamps = false;
 | 
					  public $timestamps = false;
 | 
				
			||||||
  protected $fillable = [ "nombre","region","telefono","correo","referente_finanzas","cantidad_de_nucleos","fila"];
 | 
					  protected $fillable = [ "nombre","region","telefono","correo","referente_finanzas","cantidad_de_nucleos","fila", "devoluciones_habilitadas"];
 | 
				
			||||||
  protected $table = 'grupos_de_compra';
 | 
					  protected $table = 'grupos_de_compra';
 | 
				
			||||||
  protected $hidden = ['password'];
 | 
					  protected $hidden = ['password'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public function toggleDevoluciones()
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					      $this->devoluciones_habilitadas = !$this->devoluciones_habilitadas;
 | 
				
			||||||
 | 
					      $this->save();
 | 
				
			||||||
 | 
					      return $this->devoluciones_habilitadas;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public function subpedidos() {
 | 
					  public function subpedidos() {
 | 
				
			||||||
  	return $this->hasMany('App\Subpedido');
 | 
					  	return $this->hasMany('App\Subpedido');
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -115,7 +122,7 @@ class GrupoDeCompra extends Model
 | 
				
			||||||
      $fila = $productos_id_fila[$id];
 | 
					      $fila = $productos_id_fila[$id];
 | 
				
			||||||
      $records[$fila][1] = $producto_pedido->cantidad_pedida;
 | 
					      $records[$fila][1] = $producto_pedido->cantidad_pedida;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    $records[$this->obtenerFilaDeBonoTransporte()][1] = $this->calcularCantidadBDT();
 | 
					    $records[$this->obtenerFilaDeBonoTransporte()][1] = $this->calcularCantidadBDT();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
| 
						 | 
					@ -131,12 +138,12 @@ class GrupoDeCompra extends Model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // si no hay pedidos aprobados, salir
 | 
					    // si no hay pedidos aprobados, salir
 | 
				
			||||||
    if ($productos_en_pedido->count() == 0) { \Log::debug("El grupo de compra ". $this->nombre . " no tiene pedidos aprobados."); return; }
 | 
					    if ($productos_en_pedido->count() == 0) { \Log::debug("El grupo de compra ". $this->nombre . " no tiene pedidos aprobados."); return; }
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    $pedidos = $this->pedidosAprobados();
 | 
					    $pedidos = $this->pedidosAprobados();
 | 
				
			||||||
    // Generar tabla vacía con una columna por núcleo
 | 
					    // Generar tabla vacía con una columna por núcleo
 | 
				
			||||||
    $records = $this->obtenerTemplateDeFilasVacias($pedidos->count());
 | 
					    $records = $this->obtenerTemplateDeFilasVacias($pedidos->count());
 | 
				
			||||||
    $productos_id_fila = Producto::productosIdFila();
 | 
					    $productos_id_fila = Producto::productosIdFila();
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    foreach ($productos_en_pedido as $id => $producto_pedido) {
 | 
					    foreach ($productos_en_pedido as $id => $producto_pedido) {
 | 
				
			||||||
      $fila = $productos_id_fila[$id];
 | 
					      $fila = $productos_id_fila[$id];
 | 
				
			||||||
      $i = 1;
 | 
					      $i = 1;
 | 
				
			||||||
| 
						 | 
					@ -155,7 +162,7 @@ class GrupoDeCompra extends Model
 | 
				
			||||||
      $i++;
 | 
					      $i++;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    array_splice($records, 0, 0, array($nucleos));
 | 
					    array_splice($records, 0, 0, array($nucleos));
 | 
				
			||||||
    
 | 
					
 | 
				
			||||||
    // Guardar en un archivo .csv
 | 
					    // Guardar en un archivo .csv
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
      $writer = Writer::createFromPath(resource_path('csv/exports/'.$this->nombre.'-completo.csv'), 'w');
 | 
					      $writer = Writer::createFromPath(resource_path('csv/exports/'.$this->nombre.'-completo.csv'), 'w');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ class SubpedidoController extends Controller
 | 
				
			||||||
    // recibe request, saca producto y cantidad, valida, y pasa a syncProducto en Subpedido
 | 
					    // recibe request, saca producto y cantidad, valida, y pasa a syncProducto en Subpedido
 | 
				
			||||||
    public function syncProductos(Subpedido $subpedido) {
 | 
					    public function syncProductos(Subpedido $subpedido) {
 | 
				
			||||||
        if ($subpedido->aprobado) return new SubpedidoResource($subpedido);
 | 
					        if ($subpedido->aprobado) return new SubpedidoResource($subpedido);
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        $valid = request()->validate([
 | 
					        $valid = request()->validate([
 | 
				
			||||||
            'cantidad'              => 'required|min:0',
 | 
					            'cantidad'              => 'required|min:0',
 | 
				
			||||||
            'producto_id'    => [
 | 
					            'producto_id'    => [
 | 
				
			||||||
| 
						 | 
					@ -98,4 +98,15 @@ class SubpedidoController extends Controller
 | 
				
			||||||
        return new SubpedidoResource($subpedido);
 | 
					        return new SubpedidoResource($subpedido);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function syncDevoluciones(Subpedido $subpedido) {
 | 
				
			||||||
 | 
					        if ($subpedido->aprobado) return new SubpedidoResource($subpedido);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $valid = request()->validate([
 | 
				
			||||||
 | 
					            'total' => 'required|min:0',
 | 
				
			||||||
 | 
					            'notas' => 'min:0'
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					        $subpedido->syncDevoluciones($valid['total'], $valid['notas'] ?? "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return new SubpedidoResource($subpedido);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,9 +22,12 @@ class SubpedidoResource extends JsonResource
 | 
				
			||||||
            'bonos_de_transporte' => $this->cantidadBDT(),
 | 
					            'bonos_de_transporte' => $this->cantidadBDT(),
 | 
				
			||||||
            'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),0),
 | 
					            'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),0),
 | 
				
			||||||
            'total' => number_format($this->getTotal(),0),
 | 
					            'total' => number_format($this->getTotal(),0),
 | 
				
			||||||
 | 
					            'total_menos_devoluciones' => number_format($this->getTotalMenosDevoluciones(),0),
 | 
				
			||||||
            'grupo_de_compra' => $this->grupoDeCompra,
 | 
					            'grupo_de_compra' => $this->grupoDeCompra,
 | 
				
			||||||
            'productos' => $this->productos,
 | 
					            'productos' => $this->productos,
 | 
				
			||||||
            'aprobado' => (bool) $this->aprobado
 | 
					            'aprobado' => (bool) $this->aprobado,
 | 
				
			||||||
 | 
					            'devoluciones_total' => (double) $this->devoluciones_total,
 | 
				
			||||||
 | 
					            'devoluciones_notas' => $this->devoluciones_notas
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ use App\Filtros\FiltroDeSubpedido;
 | 
				
			||||||
class Subpedido extends Model
 | 
					class Subpedido extends Model
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  public $timestamps = false;
 | 
					  public $timestamps = false;
 | 
				
			||||||
  protected $fillable = ['grupo_de_compra_id', 'aprobado', 'nombre'];
 | 
					  protected $fillable = ['grupo_de_compra_id', 'aprobado', 'nombre', 'devoluciones_total', 'devoluciones_notas'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public function productos()
 | 
					  public function productos()
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
| 
						 | 
					@ -69,6 +69,10 @@ class Subpedido extends Model
 | 
				
			||||||
    return $this->totalSinBonos() + $this->getSubtotalBDT() + $this->getSubtotalBonos();
 | 
					    return $this->totalSinBonos() + $this->getSubtotalBDT() + $this->getSubtotalBonos();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public function getTotalMenosDevoluciones() {
 | 
				
			||||||
 | 
					    return $this->getTotal() - $this->getDevoluciones();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto.
 | 
					  //Actualiza el pedido, agregando o quitando del subpedido según sea necesario. Debe ser llamado desde el controlador de subpedidos, luego de validar que los parámetros $producto y $cantidad son correctos. También calcula el subtotal por producto.
 | 
				
			||||||
  public function syncProducto(Producto $producto, Int $cantidad) {
 | 
					  public function syncProducto(Producto $producto, Int $cantidad) {
 | 
				
			||||||
        if ($cantidad){
 | 
					        if ($cantidad){
 | 
				
			||||||
| 
						 | 
					@ -94,5 +98,17 @@ class Subpedido extends Model
 | 
				
			||||||
      $view = view("pdfgen.subpedido_tabla", ["subpedido" => $this]);
 | 
					      $view = view("pdfgen.subpedido_tabla", ["subpedido" => $this]);
 | 
				
			||||||
      return $view->render();
 | 
					      return $view->render();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  public function getDevoluciones() {
 | 
				
			||||||
 | 
					    return $this->devoluciones_total;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  public function getNotasDevoluciones() {
 | 
				
			||||||
 | 
					    return $this->devoluciones_notas;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  public function syncDevoluciones(float $total, string $notas) {
 | 
				
			||||||
 | 
					    $this->devoluciones_total = $total;
 | 
				
			||||||
 | 
					    $this->devoluciones_notas = $notas;
 | 
				
			||||||
 | 
					    $this->save();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1049
									
								
								composer.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										1049
									
								
								composer.lock
									
										
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -0,0 +1,34 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
 | 
					use Illuminate\Support\Facades\Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DevolucionesPedido extends Migration
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the migrations.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function up()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::table('subpedidos', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->double('devoluciones_total', 10, 2)->default(0);
 | 
				
			||||||
 | 
					            $table->string('devoluciones_notas')->default("");
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::table('subpedidos', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->dropColumn('devoluciones_total');
 | 
				
			||||||
 | 
					            $table->dropColumn('devoluciones_notas');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
 | 
					use Illuminate\Support\Facades\Schema;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class HabilitarDevoluciones extends Migration
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Run the migrations.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function up()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::table('grupos_de_compra', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->boolean('devoluciones_habilitadas')->default(false);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Reverse the migrations.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function down()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Schema::table('grupos_de_compra', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->dropColumn('devoluciones_habilitadas');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,50 +0,0 @@
 | 
				
			||||||
CONTAINER ID        IMAGE                                  COMMAND                  CREATED             STATUS                       PORTS                                   NAMES
 | 
					 | 
				
			||||||
0be94811453f        bc48a6b1eec1                           "/bin/sh -c 'apt-get…"   3 days ago          Exited (100) 3 days ago                                              festive_poitras
 | 
					 | 
				
			||||||
20904ea983a8        bc48a6b1eec1                           "/bin/sh -c 'apt-get…"   3 days ago          Exited (100) 3 days ago                                              nifty_antonelli
 | 
					 | 
				
			||||||
eb71d65b34cc        odoo:15                                "/entrypoint.sh odoo"    6 weeks ago         Up 6 days                    0.0.0.0:8069->8069/tcp, 8071-8072/tcp   odoo_bar_web_1
 | 
					 | 
				
			||||||
6b08d5b023b7        postgres:latest                        "docker-entrypoint.s…"   6 weeks ago         Up 6 weeks                   0.0.0.0:32775->5432/tcp                 odoo_bar_db_1
 | 
					 | 
				
			||||||
2be39cf0f208        wordpress:latest                       "docker-entrypoint.s…"   2 months ago        Up 2 months                  0.0.0.0:8007->80/tcp                    wordpress-mps_wordpress_1
 | 
					 | 
				
			||||||
1fb3ab9d5196        mariadb:10.3                           "docker-entrypoint.s…"   2 months ago        Up 2 months                  3306/tcp                                wordpress-mps_db_1
 | 
					 | 
				
			||||||
62d94ac320a9        wordpress:cli-php8.0                   "docker-entrypoint.s…"   2 months ago        Exited (1) 2 months ago                                              wordpress-mps_wpcli_1
 | 
					 | 
				
			||||||
dfa0be51db2f        mysql:5.7                              "docker-entrypoint.s…"   6 months ago        Up 4 months                  33060/tcp, 0.0.0.0:33060->3306/tcp      pedi2-db
 | 
					 | 
				
			||||||
d2261994fbbb        nginx:alpine                           "/docker-entrypoint.…"   6 months ago        Up 4 months                  0.0.0.0:8903->80/tcp                    pedi2-nginx
 | 
					 | 
				
			||||||
8dfd4713c569        laravel-image                          "docker-php-entrypoi…"   6 months ago        Up 4 months                  9000/tcp                                pedi2-app
 | 
					 | 
				
			||||||
1717f2e0e075        collabora/code:latest                  "/start-collabora-on…"   6 months ago        Up 4 months                  0.0.0.0:9980->9980/tcp                  collabora
 | 
					 | 
				
			||||||
949c45e8e331        nginx:alpine                           "/docker-entrypoint.…"   11 months ago       Up 4 months                  0.0.0.0:8902->80/tcp                    planifibot-nginx
 | 
					 | 
				
			||||||
855c759a117d        70bc6d959246                           "docker-php-entrypoi…"   11 months ago       Up 4 months                  9000/tcp                                planifibot-app
 | 
					 | 
				
			||||||
f8591a57bab7        mysql:5.7                              "docker-entrypoint.s…"   11 months ago       Up 4 months                  33060/tcp, 0.0.0.0:3316->3306/tcp       planifibot-db
 | 
					 | 
				
			||||||
a7de86736ea4        akaunting/akaunting:es                 "/usr/local/bin/akau…"   12 months ago       Exited (0) 8 months ago                                              akaunting
 | 
					 | 
				
			||||||
0f4753ad709d        mariadb                                "docker-entrypoint.s…"   12 months ago       Exited (0) 8 months ago                                              akaunting-db
 | 
					 | 
				
			||||||
7dab3c403e21        127.0.0.1:5000/mps/planifibot:latest   "docker-php-entrypoi…"   12 months ago       Exited (255) 12 months ago   0.0.0.0:8044->80/tcp                    planifibot
 | 
					 | 
				
			||||||
5880418fe8df        105826cada74                           "docker-php-entrypoi…"   12 months ago       Exited (255) 12 months ago   0.0.0.0:8044->80/tcp                    admiring_lumiere
 | 
					 | 
				
			||||||
8fd9068db7ed        592f6de18841                           "docker-php-entrypoi…"   12 months ago       Exited (0) 12 months ago                                             tender_kare
 | 
					 | 
				
			||||||
db313e1dc227        72ba750ea9de                           "/bin/sh -c 'chown -…"   12 months ago       Exited (1) 12 months ago                                             pedantic_torvalds
 | 
					 | 
				
			||||||
4bd63fb01f80        8e2bc9d43c26                           "/bin/sh -c 'chown -…"   12 months ago       Exited (1) 12 months ago                                             stoic_goldstine
 | 
					 | 
				
			||||||
8181000e76cc        1ed58aad8567                           "/bin/sh -c 'docker-…"   12 months ago       Exited (1) 12 months ago                                             lucid_lalande
 | 
					 | 
				
			||||||
ec7da80bde1a        b042c91004f0                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           keen_mendel
 | 
					 | 
				
			||||||
43fd36cd860f        b042c91004f0                           "/bin/sh -c 'docker-…"   12 months ago       Exited (1) 12 months ago                                             jovial_khayyam
 | 
					 | 
				
			||||||
02a551fc62b5        b042c91004f0                           "/bin/sh -c 'docker-…"   12 months ago       Exited (1) 12 months ago                                             heuristic_curie
 | 
					 | 
				
			||||||
47f377f81a3e        1b37a536c088                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (1) 12 months ago                                             laughing_franklin
 | 
					 | 
				
			||||||
0f63ee6729d9        1b37a536c088                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (1) 12 months ago                                             elegant_hoover
 | 
					 | 
				
			||||||
8a97c786f1e8        1b37a536c088                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           distracted_yonath
 | 
					 | 
				
			||||||
d4c7f0f8b235        1b37a536c088                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           vigilant_brown
 | 
					 | 
				
			||||||
a6d3cf25487e        80bfd1c2ffed                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           dazzling_williams
 | 
					 | 
				
			||||||
50030ac55043        80bfd1c2ffed                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           pedantic_lovelace
 | 
					 | 
				
			||||||
0ba2516ca8bd        1e9cc426f6db                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           suspicious_merkle
 | 
					 | 
				
			||||||
506eb5744961        1e9cc426f6db                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           stupefied_curie
 | 
					 | 
				
			||||||
29a25c955eef        1e9cc426f6db                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           competent_greider
 | 
					 | 
				
			||||||
bcbd4a6e70fc        1e9cc426f6db                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           condescending_chaum
 | 
					 | 
				
			||||||
0ff1e51bf0c5        1e9cc426f6db                           "/bin/sh -c 'apt-get…"   12 months ago       Exited (100) 12 months ago                                           eager_morse
 | 
					 | 
				
			||||||
4b200797fbb8        9ff09bb3bbaf                           "/bin/sh -c 'apk add…"   12 months ago       Exited (127) 12 months ago                                           trusting_euler
 | 
					 | 
				
			||||||
4630e65da875        38b8d34febc3                           "/bin/sh -c 'docker-…"   12 months ago       Exited (2) 12 months ago                                             pensive_khorana
 | 
					 | 
				
			||||||
31bc5cbeebda        38b8d34febc3                           "/bin/sh -c 'docker-…"   13 months ago       Exited (2) 13 months ago                                             elated_chatterjee
 | 
					 | 
				
			||||||
dcbaf807509c        c2521253d4dc                           "/bin/sh -c 'docker-…"   13 months ago       Exited (2) 13 months ago                                             mystifying_cohen
 | 
					 | 
				
			||||||
a8d287e4972e        c2521253d4dc                           "/bin/sh -c 'docker-…"   13 months ago       Exited (2) 13 months ago                                             adoring_boyd
 | 
					 | 
				
			||||||
57e55bd140e5        919da407c087                           "/bin/sh -c 'apt-get…"   13 months ago       Exited (100) 13 months ago                                           blissful_turing
 | 
					 | 
				
			||||||
16759118d07b        919da407c087                           "/bin/sh -c 'apt-get…"   13 months ago       Exited (100) 13 months ago                                           modest_edison
 | 
					 | 
				
			||||||
686e965026ac        919da407c087                           "/bin/sh -c 'apt-get…"   13 months ago       Exited (100) 13 months ago                                           upbeat_khorana
 | 
					 | 
				
			||||||
e6a4f4e0bc55        919da407c087                           "/bin/sh -c 'apt-get…"   13 months ago       Exited (100) 13 months ago                                           inspiring_lovelace
 | 
					 | 
				
			||||||
d19e81ca0ad2        34258187e19e                           "/bin/sh -c 'wget -q…"   17 months ago       Exited (127) 17 months ago                                           hardcore_lederberg
 | 
					 | 
				
			||||||
0d3305ea4c5d        fc0cc68061fd                           "/bin/sh -c 'apt-get…"   17 months ago       Exited (2) 17 months ago                                             epic_einstein
 | 
					 | 
				
			||||||
1f0cc817b5f9        fc0cc68061fd                           "/bin/sh -c 'apt-get…"   17 months ago       Exited (2) 17 months ago                                             flamboyant_jang
 | 
					 | 
				
			||||||
ec330033c36f        mariadb:10.3                           "docker-entrypoint.s…"   22 months ago       Exited (137) 17 months ago                                           akaunting_db_1
 | 
					 | 
				
			||||||
							
								
								
									
										63
									
								
								resources/js/app.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								resources/js/app.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -24,14 +24,14 @@ files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(
 | 
				
			||||||
 * Constants
 | 
					 * Constants
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Vue.prototype.$rootMiga = {
 | 
					Vue.prototype.$rootMiga = {
 | 
				
			||||||
  nombre: "Categorías", 
 | 
					  nombre: "Categorías",
 | 
				
			||||||
  href: "/productos"
 | 
					  href: "/productos"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Global methods
 | 
					 * Global methods
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
Vue.prototype.$settearProducto = function(cantidad, id) { 
 | 
					Vue.prototype.$settearProducto = function(cantidad, id) {
 | 
				
			||||||
  Event.$emit("sync-subpedido", this.cant, this.producto.id) 
 | 
					  Event.$emit("sync-subpedido", this.cant, this.producto.id)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
Vue.prototype.$toast = function(mensaje, duration = 1000) {
 | 
					Vue.prototype.$toast = function(mensaje, duration = 1000) {
 | 
				
			||||||
  return window.bulmaToast.toast({
 | 
					  return window.bulmaToast.toast({
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,8 @@ const app = new Vue({
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        gdc: null,
 | 
					        gdc: null,
 | 
				
			||||||
        pedido: null
 | 
					        pedido: null,
 | 
				
			||||||
 | 
					        devoluciones: null,
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    computed: {
 | 
					    computed: {
 | 
				
			||||||
| 
						 | 
					@ -71,20 +72,34 @@ const app = new Vue({
 | 
				
			||||||
      cantidad(producto) {
 | 
					      cantidad(producto) {
 | 
				
			||||||
        let pedido = this.productos.some(p => p.id == producto.id)
 | 
					        let pedido = this.productos.some(p => p.id == producto.id)
 | 
				
			||||||
        return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0
 | 
					        return pedido ? this.productos.find(p => p.id == producto.id).pivot.cantidad : 0
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
 | 
					        settearDevoluciones() {
 | 
				
			||||||
 | 
					            axios.get(`/api/grupos-de-compra/${this.gdc}/devoluciones`)
 | 
				
			||||||
 | 
					                .then(response => {
 | 
				
			||||||
 | 
					                    this.devoluciones = response.data.devoluciones;
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    mounted() {
 | 
					    mounted() {
 | 
				
			||||||
      Event.$on('obtener-sesion', () => {
 | 
					        Event.$on('obtener-sesion', () => {
 | 
				
			||||||
        axios.get('/subpedidos/obtener_sesion')
 | 
					            axios.get('/subpedidos/obtener_sesion')
 | 
				
			||||||
          .then(response => {
 | 
					                .then(response => {
 | 
				
			||||||
            this.pedido = response.data.subpedido.id
 | 
					                    if (response.data.subpedido.id) {
 | 
				
			||||||
            axios.get('/api/subpedidos/' + this.pedido)
 | 
					                        this.gdc = response.data.gdc;
 | 
				
			||||||
              .then(response => {
 | 
					                        this.settearDevoluciones();
 | 
				
			||||||
                this.pedido = response.data.data
 | 
					                        this.pedido = response.data.subpedido.id;
 | 
				
			||||||
                this.gdc = this.pedido.grupo_de_compra.id
 | 
					                        axios.get('/api/subpedidos/' + this.pedido)
 | 
				
			||||||
              })
 | 
					                            .then(response => {
 | 
				
			||||||
          })
 | 
					                                this.pedido = response.data.data;
 | 
				
			||||||
      })
 | 
					                            });
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        axios.get('/admin/obtener_sesion')
 | 
				
			||||||
 | 
					                            .then(response => {
 | 
				
			||||||
 | 
					                                this.gdc = response.data.gdc
 | 
				
			||||||
 | 
					                            });
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
      Event.$on('sync-subpedido', (cantidad, id) => {
 | 
					      Event.$on('sync-subpedido', (cantidad, id) => {
 | 
				
			||||||
          if (this.pedido.aprobado) {
 | 
					          if (this.pedido.aprobado) {
 | 
				
			||||||
            this.$toast('No se puede modificar un pedido ya aprobado', 2000);
 | 
					            this.$toast('No se puede modificar un pedido ya aprobado', 2000);
 | 
				
			||||||
| 
						 | 
					@ -98,6 +113,22 @@ const app = new Vue({
 | 
				
			||||||
            this.$toast('Pedido actualizado exitosamente')
 | 
					            this.$toast('Pedido actualizado exitosamente')
 | 
				
			||||||
          });
 | 
					          });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					      // Actualizar monto y notas de devoluciones
 | 
				
			||||||
 | 
					      Event.$on('sync-devoluciones', (total, notas) => {
 | 
				
			||||||
 | 
					        if (this.pedido.aprobado) {
 | 
				
			||||||
 | 
					          this.$toast('No se puede modificar un pedido ya aprobado', 2000);
 | 
				
			||||||
 | 
					          return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", {
 | 
				
			||||||
 | 
					          total: total,
 | 
				
			||||||
 | 
					          notas: notas,
 | 
				
			||||||
 | 
					        }).then((response) => {
 | 
				
			||||||
 | 
					          this.pedido = response.data.data;
 | 
				
			||||||
 | 
					          this.$toast('Pedido actualizado');
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Event.$on('aprobacion-subpedido', (subpedidoId, aprobado) => {
 | 
					      Event.$on('aprobacion-subpedido', (subpedidoId, aprobado) => {
 | 
				
			||||||
        axios.post("/api/admin/subpedidos/" + subpedidoId + "/aprobacion", {
 | 
					        axios.post("/api/admin/subpedidos/" + subpedidoId + "/aprobacion", {
 | 
				
			||||||
          aprobacion: aprobado
 | 
					          aprobacion: aprobado
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,13 +11,6 @@
 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
            </thead>
 | 
					            </thead>
 | 
				
			||||||
            <tfoot>
 | 
					            <tfoot>
 | 
				
			||||||
            <tr>
 | 
					 | 
				
			||||||
                <th><abbr title="Bonos Solidarios">B. Solidarios</abbr></th>
 | 
					 | 
				
			||||||
                <th>{{ cantidadBonos }}</th>
 | 
					 | 
				
			||||||
                <th>{{ totalBonos }}</th>
 | 
					 | 
				
			||||||
                <th></th>
 | 
					 | 
				
			||||||
                <th></th>
 | 
					 | 
				
			||||||
            </tr>
 | 
					 | 
				
			||||||
            <tr>
 | 
					            <tr>
 | 
				
			||||||
                <th><abbr title="Bonos de Transporte">B. Transporte</abbr></th>
 | 
					                <th><abbr title="Bonos de Transporte">B. Transporte</abbr></th>
 | 
				
			||||||
                <th class="has-text-right">{{ cantidadBonosDeTransporte }}</th>
 | 
					                <th class="has-text-right">{{ cantidadBonosDeTransporte }}</th>
 | 
				
			||||||
| 
						 | 
					@ -25,10 +18,23 @@
 | 
				
			||||||
                <th></th>
 | 
					                <th></th>
 | 
				
			||||||
                <th></th>
 | 
					                <th></th>
 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr v-if="this.$root.devoluciones">
 | 
				
			||||||
 | 
					                <th><p>Devoluciones</p></th>
 | 
				
			||||||
 | 
					                <td><p :title="this.$root.pedido.devoluciones_notas">...</p></td>
 | 
				
			||||||
 | 
					                <th class="has-text-right">-{{ this.$root.pedido.devoluciones_total }}</th>
 | 
				
			||||||
 | 
					                <th>
 | 
				
			||||||
 | 
					                    <button @click.capture="modificarDevoluciones()" class="button is-warning">
 | 
				
			||||||
 | 
					                        <span class="icon">
 | 
				
			||||||
 | 
					                            <i class="fas fa-edit"></i>
 | 
				
			||||||
 | 
					                        </span>
 | 
				
			||||||
 | 
					                    </button>
 | 
				
			||||||
 | 
					                </th>
 | 
				
			||||||
 | 
					                <th></th>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
            <tr>
 | 
					            <tr>
 | 
				
			||||||
                <th>Total total</th>
 | 
					                <th>Total total</th>
 | 
				
			||||||
                <th></th>
 | 
					                <th></th>
 | 
				
			||||||
                <th>{{ total }}</th>
 | 
					                <th class="has-text-right">{{ total }}</th>
 | 
				
			||||||
                <th></th>
 | 
					                <th></th>
 | 
				
			||||||
                <th></th>
 | 
					                <th></th>
 | 
				
			||||||
            </tr>
 | 
					            </tr>
 | 
				
			||||||
| 
						 | 
					@ -55,16 +61,15 @@
 | 
				
			||||||
            totalBonosDeTransporte: function() {
 | 
					            totalBonosDeTransporte: function() {
 | 
				
			||||||
                return this.$limpiarInt(this.$root.pedido.subtotal_bonos_de_transporte)
 | 
					                return this.$limpiarInt(this.$root.pedido.subtotal_bonos_de_transporte)
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            cantidadBonos: function() {
 | 
					 | 
				
			||||||
                return this.$limpiarInt(this.$root.pedido.subtotal_bonos) / 20
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            totalBonos: function() {
 | 
					 | 
				
			||||||
                return this.$limpiarInt(this.$root.pedido.subtotal_bonos)
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            total: function() {
 | 
					            total: function() {
 | 
				
			||||||
                return this.$limpiarInt(this.$root.pedido.total)
 | 
					                return this.$limpiarInt(this.$root.devoluciones ? this.$root.pedido.total_menos_devoluciones : this.$root.pedido.total)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        methods: {
 | 
				
			||||||
 | 
					            modificarDevoluciones: function() {
 | 
				
			||||||
 | 
					                Event.$emit("modificar-devoluciones");
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,4 +79,4 @@
 | 
				
			||||||
        max-width: 80vw;
 | 
					        max-width: 80vw;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,7 @@
 | 
				
			||||||
            <span class="icon is-small mr-1">
 | 
					            <span class="icon is-small mr-1">
 | 
				
			||||||
                <img src="/assets/chismosa.png">
 | 
					                <img src="/assets/chismosa.png">
 | 
				
			||||||
            </span>
 | 
					            </span>
 | 
				
			||||||
            <span v-text="'$' + this.$limpiarInt(this.$root.pedido.total)"></span>
 | 
					            <span v-text="'$' + this.$limpiarInt($root.devoluciones ? $root.pedido.total_menos_devoluciones : $root.pedido.total)"></span>
 | 
				
			||||||
            </a>
 | 
					            </a>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="dropdown-menu chismosa-menu" :id="id" role="menu">
 | 
					        <div class="dropdown-menu chismosa-menu" :id="id" role="menu">
 | 
				
			||||||
| 
						 | 
					@ -61,4 +61,4 @@ export default {
 | 
				
			||||||
        max-height: 75vh;
 | 
					        max-height: 75vh;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										67
									
								
								resources/js/components/DevolucionesModal.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								resources/js/components/DevolucionesModal.vue
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,67 @@
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
						<div v-bind:class="visible ? 'is-active modal' : 'modal'">
 | 
				
			||||||
 | 
					        <div class="modal-background"></div>
 | 
				
			||||||
 | 
					        <div class="modal-card">
 | 
				
			||||||
 | 
					            <header class="modal-card-head">
 | 
				
			||||||
 | 
					                <p class="modal-card-title">Devoluciones</p>
 | 
				
			||||||
 | 
					                <button class="delete" aria-label="close" @click.capture="cerrar"></button>
 | 
				
			||||||
 | 
					            </header>
 | 
				
			||||||
 | 
					            <section class="modal-card-body">
 | 
				
			||||||
 | 
					                <div class="field has-addons is-centered is-thin-centered">
 | 
				
			||||||
 | 
					                    <p class="control">
 | 
				
			||||||
 | 
					                        Total:
 | 
				
			||||||
 | 
					                        <input id="total" class="input" type="number" v-model="total" style="text-align: center">
 | 
				
			||||||
 | 
					                    </p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					                <div class="field has-addons is-centered is-thin-centered">
 | 
				
			||||||
 | 
					                    <p class="control">
 | 
				
			||||||
 | 
					                        Notas:
 | 
				
			||||||
 | 
					                        <input id="notas" class="input" type="text" v-model.text="notas">
 | 
				
			||||||
 | 
					                    </p>
 | 
				
			||||||
 | 
					                </div>
 | 
				
			||||||
 | 
					            </section>
 | 
				
			||||||
 | 
					            <footer class="modal-card-foot">
 | 
				
			||||||
 | 
					                <button class="button is-success" @click="modificar">Aceptar</button>
 | 
				
			||||||
 | 
					                <button class="button" @click.capture="cerrar">Cancelar</button>
 | 
				
			||||||
 | 
					            </footer>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					    export default {
 | 
				
			||||||
 | 
					        data() {
 | 
				
			||||||
 | 
					            return {
 | 
				
			||||||
 | 
					                visible: false,
 | 
				
			||||||
 | 
					                total: 0,
 | 
				
			||||||
 | 
					                notas: "",
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        computed: {
 | 
				
			||||||
 | 
					            miga: function() {
 | 
				
			||||||
 | 
					                return {
 | 
				
			||||||
 | 
					                    nombre: "Devoluciones",
 | 
				
			||||||
 | 
					                    href: "#devoluciones",
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        methods: {
 | 
				
			||||||
 | 
							    cerrar() {
 | 
				
			||||||
 | 
							        this.visible = false;
 | 
				
			||||||
 | 
							        Event.$emit("migas-pop");
 | 
				
			||||||
 | 
							    },
 | 
				
			||||||
 | 
					            modificar() {
 | 
				
			||||||
 | 
					                Event.$emit('sync-devoluciones', this.total, this.notas);
 | 
				
			||||||
 | 
					                this.cerrar();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        mounted() {
 | 
				
			||||||
 | 
					            Event.$on('modificar-devoluciones', () => {
 | 
				
			||||||
 | 
					                this.visible = true;
 | 
				
			||||||
 | 
					                this.total = this.$root.pedido.devoluciones_total;
 | 
				
			||||||
 | 
					                this.notas = this.$root.pedido.devoluciones_notas;
 | 
				
			||||||
 | 
					                Event.$emit("migas-agregar", this.miga);
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,7 @@
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
				<div class="control">
 | 
									<div class="control">
 | 
				
			||||||
					<a class="button is-warning" @click="togglePassword">
 | 
										<a class="button is-warning" @click="togglePassword">
 | 
				
			||||||
						{{ (passwordVisible ? 'Ocultar' : 'Mostrar') + ' contraseña'}} 
 | 
											{{ (passwordVisible ? 'Ocultar' : 'Mostrar') + ' contraseña'}}
 | 
				
			||||||
					</a>
 | 
										</a>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <div class="container is-max-widescreen is-max-desktop">
 | 
					    <div class="container is-max-widescreen is-max-desktop">
 | 
				
			||||||
        <pedidos-admin-tabs-secciones></pedidos-admin-tabs-secciones>
 | 
					        <pedidos-admin-tabs-secciones></pedidos-admin-tabs-secciones>
 | 
				
			||||||
        <div class="block" id="pedidos-seccion" 
 | 
					        <div class="block" id="pedidos-seccion"
 | 
				
			||||||
        :class="seccionActiva === 'pedidos-seccion' ? 'is-active' : 'is-hidden'">
 | 
					            :class="seccionActiva === 'pedidos-seccion' ? 'is-active' : 'is-hidden'">
 | 
				
			||||||
            <div class="block pb-6" id="pedidos-tabla-y-dropdown" v-show="hayPedidos">
 | 
					            <div class="block pb-6" id="pedidos-tabla-y-dropdown" v-show="hayPedidos">
 | 
				
			||||||
                <pedidos-admin-dropdown-descargar
 | 
					                <pedidos-admin-dropdown-descargar
 | 
				
			||||||
                    :gdc="gdc">
 | 
					                    :gdc="gdc">
 | 
				
			||||||
| 
						 | 
					@ -15,8 +15,8 @@
 | 
				
			||||||
                Todavía no hay ningún pedido para administrar.
 | 
					                Todavía no hay ningún pedido para administrar.
 | 
				
			||||||
            </p>
 | 
					            </p>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="block pb-6" id="bonos-seccion" 
 | 
					        <div class="block pb-6" id="bonos-seccion"
 | 
				
			||||||
        :class="seccionActiva === 'bonos-seccion' ? 'is-active' : 'is-hidden'">
 | 
					            :class="seccionActiva === 'bonos-seccion' ? 'is-active' : 'is-hidden'">
 | 
				
			||||||
            <pedidos-admin-tabla-bonos v-show="hayAprobados"
 | 
					            <pedidos-admin-tabla-bonos v-show="hayAprobados"
 | 
				
			||||||
                :pedidos="pedidos">
 | 
					                :pedidos="pedidos">
 | 
				
			||||||
            </pedidos-admin-tabla-bonos>
 | 
					            </pedidos-admin-tabla-bonos>
 | 
				
			||||||
| 
						 | 
					@ -24,6 +24,11 @@
 | 
				
			||||||
                Todavía no hay pedidos aprobados.
 | 
					                Todavía no hay pedidos aprobados.
 | 
				
			||||||
            </p>
 | 
					            </p>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div class="block pb-6" id="caracteristicas-seccion"
 | 
				
			||||||
 | 
					             :class="seccionActiva === 'caracteristicas-seccion' ? 'is-active' : 'is-hidden'">
 | 
				
			||||||
 | 
					            <pedidos-admin-caracteristicas-opcionales>
 | 
				
			||||||
 | 
					            </pedidos-admin-caracteristicas-opcionales>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,9 +37,11 @@ import PedidosAdminTabsSecciones from './PedidosAdminTabsSecciones.vue';
 | 
				
			||||||
import PedidosAdminDropdownDescargar from "./PedidosAdminDropdownDescargar.vue";
 | 
					import PedidosAdminDropdownDescargar from "./PedidosAdminDropdownDescargar.vue";
 | 
				
			||||||
import PedidosAdminTablaBonos from './PedidosAdminTablaBonos.vue';
 | 
					import PedidosAdminTablaBonos from './PedidosAdminTablaBonos.vue';
 | 
				
			||||||
import PedidosAdminTablaPedidos from "./PedidosAdminTablaPedidos.vue";
 | 
					import PedidosAdminTablaPedidos from "./PedidosAdminTablaPedidos.vue";
 | 
				
			||||||
 | 
					import PedidosAdminCaracteristicasOpcionales from "./PedidosAdminCaracteristicasOpcionales.vue";
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    name: "PedidosAdminBody",
 | 
					    name: "PedidosAdminBody",
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
 | 
					        PedidosAdminCaracteristicasOpcionales,
 | 
				
			||||||
        PedidosAdminTabsSecciones,
 | 
					        PedidosAdminTabsSecciones,
 | 
				
			||||||
        PedidosAdminDropdownDescargar,
 | 
					        PedidosAdminDropdownDescargar,
 | 
				
			||||||
        PedidosAdminTablaPedidos,
 | 
					        PedidosAdminTablaPedidos,
 | 
				
			||||||
| 
						 | 
					@ -47,7 +54,7 @@ export default {
 | 
				
			||||||
            bonosDeTransporte: 0,
 | 
					            bonosDeTransporte: 0,
 | 
				
			||||||
            totalBonosBarriales: 0,
 | 
					            totalBonosBarriales: 0,
 | 
				
			||||||
            tabActiva: "pedidos",
 | 
					            tabActiva: "pedidos",
 | 
				
			||||||
            seccionActiva: "pedidos-seccion"
 | 
					            seccionActiva: "pedidos-seccion",
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    computed: {
 | 
					    computed: {
 | 
				
			||||||
| 
						 | 
					@ -69,6 +76,8 @@ export default {
 | 
				
			||||||
                 .then(response => {
 | 
					                 .then(response => {
 | 
				
			||||||
                    this.pedidos = response.data.data
 | 
					                    this.pedidos = response.data.data
 | 
				
			||||||
                }).get;
 | 
					                }).get;
 | 
				
			||||||
 | 
					            axios.get("/api/grupos-de-compra/"+this.gdc+"/bonos-barriales", {})
 | 
				
			||||||
 | 
					                .then(response => this.totalBonosBarriales = response.data.bonos_barriales)
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        setSeccionActiva(tabId) {
 | 
					        setSeccionActiva(tabId) {
 | 
				
			||||||
            this.tabActiva = tabId;
 | 
					            this.tabActiva = tabId;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,45 @@
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					import axios from "axios";
 | 
				
			||||||
 | 
					import PedidosAdminFilaCaracteristica from "./PedidosAdminFilaCaracteristica.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    name: "PedidosAdminCaracteristicasOpcionales",
 | 
				
			||||||
 | 
					    components: {PedidosAdminFilaCaracteristica},
 | 
				
			||||||
 | 
					    data() {
 | 
				
			||||||
 | 
					        return {
 | 
				
			||||||
 | 
					            caracteristicas: [
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    id: "devoluciones",
 | 
				
			||||||
 | 
					                    nombre: "Devoluciones",
 | 
				
			||||||
 | 
					                    habilitada: false
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
					    <div class="block">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <table class="table is-fullwidth is-striped is-bordered">
 | 
				
			||||||
 | 
					            <thead>
 | 
				
			||||||
 | 
					                <tr>
 | 
				
			||||||
 | 
					                    <th> Característica </th>
 | 
				
			||||||
 | 
					                    <th> Habilitada </th>
 | 
				
			||||||
 | 
					                </tr>
 | 
				
			||||||
 | 
					            </thead>
 | 
				
			||||||
 | 
					            <tbody>
 | 
				
			||||||
 | 
					                <pedidos-admin-fila-caracteristica
 | 
				
			||||||
 | 
					                    v-for="(c,i) in caracteristicas"
 | 
				
			||||||
 | 
					                    :key="i"
 | 
				
			||||||
 | 
					                    :caracteristica="c">
 | 
				
			||||||
 | 
					                </pedidos-admin-fila-caracteristica>
 | 
				
			||||||
 | 
					            </tbody>
 | 
				
			||||||
 | 
					        </table>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style scoped>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
							
								
								
									
										68
									
								
								resources/js/components/PedidosAdminFilaCaracteristica.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								resources/js/components/PedidosAdminFilaCaracteristica.vue
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,68 @@
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					import axios from "axios";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    name: "PedidosAdminFilaCaracteristica",
 | 
				
			||||||
 | 
					    props: {
 | 
				
			||||||
 | 
					        caracteristica: Object
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    data: {
 | 
				
			||||||
 | 
					        gdc: undefined
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    watch: {
 | 
				
			||||||
 | 
					        '$root.gdc' : {
 | 
				
			||||||
 | 
					            handler(newValue) {
 | 
				
			||||||
 | 
					                if (newValue) {
 | 
				
			||||||
 | 
					                    this.gdc = newValue;
 | 
				
			||||||
 | 
					                    this.obtenerValor();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    methods: {
 | 
				
			||||||
 | 
					        toggleActivacion() {
 | 
				
			||||||
 | 
					            const id = this.caracteristica.id;
 | 
				
			||||||
 | 
					            axios.post(`/api/grupos-de-compra/${this.gdc}/${id}`)
 | 
				
			||||||
 | 
					                .then(response => {
 | 
				
			||||||
 | 
					                    this.caracteristica.habilitada = response.data[id];
 | 
				
			||||||
 | 
					                    this.$root[id] = response.data[id];
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        obtenerValor() {
 | 
				
			||||||
 | 
					            const id = this.caracteristica.id;
 | 
				
			||||||
 | 
					            axios.get(`/api/grupos-de-compra/${this.gdc}/${id}`)
 | 
				
			||||||
 | 
					                .then(response => {
 | 
				
			||||||
 | 
					                    this.caracteristica.habilitada = response.data[id];
 | 
				
			||||||
 | 
					                    this.$root[id] = response.data[id];
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    mounted() {
 | 
				
			||||||
 | 
					        if (this.$root.gdc) {
 | 
				
			||||||
 | 
					            this.gdc = this.$root.gdc;
 | 
				
			||||||
 | 
					            this.obtenerValor(this);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<template>
 | 
				
			||||||
 | 
					    <tr>
 | 
				
			||||||
 | 
					        <td>{{ caracteristica.nombre }}</td>
 | 
				
			||||||
 | 
					        <td>
 | 
				
			||||||
 | 
					            <div class="field">
 | 
				
			||||||
 | 
					                <input type="checkbox" class="switch is-rounded is-success"
 | 
				
			||||||
 | 
					                       :id="'switch-'+caracteristica.id"
 | 
				
			||||||
 | 
					                       :checked="caracteristica.habilitada"
 | 
				
			||||||
 | 
					                       @change="toggleActivacion(caracteristica)">
 | 
				
			||||||
 | 
					                <label :for="'switch-'+caracteristica.id">
 | 
				
			||||||
 | 
					                    <span class="is-hidden-mobile">{{ caracteristica.habilitada ? 'Habilitada' : 'Deshabilitada' }}</span>
 | 
				
			||||||
 | 
					                </label>
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					    </tr>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style scoped>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,9 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <tr>
 | 
					    <tr>
 | 
				
			||||||
        <td>{{ pedido.nombre }}</td>
 | 
					        <td>{{ pedido.nombre }}</td>
 | 
				
			||||||
        <td class="has-text-right" >{{ this.$limpiarInt(pedido.total) }}</td>
 | 
					        <td v-if="$root.devoluciones" class="has-text-right" >{{ this.$limpiarInt(pedido.total) }}</td>
 | 
				
			||||||
 | 
					        <td v-if="$root.devoluciones" class="has-text-right" ><abbr :title="pedido.devoluciones_notas">-{{ pedido.devoluciones_total }}</abbr></td>
 | 
				
			||||||
 | 
					        <td class="has-text-right" >{{ $root.devoluciones ? pedido.total_menos_devoluciones : pedido.total }}</td>
 | 
				
			||||||
        <td>
 | 
					        <td>
 | 
				
			||||||
            <pedidos-admin-switch-aprobacion
 | 
					            <pedidos-admin-switch-aprobacion
 | 
				
			||||||
                :pedido="pedido">
 | 
					                :pedido="pedido">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,8 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <div class="field">
 | 
					    <div class="field">
 | 
				
			||||||
        <input type="checkbox" name="switchRoundedSuccess" class="switch is-rounded is-success"
 | 
					        <input type="checkbox" name="switchRoundedSuccess" class="switch is-rounded is-success"
 | 
				
			||||||
            :id="'switch'+this.pedido.id" 
 | 
					            :id="'switch'+this.pedido.id"
 | 
				
			||||||
            :checked="pedido.aprobado" 
 | 
					            :checked="pedido.aprobado"
 | 
				
			||||||
            @change="toggleAprobacion">
 | 
					            @change="toggleAprobacion">
 | 
				
			||||||
        <label :for="'switch'+this.pedido.id">
 | 
					        <label :for="'switch'+this.pedido.id">
 | 
				
			||||||
            <span class="is-hidden-mobile">{{ mensaje }}</span>
 | 
					            <span class="is-hidden-mobile">{{ mensaje }}</span>
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@ export default {
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    computed: {
 | 
					    computed: {
 | 
				
			||||||
        mensaje: function () {
 | 
					        mensaje: function () {
 | 
				
			||||||
            return this.aprobado ? "Aprobado" : "No aprobado"
 | 
					            return this.aprobado ? "Pagado" : "No pagado"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,35 +1,48 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <table class="table is-fullwidth is-striped is-bordered">
 | 
					    <div>
 | 
				
			||||||
 | 
					        <table class="table is-fullwidth is-striped is-bordered">
 | 
				
			||||||
            <thead>
 | 
					            <thead>
 | 
				
			||||||
                <tr>
 | 
					            <tr>
 | 
				
			||||||
                    <th>Núcleo</th>
 | 
					                <th>Núcleo</th>
 | 
				
			||||||
                    <th><abbr title="Total a Pagar">Total $</abbr></th>
 | 
					                <th v-if="$root.devoluciones"><abbr title="Total sin tomar en cuenta las devoluciones">Total parcial $</abbr></th>
 | 
				
			||||||
                    <th class="is-1"><abbr title="Aprobacion">Aprobación</abbr></th>
 | 
					                <th v-if="$root.devoluciones"><abbr title="Devoluciones correspondientes al núcleo">Devoluciones $</abbr></th>
 | 
				
			||||||
                </tr>
 | 
					                <th><abbr title="Total a Pagar por el núleo">{{ $root.devoluciones ? 'Total real' : 'Total' }} $</abbr></th>
 | 
				
			||||||
            </thead>
 | 
					                <th class="is-1"><abbr title="Pagado">Pagado</abbr></th>
 | 
				
			||||||
            <tfoot>
 | 
					            </tr>
 | 
				
			||||||
                <tr>
 | 
					        </thead>
 | 
				
			||||||
                    <th></th>
 | 
					        <tbody>
 | 
				
			||||||
                    <th>Total a recaudar:</th>
 | 
					            <pedidos-admin-fila-pedido
 | 
				
			||||||
                    <th class="has-text-right">$ {{ totalAprobados() }}</th>
 | 
					                v-for="pedido in this.pedidos"
 | 
				
			||||||
                </tr>
 | 
					                :pedido="pedido" :key="pedido.id">
 | 
				
			||||||
                <tr>
 | 
					            </pedidos-admin-fila-pedido>
 | 
				
			||||||
                    <th></th>
 | 
					        </tbody>
 | 
				
			||||||
                    <th>Total bonos barriales:</th>
 | 
					 | 
				
			||||||
                    <th class="has-text-right">$ {{ totalBonosBarriales }}</th>
 | 
					 | 
				
			||||||
                </tr>
 | 
					 | 
				
			||||||
                <tr>
 | 
					 | 
				
			||||||
                    <th></th>
 | 
					 | 
				
			||||||
                    <th>Total a transferir:</th>
 | 
					 | 
				
			||||||
                    <th class="has-text-right">$ {{ totalAprobados() - totalBonosBarriales }}</th>
 | 
					 | 
				
			||||||
                </tr>
 | 
					 | 
				
			||||||
            </tfoot>
 | 
					 | 
				
			||||||
            <tbody>
 | 
					 | 
				
			||||||
                <pedidos-admin-fila-pedido v-for="pedido in this.pedidos"
 | 
					 | 
				
			||||||
                               :pedido="pedido" :key="pedido.id">
 | 
					 | 
				
			||||||
                </pedidos-admin-fila-pedido>
 | 
					 | 
				
			||||||
            </tbody>
 | 
					 | 
				
			||||||
        </table>
 | 
					        </table>
 | 
				
			||||||
 | 
					        <table class="table is-striped is-bordered">
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th colspan="2" class="has-background-black has-text-white has-text-centered">TOTALES</th>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th>Total a recaudar:</th>
 | 
				
			||||||
 | 
					                <td class="has-text-right">$ {{ totalARecaudar }}</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th>Total bonos barriales:</th>
 | 
				
			||||||
 | 
					                <td class="has-text-right">$ {{ $parent.totalBonosBarriales }}</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr v-if="$root.devoluciones">
 | 
				
			||||||
 | 
					                <th>Total devoluciones:</th>
 | 
				
			||||||
 | 
					                <td class="has-text-right">- $ {{ totalDevoluciones() }}</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th>Total bonos de transporte:</th>
 | 
				
			||||||
 | 
					                <td class="has-text-right">$ {{ bonosDeTransporte * 15 }}</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th>Total a depositar:</th>
 | 
				
			||||||
 | 
					                <td class="has-text-right">$ {{ totalAprobadosConTransporteRecalculado() - totalBonosBarriales }}</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					        </table>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
| 
						 | 
					@ -53,15 +66,17 @@ export default {
 | 
				
			||||||
            required: true
 | 
					            required: true
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    computed: {
 | 
				
			||||||
 | 
					        totalARecaudar: function() {
 | 
				
			||||||
 | 
					            return this.$root.devoluciones ? this.totalAprobadosMenosDevoluciones() : this.totalAprobados();
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    methods: {
 | 
					    methods: {
 | 
				
			||||||
        totalBonosBarriales() {
 | 
					        totalDevoluciones() {
 | 
				
			||||||
            let suma = 0;
 | 
					            let suma = 0
 | 
				
			||||||
            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
					            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
				
			||||||
            for (let i = 0; i < aprobados.length; i++) {
 | 
					            for (let i = 0; i < aprobados.length; i++) {
 | 
				
			||||||
                let bonoBarrial = aprobados[i].productos.find(p => p.nombre.includes("barrial"))
 | 
					                suma += aprobados[i].devoluciones_total
 | 
				
			||||||
                if (bonoBarrial) {
 | 
					 | 
				
			||||||
                    suma += this.$limpiarInt(bonoBarrial.pivot.total)
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return suma;
 | 
					            return suma;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
| 
						 | 
					@ -69,8 +84,24 @@ export default {
 | 
				
			||||||
            let suma = 0
 | 
					            let suma = 0
 | 
				
			||||||
            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
					            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
				
			||||||
            for (let i = 0; i < aprobados.length; i++) {
 | 
					            for (let i = 0; i < aprobados.length; i++) {
 | 
				
			||||||
                suma += this.$limpiarFloat(aprobados[i].subtotal_bonos)
 | 
					                suma += this.$limpiarFloat(aprobados[i].total)
 | 
				
			||||||
                suma += this.$limpiarFloat(aprobados[i].subtotal_productos)
 | 
					            }
 | 
				
			||||||
 | 
					            return suma;
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        totalAprobadosMenosDevoluciones() {
 | 
				
			||||||
 | 
					            let suma = 0
 | 
				
			||||||
 | 
					            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
				
			||||||
 | 
					            for (let i = 0; i < aprobados.length; i++) {
 | 
				
			||||||
 | 
					                suma += this.$limpiarFloat(aprobados[i].total_menos_devoluciones)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return suma;
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        totalAprobadosConTransporteRecalculado() {
 | 
				
			||||||
 | 
					            let suma = 0
 | 
				
			||||||
 | 
					            let aprobados = this.pedidos.filter(p => p.aprobado);
 | 
				
			||||||
 | 
					            for (let i = 0; i < aprobados.length; i++) {
 | 
				
			||||||
 | 
					                suma += this.$limpiarFloat(aprobados[i].total)
 | 
				
			||||||
 | 
					                suma -= this.$limpiarFloat(aprobados[i].subtotal_bonos_de_transporte)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            suma += parseInt(this.bonosDeTransporte)*15
 | 
					            suma += parseInt(this.bonosDeTransporte)*15
 | 
				
			||||||
            return suma;
 | 
					            return suma;
 | 
				
			||||||
| 
						 | 
					@ -81,4 +112,4 @@ export default {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,11 +3,11 @@
 | 
				
			||||||
        <div class="tabs is-boxed" id="tabs">
 | 
					        <div class="tabs is-boxed" id="tabs">
 | 
				
			||||||
            <ul class="has-bottom-line">
 | 
					            <ul class="has-bottom-line">
 | 
				
			||||||
                <li v-for="(tab, index) in tabs" class="is-size-6"
 | 
					                <li v-for="(tab, index) in tabs" class="is-size-6"
 | 
				
			||||||
                    :key="index" 
 | 
					                    :key="index"
 | 
				
			||||||
                    :id="tab.id + '-tab'" 
 | 
					                    :id="tab.id + '-tab'"
 | 
				
			||||||
                    :class="{'is-active': tab.id === tabActiva}">
 | 
					                    :class="{'is-active': tab.id === tabActiva}">
 | 
				
			||||||
                    <a @click="setTabActiva(tab.id)">
 | 
					                    <a @click="setTabActiva(tab.id)">
 | 
				
			||||||
                        <span> 
 | 
					                        <span>
 | 
				
			||||||
                            {{ tab.nombre }}
 | 
					                            {{ tab.nombre }}
 | 
				
			||||||
                        </span>
 | 
					                        </span>
 | 
				
			||||||
                    </a>
 | 
					                    </a>
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,10 @@ export default {
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    id: "bonos",
 | 
					                    id: "bonos",
 | 
				
			||||||
                    nombre: "Bonos"
 | 
					                    nombre: "Bonos"
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    id: "caracteristicas",
 | 
				
			||||||
 | 
					                    nombre: "Caracteristicas opcionales"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -59,4 +63,4 @@ export default {
 | 
				
			||||||
    border-bottom-color: #e3342f;
 | 
					    border-bottom-color: #e3342f;
 | 
				
			||||||
    color: #e3342f;
 | 
					    color: #e3342f;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,7 +79,8 @@
 | 
				
			||||||
	      },
 | 
						      },
 | 
				
			||||||
	      guardarSubpedidoEnSesion(subpedido) {
 | 
						      guardarSubpedidoEnSesion(subpedido) {
 | 
				
			||||||
	        axios.post("/subpedidos/guardar_sesion", {
 | 
						        axios.post("/subpedidos/guardar_sesion", {
 | 
				
			||||||
	          subpedido: subpedido
 | 
						          subpedido: subpedido,
 | 
				
			||||||
 | 
					              grupo_de_compra_id: this.gdcid
 | 
				
			||||||
	        }).then(_ => {
 | 
						        }).then(_ => {
 | 
				
			||||||
				Event.$emit('obtener-sesion')
 | 
									Event.$emit('obtener-sesion')
 | 
				
			||||||
	          window.location.href = 'productos';
 | 
						          window.location.href = 'productos';
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,4 +5,5 @@
 | 
				
			||||||
<categorias-container></categorias-container>
 | 
					<categorias-container></categorias-container>
 | 
				
			||||||
<productos-container></productos-container>
 | 
					<productos-container></productos-container>
 | 
				
			||||||
<producto-modal></producto-modal>
 | 
					<producto-modal></producto-modal>
 | 
				
			||||||
 | 
					<devoluciones-modal></devoluciones-modal>
 | 
				
			||||||
@endsection
 | 
					@endsection
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,14 @@ Route::middleware('api')->group(function () {
 | 
				
			||||||
            $grupo = GrupoDeCompra::where('id',$gdc)->first();
 | 
					            $grupo = GrupoDeCompra::where('id',$gdc)->first();
 | 
				
			||||||
            return ['bonos_barriales' => $grupo->totalBonosBarriales()];
 | 
					            return ['bonos_barriales' => $grupo->totalBonosBarriales()];
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        Route::get('/{gdc}/devoluciones', function($gdc) {
 | 
				
			||||||
 | 
					            $habilitadas = GrupoDeCompra::find($gdc)->devoluciones_habilitadas;
 | 
				
			||||||
 | 
					            return ['devoluciones' => $habilitadas];
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        Route::post('/{gdc}/devoluciones', function($gdc) {
 | 
				
			||||||
 | 
					            $habilitadas = GrupoDeCompra::find($gdc)->toggleDevoluciones();
 | 
				
			||||||
 | 
					            return ['devoluciones' => $habilitadas];
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Route::prefix('subpedidos')->group(function () {
 | 
					    Route::prefix('subpedidos')->group(function () {
 | 
				
			||||||
| 
						 | 
					@ -44,6 +52,7 @@ Route::middleware('api')->group(function () {
 | 
				
			||||||
        Route::get('{subpedido}','Api\SubpedidoController@show');
 | 
					        Route::get('{subpedido}','Api\SubpedidoController@show');
 | 
				
			||||||
        Route::post('/','Api\SubpedidoController@store');
 | 
					        Route::post('/','Api\SubpedidoController@store');
 | 
				
			||||||
        Route::post('/{subpedido}/sync', 'Api\SubpedidoController@syncProductos');
 | 
					        Route::post('/{subpedido}/sync', 'Api\SubpedidoController@syncProductos');
 | 
				
			||||||
 | 
					        Route::post('/{subpedido}/sync_devoluciones', 'Api\SubpedidoController@syncDevoluciones');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Route::prefix('admin')->group(function () {
 | 
					    Route::prefix('admin')->group(function () {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,11 +34,11 @@ Route::get('/admin/obtener_sesion', function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Route::middleware(['auth', 'admin'])->group( function () {
 | 
					Route::middleware(['auth', 'admin'])->group( function () {
 | 
				
			||||||
	Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
 | 
						Route::get('/admin/pedidos', 'AdminController@index')->name('admin_login.index');
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
 | 
						Route::get('/admin/exportar-planillas-a-pdf/{gdc}', 'AdminController@exportarPlanillasAPdf');
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
 | 
						Route::get('/admin/exportar-pedido-a-csv/{gdc}', 'AdminController@exportarPedidoACSV');
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
 | 
						Route::get('/admin/exportar-pedido-con-nucleos-a-csv/{gdc}', 'AdminController@exportarPedidoConNucleosACSV');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,8 +54,12 @@ Route::middleware('auth')->group( function() {
 | 
				
			||||||
			if (!isset($r["subpedido"])) {
 | 
								if (!isset($r["subpedido"])) {
 | 
				
			||||||
	            throw new HttpException(400, "La request necesita un subpedido para guardar en sesión");
 | 
						            throw new HttpException(400, "La request necesita un subpedido para guardar en sesión");
 | 
				
			||||||
	        }
 | 
						        }
 | 
				
			||||||
 | 
					            if (!isset($r["grupo_de_compra_id"])) {
 | 
				
			||||||
 | 
					                throw new HttpException(400, "La request necesita un grupo de compra para guardar en sesión");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
	        session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
 | 
						        session(["subpedido_nombre" => $r["subpedido"]["nombre"]]);
 | 
				
			||||||
	        session(["subpedido_id" => $r["subpedido"]["id"]]);
 | 
						        session(["subpedido_id" => $r["subpedido"]["id"]]);
 | 
				
			||||||
 | 
						        session(["gdc" => $r["grupo_de_compra_id"]]);
 | 
				
			||||||
	        return "Subpedido guardado en sesión";
 | 
						        return "Subpedido guardado en sesión";
 | 
				
			||||||
		})->name('guardarSesion');
 | 
							})->name('guardarSesion');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +68,8 @@ Route::middleware('auth')->group( function() {
 | 
				
			||||||
				'subpedido' => [
 | 
									'subpedido' => [
 | 
				
			||||||
					'nombre' => session("subpedido_nombre"),
 | 
										'nombre' => session("subpedido_nombre"),
 | 
				
			||||||
					'id' => session("subpedido_id")
 | 
										'id' => session("subpedido_id")
 | 
				
			||||||
				]
 | 
									],
 | 
				
			||||||
 | 
					                'gdc' => session("gdc")
 | 
				
			||||||
			];
 | 
								];
 | 
				
			||||||
	        return $sesion;
 | 
						        return $sesion;
 | 
				
			||||||
		})->name('obtenerSesion');
 | 
							})->name('obtenerSesion');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue