34 lines
		
	
	
	
		
			927 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			927 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
    <div class="field">
 | 
						|
        <input type="checkbox" name="switchRoundedSuccess" class="switch is-rounded is-success"
 | 
						|
            :id="'switch' + pedido_id"
 | 
						|
            :checked="aprobado"
 | 
						|
            @change="setAprobacionPedido({ pedido_id: pedido_id, aprobacion: !aprobado })">
 | 
						|
        <label :for="'switch' + pedido_id">
 | 
						|
            <span class="is-hidden-mobile">{{ mensaje }}</span>
 | 
						|
        </label>
 | 
						|
    </div>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
import { mapActions, mapGetters } from "vuex";
 | 
						|
export default {
 | 
						|
    props: {
 | 
						|
        pedido_id: Number
 | 
						|
    },
 | 
						|
    computed: {
 | 
						|
        ...mapGetters('admin', ["getPedido"]),
 | 
						|
        aprobado() {
 | 
						|
            return this.getPedido(this.pedido_id).aprobado;
 | 
						|
        },
 | 
						|
        mensaje() {
 | 
						|
            return this.aprobado ? "Pagado" : "No pagado";
 | 
						|
        }
 | 
						|
    },
 | 
						|
    methods: {
 | 
						|
        ...mapActions('admin',["setAprobacionPedido"]),
 | 
						|
    },
 | 
						|
}
 | 
						|
</script>
 | 
						|
 | 
						|
<style scoped></style>
 |