Procházet zdrojové kódy

[ADD] writer/unlink line statement

adrielso před 6 roky
rodič
revize
b7e95025ca

+ 42 - 0
controllers/account_bank_statement_line.py

@@ -1,6 +1,8 @@
 # -*- coding: utf-8 -*-
 
 from openerp.http import request
+from eiru_logging import make_info_log
+
 
 _MODEL= 'account.bank.statement.line'
 
@@ -10,3 +12,43 @@ _MODEL= 'account.bank.statement.line'
 '''
 def create_statement_line(values):
     return request.env[_MODEL].sudo().create(values)
+
+''' Modify statement line '''
+def modify_statement_line(value):
+    ''' DELETED '''
+    if (value['linesDeleted']):
+        make_info_log('Unlink Statement Line')
+        for line in request.env[_MODEL].search([('id', 'in', value['linesDeleted'])]):
+            if(line.is_deleted):
+                lineWrite={'is_deleted': False}
+                write_statement_line(line,lineWrite)
+
+            unlink_statement_line(line)
+
+    ''' UPDATE '''
+    if (value['lineUpdate']):
+        make_info_log('Write Statement Line')
+        for update in value['lineUpdate']:
+            lineStatement = request.env[_MODEL].browse(update['id'])
+            if (lineStatement):
+                lines = {
+                    'amount': update['amount'],
+                    'date': update['date'],
+                    'name': update['name'],
+                    'partner_id': update['partnerId'],
+                    'ref':update['ref'],
+                }
+                write_statement_line(lineStatement, lines)
+
+    return {
+        'state': True,
+        'message': 'Proceso finalizado.'
+    }
+
+''' Unlink '''
+def unlink_statement_line(line):
+    return line.sudo().unlink()
+
+''' Write '''
+def write_statement_line(line, value):
+    return line.sudo().write(value)

+ 10 - 0
controllers/main.py

@@ -132,3 +132,13 @@ class Statement(http.Controller):
         from account_bank_statement import closing_statement
 
         return closing_statement(kw.get('data'))
+
+
+    '''
+        WRITE / UNLINK
+    '''
+    @http.route('/eiru_bank_statement/process_modify_statement_line', type='json', auth='user', methods=['POST'],cors='*')
+    def _process_modify_statement(self, **kw):
+        from account_bank_statement_line import modify_statement_line
+
+        return modify_statement_line(kw.get('data'))

+ 6 - 2
src/App.vue

@@ -7,12 +7,11 @@
             ref='wizard'
             @on-change="(prev, next) => checStepsChange(prev,next)"
         )
-            //- @on-change="(prev, next) => stepChange(prev, next)"
             // Step Initial
             template
                 tab-content( title='Seleccione la caja' :beforeChange='checkStatement' )
                     statement-step
-                    //- statement-step(@actionSelected='actionSelected')
+
             // Step Transfer
             template(v-if='!!isTransfer')
                 // Step Transfer 2
@@ -21,25 +20,30 @@
                 // Step Transfer 3
                 tab-content( title="Que valor vas a transferir")
                     statement-operation-step
+
             // step Imput
             template( v-if='!!isInputCashbox')
                 // step Imput 2
                 tab-content( title="Que valor vas a colocar")
                     statement-operation-step
+
             // Step Output
             template(v-if='!!isOutputCashbox')
                 // Step Output 2
                 tab-content( title="Que valor vas a sacar")
                     statement-operation-step
+
             // step confirm
             template(v-if='!!isStatmentConfirm')
                 // step confirm 2
                 tab-content(title='Que ajuste deseas hacer')
                     statement-confirm-step
+
             // STEP MODIFY STATMENT
             template(v-if='!!isStatmentModify')
                 tab-content(title="Que vas a modificar")
                     statement-modify
+
             // Footer
             template(
                 slot='footer'

+ 0 - 5
src/components/forms/StatementActionForm.vue

@@ -21,11 +21,6 @@
 
     export default {
         methods: {
-            // clickTransfer(){
-            //     console.log("Click");
-            //     // this.$emit('actionSelected')
-            //     this.clcikTransfer(true)
-            // },
             ...mapActions([
                 'clcikTransfer',
                 'clickInputCashbox',

+ 4 - 5
src/components/modal/StatementLineModal.vue

@@ -18,7 +18,6 @@
                     editable='false'
                     v-model='dateOperation'
                 )
-                //-:not-before="new Date()"
             .form-item
                 label.form-label Cliente / Proveedor
                 input.form-input
@@ -42,7 +41,7 @@
                     v-model='referen'
                 )
             .form-actions
-                button.form-action() Aceptar
+                button.form-action(@click.prevent="onAcept") Aceptar
                 button.form-action(@click.prevent="onCancel") Cancelar
 </template>
 
@@ -113,15 +112,12 @@
                 },
                 set(value) {
                     this.update.ref = value.trim()
-
                 }
             },
-
         },
         methods: {
             setLineUpdate(value){
                 if (!value) return
-
                 this.update.amount = value.amount
                 this.update.date = value.date
                 this.update.id = value.id
@@ -143,6 +139,9 @@
             onCancel() {
                 this.$emit('onCancel')
             },
+            onAcept() {
+                this.$emit('onAcept',this.update)
+            }
         },
         data() {
             return {

+ 0 - 2
src/components/steps/CardGridItem.vue

@@ -37,14 +37,12 @@
     .card-grid-item
         width: calc(100% - 10px)
         height: calc(100% - 10px)
-        // margin: 5px
         margin: 0px
         text-align: center
         .card-grid-wrapper-header
             width: 100%
             height: 36px
             background: $app-border-color
-            // border-bottom: 1px solid$app-border-color
         .card-grid-wrapper-line
             width: 100%
             height: calc(100% - 50px)

+ 6 - 294
src/components/steps/CardItem.vue

@@ -14,7 +14,7 @@
         .table-statement-body
             table
                 tbody
-                    tr(v-for='item in items' :class="{'is-deleted-line': item.isDelete}")
+                    tr(v-for='item in items' :class="{'is-deleted-line': item.isDelete, 'is-write-line':item.isUpdate}")
                         td {{ item.date }}
                         td {{ item.name }}
                         td {{ item.ref }}
@@ -55,6 +55,9 @@
             },
             onClickDeleted(item, state) {
                 this.$emit('onClickDeleted', item, state)
+            },
+            funtionStyle(){
+                return
             }
         }
     }
@@ -65,14 +68,12 @@
     .table-statement
         width: 100%
         height: 100%
-        // background: cyan
         text-align: center
         .table-statement-header
             width: 100%
             height: 35px
             table
                 width: calc(100% - 20px)
-                // height: 35px
                 margin: 0 10px
                 font-size: 10pt
                 font-weight: bolder
@@ -86,32 +87,26 @@
                                 width: 10%
                                 min-width: 100px
                                 text-align: left
-                                // background: green
                             &:nth-child(2)
                                 width: 30%
                                 min-width: 200px
                                 text-align: left
-                                // background: red
                             &:nth-child(3)
                                 width: 20%
                                 min-width: 200px
                                 text-align: left
-                                // background: green
                             &:nth-child(4)
                                 width: 20px
                                 min-width: 200px
                                 text-align: left
-                                // background: beige
                             &:nth-child(5)
                                 width: 10%
                                 min-width: 100px
                                 text-align: left
-                                // background: green
                             &:nth-child(6)
                                 width: 10%
                                 min-width: 50px
                                 text-align: left
-                                // background: blue
                             &:nth-child(7)
                                 display: none
         .table-statement-body
@@ -120,10 +115,8 @@
             overflow-y: auto
             table
                 width: calc(100% - 20px)
-                // height: 35px
                 margin: 0 10px
                 font-size: 9pt
-                // font-weight: bolder
                 tbody
                     tr
                         height: 28px
@@ -131,33 +124,30 @@
                         border-bottom: 1px solid $app-border-color
                         &.is-deleted-line
                             color: #f44336
+                        &.is-write-line
+                            color: #04075f
                         td
                             &:nth-child(1)
                                 width: 10%
                                 padding-left: 10px
                                 min-width: 100px
                                 text-align: left
-                                // background: green
                             &:nth-child(2)
                                 width: 30%
                                 min-width: 200px
                                 text-align: left
-                                // background: red
                             &:nth-child(3)
                                 width: 20%
                                 min-width: 200px
                                 text-align: left
-                                // background: green
                             &:nth-child(4)
                                 width: 20px
                                 min-width: 200px
                                 text-align: left
-                                // background: beige
                             &:nth-child(5)
                                 width: 10%
                                 min-width: 100px
                                 text-align: left
-                                // background: green
                             &:nth-child(6)
                                 width: 10%
                                 min-width: 50px
@@ -165,7 +155,6 @@
                                 .line-options-wrapper
                                     width: 100%
                                     height: 30px
-                                    // position: absolute
                                     bottom: 0
                                     display: flex
                                     justify-content: center
@@ -173,7 +162,6 @@
                                         width: 50px
                                         height: 20px
                                         border: 1px solid #d3d3d3
-                                        // border-bottom: none
                                         display: flex
                                         margin: 5px 0px
                                         justify-content: center
@@ -194,279 +182,3 @@
                             &:nth-child(7)
                                 display: none
 </style>
-
-
-<!--
-<template lang="pug">
-    .ticket
-        .ticket-summary
-            .ticket-summary-header
-                h3 {{ companyName }}
-                table
-                    tbody
-                        tr
-                            td Producto
-                            td Precio
-                            td Cant
-                            td Subtotal
-            .ticket-items-wrapper
-                table
-                    tbody
-                        tr(v-for='item in items' :key='item.id')
-                            td {{ item.name }}
-                            td {{ item.price }}
-                            td {{ item.quantity }}
-                            td {{ (item.price || 0) * (item.quantity || 0) }}
-            .ticket-summary-footer
-                table
-                    tbody
-                        tr
-                            td Total:
-                            td {{ total | currency(...defaultCurrency) }}
-                        tr
-                            td Cliente:
-                            td {{ customerName }}
-</template>
-
-<script>
-    export default {
-        props: {
-            companyName: {
-                type: String,
-                default: ''
-            },
-            customerName: {
-                type: String,
-                default: ''
-            },
-            defaultCurrency: {
-                type: Object,
-                default: {
-                    symbol: '$',
-                    position: 'before',
-                    thousandsSeparator: '.',
-                    decimalPlaces: 2,
-                    decimalSeparator: ','
-                }
-            },
-            total: {
-                type: Number,
-                default: 0
-            },
-            items: {
-                type: [],
-                default: []
-            }
-        }
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-    .ticket
-        width: 500px
-        height: 100%
-        .ticket-summary
-            width: 350px
-            height: 450px
-            border: 1px solid $app-border-color
-            margin: auto
-            box-shadow: -2px 2px 5pc $app-border-color, 2px 2px 5px $app-border-color
-            position: relative
-            .ticket-summary-header, .ticket-summary-footer
-                width: 100%
-                position: absolute
-            .ticket-summary-header
-                height: 65px
-                top: 0
-                h3
-                    text-align: center
-                    font-size: 14pt
-                    margin: 0 15px
-                    padding: 30px 0 15px 0
-                    color: $app-dark-color
-                table
-                    width: 308px
-                    height: 30px
-                    margin: 0 20px
-                    font-size: 7.5pt
-                    font-weight: bold
-                    tbody
-                        tr
-                            line-height: 30px
-                            border-top: 1px solid $app-border-color
-                            border-bottom: 1px solid $app-border-color
-                            td
-                                &:nth-child(1)
-                                    width: 180px
-                                    text-align: left
-
-                                &:nth-child(2)
-                                    width: 50px
-                                    text-align: right
-
-                                &:nth-child(3)
-                                    width: 30px
-                                    text-align: right
-
-                                &:nth-child(4)
-                                    width: 50px
-                                    text-align: right
-            .ticket-items-wrapper
-                width: 310px
-                height: 280px
-                margin: 95px 20px 75px 20px
-                padding-top: 5px
-                overflow-y: auto
-                table
-                    width: 100%
-                    font-size: 7.5pt
-                    tbody
-                        tr
-                            height: 28px
-                            line-height: 30px
-
-                            td
-                                &:nth-child(1)
-                                    width: 180px
-
-                                &:nth-child(2)
-                                    width: 50px
-                                    text-align: right
-
-                                &:nth-child(3)
-                                    width: 30px
-                                    text-align: right
-
-                                &:nth-child(4)
-                                    width: 50px
-                                    text-align: right
-            .ticket-summary-footer
-                width: 348px
-                height: 75px
-                bottom: 0
-                padding: 15px 25px
-                background: $app-bg-color
-                table
-                    width: 100%
-                    tbody
-                        tr
-                            height: 25px
-                            line-height: 20px
-                            td
-                                &:nth-child(1)
-                                    font-weight: bold
-                                &:nth-child(2)
-                                    text-align: right
-</style>
--->
-
-<!--  <template lang="pug">
-    .card-line-statement
-        label.item-date {{ date }}
-        label.item-name {{ name }}
-        label.item-ref {{ reference }}
-        label.item-partner {{ partnerName }}
-        label.item-amount {{ amount }}
-</template>
-
-<script>
-    // import DatePicker from 'vue2-datepicker'
-
-    export default {
-        props:{
-            date: {
-                type: String,
-                default: ''
-            },
-            name: {
-                type: String,
-                default: ''
-            },
-            reference: {
-                type: String,
-                default: ''
-            },
-            partnerName: {
-                type: String,
-                default: ''
-            },
-            amount: {
-                type: String,
-                default: ''
-            },
-        },
-        components: {
-            DatePicker,
-        },
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-
-    .card-line-statement
-        width: 100%
-        height: 35px
-        // margin: 5px
-        // border: 1px solid $app-border-color
-        display: inline-block
-        position: relative
-        // background: cyan
-        // &.selected-card
-        //     transition-duration: 300ms
-        //     border: 2px solid $app-main-color
-        &:hover
-            cursor: pointer
-        .item-date
-            width: 100px
-            height: 100%
-            border: 1px solid$app-border-color
-            display: inline-block
-            float: left
-            padding-left: 10px
-            padding-top: 8px
-            margin-right: 5px
-            // background: cyan
-        .item-name
-            width: 250px
-            height: 100%
-            border: 1px solid$app-border-color
-            display: inline-block
-            float: left
-            padding-left: 10px
-            padding-top: 8px
-            margin-right: 5px
-
-            // background: cyan
-        .item-ref
-            width: 200px
-            height: 100%
-            border: 1px solid$app-border-color
-            display: inline-block
-            float: left
-            padding-left: 10px
-            margin-right: 5px
-            padding-top: 8px
-            // background: cyan
-        .item-partner
-            width: 200px
-            height: 100%
-            border: 1px solid$app-border-color
-            display: inline-block
-            float: left
-            padding-left: 10px
-            margin-right: 5px
-            padding-top: 8px
-            // background: cyan
-        .item-amount
-            width: 200px
-            height: 100%
-            border: 1px solid$app-border-color
-            display: inline-block
-            float: left
-            padding-top: 8px
-            margin-right: 5px
-            padding-left: 10px
-
-</style>  -->

+ 0 - 35
src/components/steps/DetailsStep.vue

@@ -14,18 +14,7 @@
                     .card-right
                     h3.card-label Caja destino
                     h3.card-title {{ statementDest }}
-            //- .form-card-operation
             hr
-            //- .form-details(v-if="transferCasBox")
-            //-     h3.details-item Caja origen {{ statementOrigin }} Caja destino {{ statementDest }}
-            //-     hr
-            //- .form-details(v-if="inputCasBox")
-            //-     h3.details-item Caja destino {{ statementOrigin }}
-            //-     hr
-            //- .form-details(v-if="outputCashBox")
-            //-     h3.details-item Caja origen {{ statementOrigin }}
-
-                hr
             .form-item
                 label.form-label Valor de la operación
                 input-dropdown.form-input(
@@ -128,35 +117,11 @@
                     margin: 10px 0 0
                     color: #d3d3d3
                     text-align: center
-                // .details-item
-                    // font-size: 13pt
-                    // margin: 10px 0 0
-                    // text-align: center
             .form-card-operation
                 width: 100%
                 height: 75px
                 margin-bottom: 5px
                 text-align: center
-                // .card-statement-operation
-                //     width: 300px
-                //     height: 100%
-                //     margin: 5px
-                //     border: 1px solid$app-border-color
-                //     display: inline-block
-                //     position: relative
-                //     .card-label
-                //         width: calc(100% - 20px)
-                //         font-size: 12pt
-                //         color: #d3d3d3
-                //         margin-top: 3px
-                //         border-bottom: 1px solid$app-border-color
-                //         margin-left: 10px
-                //         margin-right: 10px
-                //     .card-title
-                //         width: 100%
-                //         height: 35px
-                //         font-size: 16px
-
                 hr
             .form-item
                 width: 100%

+ 3 - 3
src/components/steps/StatementDestStep.vue

@@ -8,7 +8,7 @@
                     :keys="['name']"
                     @onSearch='filteredStatementsDest'
                 )
-                card-grid(
+                card-grid-statement(
                     :canAdd='false'
                     :items='visibleStatementDest'
                     :details="['balanceEnd:c']"
@@ -18,12 +18,12 @@
 
 <script>
     import { mapGetters, mapActions } from 'vuex'
-    import { Searcher, CardGrid } from '../common'
+    import { Searcher, CardGridStatement } from '../common'
 
     export default {
         components: {
             Searcher,
-            CardGrid,
+            CardGridStatement,
         },
         computed:{
             ...mapGetters([

+ 4 - 3
src/components/steps/StatementModify.vue

@@ -25,6 +25,7 @@
             :line='lineSelected'
             :currencyStatement='currencyStatement'
             @onCancel='onCancel'
+            @onAcept='onWriter'
         )
 </template>
 
@@ -43,9 +44,7 @@
         },
         methods: {
             clickUpdate(value) {
-                // console.log(value);
                 this.selectLineSelected(value)
-                this.showStatementLineModify(true)
             },
             clickDeleted(value, state) {
                 this.addDeletedLine({'id':value, 'state': state})
@@ -53,6 +52,9 @@
             onCancel(){
                 this.showStatementLineModify(false)
             },
+            onWriter(value) {
+                this.addUpdateLine(value)
+            },
             ...mapActions([
                 'addDeletedLine',
                 'addUpdateLine',
@@ -88,7 +90,6 @@
                 margin-right: 50px
                 padding: 25px
                 border: 1px solid$app-border-color
-                // background: $app-bg-color
                 .form-item
                     width: 100%
                     height: 35px

+ 29 - 8
src/store/actions.js

@@ -84,6 +84,19 @@ const actions = {
             dispatch('processClosingStatement')
             commit('setCompleted', true)
         }
+
+        if (getters.isStatmentModify) {
+            console.log("Modificar");
+            let data= {}
+            data = {
+                lineUpdate: !!getters.linesUpdate.length ? getters.linesUpdate : [],
+                linesDeleted: !!getters.linesDeleted.length ?getters.linesDeleted : []
+            }
+
+            commit('setDataEndProcess', data)
+            dispatch('processModifyStatementLine')
+            // commit('setCompleted', true)
+        }
     },
 
     /**
@@ -119,16 +132,24 @@ const actions = {
             console.error(error)
         })
     },
-    /*
-       ____ ____  _____    _  _____ _____   ____ _____  _  _____ _____ __  __ _____ _   _ _____
-      / ___|  _ \| ____|  / \|_   _| ____| / ___|_   _|/ \|_   _| ____|  \/  | ____| \ | |_   _|
-     | |   | |_) |  _|   / _ \ | | |  _|   \___ \ | | / _ \ | | |  _| | |\/| |  _| |  \| | | |
-     | |___|  _ <| |___ / ___ \| | | |___   ___) || |/ ___ \| | | |___| |  | | |___| |\  | | |
-      \____|_| \_\_____/_/   \_\_| |_____| |____/ |_/_/   \_\_| |_____|_|  |_|_____|_| \_| |_|
-     */
+    /* MODIFY Line */
+    processModifyStatementLine({ getters, dispatch, commit }) {
+        return axios.post('/eiru_bank_statement/process_modify_statement_line', {
+            jsonrpc: '2.0',
+            method: 'call',
+            params: {
+                data: getters.data
+            }
+        }).then(({data}) => {
+            dispatch('notify', data.result.message)
+            commit('setCompleted', true)
+        }).catch(error => {
+            console.error(error)
+        })
+    },
+    /*  Create STATMENT */
     endProcessNewStatement({getters, commit, dispatch}) {
         let data = {}
-
         data = {
             journal_id: getters.selectedJournal,
             type_statement: getters.selectedStatementType,

+ 13 - 12
src/store/index.js

@@ -7,18 +7,19 @@ import getters from '@/store/getters'
 import mutations from '@/store/mutations'
 import actions from '@/store/actions'
 // modules
-import dateModule from '@/store/modules/date'
 import currenciesModule from '@/store/modules/currencies'
+import dateModule from '@/store/modules/date'
 import journalsModule from '@/store/modules/journals'
+import resPartners from '@/store/modules/resPartners'
+import resUsersModule from '@/store/modules/resUsers'
 import statementModule from '@/store/modules/statement'
+import statementAction from '@/store/modules/statementAction'
 import statementConfigModule from '@/store/modules/statementConfig'
-import userModule from '@/store/modules/user'
+import statementLine from '@/store/modules/statementLine'
 import statementTypeModule from '@/store/modules/statementType'
-import resUsersModule from '@/store/modules/resUsers'
+import userModule from '@/store/modules/user'
+
 //Actions Statement
-import statementAction from '@/store/modules/statementAction'
-import statementLine from '@/store/modules/statementLine'
-import resPartners from '@/store/modules/resPartners'
 
 /* Module */
 Vue.use(Vuex)
@@ -29,17 +30,17 @@ const store = new Vuex.Store({
     mutations,
     actions,
     modules: {
-        dateModule,
         currenciesModule,
+        dateModule,
         journalsModule,
-        statementModule,
-        statementConfigModule,
-        userModule,
-        statementTypeModule,
+        resPartners,
         resUsersModule,
+        statementModule,
         statementAction,
+        statementConfigModule,
         statementLine,
-        resPartners
+        statementTypeModule,
+        userModule,
     },
     strict: true
 })

+ 2 - 2
src/store/modules/statementAction.js

@@ -130,7 +130,7 @@ const actions = {
         commit('setInputCashbox', false)
         commit('setOutputCashbox', false)
         commit('setStatmentConfirm', false)
-        dispatch('resetLines')
+        dispatch('resetStatementLine')
         dispatch('resetStatemntDest')
     },
     /* AmountOperation */
@@ -149,7 +149,7 @@ const actions = {
         commit('setInputCashbox', false)
         commit('setOutputCashbox', false)
         commit('setStatmentConfirm', false)
-        dispatch('resetLines')
+        dispatch('resetStatementLine')
         dispatch('resetStatemntDest')
         commit('setAmountOperation', 0)
         commit('setDescription', '')

+ 49 - 32
src/store/modules/statementLine.js

@@ -5,15 +5,13 @@ const initialState = {
     linesUpdate: [],
     showStatementLine: false
 }
-
 const state = {
     lines: initialState.lines,
     lineSelected: initialState.lineSelected,
     linesDeleted: initialState.linesDeleted,
     linesUpdate: initialState.linesUpdate,
-    showStatementLine: initialState.showStatementLine
+    showStatementLine: initialState.showStatementLine,
 }
-
 const getters = {
     statementLines(state) {
         return state.lines
@@ -31,7 +29,6 @@ const getters = {
         return  state.lineSelected;
     }
 }
-
 const mutations = {
     setLines(state, payload) {
         let data = []
@@ -52,7 +49,7 @@ const mutations = {
     },
     /*Show Modal Modify Line */
     setShowStatementLine( state, payload){
-        state.showStatementLine = !!payload
+        state.showStatementLine = payload
     },
     /* */
     setLinesDeleted (state, payload) {
@@ -73,60 +70,80 @@ const mutations = {
             state.linesDeleted.splice(linesDeletedFound, 1)
         }
     },
-    /* */
+    /* Add Update */
     setLinesUpdate (state, payload) {
-        // state.lines.forEach(item => {
-            // if (item.id === payload {
-                // item.linesUpdate = payload
-            // }
-        // })
+        if (!payload) {
+            return
+        }
+
+        let updateLine =  state.lines.find(item => item.id === payload.id)
+        if (updateLine){
+            updateLine.amount = payload.amount
+            updateLine.date = payload.date
+            updateLine.name = payload.name
+            updateLine.isUpdate = true
+            updateLine.partnerId = payload.partnerId
+            updateLine.partnerName = payload.partnerName
+            updateLine.ref = payload.ref
+        }
+
+        let linesUpdateFound = state.linesUpdate.find(item => item.id === payload.id)
+        if (!!linesUpdateFound) {
+            let linesIndex = state.linesUpdate.findIndex(item => item.id === payload.id)
+            state.linesUpdate.splice(linesIndex, 1)
+        }
 
-        if (!!payload) {
-            let linesUpdateFound = state.linesUpdate.find(item => item === payload)
-            if (!!linesUpdateFound) return
-            state.linesUpdate = [payload, ...state.linesUpdate]
+        let statementLine = {
+            'amount': payload.amount,
+            'date': payload.date,
+            'id': payload.id,
+            'isDelete': payload.isDelete,
+            'isUpdate': true,
+            'name': payload.name,
+            'partnerId': payload.partnerId,
+            'partnerName': payload.partnerName,
+            'ref':payload.ref,
         }
 
-        // if (!payload.state) {
-        //     let linesDeletedFound = state.linesDeleted.findIndex(item => item === payload.id)
-        //     state.linesDeleted.splice(linesDeletedFound, 1)
-        // }
+        state.linesUpdate = [statementLine, ...state.linesUpdate]
     },
-    /* */
+    /* Selected */
     setLineSelected(state, payload) {
         let selected = state.lines.find(item => item.id  === payload)
         state.lineSelected = !!selected ? selected : null
     },
+    /* Reset */
+    setResetLines(state){
+        state.lines = []
+        state.lineSelected = null
+        state.linesDeleted = []
+        state.linesUpdate = []
+        state.showStatementLine = false
+    },
 }
-
 const actions = {
     initLines({ commit, getters }) {
         if (!!getters.selectedStatement) {
             commit('setLines', getters.selectedStatement.line)
         }
     },
-    resetLines({ commit }){
-        commit('setLines', [])
-    },
-    selectLineSelected({ commit, dispatch },payload){
+    selectLineSelected({ commit },payload) {
         commit('setLineSelected', payload)
-        // dispatch('showStatementLineModify', payload)
+        commit('setShowStatementLine', payload)
     },
     addDeletedLine({ commit }, payload) {
         commit('setLinesDeleted', payload)
     },
-    addUpdateLine({ commit }, payload){
+    addUpdateLine({ commit }, payload) {
         commit('setLinesUpdate', payload)
+        commit('setShowStatementLine', false)
+        commit('setLineSelected', null)
     },
     showStatementLineModify({ commit }, payload) {
         commit('setShowStatementLine', payload)
     },
     resetStatementLine({ commit }) {
-        commit('setLines', [])
-        commit('setLineSelected', null)
-        commit('setLinesDeleted', [])
-        commit('setLinesUpdate', [])
-        commit('setShowStatementLine', [])
+        commit('setResetLines')
     }
 }
 

+ 13 - 13
webpack.config.js

@@ -1,7 +1,7 @@
 var Path = require('path');
 var LiveReloadPlugin = require('webpack-livereload-plugin')
 var ExtractTextPlugin = require('extract-text-webpack-plugin')
-// var HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
+var HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
 
 var prod = process.env.NODE_ENV === 'production'
 
@@ -25,18 +25,18 @@ module.exports = {
         }),
         new ExtractTextPlugin('main.css'),
 
-        // new HardSourceWebpackPlugin({
-        //     cacheDirectory: 'node_modules/.cache/hard-source/[confighash]',
-        //     recordsPath: 'node_modules/.cache/hard-source/[confighash]/records.json',
-        //     configHash: function(webpackConfig) {
-        //         return require('node-object-hash')({sort: false}).hash(webpackConfig)
-        //     },
-	    //     nvironmentHash: {
-        //         root: process.cwd(),
-        //         directories: [],
-        //         files: ['package-lock.json', 'yarn.lock'],
-	    //     }
-	    // })
+        new HardSourceWebpackPlugin({
+            cacheDirectory: 'node_modules/.cache/hard-source/[confighash]',
+            recordsPath: 'node_modules/.cache/hard-source/[confighash]/records.json',
+            configHash: function(webpackConfig) {
+                return require('node-object-hash')({sort: false}).hash(webpackConfig)
+            },
+	        nvironmentHash: {
+                root: process.cwd(),
+                directories: [],
+                files: ['package-lock.json', 'yarn.lock'],
+	        }
+	    })
     ],
     module: {
         rules: [