<?php
/* Smarty version 3.1.34-dev-7, created on 2020-10-30 05:04:17
  from '/home/bscom/public_html/crm/ui/theme/default/ajax.contact-edit.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.34-dev-7',
  'unifunc' => 'content_5f9b2e516dbfb8_21685546',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '2fea6998fa8920d52a060d9f2443d50fcb45051f' => 
    array (
      0 => '/home/bscom/public_html/crm/ui/theme/default/ajax.contact-edit.tpl',
      1 => 1592222222,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_5f9b2e516dbfb8_21685546 (Smarty_Internal_Template $_smarty_tpl) {
?>
<form class="form-horizontal" id="rform">

    <div class="form-group"><label class="col-lg-2 control-label" for="account"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Account Name'];?>
</label>

        <div class="col-lg-10"><input type="text" id="account" name="account" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['account'];?>
">

        </div>
    </div>


    <div class="form-group"><label class="col-lg-2 control-label" for="code"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Code'];?>
</label>

        <div class="col-lg-10"><input type="text" id="code" name="code" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['code'];?>
">

        </div>
    </div>

    
        
            

    <div class="form-group"><label class="col-lg-2 control-label" for="company_id"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Company'];?>
</label>

        <div class="col-lg-10">

            <select id="company_id" name="company_id" class="form-control">
                <option value="0"><?php echo $_smarty_tpl->tpl_vars['_L']->value['None'];?>
</option>
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['companies']->value, 'company');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['company']->value) {
?>
                    <option value="<?php echo $_smarty_tpl->tpl_vars['company']->value['id'];?>
" <?php if ($_smarty_tpl->tpl_vars['d']->value->cid == ($_smarty_tpl->tpl_vars['company']->value['id'])) {?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['company']->value['company_name'];?>
</option>
                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
            </select>

        </div>
    </div>

    <div class="form-group"><label class="col-lg-2 control-label" for="edit_email"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Email'];?>
</label>

        <div class="col-lg-10"><input type="text" id="edit_email" name="edit_email" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['email'];?>
">

        </div>
    </div>


    <div class="form-group"><label class="col-lg-2 control-label" for="edit_secondary_email"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Secondary Email'];?>
</label>
        <div class="col-lg-10"><input type="text" id="edit_secondary_email" name="secondary_email" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['secondary_email'];?>
">
        </div>
    </div>


    <div class="form-group"><label class="col-lg-2 control-label" for="phone"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Phone'];?>
</label>

        <div class="col-lg-10"><input type="text" id="phone" name="phone" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['phone'];?>
">

        </div>
    </div>


    <?php if ($_smarty_tpl->tpl_vars['config']->value['show_business_number'] == '1') {?>

        <div class="form-group">

            <label class="col-lg-2 control-label" for="business_number"><?php echo $_smarty_tpl->tpl_vars['config']->value['label_business_number'];?>
</label>

            <div class="col-lg-10">

                <input type="text" id="business_number" name="business_number" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['business_number'];?>
">

            </div>
        </div>

    <?php }?>

    <?php if ($_smarty_tpl->tpl_vars['config']->value['fax_field']) {?>

        <div class="form-group"><label class="col-lg-2 control-label" for="phone"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Fax'];?>
</label>

            <div class="col-lg-10"><input type="text" id="fax" name="fax" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['fax'];?>
">

            </div>
        </div>

    <?php }?>



    <div class="form-group"><label class="col-lg-2 control-label" for="address"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Address'];?>
</label>

        <div class="col-lg-10"><input type="text" id="address" name="address" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['address'];?>
">

        </div>
    </div>
    <div class="form-group"><label class="col-lg-2 control-label" for="city"><?php echo $_smarty_tpl->tpl_vars['_L']->value['City'];?>
</label>

        <div class="col-lg-10"><input type="text" id="city" name="city" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['city'];?>
">

        </div>
    </div>
    <div class="form-group"><label class="col-lg-2 control-label" for="state"><?php echo $_smarty_tpl->tpl_vars['_L']->value['State Region'];?>
</label>

        <div class="col-lg-10"><input type="text" id="state" name="state" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['state'];?>
">

        </div>
    </div>
    <div class="form-group"><label class="col-lg-2 control-label" for="zip"><?php echo $_smarty_tpl->tpl_vars['_L']->value['ZIP Postal Code'];?>
 </label>

        <div class="col-lg-10"><input type="text" id="zip" name="zip" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['zip'];?>
">

        </div>
    </div>

    <div class="form-group"><label class="col-lg-2 control-label" for="country"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Country'];?>
</label>

        <div class="col-lg-10">

            <select name="country" id="country" class="form-control">
                <option value=""><?php echo $_smarty_tpl->tpl_vars['_L']->value['Select Country'];?>
</option>
                <?php echo $_smarty_tpl->tpl_vars['countries']->value;?>

            </select>

        </div>
    </div>

    
                                <div class="form-group"><label class="col-md-2 control-label" for="zip">Latitude & Longitude </label>

                                    <div class="col-lg-10">
                                    <input type="text" readonly id="lat" name="lat" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['lat'];?>
">
                                    <input readonly type="text" id="lon" name="lon" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['lon'];?>
">

                                    </div>
                                </div>
                                
                                <div class="form-group">
                                     <label class="col-md-4 control-label" > </label>
                                    <div class="col-lg-4">
                                     <button class="sm-btn md-btn-warning waves-effect waves-light" type="button" id="fetchbyaddress"><i class="fa fa-map"></i> Fetch  From Address</button>
                                              
                                    </div>
                                   
                                    <div class="col-lg-4">
                                     <button class="sm-btn md-btn-warning waves-effect waves-light" type="button" id="fetchbypincode"><i class="fa fa-map"></i> Fetch From Pincode</button>

                                    </div>
                                </div>
    

    <div class="form-group"><label class="col-lg-2 control-label" for="group"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Group'];?>
 </label>

        <div class="col-lg-10">

            <select class="form-control" name="group" id="group">
                <option value="0" <?php if (($_smarty_tpl->tpl_vars['d']->value['gid']) == 0) {?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['_L']->value['None'];?>
</option>
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['gs']->value, 'g');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['g']->value) {
?>
                    <option value="<?php echo $_smarty_tpl->tpl_vars['g']->value['id'];?>
" <?php if (($_smarty_tpl->tpl_vars['d']->value['gid']) == ($_smarty_tpl->tpl_vars['g']->value['id'])) {?>selected<?php }?>><?php echo $_smarty_tpl->tpl_vars['g']->value['gname'];?>
</option>
                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
            </select>

        </div>
    </div>


    <?php if ($_smarty_tpl->tpl_vars['config']->value['accounting'] == '1') {?>

        <div class="form-group"><label class="col-md-2 control-label" for="currency"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Currency'];?>
</label>

            <div class="col-lg-10">
                <select id="currency" name="currency" class="form-control">

                    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['currencies']->value, 'currency');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['currency']->value) {
?>
                        <option value="<?php echo $_smarty_tpl->tpl_vars['currency']->value['id'];?>
"
                                <?php if (($_smarty_tpl->tpl_vars['d']->value['currency']) == ($_smarty_tpl->tpl_vars['currency']->value['id'])) {?>selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['currency']->value['cname'];?>
</option>
                        <?php
}
} else {
?>
                        <option value="0"><?php echo $_smarty_tpl->tpl_vars['config']->value['home_currency'];?>
</option>
                    <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>

                </select>
            </div>
        </div>

    <?php }?>



    <?php if ($_smarty_tpl->tpl_vars['config']->value['client_dashboard'] == '1') {?>

    <?php if ($_smarty_tpl->tpl_vars['config']->value['customer_custom_username']) {?>

        <div class="form-group"><label class="col-lg-2 control-label" for="username"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Username'];?>
 </label>

            <div class="col-lg-10">

                <input type="text" id="username" name="username" class="form-control" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['username'];?>
">


            </div>
        </div>


        <?php }?>


        <div class="form-group"><label class="col-lg-2 control-label" for="password"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Password'];?>
 </label>

            <div class="col-lg-10">

                
                <input type="password" id="password" name="password" class="form-control" autocomplete="new-password">

                <span class="help-block"><?php echo $_smarty_tpl->tpl_vars['_L']->value['password_change_help'];?>
</span>

            </div>
        </div>

    <?php }?>



    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['fs']->value, 'f');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['f']->value) {
?>
        <div class="form-group"><label class="col-lg-2 control-label" for="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
"><?php echo $_smarty_tpl->tpl_vars['f']->value['fieldname'];?>
</label>
            <?php if (($_smarty_tpl->tpl_vars['f']->value['fieldtype']) == 'text') {?>


                <div class="col-lg-10">
                    <input type="text" id="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" name="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" class="form-control" value="<?php if (get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']) != '') {?> <?php echo get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']);
}?>">
                    <?php if (($_smarty_tpl->tpl_vars['f']->value['description']) != '') {?>
                        <span class="help-block"><?php echo $_smarty_tpl->tpl_vars['f']->value['description'];?>
</span>
                    <?php }?>

                </div>

            <?php } elseif (($_smarty_tpl->tpl_vars['f']->value['fieldtype']) == 'password') {?>

                <div class="col-lg-10">
                    <input type="password" id="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" name="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" class="form-control" value="<?php if (get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']) != '') {?> <?php echo get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']);
}?>">
                    <?php if (($_smarty_tpl->tpl_vars['f']->value['description']) != '') {?>
                        <span class="help-block"><?php echo $_smarty_tpl->tpl_vars['f']->value['description'];?>
</span>
                    <?php }?>
                </div>

            <?php } elseif (($_smarty_tpl->tpl_vars['f']->value['fieldtype']) == 'dropdown') {?>
                <div class="col-lg-10">
                    <select id="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" name="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" class="form-control">
                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, explode(',',$_smarty_tpl->tpl_vars['f']->value['fieldoptions']), 'fo');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['fo']->value) {
?>
                            <option value="<?php echo $_smarty_tpl->tpl_vars['fo']->value;?>
" <?php if (get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']) == $_smarty_tpl->tpl_vars['fo']->value) {?> selected="selected" <?php }?>><?php echo $_smarty_tpl->tpl_vars['fo']->value;?>
</option>
                        <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                    </select>
                    <?php if (($_smarty_tpl->tpl_vars['f']->value['description']) != '') {?>
                        <span class="help-block"><?php echo $_smarty_tpl->tpl_vars['f']->value['description'];?>
</span>
                    <?php }?>
                </div>


            <?php } elseif (($_smarty_tpl->tpl_vars['f']->value['fieldtype']) == 'textarea') {?>

                <div class="col-lg-10">
                    <textarea id="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" name="cf<?php echo $_smarty_tpl->tpl_vars['f']->value['id'];?>
" class="form-control" rows="3"><?php if (get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']) != '') {?> <?php echo get_custom_field_value($_smarty_tpl->tpl_vars['f']->value['id'],$_smarty_tpl->tpl_vars['d']->value['id']);
}?></textarea>
                    <?php if (($_smarty_tpl->tpl_vars['f']->value['description']) != '') {?>
                        <span class="help-block"><?php echo $_smarty_tpl->tpl_vars['f']->value['description'];?>
</span>
                    <?php }?>
                </div>

            <?php } else { ?>
            <?php }?>
        </div>
    <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>

    <div class="form-group"><label class="col-lg-2 control-label" for="cid"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Type'];?>
</label>

        <div class="col-lg-10">


            <div class="checkbox">
                <label>
                    <input type="checkbox" class="i-checks" name="customer" value="Customer" <?php if ($_smarty_tpl->tpl_vars['d']->value->type == 'Customer,Supplier' || $_smarty_tpl->tpl_vars['d']->value->type == 'Customer') {?> checked <?php }?>>
                    <?php echo $_smarty_tpl->tpl_vars['_L']->value['Customer'];?>

                </label>
            </div>

            <?php if ($_smarty_tpl->tpl_vars['config']->value['suppliers'] == '1') {?>
                <div class="checkbox">
                    <label>
                        <input type="checkbox" class="i-checks" name="supplier" value="Supplier"  <?php if ($_smarty_tpl->tpl_vars['d']->value->type == 'Customer,Supplier' || $_smarty_tpl->tpl_vars['d']->value->type == 'Supplier') {?> checked <?php }?>>
                        <?php echo $_smarty_tpl->tpl_vars['_L']->value['Supplier'];?>

                    </label>
                </div>
            <?php }?>

        </div>
    </div>

    <div class="form-group"><label class="col-lg-2 control-label" for="tags"><?php echo $_smarty_tpl->tpl_vars['_L']->value['Tags'];?>
</label>

        <div class="col-lg-10">

                        <select name="tags[]" id="tags"  class="form-control" multiple="multiple">
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['tags']->value, 'tag');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['tag']->value) {
?>
                    <option value="<?php echo $_smarty_tpl->tpl_vars['tag']->value['text'];?>
" <?php if (in_array($_smarty_tpl->tpl_vars['tag']->value['text'],$_smarty_tpl->tpl_vars['dtags']->value)) {?>selected="selected"<?php }?>><?php echo $_smarty_tpl->tpl_vars['tag']->value['text'];?>
</option>
                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>

            </select>

        </div>
    </div>



    <div class="form-group">
        <div class="col-lg-offset-2 col-lg-10">

            <button class="btn btn-primary" type="submit" id="submit"><i class="fa fa-check"></i> <?php echo $_smarty_tpl->tpl_vars['_L']->value['Submit'];?>
</button>
        </div>
    </div>



    <input type="hidden" name="fcid" id="fcid" value="<?php echo $_smarty_tpl->tpl_vars['d']->value['id'];?>
">


</form>
<?php echo '<script'; ?>
>
 $("#fetchbyaddress").click(function (e) {
             
                e.preventDefault();
              
                $('#ibox_form').block({ message:block_msg });
                var _url = $("#_url").val();
                
                $.post(_url + 'crmcontroller/google_geocode/',  { 'address': $('#address').val()+','+$('#city').val() })
                    .done(function (data) {
                        //alert(data);
                        var obj = JSON.parse(data);
                          // alert(obj.latitude);
                        var sbutton = $("#submit");
                        var _url = $("#_url").val();
                        $('#lat').val(obj.latitude);
                        $('#lon').val(obj.longitude);
                         $('#ibox_form').unblock();
                            var body = $("html, body");
                          //  body.animate({ scrollTop: $(document).height()/2 }, '1000', 'swing');
                            $("#emsgbody").html(obj.msg);
                            $("#emsg").show("slow");
                             $('#ibox_form').unblock();

                            if(obj.error==0){

                            body.animate({ scrollTop: $(document).height()/2 }, '1000', 'swing');
                           
                        }
                          else if(obj.error == 1){

                          body.animate({ scrollTop: 0 }, '1000', 'swing');


                          }
                         
                       
                    });
            });


              $("#fetchbypincode").click(function (e) {
                 
                e.preventDefault();
              
                $('#ibox_form').block({ message:block_msg });
                var _url = $("#_url").val();
                
                $.post(_url + 'crmcontroller/google_geocode/', { 'zip': $('#zip').val()})
                    .done(function (data) {
                      // alert(data);
                        var obj = JSON.parse(data);
                          // alert(obj.latitude);
                        var sbutton = $("#submit");
                        var _url = $("#_url").val();
                        $('#lat').val(obj.latitude);
                        $('#lon').val(obj.longitude);
                        var body = $("html, body");
                        
                         $("#emsgbody").html(obj.msg);
                         $("#emsg").show("slow");
                         // alert(OBJ);
                         $('#ibox_form').unblock();

                        if(obj.error==0){

                            body.animate({ scrollTop: $(document).height()/2 }, '1000', 'swing');
                           
                        }
                          else if(obj.error == 1){

                          body.animate({ scrollTop: 0 }, '1000', 'swing');


                          }
                         
                         
                       
                    });
            });

        
<?php echo '</script'; ?>
><?php }
}
