Compare commits
	
		
			3 commits
		
	
	
		
			bc7b7e2f22
			...
			3bf776b6f7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
							 | 
						3bf776b6f7 | ||
| 
							 | 
						0ec99a8cf5 | ||
| 
							 | 
						6f532eaf05 | 
					 6 changed files with 48 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -17,11 +17,11 @@ class SubpedidoResource extends JsonResource
 | 
			
		|||
        return [
 | 
			
		||||
            'id' => $this->id,
 | 
			
		||||
            'nombre' => $this->nombre,
 | 
			
		||||
            'subtotal_productos' => $this->getSubtotalProductos(),
 | 
			
		||||
            'subtotal_bonos' => $this->getSubtotalBonos(),
 | 
			
		||||
            'subtotal_productos' => number_format($this->getSubtotalProductos(),2),
 | 
			
		||||
            'subtotal_bonos' => number_format($this->getSubtotalBonos(),2),
 | 
			
		||||
            'bonos_de_transporte' => $this->cantidadBDT(),
 | 
			
		||||
            'subtotal_bonos_de_transporte' => $this->getSubtotalBDT(),
 | 
			
		||||
            'total' => $this->getTotal(),
 | 
			
		||||
            'subtotal_bonos_de_transporte' => number_format($this->getSubtotalBDT(),2),
 | 
			
		||||
            'total' => number_format($this->getTotal(),2),
 | 
			
		||||
            'grupo_de_compra' => $this->grupoDeCompra
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								public/assets/chismosa.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								public/assets/chismosa.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 2.4 KiB  | 
							
								
								
									
										32
									
								
								public/js/app.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								public/js/app.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -8,6 +8,10 @@ Vue.component('nav-bar', {
 | 
			
		|||
              <img src="/assets/logoMPS.png" height="28">
 | 
			
		||||
            </a>
 | 
			
		||||
            <p style="margin:0 auto" class="navbar-item"><slot name="subpedido"></slot></p>
 | 
			
		||||
            <a class="navbar-item" href="#">
 | 
			
		||||
              <img style="padding:0 0.3em;" src="/assets/chismosa.png" height="28">
 | 
			
		||||
              <p style="margin:0 auto; color:white">$ <span v-text="subpedido == null ? 0 : subpedido.total"></span></p>
 | 
			
		||||
            </a>
 | 
			
		||||
            <a role="button" class="navbar-burger" :class="{'is-active':isActive}" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample" @click="toggleState">
 | 
			
		||||
              <span aria-hidden="true"></span>
 | 
			
		||||
              <span aria-hidden="true"></span>
 | 
			
		||||
| 
						 | 
				
			
			@ -30,14 +34,30 @@ Vue.component('nav-bar', {
 | 
			
		|||
        </nav>`,
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			isActive: false
 | 
			
		||||
			isActive: false,
 | 
			
		||||
      subpedido: null
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
  	methods: {
 | 
			
		||||
  		toggleState() {
 | 
			
		||||
  			this.isActive = !this.isActive;
 | 
			
		||||
  		}
 | 
			
		||||
  	}
 | 
			
		||||
	methods: {
 | 
			
		||||
		toggleState() {
 | 
			
		||||
			this.isActive = !this.isActive;
 | 
			
		||||
		},
 | 
			
		||||
    actualizarSubpedido(){
 | 
			
		||||
      axios.get("/api/subpedidos/" + this.subpedido.id)
 | 
			
		||||
        .then(response => {
 | 
			
		||||
          this.subpedido = response.data.data;
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
	}, mounted() {
 | 
			
		||||
    axios.get("/subpedidos/obtener_sesion").then(response => {
 | 
			
		||||
      this.subpedido = response.data.subpedido;
 | 
			
		||||
      this.actualizarSubpedido()
 | 
			
		||||
    });
 | 
			
		||||
    //Emitir un evento subpedido-actualizado al agregar o eliminar un producto del subpedido para que el total de la chismosa se muestre correctamente
 | 
			
		||||
    Event.$on('subpedido-actualizado', () => {
 | 
			
		||||
      this.actualizarSubpedido();
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
Vue.component('nav-migas', {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								public/js/subpedidos-create.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								public/js/subpedidos-create.js
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -16,7 +16,7 @@ Vue.component('subpedido-select', {
 | 
			
		|||
	props: ["gdcid"],
 | 
			
		||||
	mounted() {
 | 
			
		||||
		console.log("ready");
 | 
			
		||||
  	},
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
  		onType() {
 | 
			
		||||
        if (!this.subpedido){
 | 
			
		||||
| 
						 | 
				
			
			@ -37,10 +37,14 @@ Vue.component('subpedido-select', {
 | 
			
		|||
  				nombre: this.subpedido,
 | 
			
		||||
  				grupo_de_compra_id: this.gdcid
 | 
			
		||||
  			}).then(response => {
 | 
			
		||||
          //se creo el subpedido, guardamos el subpedido en sesion
 | 
			
		||||
          this.guardarSubpedidoEnSesion(response.data);
 | 
			
		||||
          //se creo el subpedido
 | 
			
		||||
          this.elegirSubpedido(response.data);
 | 
			
		||||
  			});
 | 
			
		||||
  		},
 | 
			
		||||
      elegirSubpedido(subpedido){
 | 
			
		||||
        //lo guardamos en sesion
 | 
			
		||||
        this.guardarSubpedidoEnSesion(subpedido);
 | 
			
		||||
      },
 | 
			
		||||
      guardarSubpedidoEnSesion(subpedido) {
 | 
			
		||||
        axios.post("/subpedidos/guardar_sesion", {
 | 
			
		||||
          subpedido: subpedido
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,7 +31,7 @@
 | 
			
		|||
  				<div class="columns is-mobile" v-for="(subpedidoExistente, index) in subpedidosExistentes" :class="{'has-background-grey-lighter': index % 2}">
 | 
			
		||||
  					<div class="column is-half-mobile is-two-thirds-desktop is-two-thirds-tablet"><p style="padding-top: calc(.5em - 1px); margin-bottom: .5rem" v-text="subpedidoExistente.nombre"></p></div>
 | 
			
		||||
					<div class="buttons column is-half-mobile is-one-third-desktop is-one-third-tablet">
 | 
			
		||||
					  	<button class="button is-danger" @click="guardarSubpedidoEnSesion(subpedidoExistente)">Continuar pedido</button>
 | 
			
		||||
						<button class="button is-danger" @click="elegirSubpedido(subpedidoExistente)">Continuar pedido</button>
 | 
			
		||||
  					</div>
 | 
			
		||||
  				</div>
 | 
			
		||||
			</div>		
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,5 +35,15 @@ Route::middleware('auth')->group( function() {
 | 
			
		|||
	        session(["subpedido_id" => $r["subpedido"]["id"]]);
 | 
			
		||||
	        return "Subpedido guardado en sesión";
 | 
			
		||||
		})->name('guardarSesion');
 | 
			
		||||
 | 
			
		||||
		Route::get('obtener_sesion', function() {
 | 
			
		||||
			$sesion = [
 | 
			
		||||
				'subpedido' => [
 | 
			
		||||
					'nombre' => session("subpedido_nombre"),
 | 
			
		||||
					'id' => session("subpedido_id")
 | 
			
		||||
				]
 | 
			
		||||
			];
 | 
			
		||||
	        return $sesion;
 | 
			
		||||
		})->name('obtenerSesion');
 | 
			
		||||
	});
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue