<?php
/**
 * Marketplace - Component Marketplace 
 * ******************************************************************
 *
 * PHP version 7.0
 *
 * @category   Component
 * @package    Joomla
 * @author     WebKul software private limited <support@webkul.com>
 * @copyright  2010 WebKul software private limited
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version    GIT:5.2
 * @filesource http://store.webkul.com
 * @link       Technical Support:  webkul.uvdesk.com
 * ******************************************************************
 */
// no direct access
defined('_JEXEC') or die();
//Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
if (!class_exists('MarketplaceHelper')) {
    include JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.
    'components'.DIRECTORY_SEPARATOR.'com_marketplace'.
    DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.
    'marketplace.php';
}
if (!class_exists('Vmconfig')) {
    include JPATH_ADMINISTRATOR.'/components/com_virtuemart/helpers/config.php';
}
Vmconfig::loadConfig();
$mpHelp=new MarketplaceHelper();
$modProfFE=$mpHelp->getMarketModelS('Profile');
$payment_result=$modProfFE->getPaymentInfo();
$params = JComponentHelper::getParams('com_marketplace');
$mapkey = trim($params->get('mapkey'));
JHtml::_('bootstrap.framework');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
$doc=JFactory::getDocument();
$doc->addStyleSheet(
    'components/com_marketplace/assets/newdesign/edit_form.css'
);
$doc->addScript(
    '//maps.googleapis.com/maps/api/js?libraries=plac'.
    'es&key='.$mapkey
);
$doc->addStyleSheet(
    JURI::root().'components/com_marketplace/css/msdropdown/dd.css'
);
$doc->addStyleSheet(
    JURI::root().'components/com_marketplace/css/msdropdown/flags.css'
);
$doc->addScript(
    JURI::root().'components/com_marketplace/js/msdropdown/jquery.dd.min.js'
);
$lg=0.0;
$lt=0.0;

JFactory::getDocument()->addStyleDeclaration(
    "
    #jform_shortdescription {
        width: 98%;
    }
    #jform_cover, #jform_shoplogo {
        display: block;
        margin-top: 10px;
    }"
);
JFactory::getDocument()->addScriptDeclaration(
    "
Joomla.submitbutton = function (task) {
    if (task == 'user.cancel' || document.formvalidator.isValid(document.getElementById('user-form'))) {
        Joomla.submitform(task, document.getElementById('user-form'));
    }
};
Joomla.twoFactorMethodChange = function (e) {
    var selectedPane = 'com_users_twofactor_' + jQuery('#jform_twofactor_method').val();
    jQuery.each(jQuery('#com_users_twofactor_forms_container>div'), function (i, el) {
        if (el.id != selectedPane) {
            jQuery('#' + el.id).hide(0);
        } else {
            jQuery('#' + el.id).show(0);
        }
    });
};
    "
);
$db=JFactory::getDBO();
$_input = JFactory::getApplication()->input;
$seller_id= $_input->get('seller_id', 0, 'INT');
$model=$this->getModel('marketplace');
$info=$model->getSellerInfo($seller_id);
/**
 * *****************************************
 * For country select list
 */
$country_html_id="countries";
$country_html_name="countries";
$country_select = MarketplaceHelper::getCountrySelectField(
    $info->countrylogo, $country_html_id, $country_html_name,
    "width:312px;", " required"
);
/**
 * For country select list
 * ****************END HERE*****************
 */
$country_mod = VmModel::getModel("Country");
$country_data = $country_mod->getCountryByCode($info->countrylogo);
$state_mod = VmModel::getModel("State");
if ($country_data != false) {
    $state_data = $state_mod->getStates($country_data->virtuemart_country_id);
} else {
    $state_data = array();
}
$state_arr=array();
foreach ($state_data as $key => $value) {
    $state_arr[]= array(
        'value' => $value->virtuemart_state_id,
        'text' => $value->state_name,
    );
}

$name="virtuemart_state_id";
$options = array(
    'id' => $name, // HTML id for select field
    'list.attr' => array( // additional HTML attributes for select field
        'class'=>'field-groups',
        "style"=>'width:312px;'
    ),
    'option.key'=>'value', // key name for value in data array
    'option.text'=>'text', // key name for text in data array
    'list.select'=>$info->state_vm, // value of the SELECTED field
);
$state_html = JHtmlSelect::genericlist($state_arr, $name, $options);
$l=explode('::', $info->shop_location);
if (count($l)<2) {
    $lg=0;
    $lt=0;
} else {
    $lg=$l[0];
    $lt=$l[1];
}
if (isset($info->screenname)
    && strlen($info->screenname)
) {
    $this->form->setValue('screenname', '', $info->screenname);
}
if (isset($info->gender)&& strlen($info->gender)
) {
    $this->form->setValue('gender', '', $info->gender);
}
if (isset($info->companyname)
    && strlen($info->companyname)
) {
    $this->form->setValue('shopname', '', $info->companyname);
}
if (isset($info->phone)
    && strlen($info->phone)
) {
    $this->form->setValue('phone', '', $info->phone);
}
if (isset($info->companylocality)
    && strlen($info->companylocality)
) {
    $this->form->setValue('shoplocality', '', $info->companylocality);
}
if (isset($info->address)
    && strlen($info->address)
) {
    $this->form->setValue('address', '', $info->address);
}
if (isset($info->first_name)
    && strlen($info->first_name)
) {
    $this->form->setValue('first_name', '', $info->first_name);
}
if (isset($info->last_name)
    && strlen($info->last_name)
) {
    $this->form->setValue('last_name', '', $info->last_name);
}
if (isset($info->zip)
    && strlen($info->zip)
) {
    $this->form->setValue('zip', '', $info->zip);
}
if (strlen($info->shop_location)&& isset($info->shop_location)) {
    $latlong=explode('::', $info->shop_location);
    $this->form->setValue('latitude', '', $latlong[0]);
    $this->form->setValue('logtitude', '', $latlong[1]);
}

$pay_mode=explode(',', $info->payment_mode);
$pay_desc=explode(',', $info->payment_desc);

$social_mode=explode(',', $info->social_mode);
$social_id=explode(',', $info->social_id);
if (isset($social_id[0]) && strlen(trim($social_id[0]))) {
    $this->form->setValue('social0', '', $social_id[0]);
    $this->form->setValue('facebook', '', 'FACEBOOK_CHECK');
}
if (isset($social_id[1])
    && strlen(trim($social_id[1]))
) {
    $this->form->setValue('social1', '', $social_id[1]);
    $this->form->setValue('twitter', '', 'TWITTER_CHECK');
}
if (isset($social_id[2])
    && strlen(trim($social_id[2]))
) {
    $this->form->setValue('social2', '', $social_id[2]);
    $this->form->setValue('google', '', 'GOOGLE_CHECK');
}
if (isset($social_id[3])
    && strlen(trim($social_id[3]))
) {
    $this->form->setValue('social3', '', $social_id[3]);
    $this->form->setValue('linkedin', '', 'LINKEDIN_CHECK');
}
if (isset($info->companydescription)
    && strlen($info->companydescription)
) {
    $this->form->setValue('shopdescription', '', $info->companydescription);
}
if (isset($info->descriptioninhtml)
    && strlen($info->descriptioninhtml)
) {
    $this->form->setValue('shortdescription', '', $info->descriptioninhtml);
}
?>
<form action="<?php echo JRoute::_('index.php?option=com_marketplace&view=marketplace&layout=edit_seller_form&seller_id=' . (int)$seller_id); ?>" method="post" name="adminForm" id="user-form" class="form-validate form-horizontal" enctype="multipart/form-data">
    <?php echo JLayoutHelper::render('joomla.edit.item_title', $this); ?>
    <?php if(!empty($this->sidebar)) : ?>
  <div id="j-sidebar-container">
    <?php
    echo $this->sidebar;
    ?>
  </div>
  <div id="j-main-container" class="span10">
    <?php else : ?>
    <div id="j-main-container">
    <?php endif; ?>
      <div  onload="initialize()" id="k-main-container">
        <div class="main1-container">
          <div class="menubar">
            <ul class="nav nav-pills nav-stacked" id="myTabs">
              <li class="active"><a data-toggle="tab" href="#home"><?php echo JText::_('PERSONAL_PROFILE');?></a></li>
              <li><a data-toggle="tab" href="#social"><?php echo JText::_('SOCIAL_PROFILE');?></a></li>
              <li><a data-toggle="tab" href="#shop"><?php echo JText::_('ABOUT_SHOP');?></a></li>
              <li><a data-toggle="tab" href="#payment"><?php echo JText::_('PAYMENT_MODE');?></a></li>
            </ul>
          </div>
          <div class="contentbar">
            <div class="tab-content">
              <div class="tab-pane active" id="home">
                <div class="singlerow">
                    <?php echo $this->form->getLabel('screenname'); ?>
                  <div class="scrname">
                    <?php echo $this->form->getInput('screenname');?>
                  </div>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('gender'); ?>
                    <?php echo $this->form->getInput('gender'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('first_name'); ?>
                    <?php echo $this->form->getInput('first_name'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('last_name'); ?>
                    <?php echo $this->form->getInput('last_name'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('shopname'); ?>
                    <?php echo $this->form->getInput('shopname'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('phone'); ?>
                    <div>
                        <?php echo $this->form->getInput('phone'); ?>
                    </div>
                </div>
                <div class="singlerow">
                  <label for="<?php echo $country_html_id; ?>" class="cnt">
                    <?php
                    echo JText::_('COUNTRY');
                    ?>
                  </label>
                  <div>
                    <?php
                    echo $country_select;
                    ?>
                  </div>
                </div>
                <div class="singlerow">
                  <label id="jform_country-lbl" class="cnt">
                    <?php
                    echo JText::_('STATE');
                    ?>
                  </label>
                  <div>
                    <?php
                    echo $state_html;
                    ?>
                  </div>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('shoplocality'); ?>
                    <?php echo $this->form->getInput('shoplocality'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('address'); ?>
                    <?php echo $this->form->getInput('address'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('zip'); ?>
                    <?php echo $this->form->getInput('zip'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('latitude'); ?>
                    <?php echo $this->form->getLabel('logtitude'); ?>
                  <div>
                    <?php echo $this->form->getInput('latitude'); ?>
                    <?php echo $this->form->getInput('logtitude'); ?>
                  </div>
                </div>
                <div>
                <input  id="pac_input" class="controls searchicon" type="text" placeholder="<?php echo JText::_('SEARCH_LOCATION');?>" style="width:180px;">
                  <div id="map_canvas"></div>
                </div>
                <div class="singlerow">
                <?php echo $this->form->getLabel('cover'); ?>
                  <div class="sellerimg">
                <?php
                if (isset($info->companybanner) && strlen($info->companybanner)) {
                    $src=JURI::root().$info->companybanner;
                } else {
                    $src=JURI::root()."administrator/components/com_marketplace/assets/images/banner-dummy.png";
                }
                    
                if (isset($info->companylogo) && strlen($info->companylogo)) {
                    $src1=JURI::root().$info->companylogo;
                } else {
                    $src1=JURI::root()."administrator/components/com_marketplace/assets/images/logo-dummy.png";
                }
                ?>
                    <img class="sellerimg1" src="<?php echo $src;?>"/>
                  </div>
                <?php echo $this->form->getInput('cover'); ?>
                </div>
                <div class="singlerow">
                <?php echo $this->form->getLabel('shoplogo'); ?>
                  <div class="sellerimg">
                    <img class="sellerimg2" src="<?php echo $src1;?>"/>
                  </div>
                <?php echo $this->form->getInput('shoplogo'); ?>
                </div>
              </div>
              <div class="tab-pane" id="social">
                <div class="singlerow">
                  <div>
                    <?php echo $this->form->getInput('facebook'); ?>
                    <?php echo $this->form->getLabel('facebook'); ?>
                  </div>
                  <div>
                    <?php echo $this->form->getInput('twitter'); ?>
                    <?php echo $this->form->getLabel('twitter'); ?>
                  </div>
                  <div>
                    <?php echo $this->form->getInput('google'); ?>
                    <?php echo $this->form->getLabel('google'); ?>
                  </div>
                  <div>
                    <?php echo $this->form->getInput('linkedin'); ?>
                    <?php echo $this->form->getLabel('linkedin'); ?>
                  </div>
                  <div class="social_input">
                    <?php echo $this->form->getInput('social0'); ?>
                    <?php echo $this->form->getInput('social1'); ?>
                    <?php echo $this->form->getInput('social2'); ?>
                    <?php echo $this->form->getInput('social3'); ?>
                  </div>
                </div>
              </div>
              <div class="tab-pane" id="shop">
                <div class="singlerow">
                <?php echo $this->form->getLabel('shopdescription'); ?>
                <?php echo $this->form->getInput('shopdescription'); ?>
                </div>
                <div class="singlerow">
                    <?php echo $this->form->getLabel('shortdescription'); ?>
                    <?php echo $this->form->getInput('shortdescription'); ?>
                </div>
              </div>
              <div class="tab-pane" id="payment">
                    
                    <div class="payment_method" >
                            <?php
                            $stan=-1;
                            //To Do
                            $pay_array=array();
                            foreach ($payment_result as $payment) {
                                $checked='';
                                $value='';
                                $check='';
                                $descvalue='';
                                $payment_name1=$payment->payment_element;
                                $display=" style='display:none;'";
                                if ($payment->payment_element=='standard') {
                                    $disabled="disabled";
                                    if (in_array($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode)) {
                                        $descvalue=array_search($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode);
                                        $value=$pay_desc[$descvalue];
                                        $stan=1;
                                        $check="checked";
                                        $display=" style='display:block;'";
                                        $disabled="";
                                    }
                                    
                                    $pd_id=str_replace(' ', '_', $payment_name1);
                                    $payment->payment_name = strlen($payment->payment_name) > 10 ? substr($payment->payment_name, 0, 15)."..." : $payment->payment_name;
                                        echo '<div class="wk_payment_single"><span class="switch">
                                                <input type="checkbox" id="wk_cod'."-".$payment->virtuemart_paymentmethod_id.'" name="payment_mode[]" value="'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'"  '.$check.' " data-field="jform_'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'"/>
                                                </span><span for="wk_cod'."-".$payment->virtuemart_paymentmethod_id.'"><i class="fa fa-bank" aria-hidden="true"></i><span class="lbl">'.$payment->payment_name.'</span>&nbsp;&nbsp;
                                                </span>
                                        </div>
                                        <div class="wk_payment_ids ">
                                            <input placeholder="Please Enter Your Payment Option Details" type="text" name="payment[]" value="'.htmlspecialchars($value, ENT_QUOTES).'" id="jform_'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'"'.$disabled.'>
                                        </div>
                                    ';
                                } elseif ($payment->payment_element=='paypal') {
                                    $checked='';
                                    $descvalue=array_search($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode);
                                    $disabled="disabled";
                                    if (in_array($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode)) {
                                        $value=$pay_desc[$descvalue];
                                        $checked="checked";
                                        $disabled="";
                                    }
                                    $index=-1;
                                    for ($i=0; $i <sizeof($pay_mode); $i++) {
                                        if ($payment->payment_element==$pay_mode[$i]) {
                                            $index=$i;
                                            break;
                                        }
                                    }
                                    $pd_id=str_replace(' ', '_', $payment_name1);
                                    if ($stan==1) {
                                        $index-=1;
                                    }
                                    
                                    $payment->payment_name = strlen($payment->payment_name) > 10 ? substr($payment->payment_name, 0, 10)."..." : $payment->payment_name;
                                    echo '<div class="wk_payment_single"><span class="switch">
                                                <input type="checkbox" id="wk_paypal'."-".$payment->virtuemart_paymentmethod_id.'" name="payment_mode[]" value="'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'" '.$checked.' data-field="jform_'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'"/>
                                                </span><span for="wk_paypal'."-".$payment->virtuemart_paymentmethod_id.'"><i class="fa fa-bank" aria-hidden="true"></i><span class="lbl">'.$payment->payment_name.'</span>&nbsp;&nbsp;
                                                </span>
                                        </div>
                                        <div class="wk_payment_ids ">
                                            <input type="text" placeholder="Enter Paypal Id " value="'.htmlspecialchars($value, ENT_QUOTES).'" id="jform_'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'" name="payment[]"'.$disabled.'>
                                        </div>
                                    ';
                                } else {
                                    continue;
                                }
                                echo "<br><br>";
                            }?>
                            <hr>
                                <?php
                                $stripe_payment_params=$modProfFE->getPaymentMethodId();/*contains array of params*/
                                if (!empty($stripe_payment_params)) {
                                    $stripe_type=$stripe_payment_params['stripe_payment_type'];
                                    if ($stripe_type) {
                                        $stripe_client_id=$stripe_payment_params['stripe_live_client_id'];
                                        $secret_key=$stripe_payment_params['stripe_live_secret_key'];
                                        $public_key=$stripe_payment_params['stripe_live_publishable_key'];
                                    } else {
                                        $stripe_client_id=$stripe_payment_params['stripe_test_client_id'];
                                        $secret_key=$stripe_payment_params['stripe_test_secret_key'];
                                        $public_key=$stripe_payment_params['stripe_test_publishable_key'];
                                    }
                                }
                                $checkRemitaInstallation=JPluginHelper::getPlugin('vmpayment', 'remitasplit');
                                if (!empty($checkRemitaInstallation)) {
                                    $remitaSellerData=$modProfFE->getRemitaSeller($info->seller_id);
                                    if (!$remitaSellerData) {
                                        $remitaSellerData =new stdClass();
                                        $remitaSellerData->name="";
                                        $remitaSellerData->account="";
                                        $remitaSellerData->bankcode="";
                                    }
                                }
                                foreach ($payment_result as $payment) {
                                    if ($payment->payment_element=='stripeconnect') {
                                        if (($stripe_client_id && $secret_key) && $public_key) {
                                            $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$stripe_client_id.'&scope=read_write';
                                            $url_deauth=JURI::base() . "index.php?option=com_marketplace&view=marketplace&layout=edit_seller_form&deauth=true&seller_id=".$info->seller_id;
                                            echo "<div class='wk_payment_single'>
                                                    <label class='switch'>
                                                          <input type='checkbox' disabled='true' id='stripeconnect' name='payment_mode[]' value='".$payment->payment_name."' /><span class='lbl'>".$payment->payment_name."</span>&nbsp;&nbsp;
                                                    </label>
                                                </div>
                                                <div class='wk_payment_ids' >
                                                    <input  type='text' placeholder='' readonly='true' name='payment_id[]' value='' id='jform_seller_stripe_id'class='entry form-control width-100-mp text-padd soc_chk_txt' rel='' >
                                                </div>
                                                ";
                                        }
                                    } elseif ($payment->payment_element=='adaptivepaypal') {
                                        $checked='';
                                        $descvalue=array_search($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode);
                                        $value="";
                                        $disabled="disabled";
                                        if (in_array($payment->payment_element."-".$payment->virtuemart_paymentmethod_id, $pay_mode)) {
                                            $value=$pay_desc[$descvalue];
                                            $checked="checked";
                                            $disabled="";
                                        }
                                        $index=-1;
                                        for ($i=0; $i <sizeof($pay_mode); $i++) {
                                            if ($payment->payment_element."-".$payment->virtuemart_paymentmethod_id==$pay_mode[$i]) {
                                                $index=$i;
                                                break;
                                            }
                                        }
                                        $pd_id=str_replace(' ',  '_', $payment->payment_element);
                                        if ($stan==1) {
                                            $index-=1;
                                        }
                                        $payment->payment_name = strlen($payment->payment_name) > 10 ? substr($payment->payment_name, 0, 10)."..." : $payment->payment_name;
                                        echo '<div class="wk_payment_single"><span class="switch">
                                                <input type="checkbox" id="wk_adaptive'."-".$payment->virtuemart_paymentmethod_id.'" name="payment_mode[]" value="'.$payment->payment_element."-".$payment->virtuemart_paymentmethod_id.'" '.$checked.' data-field="jform_'.$payment_name1."-".$payment->virtuemart_paymentmethod_id.'">
                                                </span><span for="wk_paypal'."-".$payment->virtuemart_paymentmethod_id.'"><i class="fa fa-bank" aria-hidden="true"></i><span class="lbl">'.$payment->payment_name.'</span>&nbsp;&nbsp;
                                                </span>
                                        </div>
                                        <div class="wk_payment_ids ">
                                            <input type="text" placeholder="Enter Id " value="'.htmlspecialchars($value, ENT_QUOTES).'" id="jform_'.$payment->payment_element."-".$payment->virtuemart_paymentmethod_id.'" name="payment[]" '.$disabled.'>
                                        </div>
                                    ';
                                    } elseif ($payment->payment_element=='remitasplit') {
                                        if (!empty($checkRemitaInstallation)) {
                                            $checked='';
                                            $descvalue=array_search($payment->payment_element, $pay_mode);
                                            $payment->payment_name = strlen($payment->payment_name) > 10?substr($payment->payment_name, 0, 10)."..." : $payment->payment_name;
                                            if (in_array('remitasplit', $pay_mode)) {
                                                $checked="checked";
                                            }         
                                            
                                            echo '<div class="wk_payment_single" style="position:relative;bottom: 100px;">
                                                    <label for="wk_remitasplit"><i class="fa fa-money" aria-hidden="true"></i>
                                                        <input type="checkbox" id="wk_remitasplit" name="payment_mode[]" value="remitasplit" '.$checked.' >&nbsp;&nbsp;<span class="lbl">'. $payment->payment_name.'
                                                        </span>
                                                        </label>
                                                    <label class="switch">
                                                        
                                                        <div class="slider round"></div>
                                                    </label>
                                                </div>
                                                <div class="wk_payment_ids" >
                                                        <label for="remita_name" class="label1">'.JText::_("REMITA_NAME").'</label>
                                                            <input class="entry form-control width-100-mp text-padd" type="text" value="'.$remitaSellerData->name.'" name="remita_name" id="jform_remita_name" placeholder="'.JText::_('REMITA_NAME').'" />
                                                        <label for="remita_account" class="label1">'.JText::_("ACCOUNT_NUMBER").'</label>
                                                            <input class="entry form-control width-100-mp text-padd" type="text" value="'.$remitaSellerData->account.'" name="remita_account" id="jform_remita_account" placeholder="'.JText::_('ACCOUNT_NUMBER').'"/>
                                                        <label for="remita_bank_code" class="label1">'.JText::_("BANK_CODE").' </label>
                                                            <select name="remita_bank_code" id="jform_remita_bank_code" value="">
                                                                <option value="">'.JText::_("REMITA_SELECT_TEXT").'</option>
                                                                    <option value="044" >Access Bank (044)</option>
                                                                    <option value="014" >Afribank (014)</option>
                                                                    <option value="023" >Citibank (023)</option>
                                                                    <option value="063" >Diamond Bank (063)</option>
                                                                    <option value="050" >Ecobank (050)</option>
                                                                    <option value="040" >Equitorial Trust Bank (040)</option>
                                                                    <option value="011" >First Bank (011)</option>
                                                                    <option value="214" >FCMB (214)</option>
                                                                    <option value="070" >Fidelity Bank (070)</option>
                                                                    <option value="085" >Finbank (085)</option>
                                                                    <option value="058" >Guaranty Trust Bank (058)</option>
                                                                    <option value="069" >Intercontinental Bank (069)</option>
                                                                    <option value="056" >Oceanic Bank (056)</option>
                                                                    <option value="082" >BankPhb (082)</option>
                                                                    <option value="076" >Skye Bank (076)</option>
                                                                    <option value="084" >Spring Bank (084)</option>
                                                                    <option value="221" >StanbicIBTC (221)</option>
                                                                    <option value="068" >Standard Chartered Bank (068)</option>
                                                                    <option value="232" >Sterling Bank (232)</option>
                                                                    <option value="033" >United Bank Of Africa (033)</option>
                                                                    <option value="032" >Union Bank (032)</option>
                                                                    <option value="035" >Wema Bank (035)</option>
                                                                    <option value="057" >Zenith Bank (057)</option>
                                                                    <option value="215" >Unity Bank (215)</option>
                                                            </select>
                                                </div>';
                                            /*add script for remita split*/
                                            $doc->addScriptDeclaration(
                                                '
                                                jQuery(document).ready(function(){
                                                    jQuery("#jform_remita_bank_code option[value=\''.
                                                    $remitaSellerData->bankcode.
                                                    '\']").attr("selected","selected");
                                                    jQuery("#jform_remita_bank_code").trigger("liszt:updated");
                                                });
                                                '
                                            );
                                        }
                                    } else {
                                        continue;
                                    }
                                    echo "<br><br>";
                                }
                                $checkStripeInstallation=JPluginHelper::getPlugin('vmpayment', 'stripeconnect');
                                if (!empty($checkStripeInstallation)) {
                                    $wk_get_result=$modProfFE->getStripeData(
                                        $info->seller_id
                                    );
                                    if ($wk_get_result && $wk_get_result !='') {
                                        $url= JURI::base() . "index.php?option=com_marketplace&view=marketplace&layout=edit_seller_form&deauth=true&seller_id=".$info->seller_id;
                                        ?>
                                        <script type="text/javascript">
                                            jQuery("#stripeconnect").attr("checked", "true");
                                            jQuery("#jform_seller_stripe_id").show();
                                            jQuery("#jform_seller_stripe_id").val("<?php echo 'account id :  '.$wk_get_result;?>");
                                        </script>
                                        <?php
                                    }
                                }
                                ?>
                        </div>
                    </div>
              </div>
          </div>
        </div>
        <input type="hidden" name="seller_id" value="<?php echo $info->seller_id;?>">
        <input type="hidden" name="task" value="" />
        <?php echo JHtml::_('form.token'); ?>
      </form>
    </div>
  </div>
</div>
<style>
.wk_payment_ids {
    display: inline-block;
}
.wk_payment_single {
    width: 200px;
    display: inline-block;
}

.wk_payment_ids input:focus {
    padding: 5px;
    border-radius: 4px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function () {
    document.formvalidator.setHandler('name', function (value) {
        var regex=/^[a-zA-Z ]+$/;
        return regex.test(value); 
    });
    document.formvalidator.setHandler('screen', function(value) {
        var nm =/^[A-Za-z0-9 ]+$/;
        return nm.test(value);
    });
    document.formvalidator.setHandler('phone', function(value=0) {
        var mob =/^[+\-\(\) 0-9]{5,20}$/;
        return mob.test(value);
    });
    document.formvalidator.setHandler('company', function(value) {
        var nm =/^[A-Za-z0-9 _]{3,40}$/;
        return nm.test(value);
    });
    document.formvalidator.setHandler('zip', function(value) {
        var nm =/^[A-Za-z0-9 ]{3,40}$/;
        return nm.test(value);
    });
    jQuery('#<?php echo $country_html_id; ?>').on('change', function(){
        var countryid = jQuery(this).children(":selected").attr('data-id');
        jQuery.ajax({
            type:"post",
            url:"<?php echo JRoute::_(
                'index.php?option=com_marketplace&view=marketplace&task=marketplace.getCountryState',
                false
            )?>",
            data: {ID : countryid},
            success:function(data){
                jQuery("#virtuemart_state_id").html(data);
                jQuery("#virtuemart_state_id").chosen("destroy");
                jQuery("#virtuemart_state_id").chosen();
            }
        });
    });
    
    jQuery(".wk_payment_single input[type=checkbox]").on("change", function () {
        var field_id = jQuery(this).attr("data-field");
        var checked = jQuery(this).prop("checked");
        if (checked) {
            jQuery("#" + field_id).prop("disabled", null);
            jQuery("#" + field_id).focus();
        } else {
            jQuery("#" + field_id).prop("disabled", true);
        }
    });
    jQuery(".wk_payment_ids input[type=text]").on("blur", function () {
        var value = jQuery(this).val();
        var id = jQuery(this).attr("id");
        if (value.trim() == "") {
            jQuery(".wk_payment_single input[data-field=" + id + "]").prop("checked", null);
            jQuery(this).prop("disabled", true);
        }
    });
});

function readURL(input, ids) {

    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {

            jQuery(ids).attr('src', e.target.result);
        }
        reader.readAsDataURL(input.files[0]);
    }
}
jQuery('body').on('change', '#jform_cover', function () {

    readURL(this, '.sellerimg1');
});
jQuery('body').on('change', '#jform_shoplogo', function () {

    readURL(this, '.sellerimg2');
});
jQuery('body').on('change', '#jform_avatar', function () {

    readURL(this, '.avatarimg');
});
jQuery(function () {
    initialize();
});
var oldMarker;

function initialize() {
    var icon = "green";
    var latlng = {
        lat: <?php echo ' '.$lg; ?>,
        lng: <?php echo ' '.$lt; ?>
    };
    var map = new google.maps.Map(document.getElementById('map_canvas'), {
        zoom: 12,
        center: latlng
    });
    icon = "//maps.google.com/mapfiles/ms/icons/" + icon + ".png";
    var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: new google.maps.MarkerImage(icon),
        title: 'saved location'
    });
    google.maps.event.addListener(map, 'click', function (event) {
        jQuery('#jform_latitude').val(event.latLng.lat());
        jQuery('#jform_logtitude').val(event.latLng.lng());
        placeMarker(event.latLng);
    });

    function placeMarker(location) {
        var iconBase = '//maps.google.com/mapfiles/kml/shapes/';
        var infowindow = new google.maps.InfoWindow({
            content: 'Your location'
        });
        icon = "red";
        icon = "//maps.google.com/mapfiles/ms/icons/" + icon + ".png";
        marker1 = new google.maps.Marker({
            position: location,
            map: map,
            icon: new google.maps.MarkerImage(icon),
            animation: google.maps.Animation.BOUNCE
        });
        if (oldMarker != undefined) {
            oldMarker.setMap(null);
        }
        oldMarker = marker1;
        map.setCenter(location);
        marker1.addListener('click', function () {
            infowindow.open(map, marker1);
        });
    }
    var input = document.getElementById('pac_input');
    var searchBox = new google.maps.places.SearchBox(input);
    map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
    map.addListener('bounds_changed', function () {
        searchBox.setBounds(map.getBounds());
    });
    var markers = [];
    searchBox.addListener('places_changed', function () {
        var places = searchBox.getPlaces();
        if (places.length == 0) {
            return;
        }
        markers.forEach(function (marker) {
            marker.setMap(null);
        });
        markers = [];
        var bounds = new google.maps.LatLngBounds();
        places.forEach(function (place) {
            var icon = {
                url: place.icon,
                size: new google.maps.Size(71, 71),
                origin: new google.maps.Point(0, 0),
                anchor: new google.maps.Point(17, 34),
                scaledSize: new google.maps.Size(25, 25)
            };
            // Create a marker for each place.
            markers.push(new google.maps.Marker({
                map: map,
                icon: icon,
                title: place.name,
                position: place.geometry.location
            }));
            if (place.geometry.viewport) {
                // Only geocodes have viewport.
                bounds.union(place.geometry.viewport);
            } else {
                bounds.extend(place.geometry.location);
            }
        });
        map.fitBounds(bounds);
    });
}

</script>