<?php /* Smarty version Smarty-3.1.7, created on 2022-09-23 20:00:49
         compiled from "layouts/v7/modules/Potentials/formTransaccional.tpl" */ ?>
<?php /*%%SmartyHeaderCode:136472139630639a8a0b050-44358432%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '64a091dbaed99b6d5fdf00ac321feb059abf1b31' => 
    array (
      0 => 'layouts/v7/modules/Potentials/formTransaccional.tpl',
      1 => 1663963241,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '136472139630639a8a0b050-44358432',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.7',
  'unifunc' => 'content_630639a8a4714',
  'variables' => 
  array (
    'RECORD' => 0,
    'ACCOUNTS' => 0,
    'ASSIGNED_TO' => 0,
    'CONTACTS' => 0,
    'KEY' => 0,
    'CONTACT' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_630639a8a4714')) {function content_630639a8a4714($_smarty_tpl) {?>

    

<div class="modal-dialog"><div class="modal-content" id="form_Trans"><form class="form-horizontal" id="formTrans" name="formTrans" method="post" action="index.php"><input type="hidden" name="action" value="sendTransaccionalData" /><input type="hidden" name="module" value="Potentials" /><input type="hidden" name="record" value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->getId();?>
" /><div class="modal-header"><div class="clearfix"><div class="pull-right " ><button type="button" class="close" aria-label="Close" data-dismiss="modal"><span aria-hidden="true" class='fa fa-close'></span></button></div><h4 class="pull-left" id="titulo_tranferencia">Enviar datos a Transaccional</h4></div></div><div class="modal-body"><legend>Datos de Cliente</legend><div class="form-group"><label class="col-lg-4 control-label">Tipo de Documento</label><div class="col-lg-6"><input class="inputElement" id="tipo_documento" readonly value="RUC"></div></div><div class="form-group"><label class="col-lg-4 control-label">Nombre / Razón Social</label><div class="col-lg-6"><input class="inputElement" id="nombre_rz" readonly value="<?php if ($_smarty_tpl->tpl_vars['ACCOUNTS']->value!=''){?><?php echo $_smarty_tpl->tpl_vars['ACCOUNTS']->value->get('accountname');?>
<?php }?>"></div></div><div class="form-group"><label class="col-lg-4 control-label">Domicilio Legal *</label><div class="col-lg-6"><input class="inputElement" id="domicilio_legal" name='bill_street' required value="<?php if ($_smarty_tpl->tpl_vars['ACCOUNTS']->value!=''){?><?php echo $_smarty_tpl->tpl_vars['ACCOUNTS']->value->get('bill_street');?>
<?php }?>"></div></div><legend>Datos de la Operación</legend><div class="form-group"><label class="col-lg-4 control-label">Responsable</label><div class="col-lg-6"><input class="inputElement" id="" readonly value="<?php echo $_smarty_tpl->tpl_vars['ASSIGNED_TO']->value->get('first_name');?>
 <?php echo $_smarty_tpl->tpl_vars['ASSIGNED_TO']->value->get('last_name');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Correo del Responsable</label><div class="col-lg-6"><input class="inputElement" id="" readonly value="<?php echo $_smarty_tpl->tpl_vars['ASSIGNED_TO']->value->get('email1');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Moneda</label><div class="col-lg-6"><input class="inputElement" id="" readonly value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('moneda');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Producto</label><div class="col-lg-6"><input class="inputElement" id="" readonly value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('opportunity_type');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Línea Solicitada</label><div class="col-lg-6"><input class="inputElement" id="" readonly value="<?php echo $_smarty_tpl->tpl_vars['RECORD']->value->get('cf_1026');?>
"></div></div><?php if ($_smarty_tpl->tpl_vars['CONTACTS']->value!=''){?><legend>Contactos</legend><?php  $_smarty_tpl->tpl_vars['CONTACT'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['CONTACT']->_loop = false;
 $_smarty_tpl->tpl_vars['KEY'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['CONTACTS']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['CONTACT']->key => $_smarty_tpl->tpl_vars['CONTACT']->value){
$_smarty_tpl->tpl_vars['CONTACT']->_loop = true;
 $_smarty_tpl->tpl_vars['KEY']->value = $_smarty_tpl->tpl_vars['CONTACT']->key;
?><input type="hidden" name="contact[<?php echo $_smarty_tpl->tpl_vars['KEY']->value;?>
]" value ="<?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->getId();?>
"><div class="form-group"><label class="col-lg-4 control-label">Nombre completo</label><div class="col-lg-6"><input class="inputElement" readonly name="nombre[<?php echo $_smarty_tpl->tpl_vars['KEY']->value;?>
]" value="<?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->get('firstname');?>
 <?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->get('lastname');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Documento</label><div class="col-lg-6"><input class="inputElement" name="documento[<?php echo $_smarty_tpl->tpl_vars['KEY']->value;?>
]" required value="<?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->get('nrodocumento');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Correo Electrónico</label><div class="col-lg-6"><input class="inputElement" name="email[<?php echo $_smarty_tpl->tpl_vars['KEY']->value;?>
]" required value="<?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->get('email');?>
"></div></div><div class="form-group"><label class="col-lg-4 control-label">Teléfono</label><div class="col-lg-6"><input class="inputElement" name="telefono[<?php echo $_smarty_tpl->tpl_vars['KEY']->value;?>
]" required value="<?php echo $_smarty_tpl->tpl_vars['CONTACT']->value->get('mobile');?>
"></div></div><hr><?php } ?><?php }?></div><div class="modal-footer "><center><button class="btn btn-success" type="submit" id="btnEnviar"><strong>Transferir</strong></button><a class="btn btn-default cancelLink" type="reset" id="btnCancelar" data-dismiss="modal"><strong>Cancelar</strong></a></center></div></form></div></div>

<script type="text/javascript">
$(document).ready(function(){
    function getFormData($form){
        var unindexed_array = $form.serializeArray();
        var indexed_array = {};

        $.map(unindexed_array, function(n, i){
            indexed_array[n['name']] = n['value'];
        });

        return indexed_array;
    }

    $(document).on('submit','#formTrans',function(e){
        e.preventDefault();
        app.helper.showConfirmationBox({'message' : '¿Desea enviar estos datos al Sistema Transaccional?'}).then(
            function(e) {
                var $form = $('#formTrans');
                var params = getFormData($form);
                app.helper.showProgress();
                app.request.post({"data":params}).then(function(err,data){
                    app.helper.hideProgress();
                    if(!err)
                    {
                        $('#btnCancelar').click();
                        if(data.data == 2) //Op exitosa
                        {
                            app.helper.showSuccessNotification({message: app.vtranslate('Transacción realizada satisfactoriamente.')});
                             const myTimeout = setTimeout(function(){
                                location.reload();
                             }, 5000);
                        }
                        else{
                            app.helper.showErrorNotification({message: app.vtranslate('Hubo un error. Transacción Cancelada.')});
                        }
                    }
                    
                });
            },
            function(error, err){
            }
        )
    });
});


</script>
<?php }} ?>