ソースを参照

[ADD] Transfer, input, output, confir

adrielso 6 年 前
コミット
581dc60025
40 ファイル変更1348 行追加1072 行削除
  1. 1 0
      __openerp__.py
  2. 74 28
      controllers/account_bank_statement.py
  3. 35 0
      controllers/account_bank_statement_config.py
  4. 0 34
      controllers/account_bank_statement_line.py
  5. 2 1
      controllers/account_bank_statement_type.py
  6. 85 0
      controllers/account_journal.py
  7. 0 42
      controllers/cashbox_confirm.py
  8. 7 0
      controllers/eiru_logging.py
  9. 26 226
      controllers/main.py
  10. 15 0
      controllers/res_partner.py
  11. 2 14
      controllers/res_store.py
  12. 22 0
      controllers/res_users.py
  13. 7 7
      controllers/server_datetime.py
  14. 15 23
      src/App.vue
  15. 0 138
      src/components/common/Cart.vue
  16. 0 2
      src/components/common/index.js
  17. 9 14
      src/components/forms/StatementActionForm.vue
  18. 1 1
      src/components/modal/BankStatementModal.vue
  19. 236 0
      src/components/modal/StatementLineModal.vue
  20. 18 193
      src/components/steps/CardGridItem.vue
  21. 365 172
      src/components/steps/CardItem.vue
  22. 35 3
      src/components/steps/StatementModify.vue
  23. 4 0
      src/index.js
  24. 22 28
      src/store/actions.js
  25. 3 1
      src/store/getters.js
  26. 4 0
      src/store/index.js
  27. 5 5
      src/store/modules/currencies.js
  28. 1 7
      src/store/modules/date.js
  29. 11 13
      src/store/modules/journals.js
  30. 30 0
      src/store/modules/resPartners.js
  31. 14 8
      src/store/modules/resUsers.js
  32. 33 11
      src/store/modules/statement.js
  33. 50 18
      src/store/modules/statementAction.js
  34. 45 77
      src/store/modules/statementConfig.js
  35. 138 0
      src/store/modules/statementLine.js
  36. 9 4
      src/store/modules/statementType.js
  37. 4 0
      src/store/modules/user.js
  38. 4 1
      src/store/mutations.js
  39. 1 0
      src/store/state.js
  40. 15 1
      webpack.config.js

+ 1 - 0
__openerp__.py

@@ -20,6 +20,7 @@
         'currency_utility',
         'eiru_sidebar_toggler',
         'eiru_topbar_toggler',
+        'eiru_account_bank_statement_utility'
     ],
     'data': [
         'views/templates.xml',

+ 74 - 28
controllers/account_bank_statement.py

@@ -1,23 +1,13 @@
 # -*- coding: utf-8 -*-
 from openerp.http import request
-'''
-    ██████   █████  ███    ██ ██   ██    ███████ ████████  █████  ████████ ███████ ███    ███ ███████ ███    ██ ████████
-    ██   ██ ██   ██ ████   ██ ██  ██     ██         ██    ██   ██    ██    ██      ████  ████ ██      ████   ██    ██
-    ██████  ███████ ██ ██  ██ █████      ███████    ██    ███████    ██    █████   ██ ████ ██ █████   ██ ██  ██    ██
-    ██   ██ ██   ██ ██  ██ ██ ██  ██          ██    ██    ██   ██    ██    ██      ██  ██  ██ ██      ██  ██ ██    ██
-    ██████  ██   ██ ██   ████ ██   ██ ██ ███████    ██    ██   ██    ██    ███████ ██      ██ ███████ ██   ████    ██
-'''
+from eiru_logging import make_info_log
 
 _MODEL = 'account.bank.statement'
 
-'''
-         ██████  ███████ ████████
-        ██       ██         ██
-        ██   ███ █████      ██
-        ██    ██ ██         ██
-         ██████  ███████    ██
-'''
+''' '''
 def search_account_bank_statement(statementId):
+    make_info_log('GET Account Bank Statement')
+
     casbox= []
     statement = request.env['account.bank.statement'].browse(statementId)
 
@@ -32,14 +22,74 @@ def search_account_bank_statement(statementId):
 
     return casbox
 
-'''
-         ██████ ██████  ███████  █████  ████████ ███████
-        ██      ██   ██ ██      ██   ██    ██    ██
-        ██      ██████  █████   ███████    ██    █████
-        ██      ██   ██ ██      ██   ██    ██    ██
-         ██████ ██   ██ ███████ ██   ██    ██    ███████ ██ Account Bank Statement
-'''
+''' account.bank.statement all'''
+def get_account_bank_statement( journalIds=None):
+    make_info_log('GET Account Bank Statement all ')
+
+    if (not journalIds):
+        return False
+    domain = [('journal_id.id', 'in', journalIds),('state', '=', 'open')]
+    # domain = [('journal_id.id', 'in', journalIds), ('user_id', '=', request.env.user.id)]
+    return [{
+        'id': statement.id,
+        'name': statement.name,
+        'date': statement.date,
+        'state': statement.state,
+        'balanceEnd': statement.balance_end,
+        'user': {
+            'id': statement.user_id.id,
+            'name': statement.user_id.name,
+            'displayName': statement.user_id.display_name
+        },
+        'userSession': request.env.user.id,
+        'journal': {
+            'id': statement.journal_id.id,
+            'name': statement.journal_id.name,
+            'displayName': statement.journal_id.display_name,
+            'code': statement.journal_id.code,
+            'cashControl': statement.journal_id.cash_control,
+            'type': statement.journal_id.type,
+            'currency': {
+                'id': statement.journal_id.currency.id,
+                'name': statement.journal_id.currency.name,
+                'displayName': statement.journal_id.currency.display_name
+            }
+        },
+        'line': [{
+            'id': line.id,
+            'date': line.date,
+            'name': line.name,
+            'ref': line.ref,
+            'amount': line.amount,
+            'partnerId': line.partner_id.id,
+            'partner':[{
+                'id': partner.id,
+                'name': partner.name,
+                'displayName': partner.display_name
+            }for partner in request.env['res.partner'].browse(line.partner_id.id)],
+        } for line in statement.line_ids],
+        'typeStatement': {
+            'id': statement.type_statement.id,
+            'name': statement.type_statement.name,
+            'code': statement.type_statement.code
+        },
+        'currency': {
+            'id': statement.currency.id,
+            'name': statement.currency.display_name,
+            'base': statement.currency.base,
+            'symbol': statement.currency.symbol,
+            'position': statement.currency.position,
+            'rateSilent': statement.currency.rate_silent,
+            'decimalSeparator': statement.currency.decimal_separator,
+            'decimalPlaces': statement.currency.decimal_places,
+            'thousandsSeparator': statement.currency.thousands_separator
+        }
+    } for statement in request.env['account.bank.statement'].search(domain)]
+
+'''Create Account Bank Statement '''
 def create_account_bank_statement(data):
+    make_info_log('Create Account Bank Statement')
+
     from account_bank_statement_config import get_bank_statement_config
 
     config = get_bank_statement_config()
@@ -132,14 +182,10 @@ def create_account_bank_statement(data):
         }
     }
 
-'''
-         ██████ ██       ██████  ███████ ██ ███    ██  ██████
-        ██      ██      ██    ██ ██      ██ ████   ██ ██
-        ██      ██      ██    ██ ███████ ██ ██ ██  ██ ██   ███
-        ██      ██      ██    ██      ██ ██ ██  ██ ██ ██    ██
-         ██████ ███████  ██████  ███████ ██ ██   ████  ██████   bank Statement
-'''
+''' confirm bank Statement '''
 def closing_statement(data):
+    make_info_log('Confirm Account Bank Statement')
+
     from account_bank_statement_line import create_statement_line
     from cashbox_confirm import get_cashbox_statement_confirm, create_cashbox_statement_confirm, write_cashbox_statement_confirm
     from server_datetime import get_date

+ 35 - 0
controllers/account_bank_statement_config.py

@@ -1,13 +1,48 @@
 # -*- coding: utf-8 -*-
 from openerp.http import request
+from eiru_logging import make_info_log
 
 _MODEL = 'account.bank.statement.config'
 
 def get_bank_statement_config():
+    make_info_log('GET StatementConfig')
     return request.env[_MODEL].search([('active', '=', True)])
 
     # import pdb_pdb; pdb_pdb.set_trace()
+''' Configuracion de Caja '''
+def get_account_bank_statement_config():
+    make_info_log('GET StatementConfig Init')
 
+    return [{
+        'transfer': {
+            'userIds': map(lambda x: x.id, config.transfer_user_ids),
+            'statementIds': map(lambda x: x.id, config.transfer_statement_ids) ,
+            'negativeAmount': config.transfer_negative_amount
+        },
+        'inputCashBox': {
+            'userIds': map(lambda x: x.id, config.input_cash_box_user_id),
+            'statementIds': map(lambda x: x.id, config.input_cash_box_statement_ids)
+        },
+        'outputCashBox': {
+            'userIds': map(lambda x: x.id, config.output_cash_box_user_id),
+            'statementIds': map(lambda x: x.id, config.output_cash_box_statement_ids),
+            'negativeAmount': config.output_negative_amount
+        },
+        'delete': {
+            'outputUserIds': map(lambda x: x.id, config.delete_output_user_ids),
+            'inputUserIds': map(lambda x: x.id, config.delete_input_user_ids),
+            'transferUserIds': map(lambda x: x.id, config.delete_transfer_user_ids)
+        },
+        'statementOpen': config.statement_open_config,
+        'statementConfirm' :{
+            'userIds': map(lambda x: x.id, config.statement_confirm_user),
+            'transferUserIds': map(lambda x: x.id , config.statement_confirm_transfer_user),
+            'balanceUserIds': map(lambda x: x.id, config.statement_confirm_balance),
+            'negativeAmountUserIds': map(lambda x: x.id, config.statement_confirm_negative_amount)
+        },
+        'statementCancelUserIds': map(lambda x: x.id, config.statement_cancel_user),
+        'statementUnlinkUserIds': map(lambda x: x.id, config.statement_unlink_user)
+    } for config in request.env[_MODEL].search([('active', '=', True)],order='id')]
 
 '''
 name = fields.Char('Name', required=True, default="Configuración Cajas")

+ 0 - 34
controllers/account_bank_statement_line.py

@@ -10,37 +10,3 @@ _MODEL= 'account.bank.statement.line'
 '''
 def create_statement_line(values):
     return request.env[_MODEL].sudo().create(values)
-
-    # '''
-    #     Create Line statement.
-    # '''
-    # def _create_statement_line_transfer(self, statement, name, amount, ref):
-    #     statementLine = {
-    #         'statement_id': statement.id,
-    #         'name': name,
-    #         'amount': amount ,
-    #         'ref': ref,
-    #         'account_id': statement.journal_id.internal_account_id.id,
-    #         'journal_id': statement.journal_id.id,
-    #         'is_deleted': True
-    #     }
-    #
-    #     line = self.env['account.bank.statement.line'].create(statementLine)
-    #     return line
-    #
-    #
-    # '''
-    #     Create cash box transfer
-    # '''
-    # def _create_cash_box_transfer(self, ref, amount, lineInput, lineOutput):
-    #     cash = {
-    #         'name': "TRANSFERENCIA %s a %s" %((lineOutput.statement_id.name),(lineInput.statement_id.name)),
-    #         'amount': amount,
-    #         'ref': ref,
-    #         'input_line': lineInput.id,
-    #         'output_line': lineOutput.id,
-    #         'input_statement': lineInput.statement_id.id,
-    #         'output_statement': lineOutput.statement_id.id,
-    #         'date': lineOutput.date
-    #     }
-    #     return self.env['cash.box.transfer'].create(cash)

+ 2 - 1
controllers/account_bank_statement_type.py

@@ -1,10 +1,11 @@
 # -*- coding: utf-8 -*-
-
 from openerp.http import request
+from eiru_logging import make_info_log
 
 _MODEL = 'account.bank.statement.type'
 
 def get_account_bank_statement_type():
+    make_info_log('GET Statement Type')
     return[{
         'id': type.id,
         'name': type.name,

+ 85 - 0
controllers/account_journal.py

@@ -0,0 +1,85 @@
+# -*- codign: utf-8 -*-
+from openerp.http import request
+from eiru_logging import make_info_log
+_MODEL='account.journal'
+
+def get_currencies_from_journal():
+    make_info_log('GET currency the journal active in store')
+
+    domain = [('type', 'in', ['bank', 'cash']),('active', '=', True)]
+    currencies = []
+
+    for j in request.env[_MODEL].search(domain):
+        c = j.currency or j.company_id.currency_id
+
+        currencies.append({
+            'id': c.id,
+            'name': c.display_name,
+            'base': c.base,
+            'symbol': c.symbol,
+            'position': c.position,
+            'rateSilent': c.rate_silent,
+            'decimalSeparator': c.decimal_separator,
+            'decimalPlaces': c.decimal_places,
+            'thousandsSeparator': c.thousands_separator
+        })
+
+    return {c['id']:c for c in currencies}.values()
+
+'''  all active journals '''
+def get_journals(type=None):
+    make_info_log('GET Journal active in store')
+
+    if ((not type[0]) or (not type)):
+        type= ['bank', 'cash']
+
+    user = request.env.user
+    journal = []
+
+    for store in user.store_ids:
+        for journalID in store.journal_ids:
+            if (journalID.type in ['bank', 'cash']):
+                journal.append(journalID.id)
+
+    # domain = [('type', 'in', type), ('default_debit_account_id.currency_id', '=', False), ('active', '=', True)]
+    domain = [('type', 'in', type),('active', '=', True)]
+
+    if (journal):
+        domain.append(('id', 'in', journal ))
+
+    return [{
+        'id': journal.id,
+        'name': journal.name,
+        'displayName': journal.display_name,
+        'code': journal.code,
+        'cashControl': journal.cash_control,
+        'type': journal.type,
+        'storeIds': map(lambda x: x.id, journal.store_ids),
+        'currency': {
+            'id': journal.currency.id,
+            'name': journal.currency.name,
+            'displayName': journal.currency.display_name
+        },
+        'defaultDebitAccount': {
+            'id': journal.default_debit_account_id.id,
+            'name': journal.default_debit_account_id.name,
+            'displayName': journal.default_debit_account_id.display_name,
+            'code': journal.default_debit_account_id.code,
+            'exchange_rate': journal.default_credit_account_id.exchange_rate,
+            'foreignBalance': journal.default_credit_account_id.foreign_balance,
+            'reconcile': journal.default_credit_account_id.reconcile,
+            'debit': journal.default_credit_account_id.debit,
+            'credit': journal.default_credit_account_id.credit,
+            'currencyMode': journal.default_credit_account_id.currency_mode,
+            'companyCurrency': {
+                'id': journal.default_credit_account_id.company_currency_id.id,
+                'name': journal.default_credit_account_id.company_currency_id.name,
+                'displayName': journal.default_credit_account_id.company_currency_id.display_name,
+            },
+            'currency': {
+                'id': journal.default_credit_account_id.currency_id.id,
+                'name': journal.default_credit_account_id.currency_id.name,
+                'displayName': journal.default_credit_account_id.currency_id.display_name
+            }
+        }
+    } for journal in request.env[_MODEL].search(domain, order='id')]

+ 0 - 42
controllers/cashbox_confirm.py

@@ -21,45 +21,3 @@ def create_cashbox_statement_confirm(data):
 def write_cashbox_statement_confirm(confirmId, data):
     confirm = request.env[_MODEL].browse(confirmId)
     return  confirm.sudo().write(data)
-
-#
-# def _create_cashbox_statement_confirm(self,values, statement):
-#     casbox = self.env['cashbox.statement.confirm'].search([('statement_id.id', '=', statement.id)])
-#     if (not casbox):
-#         confirm = self.env['cashbox.statement.confirm'].create(values)
-#     else:
-#         confirm = casbox.write(values)
-#         if (confirm):
-#             confirm = self.env['cashbox.statement.confirm'].search([('statement_id.id', '=', statement.id)])
-#
-#     return confirm
-
-'''
-    name = fields.Char('name', required=True)
-    ref = fields.Char('Ref')
-    date = fields.Date()
-    active = fields.Boolean('Active', default=True)
-    message_confirm = fields.Text('Message Confirm')
-    message_deleted = fields.Text('Message Deleted')
-    ### Statement confirm - open
-    statement_id = fields.Many2one('account.bank.statement', 'Bank Statement Confirm')
-    statement_open = fields.Many2one('account.bank.statement', 'Bank Statement Open')
-    ## User statement - User Confirm
-    user_statement = fields.Many2one('res.users', 'Res user')
-    user_confirm = fields.Many2one('res.users', 'Res user')
-    ## Journal
-    journal_id = fields.Many2one('account.journal', 'Journal')
-    ## Line
-    line_difference = fields.Many2one('account.bank.statement.line', 'Bank statement line difference')
-    line_next_open = fields.Many2one('account.bank.statement.line', 'Bank statement line next open statement')
-    line_open = fields.Many2one('account.bank.statement.line', 'Bank statement line open')
-    ### Amount
-    amount_statement = fields.Float('Amount Statement', digits_compute=dp.get_precision('Account'), required=True)
-    amount_real = fields.Float('Amount Real', digits_compute=dp.get_precision('Account'), required=True)
-    amount_difference = fields.Float('Amount Difference', digits_compute=dp.get_precision('Account'), required=True)
-    amount_next_open =  fields.Float('Amount Next open statement', digits_compute=dp.get_precision('Account'), required=True)
-    ## estado del regsitro
-    state_avaliable = fields.Boolean('Avaliable', default=True, help="True : disponible, False : Utilizado")
-    # casbox_transfer_id =fields.Many2one('cash.box.transfer', 'cashBox transfer')
-    cashbox_transfer_ids =fields.One2many('cash.box.transfer', 'cashbox_confirm_id', string="transfer id")
-'''

+ 7 - 0
controllers/eiru_logging.py

@@ -0,0 +1,7 @@
+from openerp.http import request
+import logging
+LOGGER = logging.getLogger(__name__)
+
+''' Logger info '''
+def make_info_log(log):
+    LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))

+ 26 - 226
controllers/main.py

@@ -3,230 +3,20 @@ from openerp import http
 from openerp.http import request
 from werkzeug.wrappers import Response
 from werkzeug.datastructures import Headers
-from datetime import datetime
 from dateutil.relativedelta import relativedelta as rd
 from dateutil.parser import parse
-from pytz import timezone
 from gzip import GzipFile
 from StringIO import StringIO as IO
 import simplejson as json
 import gzip
-import logging
+# import logging
+from eiru_logging import make_info_log
 
-LOGGER = logging.getLogger(__name__)
-DATE_FORMAT = '%Y-%m-%d'
-DATETIME_FORMAT = '%Y-%m-%d %H:%m:%S'
+# LOGGER = logging.getLogger(__name__)
 GZIP_COMPRESSION_LEVEL = 9
 
 class Statement(http.Controller):
 
-    ''' Get timezone '''
-    def get_timezone(self):
-        return timezone(request.context['tz'])
-
-    '''  Get server date to send '''
-    def get_server_date(self):
-        return datetime.now(self.get_timezone()).strftime(DATE_FORMAT)
-
-    ''' Get current user information '''
-    def get_user(self):
-        user = request.env.user
-        return {
-            'id': user.id,
-            'name': user.name,
-            'displayName': user.display_name,
-            'currency': {
-                'id': user.company_id.currency_id.id,
-                'name': user.company_id.currency_id.name,
-                'displayName': user.company_id.currency_id.display_name,
-                'symbol': user.company_id.currency_id.symbol
-            },
-            'company': {
-                'id': user.company_id.id,
-                'name': user.company_id.name,
-                'displayName': user.company_id.display_name
-            }
-        }
-
-    ''' Get currencies from journals '''
-    def get_currencies_from_journal(self):
-        domain = [
-            ('type', 'in', ['bank', 'cash']),
-            # ('default_debit_account_id.currency_id', '=', False),
-            ('active', '=', True)
-        ]
-
-        currencies = []
-
-        for j in request.env['account.journal'].search(domain):
-            c = j.currency or j.company_id.currency_id
-
-            currencies.append({
-                'id': c.id,
-                'name': c.display_name,
-                'base': c.base,
-                'symbol': c.symbol,
-                'position': c.position,
-                'rateSilent': c.rate_silent,
-                'decimalSeparator': c.decimal_separator,
-                'decimalPlaces': c.decimal_places,
-                'thousandsSeparator': c.thousands_separator
-            })
-
-        return {c['id']:c for c in currencies}.values()
-
-    '''  all active journals '''
-    def get_journals(self, type=None):
-        if (not type[0]):
-            type= ['bank', 'cash']
-
-        user = request.env.user
-        journal = []
-
-        for store in user.store_ids:
-            for journalID in store.journal_ids:
-                if (journalID.type in ['bank', 'cash']):
-                    journal.append(journalID.id)
-
-        # domain = [('type', 'in', type), ('default_debit_account_id.currency_id', '=', False), ('active', '=', True)]
-        domain = [('type', 'in', type),('active', '=', True)]
-
-        if (journal):
-            domain.append(('id', 'in', journal ))
-
-        return [{
-            'id': journal.id,
-            'name': journal.name,
-            'displayName': journal.display_name,
-            'code': journal.code,
-            'cashControl': journal.cash_control,
-            'type': journal.type,
-            'storeIds': map(lambda x: x.id, journal.store_ids),
-            'currency': {
-                'id': journal.currency.id,
-                'name': journal.currency.name,
-                'displayName': journal.currency.display_name
-            },
-            'defaultDebitAccount': {
-                'id': journal.default_debit_account_id.id,
-                'name': journal.default_debit_account_id.name,
-                'displayName': journal.default_debit_account_id.display_name,
-                'code': journal.default_debit_account_id.code,
-                'exchange_rate': journal.default_credit_account_id.exchange_rate,
-                'foreignBalance': journal.default_credit_account_id.foreign_balance,
-                'reconcile': journal.default_credit_account_id.reconcile,
-                'debit': journal.default_credit_account_id.debit,
-                'credit': journal.default_credit_account_id.credit,
-                'currencyMode': journal.default_credit_account_id.currency_mode,
-                'companyCurrency': {
-                    'id': journal.default_credit_account_id.company_currency_id.id,
-                    'name': journal.default_credit_account_id.company_currency_id.name,
-                    'displayName': journal.default_credit_account_id.company_currency_id.display_name,
-                },
-                'currency': {
-                    'id': journal.default_credit_account_id.currency_id.id,
-                    'name': journal.default_credit_account_id.currency_id.name,
-                    'displayName': journal.default_credit_account_id.currency_id.display_name
-                }
-            }
-        } for journal in request.env['account.journal'].search(domain, order='id')]
-
-    ''' account.bank.statement '''
-    def get_account_bank_statement(self, journalIds=None):
-        if (not journalIds):
-            return False
-
-        domain = [('journal_id.id', 'in', journalIds)]
-        # domain = [('journal_id.id', 'in', journalIds), ('user_id', '=', request.env.user.id)]
-        return [{
-            'id': statement.id,
-            'name': statement.name,
-            'date': statement.date,
-            'state': statement.state,
-            'balanceEnd': statement.balance_end,
-            'user': {
-                'id': statement.user_id.id,
-                'name': statement.user_id.name,
-                'displayName': statement.user_id.display_name
-            },
-            'userSession': request.env.user.id,
-            'journal': {
-                'id': statement.journal_id.id,
-                'name': statement.journal_id.name,
-                'displayName': statement.journal_id.display_name,
-                'code': statement.journal_id.code,
-                'cashControl': statement.journal_id.cash_control,
-                'type': statement.journal_id.type,
-                'currency': {
-                    'id': statement.journal_id.currency.id,
-                    'name': statement.journal_id.currency.name,
-                    'displayName': statement.journal_id.currency.display_name
-                }
-            },
-            'line': [{
-                'id': line.id,
-                'date': line.date,
-                'name': line.name,
-                'ref': line.ref,
-                'amount': line.amount,
-                'patner':{
-                    'id': line.partner_id.id,
-                    'name': line.partner_id.name,
-                    'displayName': line.partner_id.display_name
-                },
-            } for line in statement.line_ids],
-            'typeStatement': {
-                'id': statement.type_statement.id,
-                'name': statement.type_statement.name,
-                'code': statement.type_statement.code
-            },
-            'currency':{
-                'id': statement.currency.id,
-                'name': statement.currency.display_name,
-                'base': statement.currency.base,
-                'symbol': statement.currency.symbol,
-                'position': statement.currency.position,
-                'rateSilent': statement.currency.rate_silent,
-                'decimalSeparator': statement.currency.decimal_separator,
-                'decimalPlaces': statement.currency.decimal_places,
-                'thousandsSeparator': statement.currency.thousands_separator
-            }
-        } for statement in request.env['account.bank.statement'].search(domain)]
-
-    ''' Configuracion de Caja '''
-    def get_account_bank_statement_config(self):
-        'account.bank.statement.config'
-        return [{
-            'transfer': {
-                'userIds': map(lambda x: x.id, config.transfer_user_ids),
-                'statementIds': map(lambda x: x.id, config.transfer_statement_ids) ,
-                'negativeAmount': config.transfer_negative_amount
-            },
-            'inputCashBox': {
-                'userIds': map(lambda x: x.id, config.input_cash_box_user_id),
-                'statementIds': map(lambda x: x.id, config.input_cash_box_statement_ids)
-            },
-            'outputCashBox': {
-                'userIds': map(lambda x: x.id, config.output_cash_box_user_id),
-                'statementIds': map(lambda x: x.id, config.output_cash_box_statement_ids),
-                'negativeAmount': config.output_negative_amount
-            },
-            'delete': {
-                'outputUserIds': map(lambda x: x.id, config.delete_output_user_ids),
-                'inputUserIds': map(lambda x: x.id, config.delete_input_user_ids),
-                'transferUserIds': map(lambda x: x.id, config.delete_transfer_user_ids)
-            },
-            'statementOpen': config.statement_open_config,
-            'statementConfirm' :{
-                'userIds': map(lambda x: x.id, config.statement_confirm_user),
-                'transferUserIds': map(lambda x: x.id , config.statement_confirm_transfer_user),
-                'balanceUserIds': map(lambda x: x.id, config.statement_confirm_balance),
-                'negativeAmountUserIds': map(lambda x: x.id, config.statement_confirm_negative_amount)
-            },
-            'statementCancelUserIds': map(lambda x: x.id, config.statement_cancel_user),
-            'statementUnlinkUserIds': map(lambda x: x.id, config.statement_unlink_user)
-        } for config in request.env['account.bank.statement.config'].search([('active', '=', True)],order='id')]
-
     ''' Make JSON response to send '''
     def make_response(self, data=None, status=200):
         return Response(json.dumps(data), status=status, content_type='application/json')
@@ -247,9 +37,9 @@ class Statement(http.Controller):
 
         return Response(contents, status=status, headers=headers, content_type='application/json')
 
-    ''' Logger info '''
-    def make_info_log(self, log):
-        LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))
+    # ''' Logger info '''
+    # def make_info_log(self, log):
+    #     LOGGER.info('\033[1;34m[INFO] --> \033[m{}'.format(log))
 
     '''
         ██ ███    ██ ██ ████████
@@ -262,20 +52,30 @@ class Statement(http.Controller):
     def init_bank_statement(self,**kw):
         from account_bank_statement_type import get_account_bank_statement_type
         from res_store import get_res_store
-        from res_users import get_res_users
-        self.make_info_log('Preparing data to {}'.format(kw.get('mode')))
+        from res_users import get_res_users, get_user
+        from server_datetime import get_date
+        from res_partner import get_res_partner
+        from account_bank_statement_config import get_account_bank_statement_config
+        from account_journal import get_currencies_from_journal, get_journals
+        from account_bank_statement import get_account_bank_statement
+
+        make_info_log('Preparing data to {}'.format(kw.get('mode')))
+        # self.make_info_log('Preparing data to {}'.format(kw.get('mode')))
         store = get_res_store(kw.get('mode'))
 
+        # from eiru_logging import make_info_log
+        # make_info_log('GET Timezone')
+
         return self.make_gzip_response({
-            'date': self.get_server_date(),
-            'user': self.get_user(),
-            'currencies': self.get_currencies_from_journal(),
-            'journals': self.get_journals([kw.get('mode')]),
-            # 'statement': self.get_account_bank_statement(map(lambda x: x['id'], journals[0])),
-            'statement': self.get_account_bank_statement(store['journalIds']),
-            'statementConfig' : self.get_account_bank_statement_config(),
+            'date': get_date(),
+            'user': get_user(),
+            'resUsers': get_res_users(store['userIds']),
             'statementType': get_account_bank_statement_type(),
-            'resUsers': get_res_users(store['userIds'])
+            'resPartners': get_res_partner(),
+            'statementConfig': get_account_bank_statement_config(),
+            'currencies': get_currencies_from_journal(),
+            'journals': get_journals([kw.get('mode')]),
+            'statement': get_account_bank_statement(store['journalIds']),
         })
 
     '''

+ 15 - 0
controllers/res_partner.py

@@ -0,0 +1,15 @@
+# -*- codign: utf-8 -*-
+from openerp.http import request
+from eiru_logging import make_info_log
+
+_MODEL='res.partner'
+
+def get_res_partner():
+    make_info_log('GET Res-Partner')
+    domain = [('active', '=', True)]
+
+    return[{
+        'id':  partner.id,
+        'name': partner.display_name,
+        'ruc': partner.ruc
+    } for partner in request.env[_MODEL].search(domain)]

+ 2 - 14
controllers/res_store.py

@@ -2,20 +2,7 @@
 from openerp.http import request
 
 _MODEL='res.store'
-'''
-        ██████  ███████ ███████    ███████ ████████  ██████  ██████  ███████
-        ██   ██ ██      ██         ██         ██    ██    ██ ██   ██ ██
-        ██████  █████   ███████    ███████    ██    ██    ██ ██████  █████
-        ██   ██ ██           ██         ██    ██    ██    ██ ██   ██ ██
-        ██   ██ ███████ ███████ ██ ███████    ██     ██████  ██   ██ ███████
-'''
-'''
-  ██████  ███████ ████████
- ██       ██         ██
- ██   ███ █████      ██
- ██    ██ ██         ██
-  ██████  ███████    ██
-'''
+''' '''
 def get_res_store(mode):
     userIds = []
     journalIds = []
@@ -33,4 +20,5 @@ def get_res_store(mode):
         'userIds': userIds,
         'journalIds': journalIds
     }
+
     # user_ids

+ 22 - 0
controllers/res_users.py

@@ -1,9 +1,11 @@
 # -*- codign: utf-8 -*-
 from openerp.http import request
+from eiru_logging import make_info_log
 
 _MODEL='res.users'
 
 def get_res_users(store):
+    make_info_log('GET user in store')
     domain = [('active', '=', True)]
 
     if (store):
@@ -15,3 +17,23 @@ def get_res_users(store):
         'image': users.image_medium,
         'storeIds': map(lambda x: x.id, users.store_ids),
     } for users in request.env[_MODEL].search(domain)]
+
+def get_user():
+    make_info_log('GET user session')
+    user = request.env.user
+    return {
+        'id': user.id,
+        'name': user.name,
+        'displayName': user.display_name,
+        'currency': {
+            'id': user.company_id.currency_id.id,
+            'name': user.company_id.currency_id.name,
+            'displayName': user.company_id.currency_id.display_name,
+            'symbol': user.company_id.currency_id.symbol
+        },
+        'company': {
+            'id': user.company_id.id,
+            'name': user.company_id.name,
+            'displayName': user.company_id.display_name
+        }
+    }

+ 7 - 7
controllers/server_datetime.py

@@ -3,19 +3,19 @@ from openerp.http import request
 from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
 from pytz import timezone
 from datetime import datetime
+from eiru_logging import make_info_log
 
-'''
-
-'''
+''' Timezone'''
 def get_timezone():
+    make_info_log('GET Timezone')
     return timezone(request.context['tz'])
 
-'''
-'''
+''' Datatime '''
 def get_datetime():
+    make_info_log('GET DateTime')
     return datetime.now(get_timezone()).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
 
-'''
-'''
+''' Date '''
 def get_date():
+    make_info_log('GET Date')
     return datetime.now(get_timezone()).strftime(DEFAULT_SERVER_DATE_FORMAT)

+ 15 - 23
src/App.vue

@@ -5,12 +5,14 @@
             subtitle=''
             color='#7c7bad'
             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(@actionSelected='actionSelected')
+                    statement-step
+                    //- statement-step(@actionSelected='actionSelected')
             // Step Transfer
             template(v-if='!!isTransfer')
                 // Step Transfer 2
@@ -35,7 +37,7 @@
                 tab-content(title='Que ajuste deseas hacer')
                     statement-confirm-step
             // STEP MODIFY STATMENT
-            template
+            template(v-if='!!isStatmentModify')
                 tab-content(title="Que vas a modificar")
                     statement-modify
             // Footer
@@ -94,52 +96,42 @@
             'isInputCashbox',       // Input
             'isOutputCashbox',      // Output
             'isStatmentConfirm',    // codnfirm
-
+            'isStatmentModify',     // Modify
             'selectedActions',
             'selectedStatement',
             'selectedStatementDest',
+            'completed'
         ]),
         methods: {
             goNext() {
                 this.$refs.wizard.nextTab()
-                // if (this.$refs.wizard.activeTabIndex >= 1) {
-                //     this.changeInitialPayment(this.initialPayment)
-                // }
             },
             goBack() {
-                // if (this.$refs.wizard.activeTabIndex === 1 ) {
-                // this.resetStoreModules(this.$refs.wizard.activeTabIndex)
-                // }
                 this.$refs.wizard.prevTab()
             },
-            // actionSelected() {
-                // this.stepChange(0, 1)
-            // },
-            /*
-            stepChange(prev, next) {
-                console.log(prev);
-                console.log(next);
-                // if ((this.$refs.wizard.maxStep === 0) && (this.$refs.wizard.maxStep === this.$refs.wizard.activeTabIndex)){
-                //     this.goNext()
-                //     return false
-                //}
+            checStepsChange(prev, next) {
+                if ((prev === 1) && (next === 0)){
+                    this.resetClick()
+                }
             },
-            */
+
             ...mapActions([
                 'initProcessBank',
+                'resetProcess',
                 'endProcess',
                 'checkStatement',
                 'checkStatementDest',
                 'resetStoreModules',
+                'resetClick',
             ])
         },
         watch: {
-            isCompleted(value) {
+            completed(value) {
                 if (!value) {
                     return
                 }
                 this.$refs.wizard.changeTab(2, 0, false)
-        //         this.resetPurchase()
+                this.resetProcess()
             }
         },
         mounted() {

+ 0 - 138
src/components/common/Cart.vue

@@ -1,138 +0,0 @@
-<template lang="pug">
-    .cart(:style='{ width: defaultOptions.layout.width, height: defaultOptions.layout.height }')
-        .cart-total
-            h2.currency-cart-total {{ total | currency(...defaultOptions.currency) }}
-        .cart-items-wrapper
-            transition-group(name='list' tag='ul' class='cart-items')
-                cart-item(v-for='(item, index) in items' :key='index' :index='index' :item='item' @onClickQuantity='onClickQuantity' @onChange='onItemChanged' @onClickIncrement='onIncrementQty' @onClickDecrement='onDecrementQty' @onClickMoney='onChangePrice' @onClickUndo='onUndoPrice' @onClickDelete='onDeleteItem' :options='defaultOptions.currency')
-</template>
-
-<script>
-    import CartItem from './CartItem'
-
-    export default {
-        components: {
-            CartItem
-        },
-        props: {
-            items: {
-                type: Array,
-                default: [],
-                required: true
-            },
-            options: {
-                type: Object || String,
-                default: null
-            }
-        },
-        methods: {
-            computeOptions(value) {
-                if (!value) {
-                    return
-                }
-
-                for(let key in value) {
-                    if(!this.defaultOptions.currency[key]) {
-                        continue
-                    }
-
-                    this.defaultOptions.currency[key] = value[key]
-                }
-            },
-            computeTotal() {
-                let sum = 0
-
-                for (let item of this.items) {
-                    sum = sum + ((item.price || 0) * (item.quantity || 0))
-                }
-
-                this.total = sum
-
-                this.$emit('onTotalComputed', this.total)
-            },
-            onItemChanged(item) {
-                this.computeTotal();
-            },
-            onIncrementQty(item) {
-                this.$emit('onIncrementQty', item)
-            },
-            onDecrementQty(item) {
-                this.$emit('onDecrementQty', item)
-            },
-            onChangePrice(item) {
-                this.$emit('onChangePrice', item)
-            },
-            onUndoPrice(item) {
-                this.$emit('onUndoPrice', item)
-            },
-            onDeleteItem(item) {
-                this.$emit('onDeleteItem', item)
-            }
-        },
-        watch: {
-            items() {
-                this.computeTotal()
-            },
-            options(value) {
-                this.computeOptions(value)
-            }
-        },
-        data() {
-            return {
-                total: 0,
-                defaultOptions: {
-                    currency: {
-                        symbol: '$',
-                        position: 'before',
-                        thousandsSeparator: '.',
-                        decimalPlaces: 2,
-                        decimalSeparator: ',' 
-                    },
-                    layout: {
-                        width: '300px',
-                        height: '100%'
-                    }
-                }
-            }
-        }
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-    .cart
-        border-left: 1px solid $app-border-color
-        padding-left: 10px
-        display: inline-block
-        vertical-align: top
-        .cart-total
-            width: 100%
-            height: 50px
-            .currency-cart-total
-                width: 100%
-                height: 50px
-                margin: 0
-                font-size: 30pt
-        .cart-items-wrapper
-            width: 100%
-            height: calc(100% - 100px)
-            overflow-y: auto
-            overflow-x: hidden
-            &::-webkit-scrollbar
-                width: 2px
-                background: #f5f5f5
-            &::-webkit-scrollbar-thumb
-                background: #7c7bad
-            &::-webkit-scrollbar-track
-                -webkit-box-shadow: inset 0 0 6px #d3d3d3
-                background: #f5f5f5
-            .cart-items
-                width: 100%
-                padding: 0
-                margin: 0
-            .list-enter-active, .list-leave-active
-                transition: all 0.3s
-            .list-enter, .list-leave-to
-                opacity: 0
-                transform: translateX(300px)
-</style>

+ 0 - 2
src/components/common/index.js

@@ -1,5 +1,4 @@
 import CardGrid from './CardGrid'
-import Cart from './Cart'
 import DropdownSearcher from './DropdownSearcher'
 import InputDropdown from './InputDropdown'
 import InputSelect from './InputSelect'
@@ -13,7 +12,6 @@ import CardGridStatement from './CardGridStatement'
 export {
     CardGrid,
     CardGridStatement,
-    Cart,
     DropdownSearcher,
     InputDropdown,
     InputSelect,

+ 9 - 14
src/components/forms/StatementActionForm.vue

@@ -4,23 +4,16 @@
             h2 Acciones disponibles
             hr
             from.from-display
-                //-.form-separator
-                    h3 Seleccione una opción
-                //- .form-item
-                    //- button.form-action Modificar
-                .form-item( v-if='!!actionTransfer')
+                .form-item(v-if='!!actionModifyStatement')
+                    button.form-action(@click.prevent='clickModify') Modificar
+                .form-item(v-if='!!actionTransfer')
                     button.form-action(@click.prevent='clcikTransfer') Crear transferencia
                 .form-item(v-if ='!!actionInputCashbox')
-                    button.form-action(@click.prevent='clickInputCashbox' @actionSelected='actionSelected') Poner dinero
+                    button.form-action(@click.prevent='clickInputCashbox') Poner dinero
                 .form-item(v-if='!!actionOutputCashbox')
-                    button.form-action(@click.prevent='clickOutputCashbox' @actionSelected='actionSelected') Sacar dinero
+                    button.form-action(@click.prevent='clickOutputCashbox' ) Sacar dinero
                 .form-item(v-if='!!actionStatementConfirm')
-                    button.form-action(@click.prevent='clcikConfig' @actionSelected='actionSelected')  Procesar Cierre
-                //- .form-item
-                //-     button.form-action  Eliminar caja
-                //- .form-item
-                //-     button.form-action  Reabrir Caja
-        //-
+                    button.form-action(@click.prevent='clcikConfig') Procesar Cierre
 </template>
 
 <script>
@@ -38,6 +31,7 @@
                 'clickInputCashbox',
                 'clickOutputCashbox',
                 'clcikConfig',
+                'clickModify',
             ])
         },
         computed: {
@@ -45,7 +39,8 @@
                 'actionTransfer',
                 'actionInputCashbox',
                 'actionOutputCashbox',
-                'actionStatementConfirm'
+                'actionStatementConfirm',
+                'actionModifyStatement'
             ])
         }
     }

+ 1 - 1
src/components/modal/BankStatementModal.vue

@@ -154,7 +154,7 @@
             },
             selectStatementJournal(journal) {
                 this.$emit('onSelectStatementJournal', journal)
-                console.log(this.users);
+                // console.log(this.users);
             },
             selectTypestatement(type) {
                 this.$emit('onSelectStatementType', type)

+ 236 - 0
src/components/modal/StatementLineModal.vue

@@ -0,0 +1,236 @@
+<template lang="pug">
+    modal(
+        name='statement-line-modal',
+        transition='nice-modal-fade'
+        :classes="['v--modal', 'statement-line-modal']"
+        adaptive='true'
+        width='620px'
+        height='auto'
+        @before-close='beforeClose'
+    )
+        form.statement-line-form
+            .form-item
+                label.form-label Fecha de Operacion
+                date-picker.form-date-picker(
+                    input-class='form-date-picker'
+                    lang='es'
+                    format='DD/MM/YYYY'
+                    editable='false'
+                    v-model='dateOperation'
+                )
+                //-:not-before="new Date()"
+            .form-item
+                label.form-label Cliente / Proveedor
+                input.form-input
+            .form-item
+                label.form-label Valor de la operación
+                input-dropdown.form-input(
+                    format="number"
+                    :value='this.update.amount'
+                    :currency='currencyStatement'
+                    :suffix="currencyStatement.symbol"
+                    @onChangeValue="onChangeValue"
+                )
+            .form-item-textarea
+                label.form-label Comunicación
+                textarea.form-textarea(
+                    v-model='name'
+                )
+            .form-item-textarea
+                label.form-label Referencia
+                textarea.form-textarea(
+                    v-model='referen'
+                )
+            .form-actions
+                button.form-action() Aceptar
+                button.form-action(@click.prevent="onCancel") Cancelar
+</template>
+
+<script>
+    import DatePicker from 'vue2-datepicker'
+    import {InputDropdown } from '../common'
+
+
+    export default {
+        components: {
+            DatePicker,
+            InputDropdown
+        },
+        props: {
+            show: {
+                type: Boolean,
+                default: false
+            },
+            line: {
+                type: Object,
+                default: {
+                    amount: 0,
+                    date: '',
+                    id: null,
+                    isDelete: false,
+                    isUpdate: false,
+                    name: '',
+                    partnerId: '',
+                    partnerName: '',
+                    ref:'',
+                }
+            },
+            currencyStatement: {
+                type: Object,
+                default: {}
+            },
+        },
+        watch: {
+            show(value) {
+                if (!value){
+                    this.$modal.hide('statement-line-modal')
+                    return
+                }
+                this.$modal.show('statement-line-modal')
+                this.setLineUpdate(this.line)
+            }
+        },
+        computed: {
+            dateOperation: {
+                get() {
+                    return moment(this.update.date).format('DD/MM/YYYY')
+                },
+                set(value) {
+                    this.update.date = moment(value).format('YYYY/MM/DD')
+                }
+            },
+            name: {
+                get() {
+                    return this.update.name
+                },
+                set(value) {
+                    this.update.name = value.trim()
+                }
+            },
+            referen: {
+                get() {
+                    return this.update.ref
+                },
+                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
+                this.update.isDelete = value.isDelete
+                this.update.isUpdate = value.isUpdate
+                this.update.name = value.name
+                this.update.partnerId = value.partnerId
+                this.update.partnerName = value.partnerName
+                this.update.ref = value.ref
+            },
+            onChangeValue(value) {
+                this.update.amount = value
+            },
+            beforeClose(e) {
+                if (this.show) {
+                    e.stop()
+                }
+            },
+            onCancel() {
+                this.$emit('onCancel')
+            },
+        },
+        data() {
+            return {
+                update: {
+                    amount: 0,
+                    date: null,
+                    id: null,
+                    isDelete: false,
+                    isUpdate: false,
+                    name: null,
+                    partnerId: null,
+                    partnerName: null,
+                    ref:null,
+                }
+            }
+        },
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+
+    .statement-line-modal
+        padding: 0 !important
+        &::before
+            content: ''
+            display: block
+            position: absolute
+            background-size: cover
+            filter: blur(3px)
+            z-index: -1
+        .statement-line-form
+            width: 100%
+            margin-top: 10px
+            .form-item
+                width: calc(100% - 20px)
+                height: 40px
+                margin-left: 10px
+                margin-right: 10px
+                margin-bottom: 10px
+                .form-label
+                    width: 200px
+                    height: 45px
+                    font-size: 12pt
+                    text-align: right
+                    line-height: 40px
+                    padding-right: 15px
+                    float: left
+                .form-input
+                    width: 400px
+                    height: 40px
+                    font-size: 12pt
+                    color: #4c4c4c
+                    float: right
+                .form-date-picker
+                    width: 250px
+                    height: 40px
+                    font-size: 12pt
+                    color: #4c4c4c
+            .form-item-textarea
+                width: calc(100% - 20px)
+                height: 120px
+                margin-bottom: 10px
+                margin-left: 10px
+                margin-right: 10px
+                .form-label
+                    width: 200px
+                    height: 120px
+                    font-size: 12pt
+                    text-align: right
+                    line-height: 120px
+                    padding-right: 15px
+                    float: left
+                .form-textarea
+                    width: 400px
+                    height: 120px
+                    font-size: 12pt
+                    color: #4c4c4c
+            .form-actions
+                float: right
+                margin-bottom: 10px
+                .form-action
+                    width: 150px
+                    height: 40px
+                    border: none
+                    box-shadow: none
+                    border-radius: 0
+                    margin-right: 5px
+                    background: $app-main-color
+                    color: $app-bg-color
+</style>

+ 18 - 193
src/components/steps/CardGridItem.vue

@@ -1,39 +1,34 @@
 <template lang="pug">
     .card-grid-item
-        .card-grid-wrapper-header
-            card-item(
-                date='Fecha'
-                name='Comunicacion'
-                reference="Referencia"
-                partnerName="Socio"
-                amount="Importe"
-            )
-        .card-grid-wrapper-line
-            card-item(
-                v-for='item in items'
-                :date='item.date'
-                :name='item.name'
-                :reference='item.ref'
-                :partnerName= 'item.patner.displayName'
-                :amount='item.amount'
-            )
+        card-item(
+            :items='items'
+            @onClickUpdate='onClickUpdate'
+            @onClickDeleted='onClickDeleted'
+        )
 </template>
 
 <script>
     import CardItem from '@/components/steps/CardItem'
-
     export default {
         props: {
             items: {
-                type: Array,
+                type: [],
                 default: []
-            },
+            }
         },
         components: {
             CardItem
         },
-
+        methods: {
+            onClickUpdate(value) {
+                this.$emit('onClickUpdate', value)
+            },
+            onClickDeleted(value, state) {
+                this.$emit('onClickDeleted', value, state)
+            }
+        }
     }
+
 </script>
 
 <style lang="sass">
@@ -42,7 +37,8 @@
     .card-grid-item
         width: calc(100% - 10px)
         height: calc(100% - 10px)
-        margin: 5px
+        // margin: 5px
+        margin: 0px
         text-align: center
         .card-grid-wrapper-header
             width: 100%
@@ -74,174 +70,3 @@
                     color: #9e9e9e
                     font-size: 11pt
 </style>
-
-
-<!--
-<template lang="pug">
-    .card-grid-wrapper-statement
-        .card-grid
-            add-card(
-                v-if='canAdd'
-                @onClickAdd='onClickAdd'
-            )
-            card(
-                v-for='item in items'
-                :key='item.id'
-                :title='item.name'
-                :date='item.date'
-                :journalName='item.journal.displayName'
-                :typeStatement='item.typeStatement.name'
-                :countLine='item.line.length'
-                :state='item.state'
-                :isSelected='item.id === selectedId'
-                :details='computeDetails(item)'
-                :options='item.currency'
-                @onClick='onClickCard(item)'
-            )
-        .no-items(v-show='!items || items.length == 0')
-            p No hay items
-</template>
-
-<script>
-    import AddCard from '@/components/common/AddCard'
-    import Card from '@/components/common/CardStatement'
-
-    export default {
-        props: {
-            items: {
-                type: Array,
-                default: []
-            },
-            canAdd: {
-                type: Boolean,
-                default: false
-            },
-            details: {
-                type: Array,
-                default: []
-            },
-            loading: {
-                type: Boolean,
-                default: false
-            },
-            options: {
-                type: Object,
-                default: {}
-            }
-        },
-        components: {
-            AddCard,
-            Card
-        },
-        watch: {
-            options(value) {
-                this.computeOptions(value)
-            }
-        },
-        methods: {
-            computeDetails(item) {
-                if (!this.details) {
-                    return []
-                }
-
-                if (this.details.length === 0) {
-                    return []
-                }
-
-                let results = []
-                let computableDetails = this.details.map(item => item.split(/:/))
-
-                for (let detail of computableDetails) {
-                    for (let field in item) {
-                        if (field === detail[0]) {
-                            results.push({
-                                value: item[field],
-                                format: (() => {
-                                    if (!detail[1] || detail[1] === 's') {
-                                        return 'string'
-                                    }
-
-                                    if (detail[1] === 'c') {
-                                        return 'currency'
-                                    }
-
-                                    if (detail[1] === 'd') {
-                                        return 'date'
-                                    }
-
-                                    return 'string'
-                                })()
-                            })
-
-                            break
-                        }
-                    }
-                }
-                return results
-            },
-            computeOptions(value) {
-                if (!value) {
-                    return
-                }
-
-                for(let key in value) {
-                    if(!this.defaultOptions.currency[key]) {
-                        continue
-                    }
-
-                    this.defaultOptions.currency[key] = value[key]
-                }
-            },
-            onClickAdd() {
-                this.$emit('onAdd')
-            },
-            onClickCard(item) {
-                this.selectedId = item.id
-                this.$emit('onSelect', item)
-            }
-        },
-        data() {
-            return {
-                selectedId: -1,
-                defaultOptions: {
-                    currency: {
-                        symbol: '$',
-                        position: 'before',
-                        thousandsSeparator: '.',
-                        decimalPlaces: 2,
-                        decimalSeparator: ','
-                    },
-                }
-            }
-        }
-    }
-</script>
-
-<style lang="sass">
-    .card-grid-wrapper-statement
-        width: 100%
-        height: calc(100% - 50px)
-        margin-top: 10px
-        overflow-y: auto
-        &::-webkit-scrollbar
-            width: 2px
-            background: #f5f5f5
-        &::-webkit-scrollbar-thumb
-            background: #7c7bad
-        &::-webkit-scrollbar-track
-            -webkit-box-shadow: inset 0 0 6px #d3d3d3
-            background: #f5f5f5
-        .card-grid
-            width: 100%
-        .no-items
-            width: 100%
-            height: 100%
-            display: flex
-            align-items: center
-            justify-content: center
-            p
-                color: #9e9e9e
-                font-size: 11pt
-</style>
-
--->

+ 365 - 172
src/components/steps/CardItem.vue

@@ -1,4 +1,367 @@
 <template lang="pug">
+    .table-statement
+        .table-statement-header
+            table
+                tbody
+                    tr
+                        td Fecha
+                        td Comunicación
+                        td Referencia
+                        td Socio
+                        td Importe
+                        td Operación
+                        td id
+        .table-statement-body
+            table
+                tbody
+                    tr(v-for='item in items' :class="{'is-deleted-line': item.isDelete}")
+                        td {{ item.date }}
+                        td {{ item.name }}
+                        td {{ item.ref }}
+                        td {{ item.partnerName }}
+                        td {{ item.amount }}
+                        td
+                            .line-options-wrapper
+                                .line-options
+                                    .line-option(
+                                        v-if="!item.isDelete"
+                                        class='fa fa-pencil'
+                                        @click="onClickUpdate(item.id)"
+                                    )
+                                    .line-option(
+                                        v-if='!item.isUpdate'
+                                        class='fa fa-trash'
+                                        @click="onClickDeleted(item.id, true)"
+                                    )
+                                    .line-option(
+                                        v-if='item.isDelete'
+                                        class='fa fa-times'
+                                        @click="onClickDeleted(item.id, false)"
+                                    )
+                        td {{ item.id }}
+</template>
+
+<script>
+    export default {
+        props: {
+            items: {
+                type: [],
+                default: []
+            }
+        },
+        methods: {
+            onClickUpdate(item) {
+                this.$emit('onClickUpdate', item)
+            },
+            onClickDeleted(item, state) {
+                this.$emit('onClickDeleted', item, state)
+            }
+        }
+    }
+</script>
+
+<style lang="sass">
+    @import '../../assets/variables'
+    .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
+                tbody
+                    tr
+                        line-height: 30px
+                        border-top: 1px solid $app-border-color
+                        border-bottom: 1px solid $app-border-color
+                        td
+                            &:nth-child(1)
+                                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
+            width: 100%
+            height: 245px
+            overflow-y: auto
+            table
+                width: calc(100% - 20px)
+                // height: 35px
+                margin: 0 10px
+                font-size: 9pt
+                // font-weight: bolder
+                tbody
+                    tr
+                        height: 28px
+                        line-height: 30px
+                        border-bottom: 1px solid $app-border-color
+                        &.is-deleted-line
+                            color: #f44336
+                        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
+                                text-align: left
+                                .line-options-wrapper
+                                    width: 100%
+                                    height: 30px
+                                    // position: absolute
+                                    bottom: 0
+                                    display: flex
+                                    justify-content: center
+                                    .line-options
+                                        width: 50px
+                                        height: 20px
+                                        border: 1px solid #d3d3d3
+                                        // border-bottom: none
+                                        display: flex
+                                        margin: 5px 0px
+                                        justify-content: center
+                                        .line-option
+                                            width: 18px
+                                            height: 18px
+                                            margin: 0 5px
+                                            color: #666
+                                            &:hover
+                                                cursor: pointer
+                                            &.fa
+                                                padding-left: 2px
+                                                line-height: 20px
+                                                &.fa-pencil:hover
+                                                    color: #2196f3
+                                                &.fa-trash:hover
+                                                    color: #f44336
+                            &: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 }}
@@ -8,7 +371,7 @@
 </template>
 
 <script>
-    import DatePicker from 'vue2-datepicker'
+    // import DatePicker from 'vue2-datepicker'
 
     export default {
         props:{
@@ -105,175 +468,5 @@
             padding-top: 8px
             margin-right: 5px
             padding-left: 10px
-            // text-align: center
-            // background: cyan
 
-</style>
-<!--
-<template lang="pug">
-    .card-statement(
-        @click='onClick'
-        :class="{ 'selected-card': isSelected }"
-    )
-        .card-date {{ date }}
-        .card-title {{ title }}
-        .card-journal {{ journalName }}
-        .card-type {{ typeStatement }}
-        .card-count-intem Lineas({{ countLine}})
-        .card-amount(:class="{'statement-confirm': !!(state === 'confirm')}")
-            span(v-for='detail in details') {{ computeDetail(detail) }}
-</template>
-
-<script>
-    export default {
-        props: {
-            title: {
-                type: String,
-                default: 'Sin título'
-            },
-            date: {
-                type: Date,
-                default: ''
-            },
-            state: {
-                type: String,
-                default:'open'
-            },
-            journalName: {
-                type: String,
-                default: ''
-            },
-            typeStatement: {
-                type: String,
-                default: ''
-            },
-            countLine: {
-                type: String,
-                default: 0
-            },
-            details: {
-                type: Array,
-                default: []
-            },
-            isSelected: {
-                type: Boolean,
-                default: true
-            },
-            options: {
-                type: Object,
-                default: {}
-            }
-        },
-        methods: {
-            computeDetail(detail) {
-                if (detail.format === 'currency') {
-                    return this.$options.filters.currency(detail.value, {...this.options})
-                }
-
-                return detail.value
-            },
-            onClick() {
-                this.$emit('onClick')
-            }
-        }
-    }
-</script>
-
-<style lang="sass">
-    @import '../../assets/variables'
-
-    .card-statement
-        width: 180px
-        height: 130px
-        margin: 5px
-        border: 1px solid $app-border-color
-        display: inline-block
-        position: relative
-        &.selected-card
-            transition-duration: 300ms
-            border: 2px solid $app-main-color
-        &:hover
-            cursor: pointer
-        .card-date
-            width: 100%
-            height: 30px
-            position: absolute
-            font-size: 9pt
-            margin-top: 10px
-            padding-right: 10px
-            text-align: right
-            font-weight: normal
-            top: 0
-
-        .card-title
-            width: 100%
-            height: 30px
-            position: absolute
-            font-size: 9pt
-            font-weight: bold
-            margin-top: 30px
-            text-align: center
-            padding-right: 5px
-            padding-left: 5px
-            top: 0
-
-        .card-journal
-            width: 100%
-            height: 30px
-            position: absolute
-            margin-top: 50px
-            font-size: 9pt
-            float: right
-            padding-right: 5px
-            padding-left: 5px
-            text-align: center
-            font-weight: normal
-            top: 0
-
-        .card-type
-            width: 50%
-            height: 30px
-            margin-top: 70px
-            font-size: 9pt
-            float: left
-            padding-left: 5px
-            text-align: center
-            font-weight: normal
-            top: 0
-
-        .card-count-intem
-            width: 50%
-            height: 30px
-            margin-top: 70px
-            font-size: 9pt
-            text-align: center
-            float: right
-            padding-right: 5px
-            font-weight: normal
-            top: 0
-
-        .card-amount
-            width: 100%
-            height: 30px
-            padding-top: 5px
-            text-align: center
-            font-weight: bold
-            font-size: 10pt
-            position: absolute
-            background: $app-main-color
-            color: $app-bg-color
-            margin-bottom: 0px
-            bottom: 0
-        .statement-confirm
-            background: #ccc
-
-        @keyframes card-bubble
-            30%
-                transform: scaleX(0.75) scaleY(1.25)
-            40%
-                transform: scaleX(1.25) scaleY(0.75)
-            60%
-                transform: scaleX(0.85) scaleY(1.15)
-</style>
-
--->
+</style>  -->

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

@@ -16,27 +16,59 @@
                     input.form-input(readonly='readonly' v-model='getUserSelectedStatement')
         .details-items-line
             card-grid-item(
-                :items='selectedStatement.line'
+                :items='statementLines'
+                @onClickUpdate='clickUpdate'
+                @onClickDeleted='clickDeleted'
             )
+        statement-line-modal(
+            :show='showStatementLine'
+            :line='lineSelected'
+            :currencyStatement='currencyStatement'
+            @onCancel='onCancel'
+        )
 </template>
 
 <script>
     import { mapGetters, mapActions } from 'vuex'
     import {SwitchButtonInput, InputDropdown } from '../common'
     import CardGridItem from '@/components/steps/CardGridItem'
+    import StatementLineModal from '../modal/StatementLineModal'
 
     export default {
-
         components: {
             SwitchButtonInput,
             InputDropdown,
-            CardGridItem
+            CardGridItem,
+            StatementLineModal,
+        },
+        methods: {
+            clickUpdate(value) {
+                // console.log(value);
+                this.selectLineSelected(value)
+                this.showStatementLineModify(true)
+            },
+            clickDeleted(value, state) {
+                this.addDeletedLine({'id':value, 'state': state})
+            },
+            onCancel(){
+                this.showStatementLineModify(false)
+            },
+            ...mapActions([
+                'addDeletedLine',
+                'addUpdateLine',
+                'showStatementLineModify',
+                'selectLineSelected',
+            ])
         },
         computed: mapGetters([
             'selectedStatement',
             'getJournalSelectedStatement',
             'getTypeSelectedStatement',
             'getUserSelectedStatement',
+            'statementLines',
+            'showStatementLine',
+            'lineSelected',
+            'currencyStatement',
         ]),
     }
 </script>

+ 4 - 0
src/index.js

@@ -6,10 +6,14 @@ import store from '@/store'
 import currency from '@/components/filters/currency'
 import absolute from '@/components/filters/absolute'
 
+// import Datatable from 'vue2-datatable-component'
+
+
 Vue.filter('currency', currency)
 Vue.filter('absolute', absolute)
 
 Vue.use(VueModal)
+// Vue.use(Datatable)
 
 Vue.config.productionTip = false
 Vue.config.silent = true

+ 22 - 28
src/store/actions.js

@@ -7,7 +7,7 @@ const actions = {
     },
     initProcessBank({ getters, commit, dispatch}, mode) {
         commit('setMode', mode || getters.mode)
-
+        commit('setCompleted', false)
         return axios.get('/eiru_bank_statement/init', {
             params: {
                 mode: getters.mode
@@ -43,7 +43,6 @@ const actions = {
     endProcess({getters, commit, dispatch}) {
         let data = {}
         if (getters.isTransfer || getters.isInputCashbox || getters.isOutputCashbox) {
-            console.log("Transferencia, entrada o Salida")
             /* Verift Amount Operation */
             if (getters.amountOperation <= 0) {
                 dispatch('notify', 'El valor de la operación debe ser mayor que “0”.')
@@ -66,9 +65,9 @@ const actions = {
             }
             commit('setDataEndProcess', data)
             dispatch('createCasboxMove')
+            commit('setCompleted', true)
         }
         if (getters.isStatmentConfirm) {
-            console.log("CIERRE ")
 
             let data = {}
             if (!getters.description.trim()) {
@@ -83,6 +82,7 @@ const actions = {
             }
             commit('setDataEndProcess', data)
             dispatch('processClosingStatement')
+            commit('setCompleted', true)
         }
     },
 
@@ -100,7 +100,8 @@ const actions = {
                 data: getters.data
             }
         }).then(({data}) => {
-            // dispatch('notify', data.result.message)
+            dispatch('notify', data.result.message)
+            commit('setCompleted', true)
         }).catch(error => {
             console.error(error)
         })
@@ -118,8 +119,6 @@ const actions = {
             console.error(error)
         })
     },
-
-
     /*
        ____ ____  _____    _  _____ _____   ____ _____  _  _____ _____ __  __ _____ _   _ _____
       / ___|  _ \| ____|  / \|_   _| ____| / ___|_   _|/ \|_   _| ____|  \/  | ____| \ | |_   _|
@@ -127,7 +126,7 @@ const actions = {
      | |___|  _ <| |___ / ___ \| | | |___   ___) || |/ ___ \| | | |___| |  | | |___| |\  | | |
       \____|_| \_\_____/_/   \_\_| |_____| |____/ |_/_/   \_\_| |_____|_|  |_|_____|_| \_| |_|
      */
-    endProcessNewStatement({getters, commit, dispatch}){
+    endProcessNewStatement({getters, commit, dispatch}) {
         let data = {}
 
         data = {
@@ -157,28 +156,23 @@ const actions = {
             console.error(error)
         })
     },
+    // Reset
+    resetProcess({ rootState, dispatch }) {
+        for(let key in rootState) {
+            if (!(rootState[key] instanceof Object)) {
+                continue
+            }
 
-    resetStoreModules({ dispatch }, payload) {
-        // console.log(payload)
-        // console.log(
-        //     !!getters.isInputCashbox
-        //     !!getters.isOutputCashbox
-        // )
-        // if (!!getters.isInputCashbox || !!getters.isOutputCashbox && payload === 1) {
-        //
-        // }
-        // if (payload > 1 ){
-            // return
-        // }
-        // dispatch('resetStatementAction')
-        // dispatch('resetStatement')
-        // isTransfer
-        // isInputCashbox
-        // isOutputCashbox
+            key = key.replace('Module', '')
 
-        // resetStatement
-        // resetStatementAction
-        return
-    }
+            if (key === 'data') {
+                continue
+            }
+            dispatch(`reset${key[0].toUpperCase()}${key.slice(1)}`)
+        }
+
+        dispatch('initProcessBank')
+
+    },
 }
 export default actions

+ 3 - 1
src/store/getters.js

@@ -5,7 +5,9 @@ const getters = {
     data(state) {
         return state.data;
     },
-
+    completed(state) {
+        return state.completed
+    },
     // selectedActions(state) {
     //     return false;
     // }

+ 4 - 0
src/store/index.js

@@ -17,6 +17,8 @@ import statementTypeModule from '@/store/modules/statementType'
 import resUsersModule from '@/store/modules/resUsers'
 //Actions Statement
 import statementAction from '@/store/modules/statementAction'
+import statementLine from '@/store/modules/statementLine'
+import resPartners from '@/store/modules/resPartners'
 
 /* Module */
 Vue.use(Vuex)
@@ -36,6 +38,8 @@ const store = new Vuex.Store({
         statementTypeModule,
         resUsersModule,
         statementAction,
+        statementLine,
+        resPartners
     },
     strict: true
 })

+ 5 - 5
src/store/modules/currencies.js

@@ -2,12 +2,10 @@ const initialState = {
     currencies: null,
     loadingCurrencies: false
 }
-
 const state = {
     currencies: initialState.currencies,
     loadingCurrencies: initialState.loadingCurrencies
 }
-
 const getters = {
     currencies(state) {
         return state.currencies;
@@ -16,7 +14,6 @@ const getters = {
         return state.loadingCurrencies;
     }
 }
-
 const mutations = {
     setCurrencies(state, payload) {
         state.currencies = payload
@@ -25,14 +22,17 @@ const mutations = {
         state.loadingCurrencies = !!payload
     }
 }
-
 const actions = {
     initCurrencies({ commit }, payload) {
         commit('setCurrencies', payload)
         commit('setLoadingCurrencies', payload)
+    },
+    resetCurrencies({ commit }){
+        commit('setCurrencies', null)
+        commit('setLoadingCurrencies', false)
     }
-}
 
+}
 export default {
     state,
     getters,

+ 1 - 7
src/store/modules/date.js

@@ -3,13 +3,11 @@ const initialState = {
     loadingDate: false,
     dateStatement: '',
 }
-
 const state = {
     date: initialState.date,
     loadingDate: initialState.loadingDate,
     dateStatement: initialState.dateStatement
 }
-
 const getters = {
     date(state) {
         return state.date
@@ -18,11 +16,9 @@ const getters = {
         return state.loadingDate
     },
     dateStatement(state) {
-        console.log(state.dateStatement);
         return !state.dateStatement ?moment(state.date).format('DD/MM/YYYY') :state.dateStatement
     },
 }
-
 const mutations = {
     setDate(state, payload) {
         state.date = payload
@@ -31,11 +27,9 @@ const mutations = {
         state.loadingDate = !!loading
     },
     setDateStatement(state, payload) {
-        console.log(payload);
         state.dateStatement = moment(payload).format('DD/MM/YYYY')
     },
 }
-
 const actions = {
     initDate({ commit }, payload) {
         commit('setDate',payload)
@@ -44,12 +38,12 @@ const actions = {
     resetDate({ getters, commit }) {
         commit('setLoadingDate', true)
         commit('setDate',null)
+        commit('setDateStatement', '')
     },
     dateNewStatement({ commit }, payload) {
         commit('setDateStatement', payload)
     }
 }
-
 export default {
     state,
     getters,

+ 11 - 13
src/store/modules/journals.js

@@ -1,18 +1,15 @@
-const initialState ={
+const initialState = {
     journals: null,
     loadingJournals: false,
     selectedJournal: null,
     selectedJournalName: '',
-
 }
-
 const state = {
     journals : initialState.journals,
     loadingJournals: initialState.loadingJournals,
     selectedJournal: initialState.selectedJournal,
     selectedJournalName: initialState.selectedJournalName
 }
-
 const getters = {
     journals(state) {
         return state.journals
@@ -23,11 +20,10 @@ const getters = {
     selectedJournal(state) {
         return state.selectedJournal
     },
-    selectedJournalName(state){
+    selectedJournalName(state) {
         return state.selectedJournalName
     }
 }
-
 const mutations = {
     setJournals(state, payload) {
         state.journals = payload
@@ -36,12 +32,10 @@ const mutations = {
         state.loadingJournals = !!payload
     },
     setSelectedJournal(state, payload) {
-        state.selectedJournal = payload.id
-        state.selectedJournalName = payload.name
-
+        state.selectedJournal = !!payload ?payload.id : null
+        state.selectedJournalName = !!payload ?payload.name :''
     }
 }
-
 const actions = {
     initJournals({ commit }, payload) {
         commit('setJournals', payload)
@@ -50,11 +44,15 @@ const actions = {
     /* Seleccionar Diario */
     selectJournal({ commit , dispatch}, payload) {
         commit('setSelectedJournal', payload)
-
         dispatch('filterUserJournalSelected', payload)
-    }
-}
+    },
+    resetJournals({ commit }){
+        commit('setJournals', null)
+        commit('setLoadingJournals', false)
+        commit('setSelectedJournal', null)
+    },
 
+}
 export default {
     state,
     getters,

+ 30 - 0
src/store/modules/resPartners.js

@@ -0,0 +1,30 @@
+const initialState = {
+    resPartners: []
+}
+const state = {
+    resPartners: initialState.resPartners
+}
+const getters = {
+    resPartners(state){
+        return state.resPartners
+    }
+}
+const mutations = {
+    setResPartners(state, payload){
+        state.resPartners = payload
+    }
+}
+const actions = {
+    initResPartners({commit}, payload){
+        commit('setResPartners', payload)
+    },
+    resetResPartners({ commit }) {
+        commit('setResPartners', [])
+    }
+}
+export default {
+    state,
+    getters,
+    mutations,
+    actions
+}

+ 14 - 8
src/store/modules/resUsers.js

@@ -1,4 +1,4 @@
-const initialState ={
+const initialState = {
     resUsers: [],
     selectedUserStatement: null,
     selectedUserName: '',
@@ -10,7 +10,6 @@ const state = {
     visibleUser: initialState.visibleUser,
     selectedUserName: initialState.selectedUserName,
 }
-
 const getters = {
     resUsers(state) {
         return state.resUsers
@@ -25,17 +24,20 @@ const getters = {
         return state.selectedUserName
     }
 }
-
 const mutations = {
     setResUsers(state, payload) {
         state.resUsers = payload
     },
     setSelectedUserStatement(state, payload) {
-        state.selectedUserStatement = payload.id
-        state.selectedUserName = payload.name
+
+        state.selectedUserStatement = !payload ?null :payload.id
+        state.selectedUserName = !payload ?'' :payload.name
     },
     setUserJournalSelected(state, payload) {
         let userFilter = []
+        if (!payload){
+            return
+        }
         for (let store of payload.storeIds ){
             for(let user of state.resUsers) {
                 if (!!user.storeIds.find(item => item === store)) {
@@ -53,7 +55,6 @@ const mutations = {
         state.visibleUser = userFilter
     }
 }
-
 const actions = {
     initResUsers({ commit }, payload){
         commit('setResUsers', payload)
@@ -63,9 +64,14 @@ const actions = {
     },
     filterUserJournalSelected({ commit }, payload) {
         commit('setUserJournalSelected', payload)
-    }
-}
+    },
+    resetResUsers({ commit }) {
+        commit('setResUsers', [])
+        commit('setSelectedUserStatement', null)
+        commit('setUserJournalSelected', null)
 
+    },
+}
 export default {
     state,
     getters,

+ 33 - 11
src/store/modules/statement.js

@@ -10,7 +10,6 @@ const initialState = {
     filteredStatementDest: [],
     selectedStatementDest: null,
 }
-
 const state = {
     statements: initialState.statements,
     filteredStatements: initialState.filteredStatements,
@@ -23,7 +22,6 @@ const state = {
     filteredStatementDest: initialState.filteredStatementDest,
     selectedStatementDest: initialState.selectedStatementDest
 }
-
 const getters = {
     statements(state) {
         return  state.statements
@@ -96,9 +94,15 @@ const mutations = {
         state.selectedStatementDest = payload
     },
     setCurrencyStatement(state, payload) {
+        if (!payload){
+            state.currencyStatement = null
+        }
         state.currencyStatement = payload.currency
     },
     setStatementsDest(state, payload) {
+        // if (!payload.length){
+        //     state.statementsDest = []
+        // }
         state.statementsDest = state.statements.filter(item => item.id !== state.selectedStatement.id && item.journal.id === state.selectedStatement.journal.id && item.state === 'open')
     },
     setFilteredStatementsDest(state, payload) {
@@ -115,45 +119,63 @@ const actions = {
         commit('setLoadingStatements', payload)
     },
     /* Filter */
-    filteredStatements( {commit}, payload){
+    filteredStatements( {commit}, payload) {
         commit('setFilteredStatements', payload)
     },
-    filteredStatementsDest( {commit}, payload){
+    filteredStatementsDest( {commit}, payload) {
         commit('setFilteredStatementsDest', payload)
     },
     showStatementAdd({ commit }, payload) {
         commit('setShowStatement', payload)
     },
-
     /* Selected */
     selectedStatements({ dispatch, commit }, payload) {
         commit('setSelectedStatement', payload)
         commit('setCurrencyStatement', payload)
-        commit('setStatementsDest', payload)
-
-        // commit('setFilteredStatements', [])
+        // commit('setStatementsDest', payload)
 
+        // dispatch('initLines', payload.line)
         dispatch('verifyActionCashbox', payload)
     },
+    filteredStatementsDest({ commit, getters }){
+        commit('setStatementsDest', getters.selectedStatement)
+    },
     selectStatementsDest( { commit },payload){
         commit('setSelectedStatementDest', payload)
     },
     /* Resetar */
     resetStatement({ commit }) {
+        commit('setStatements', [])
         commit('setLoadingStatements', false)
         commit('setFilteredStatements', [])
         commit('setSelectedStatement', null)
-        // commit('setStatementsDest')
+
+        commit('setStatementsDest')
         commit('setFilteredStatementsDest', [])
         commit('setSelectedStatementDest', null)
-    },
 
+        commit('setShowStatement', false)
+        // loadingStatements: false,
+        // filteredStatements: [],
+        // selectedStatement: null,
+        // statements: [],
+        // currencyStatement: null,
+        // showStatement: false,
+        /* transfer */
+        // statementsDest : [],
+        // filteredStatementDest: [],
+        // selectedStatementDest: null,
+    },
+    resetStatemntDest({ commit }) {
+        commit('setStatementsDest',[])
+        commit('setFilteredStatementsDest', [])
+        commit('setSelectedStatementDest', null)
+    },
     receiveStatment({ commit }, payload) {
         commit('addStatment', payload)
         commit('setLoadingStatements', false)
 
     },
-
 }
 
 export default {

+ 50 - 18
src/store/modules/statementAction.js

@@ -3,11 +3,10 @@ const initialState = {
     isInputCashbox: false,
     isOutputCashbox: false,
     isStatmentConfirm: false,
+    isStatmentModify: false,
     amountOperation: 0,
     description: '',
-    // operationTitle: ''
 }
-
 const state = {
     isTransfer: initialState.isTransfer,
     isInputCashbox: initialState.isInputCashbox,
@@ -15,10 +14,9 @@ const state = {
     isStatmentConfirm: initialState.isStatmentConfirm,
     amountOperation: initialState.amountOperation,
     description: initialState.description,
-    // operationTitle: initialState.operationTitle
+    isStatmentModify: initialState.isStatmentModify,
 }
-
-const getters ={
+const getters = {
     isTransfer(state) {
         return state.isTransfer;
     },
@@ -31,10 +29,12 @@ const getters ={
     isStatmentConfirm(state) {
         return state.isStatmentConfirm
     },
+    isStatmentModify(state) {
+        return state.isStatmentModify
+    },
     amountOperation(state) {
         return state.amountOperation
     },
-
     description(state) {
         return state.description
     },
@@ -50,25 +50,25 @@ const getters ={
         }
         if (state.isStatmentConfirm) {
             return 'Cierre de Caja'
-
         }
     }
 }
-
 const mutations = {
     setTransfer(state, payload) {
-        state.isTransfer = !!payload
+        state.isTransfer = payload
     },
     setInputCashbox(state, payload) {
-        state.isInputCashbox = !!payload
+        state.isInputCashbox = payload
     },
     setOutputCashbox(state, payload) {
-        state.isOutputCashbox = !!payload
+        state.isOutputCashbox = payload
     },
     setStatmentConfirm( state, payload) {
-        state.isStatmentConfirm = !!payload
+        state.isStatmentConfirm = payload
+    },
+    setStatmentModify(state, payload) {
+        state.isStatmentModify = payload
     },
-
     /* amountOperation */
     setAmountOperation(state, payload) {
         state.amountOperation = payload
@@ -79,49 +79,81 @@ const mutations = {
 }
 
 const actions = {
-    clcikTransfer({ commit }, payload) {
+    /* Transferencia */
+    clcikTransfer({ commit, dispatch }, payload) {
         commit('setTransfer', payload)
         commit('setInputCashbox', false)
         commit('setOutputCashbox', false)
         commit('setStatmentConfirm', false)
+        commit('setStatmentModify', false)
+        dispatch('filteredStatementsDest')
     },
+    /* Input */
     clickInputCashbox({ commit }, payload) {
         commit('setTransfer', false)
         commit('setInputCashbox', payload)
         commit('setOutputCashbox', false)
         commit('setStatmentConfirm', false)
+        commit('setStatmentModify', false)
     },
+    /* Output */
     clickOutputCashbox({ commit }, payload) {
         commit('setTransfer', false)
         commit('setInputCashbox', false)
         commit('setOutputCashbox', payload)
         commit('setStatmentConfirm', false)
+        commit('setStatmentModify', false)
     },
+    /* Config */
     clcikConfig({ commit, dispatch, getters },payload) {
         commit('setStatmentConfirm', payload)
         commit('setTransfer', false)
         commit('setInputCashbox', false)
         commit('setOutputCashbox', false)
+        commit('setStatmentModify', false)
         /* Change amount operation */
         dispatch('changeAmountOperation',getters.amountStatementOrigin)
     },
+    /* Write */
+    clickModify({ commit, dispatch }, payload) {
+        commit('setStatmentModify', payload)
+        commit('setTransfer', false)
+        commit('setInputCashbox', false)
+        commit('setOutputCashbox', false)
+        commit('setStatmentConfirm', false)
+        dispatch('initLines')
+    },
+    /* Reset Steps*/
+    resetClick({ commit, dispatch }) {
+        commit('setStatmentModify', false)
+        commit('setTransfer', false)
+        commit('setInputCashbox', false)
+        commit('setOutputCashbox', false)
+        commit('setStatmentConfirm', false)
+        dispatch('resetLines')
+        dispatch('resetStatemntDest')
+    },
     /* AmountOperation */
     changeAmountOperation({ commit }, payload) {
         commit('setAmountOperation', payload)
     },
-
     /* Description */
     changeDescriptionOperation({ commit }, payload){
         commit('setDescription', payload)
     },
-
-    resetStatementAction({ commit }) {
+    resetStatementAction({ commit, dispatch }) {
+        // dispatch('resetClick')
+        commit('setStatmentModify', false)
         commit('setTransfer', false)
+
         commit('setInputCashbox', false)
         commit('setOutputCashbox', false)
+        commit('setStatmentConfirm', false)
+        dispatch('resetLines')
+        dispatch('resetStatemntDest')
         commit('setAmountOperation', 0)
         commit('setDescription', '')
-    }
+    },
 }
 
 export default {

+ 45 - 77
src/store/modules/statementConfig.js

@@ -1,21 +1,23 @@
 const initialState = {
     statementConfig: [],
     loadingStatementConfig: false,
-
+    configStatemen: false,
     actionTransfer: false,
     actionInputCashbox: false,
     actionOutputCashbox: false,
-    actionStatementConfirm: false
+    actionStatementConfirm: false,
+    actionModifyStatement: true
 }
 
 const state = {
     statementConfig: initialState.statementConfig,
     loadingStatementConfig: initialState.loadingStatementConfig,
-
+    configStatemen: initialState.configStatemen,
     actionTransfer: initialState.actionTransfer,
     actionInputCashbox: initialState.actionInputCashbox,
     actionOutputCashbox: initialState.actionOutputCashbox,
-    actionStatementConfirm: initialState.actionStatementConfirm
+    actionStatementConfirm: initialState.actionStatementConfirm,
+    actionModifyStatement: initialState.actionModifyStatement,
 }
 
 const getters = {
@@ -25,7 +27,6 @@ const getters = {
     loadingStatementConfig(state) {
         return state.loadingStatementConfig
     },
-
     actionTransfer(state) {
         return state.actionTransfer
     },
@@ -37,7 +38,13 @@ const getters = {
     },
     actionStatementConfirm(state) {
         return state.actionStatementConfirm
-    }
+    },
+    configStatemen(state) {
+        return state.configStatemen;
+    },
+    actionModifyStatement(state) {
+        return  state.actionModifyStatement
+    },
 }
 
 const mutations = {
@@ -47,95 +54,56 @@ const mutations = {
     setLoadingStatementConfig(state, payload) {
         state.loadingStatementConfig = !!payload
     },
-
-    /*  @ Transfer */
-    setActionTransfer(state, payload) {
-        let config = state.statementConfig.length > 0 ?  state.statementConfig[0] :false
-        if (!config){
-            state.actionTransfer = false
-            return
+    setConfigStatemen(state, payload) {
+        if (!!payload.length) {
+            state.configStatemen = payload[0]
         }
-        let result =  !!config.transfer.userIds.find(item => item === payload.userSession) && !!config.transfer.statementIds.find(item => item === payload.typeStatement.id)
-        state.actionTransfer = result
     },
+    /* Allowed Actions statement */
+    setAllowedActions(state, payload) {
 
-    /* @ Input */
-    setActionInputCashbox(state, payload) {
-        let config = state.statementConfig.length > 0 ?  state.statementConfig[0] :false
+        let config = !payload ? null :state.configStatemen
         if (!config){
+            state.actionTransfer = false
             state.actionInputCashbox = false
-            return
-        }
-        let result =  !!config.inputCashBox.userIds.find(item => item === payload.userSession) && !!config.inputCashBox.statementIds.find(item => item === payload.typeStatement.id)
-        state.actionInputCashbox = result
-    },
-
-    /*  @Output */
-    setActionOutputCashbox(state, payload) {
-        let config = state.statementConfig.length > 0 ?  state.statementConfig[0] :false
-        if (!config) {
             state.actionOutputCashbox = false
-            return
-        }
-        let result =  !!config.outputCashBox.userIds.find(item => item === payload.userSession) && !!config.outputCashBox.statementIds.find(item => item === payload.typeStatement.id)
-        state.actionOutputCashbox = result
-    },
-    /* @Confirm */
-    setActionStatementConfirm(state, payload) {
-        let config = state.statementConfig.length > 0 ?  state.statementConfig[0] :false
-        if (!config){
             state.actionStatementConfirm = false
+            // !! mas acciones agregar aqui
             return
         }
-        let result =  !!config.statementConfirm.userIds.find(item => item === payload.userSession)
-        state.actionStatementConfirm = result
-    }
-}
 
-/*
-'transfer':{
-    'userIds'
-    'statementIds'
-    'negativeAmount':
-},
-'inputCashBox': {
-    'userIds',
-    'statementIds'
-},
-'outputCashBox': {
-    'userIds'
-    'statementIds'
-    'negativeAmount'
-},
+        //  @Transfer
+        let resultTransfer = !!config.transfer.userIds.find(item => item === payload.userSession) && !!config.transfer.statementIds.find(item => item === payload.typeStatement.id)
+        state.actionTransfer = resultTransfer
+
+        // @Input
+        let resultInput = !!config.inputCashBox.userIds.find(item => item === payload.userSession) && !!config.inputCashBox.statementIds.find(item => item === payload.typeStatement.id)
+        state.actionInputCashbox = resultInput
 
-'delete': {
-    'outputUserIds'
-    'inputUserIds'
-    'transferUserIds'
-},
-'statementConfirm' :{
-    'userIds'
-    'transferUserIds'
-    'balanceUserIds'
-    'negativeAmountUserIds'
-},
-'statementOpen',
-'statementCancelUserIds',
-'statementUnlinkUserIds'
- */
+        // @Output
+        let resultOutput = !!config.outputCashBox.userIds.find(item => item === payload.userSession) && !!config.outputCashBox.statementIds.find(item => item === payload.typeStatement.id)
+        state.actionOutputCashbox = resultOutput
 
+        // @Confirm
+        let resultConfirm = !!config.statementConfirm.userIds.find(item => item === payload.userSession)
+        state.actionStatementConfirm = resultConfirm
+    },
+}
 
 const actions = {
     initStatementConfig({ commit }, payload) {
         commit('setStatementConfig',payload)
+        commit('setConfigStatemen', payload)
         commit('setLoadingStatementConfig', payload)
     },
-    verifyActionCashbox({ getters, commit }, payload){
-        // if (getters.stateStatementSelected === 'open')
-        commit('setActionTransfer', payload) // transfer
-        commit('setActionInputCashbox', payload) // Input
-        commit('setActionOutputCashbox', payload) // Output
-        commit('setActionStatementConfirm', payload) //Confirm
+    verifyActionCashbox({ getters, commit }, payload) {
+        commit('setAllowedActions', payload)
+    },
+    resetStatementConfig({commit}){
+        commit('setStatementConfig',[])
+        commit('setLoadingStatementConfig', false)
+        commit('setConfigStatemen', [])
+        commit('setAllowedActions', null)
     },
 }
 

+ 138 - 0
src/store/modules/statementLine.js

@@ -0,0 +1,138 @@
+const initialState = {
+    lines: [],
+    lineSelected: null,
+    linesDeleted: [],
+    linesUpdate: [],
+    showStatementLine: false
+}
+
+const state = {
+    lines: initialState.lines,
+    lineSelected: initialState.lineSelected,
+    linesDeleted: initialState.linesDeleted,
+    linesUpdate: initialState.linesUpdate,
+    showStatementLine: initialState.showStatementLine
+}
+
+const getters = {
+    statementLines(state) {
+        return state.lines
+    },
+    linesDeleted(state) {
+        return state.linesDeleted
+    },
+    linesUpdate(state) {
+        return state.linesUpdate
+    },
+    showStatementLine(state) {
+        return state.showStatementLine
+    },
+    lineSelected(state) {
+        return  state.lineSelected;
+    }
+}
+
+const mutations = {
+    setLines(state, payload) {
+        let data = []
+        payload.forEach(item => {
+            data.push({
+                id: item.id,
+                date: item.date,
+                name: item.name,
+                ref: item.ref,
+                amount: item.amount,
+                partnerId: item.partner.length === 0 ? '' : item.partner[0].id,
+                partnerName: item.partner.length === 0 ? '' : item.partner[0].displayName,
+                isDelete: false,
+                isUpdate: false,
+            })
+        })
+        state.lines = data
+    },
+    /*Show Modal Modify Line */
+    setShowStatementLine( state, payload){
+        state.showStatementLine = !!payload
+    },
+    /* */
+    setLinesDeleted (state, payload) {
+        state.lines.forEach(item => {
+            if (item.id === payload.id ) {
+                item.isDelete = payload.state
+            }
+        })
+
+        if (!!payload.state) {
+            let linesDeletedFound = state.linesDeleted.find(item => item === payload.id)
+            if (!!linesDeletedFound) return
+            state.linesDeleted = [payload.id, ...state.linesDeleted]
+        }
+
+        if (!payload.state) {
+            let linesDeletedFound = state.linesDeleted.findIndex(item => item === payload.id)
+            state.linesDeleted.splice(linesDeletedFound, 1)
+        }
+    },
+    /* */
+    setLinesUpdate (state, payload) {
+        // state.lines.forEach(item => {
+            // if (item.id === payload {
+                // item.linesUpdate = payload
+            // }
+        // })
+
+        if (!!payload) {
+            let linesUpdateFound = state.linesUpdate.find(item => item === payload)
+            if (!!linesUpdateFound) return
+            state.linesUpdate = [payload, ...state.linesUpdate]
+        }
+
+        // if (!payload.state) {
+        //     let linesDeletedFound = state.linesDeleted.findIndex(item => item === payload.id)
+        //     state.linesDeleted.splice(linesDeletedFound, 1)
+        // }
+    },
+    /* */
+    setLineSelected(state, payload) {
+        let selected = state.lines.find(item => item.id  === payload)
+        state.lineSelected = !!selected ? selected : null
+    },
+}
+
+const actions = {
+    initLines({ commit, getters }) {
+        if (!!getters.selectedStatement) {
+            commit('setLines', getters.selectedStatement.line)
+        }
+    },
+    resetLines({ commit }){
+        commit('setLines', [])
+    },
+    selectLineSelected({ commit, dispatch },payload){
+        commit('setLineSelected', payload)
+        // dispatch('showStatementLineModify', payload)
+    },
+    addDeletedLine({ commit }, payload) {
+        commit('setLinesDeleted', payload)
+    },
+    addUpdateLine({ commit }, payload){
+        commit('setLinesUpdate', payload)
+    },
+    showStatementLineModify({ commit }, payload) {
+        commit('setShowStatementLine', payload)
+    },
+    resetStatementLine({ commit }) {
+        commit('setLines', [])
+        commit('setLineSelected', null)
+        commit('setLinesDeleted', [])
+        commit('setLinesUpdate', [])
+        commit('setShowStatementLine', [])
+    }
+}
+
+export default{
+    state,
+    getters,
+    mutations,
+    actions
+}

+ 9 - 4
src/store/modules/statementType.js

@@ -32,8 +32,8 @@ const mutations = {
         state.loadingStatementType = !!payload
     },
     setSelectedStatementType(state, payload) {
-        state.selectedStatementType = payload.id
-        state.selectedStatementTypeName = payload.name
+        state.selectedStatementType = !payload ?null :payload.id
+        state.selectedStatementTypeName =!payload ?'' :payload.name
     }
 }
 const actions = {
@@ -43,8 +43,13 @@ const actions = {
     },
     selectStatementType({ commit }, payload) {
         commit('setSelectedStatementType', payload)
-        
-    }
+
+    },
+    resetStatementType({ commit }) {
+        commit('setStatementType', [])
+        commit('setLoadingStatementType', false)
+        commit('setSelectedStatementType', null)
+    },
 }
 
 export default {

+ 4 - 0
src/store/modules/user.js

@@ -30,6 +30,10 @@ const actions = {
     initUser({ commit }, payload) {
         commit('setUser', payload)
         commit('setLoadingUser', payload)
+    },
+    resetUser({ commit }){
+        commit('setUser', [])
+        commit('setLoadingUser', false)
     }
 }
 

+ 4 - 1
src/store/mutations.js

@@ -4,7 +4,10 @@ const mutations = {
     },
     setDataEndProcess(state, payload) {
         state.data =  payload
-    }
+    },
+    setCompleted(state, payload) {
+        state.completed = payload
+    },
 }
 
 export default mutations

+ 1 - 0
src/store/state.js

@@ -1,6 +1,7 @@
 const state = {
     mode : 'cash',
     data : [],
+    completed: false
 }
 
 export default state

+ 15 - 1
webpack.config.js

@@ -1,6 +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 prod = process.env.NODE_ENV === 'production'
 
@@ -22,7 +23,20 @@ module.exports = {
         new LiveReloadPlugin({
             appendScriptTag: true
         }),
-        new ExtractTextPlugin('main.css')
+        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'],
+	    //     }
+	    // })
     ],
     module: {
         rules: [