robert 6 rokov pred
rodič
commit
fd107111b3

+ 2 - 1
controllers/main.py

@@ -6,7 +6,8 @@ import logging
 
 LOGGER = logging.getLogger(__name__)
 
-def make_info_log(self, log):
+
+def make_info_log(log):
     LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))
 
 

+ 35 - 7
src/App.vue

@@ -1,12 +1,33 @@
 <template lang="pug">
     .purchases
-        form-wizard(title='' subtitle='' finishButtonText='Finalizar' :hideButtons='isProcessing' color='#7c7bad' nextButtonText='Continuar' backButtonText='Volver' @on-complete='createPurchase' ref='wizard')
-            tab-content(title='Cuál es su proveedor?' :before-change='checkSupplier')
-                supplier-step
-            tab-content(:title="mode === 'purchase' ? 'Qué productos comprarás?' : 'En que gastarás?'" :before-change='checkCart')
-                product-step
-            tab-content(title='Cómo quieres pagar?' :before-change='checkAmountReceived')
-                payment-step
+        form-wizard(
+            title=''
+            subtitle=''
+            finishButtonText='Finalizar'
+            :hideButtons='isProcessing'
+            color='#7c7bad'
+            nextButtonText='Continuar'
+            backButtonText='Volver'
+            @on-complete='createPurchase'
+            ref='wizard'
+        )
+            template(v-if='isPurchase || isExpense')
+                tab-content(title='Cuál es su proveedor?' :beforeChange='checkSupplier')
+                    supplier-step
+                tab-content(title="mode === 'purchase' ? 'Qué productos comprarás?' : 'En que gastarás?'" :beforeChange='checkCart')
+                    product-step
+                tab-content(title='Cómo quieres pagar?' :beforeChange='checkAmountReceived')
+                    payment-step
+            template(v-else-if='isPurchasePicking')
+                tab-content(title='Cuál es su proveedor?' :beforeChange='checkSupplier')
+                    supplier-step
+                tab-content(title='Qué productos comprarás?' :beforeChange='checkCart')
+                    product-step
+            template(v-else='isPurchasePicking')
+                tab-content(title='Qué presupuesto es?')
+                    budget-step
+                tab-content(title='Cómo quieres pagar?' :beforeChange='checkAmountReceived')
+                    payment-step
         loading-overlay(:show='isLoading')
 </template>
 
@@ -19,6 +40,7 @@
     import SupplierStep from '@/components/steps/SupplierStep'
     import ProductStep from '@/components/steps/ProductStep'
     import PaymentStep from '@/components/steps/PaymentStep'
+    import BudgetStep from '@/components/steps/BudgetStep'
 
     import { LoadingOverlay } from '@/components/common'
 
@@ -29,11 +51,17 @@
             SupplierStep,
             ProductStep,
             PaymentStep,
+            BudgetStep,
             LoadingOverlay
         },
         computed: mapGetters([
             'isLoading',
             'isCompleted',
+            'isPurchase',
+            'isExpense',
+            'isPurchasePicking',
+            'isPurchasePayment',
+            'isPurchaseTaking',
             'isProcessing',
             'state',
             'mode'

+ 18 - 0
src/components/steps/BudgetStep.vue

@@ -0,0 +1,18 @@
+<template lang="pug">
+    .purchase-step
+</template>
+
+<script>
+    export default {
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+
+    .purchase-step
+        width: 100%
+        height: calc(100% - 50px)
+        padding-bottom: 50px
+        display: flex
+</style>

+ 0 - 170
src/components/steps/PaymentAmount.vue

@@ -1,170 +0,0 @@
-<template lang="pug">
-    .purchase-step
-        ticket(:customerName='selectedSupplier && selectedSupplier.name' :companyName='user && user.company.name' :total='cartTotal' :items='cartItems' :defaultCurrency='selectedCurrency')
-        form.payment-amount
-            .form-loading(v-show='isProcessing')
-                .form-overlay
-                .form-spinner
-                    spinner(type='wave')
-            .form-separator
-                h3 Detalles del Pago
-                hr
-            .form-item(v-show="paymentType === 'cash'")
-                label.form-label Monto a Pagar
-                input.form-input(:value='cartTotal | currency(...selectedCurrency)' readonly)
-            .form-item
-                label.form-label Monto Entregado
-                input.form-input(v-model='amountReceived' autofocus)
-            .form-item(v-show="paymentType === 'cash'")
-                hr
-                label.form-label Monto a Recibir
-                input.form-input(:value='paymentResidual | currency(...selectedCurrency)' readonly)
-            .form-item-table(v-show="paymentType === 'credit'")
-                table
-                    thead
-                        tr
-                            th Monto a Pagar
-                            th Fecha de Pago
-                    tbody
-                        tr(v-for='line in paymentLines')
-                            td {{ line.total | currency(...selectedCurrency) }}
-                            td {{ line.date }}
-</template>
-
-<script>
-    import { mapGetters, mapActions } from 'vuex'
-
-    import { Ticket, Spinner } from '../common'
-
-    export default {
-        components: {
-            Ticket,
-            Spinner
-        },
-        computed: {
-            amountReceived: {
-                get() {
-                    let formatted = this.$options.filters.currency(this.initialPayment, {...this.selectedCurrency})
-
-                    return !!this.initialPayment ? formatted : formatted.replace(/\d/, '')
-                },
-                set(value) {
-                    value = value.replace(/[\.|,](\d{0,2}$)/, '?$1').split(/\?/)
-                    value[0] = value[0].replace(/[^0-9]/g, '')
-                    value = Number.parseFloat(value.join('.')) || 0
-
-                    this.changeInitialPayment(value)
-                    this.computePaymentResidual(value)
-
-                    if (this.paymentType === 'credit') {
-                       this.computePaymentLines()		
-                    }
-                }
-            },
-            ...mapGetters([
-                'user',
-                'selectedSupplier',
-                'cartItems',
-                'cartTotal',
-                'paymentTerms',
-                'paymentType',
-                'paymentLines',
-                'initialPayment',
-                'selectedCurrency',
-                'isProcessing'
-            ])
-        },
-        methods: {
-            computePaymentResidual(value) {
-                this.paymentResidual = value < this.cartTotal ? 0 : value - this.cartTotal
-            },
-            ...mapActions([
-                'changeInitialPayment',
-                'computePaymentLines'
-            ])
-        },
-        data() {
-            return {
-                paymentResidual: 0
-            }
-        }
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-    .purchase-step
-        width: 100%
-        height: calc(100% - 50px)
-        padding-bottom: 50px
-        display: flex
-        .payment-amount
-            width: calc(100% - 450px)
-            height: 100%
-            margin-right: 50px
-            padding: 35px
-            background: $app-light-color
-            position: relative
-            .form-loading
-                width: 90%
-                height: 90%
-                position: absolute
-                .form-overlay
-                    width: 100%
-                    height: 100%
-                    background: $app-bg-color
-                    opacity: 0.5
-                    position: absolute
-                .form-spinner
-                    width: 100%
-                    height: 100%
-                    display: flex
-                    justify-content: center
-                    align-items: center
-            .form-separator
-                h3
-                    color: $app-separator-color
-                    font-size: 8pt
-                    margin: 0
-                hr
-                    margin-top: 15px
-            .form-item
-                width: 100%px
-                height: 45px
-                margin-bottom: 15px
-                .form-label
-                    width: 250px
-                    height: 45px
-                    font-size: 14pt
-                .form-input
-                    width: 350px
-                    height: 45px
-                    font-size: 14pt
-                    border-radius: 0
-                    &.input-only
-                        margin-left: 250px
-                        margin-bottom: 15px
-            .form-item-table
-                width: 100%
-                height: 250px
-                border: 1px solid $app-border-color
-                overflow-y: auto
-                table
-                    width: 100%
-                    thead
-                        th
-                            line-height: 35px
-                            padding-left: 10px
-                        th:nth-child(1)
-                            width: 200px
-                        th:nth-child(2)
-                            width: 200px
-                    tbody
-                        td
-                            height: 35px
-                            padding-left: 10px
-
-                        td:nth-child(1)
-                            width: 200px
-                        td:nth-child(2)
-</style>

+ 0 - 136
src/components/steps/PaymentMethod.vue

@@ -1,136 +0,0 @@
-<template lang="pug">
-    .purchase-step
-        ticket(:customerName='selectedSupplier && selectedSupplier.name' :companyName='user && user.company.name' :total='cartTotal' :items='cartItems' :defaultCurrency='selectedCurrency')
-        form.payment-method
-            .form-separator
-                h3 Detalles del Proveedor
-                hr
-            .form-item
-                label.form-label Proveedor
-                input.form-input(:value='selectedSupplier && selectedSupplier.name' readonly)
-            .form-separator
-                h3 Detalles del Pago
-                hr
-            .form-item
-                label.form-label Forma de Pago
-                .form-item-option
-                    input.form-input(type='radio' id='cash' value='cash' v-model='payment')
-                    label(for='cash') Contado
-                .form-item-option
-                    input.form-input(type='radio' id='credit' value='credit' v-model='payment')
-                    label(for='credit') Crédito
-            transition(name='fade')
-                .form-item(v-if="payment === 'credit'")
-                    select.form-input.input-only(v-model='paymentTermId')
-                        option(v-for='term in paymentTerms' :value='term.id' v-if="term.lines.length > 0 && (term.lines[0].days !== 0 || term.lines[0].value !==  'balance')") {{ term.displayName }}
-                .form-item(v-else)
-                    label.form-label Método de Pago
-                    select.form-input(v-model='journalId')
-                        option(v-for='journal in journals' :value='journal.id') {{ journal.displayName }}
-</template>
-
-<script>
-    import { mapGetters, mapActions } from 'vuex'
-
-    import Ticket from '@/components/common/Ticket'
-
-    export default {
-        components: {
-            Ticket
-        },
-        computed: {
-            paymentTermId: {
-                get() {
-                    return (this.selectedPaymentTerm && this.selectedPaymentTerm.id) || -1
-                },
-                set(value) {
-                    this.selectPaymentTerm(value)
-                }
-            },
-            journalId: {
-                get() {
-                    return (this.selectedJournal && this.selectedJournal.id) || -1
-                },
-                set(value) {
-                   this.selectJournal(value)
-                }
-            },
-            payment: {
-                get() {
-                    return this.paymentType
-                },
-                set(value) {
-                    this.changePaymentType(value)
-
-                    if (value === 'credit') {
-                        this.computePaymentLines()
-                    }
-                }
-            },
-            ...mapGetters([
-                'user',
-                'selectedSupplier',
-                'cartItems',
-                'cartTotal',
-                'paymentTerms',
-                'paymentType',
-                'selectedPaymentTerm',
-                'journals',
-                'selectedCurrency',
-                'selectedJournal'
-            ])
-        },
-        methods: mapActions([
-            'changePaymentType',
-            'selectJournal',
-            'selectPaymentTerm',
-            'computePaymentLines'
-        ])
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-    .purchase-step
-        width: 100%
-        height: calc(100% - 50px)
-        padding-bottom: 50px
-        display: flex
-        .payment-method
-            width: calc(100% - 450px)
-            height: 100%
-            margin-right: 50px
-            padding: 35px
-            background: $app-light-color
-            .form-separator
-                h3
-                    color: $app-separator-color
-                    font-size: 8pt
-                    margin: 0
-                hr
-                    margin-top: 15px
-            .form-item
-                width: 100%px
-                height: 45px
-                margin-bottom: 15px
-                .form-label
-                    width: 250px
-                    height: 45px
-                    font-size: 14pt
-                .form-input
-                    width: 350px
-                    height: 45px
-                    font-size: 14pt
-                    border-radius: 0
-                    &.input-only
-                        margin-left: 250px
-                        margin-bottom: 15px
-                .form-item-option
-                    display: inline-block
-                    input
-                        width: 20px
-                        height: 20px
-                    label
-                        font-size: 12pt
-                        margin: 0 45px 15px 5px
-</style>

+ 15 - 0
src/store/app.js

@@ -26,6 +26,21 @@ const getters = {
     state() {
         return state.currentState
     },
+    isPurchase() {
+        return state.currentMode === 'purchase'
+    },
+    isExpense() {
+        return state.currentMode === 'expense'
+    },
+    isPurchasePicking() {
+        return state.currentMode === 'product_picking'
+    },
+    isPurchasePayment() {
+        return state.currentMode === 'payment'
+    },
+    isPurchaseTaking() {
+        return state.currentMode === 'product_taking'
+    },
     isCompleted(state) {
         return state.completed
     },