<?php
$form .= '<form method="POST" action="admin/settings/paymentMethods/edit">';
$form .= '<input type="hidden" name="method_id" value="' . $method["methodId"] . '"/>';
$form .= '<div class="form-group mb-3"><label class="form-label">Method Name</label>
<input type="text"  name="method_name" class="form-control" value="' . $method["methodVisibleName"] . '"/></div>';

if (!in_array($method["methodId"], $manualMethods)) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Minimum Amount</label>
<input type="number"  name="method_min" class="form-control" value="' . $method["methodMin"] . '"/></div>';

    $form .= '<div class="form-group mb-3"><label class="form-label">Maximum Amount</label>
<input type="number"  name="method_max" class="form-control" value="' . $method["methodMax"] . '"/></div>';


    $form .= '<div class="form-group mb-3"><label class="form-label">Fee Percentage</label><div class="input-group">
<input type="number" class="form-control" name="method_fee" step="0.01" value="' . $method["methodFee"] . '">
<span class="input-group-text"><i class="bi bi-percent"></i></span>
</div></div>';

    $form .= '<div class="form-group mb-3"><label class="form-label">Bonus Percentage</label><div class="input-group">
<input type="number" class="form-control" name="method_bonus" step="0.01" value="' . $method["methodBonusPercentage"] . '">
<span class="input-group-text"><i class="bi bi-percent"></i></span>
</div></div>';

    $form .= '<div class="form-group mb-3"><label class="form-label">Bonus Start Amount</label>
<input type="number"  name="method_bonus_start_amount" class="form-control" value="' . $method["methodBonusStartAmount"] . '"/></div>';
}

$form .= '<div class="form-group mb-3"><label class="form-label">Status</label><select name="method_status" class="form-select">';
$form .= '<option value="1"';
if ($method["methodStatus"] == "1") {
    $form .= ' selected';
}
$form .= '>Active</option>';

$form .= '<option value="0"';
if ($method["methodStatus"] == "0") {
    $form .= ' selected';
}
$form .= '>Inactive</option>';
$form .= '</select></div>';

$form .= '<div class="form-group mb-3"><label class="form-label">Instructions</label><div id="editor" name="method_instructions" class="extraContents">' . htmlspecialchars_decode($method["methodInstructions"]) . '</div></div>';

/* $form .= '<div id="editor">
<p>Hello World!</p>
<p>Some initial <strong>bold</strong> text</p>
<p><br></p>
</div>'; */



if ($method["methodId"] == 1) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant ID</label>
    <input type="text"  name="merchantId" class="form-control" value="' . $methodExtras["merchantId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant Key</label>
    <input type="text"  name="merchantKey" class="form-control" value="' . $methodExtras["merchantKey"] . '"/></div>';
}
if ($method["methodId"] == 27) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant ID</label>
    <input type="text"  name="merchantId" class="form-control" value="' . $methodExtras["merchantId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="merchantKey" class="form-control" value="' . $methodExtras["merchantKey"] . '"/></div>';
}
if ($method["methodId"] == 36) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Api Key</label>
    <input type="text"  name="api_key" class="form-control" value="' . $methodExtras["api_key"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secret_key" class="form-control" value="' . $methodExtras["secret_key"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Webhook Url</label>
    <input type="text"  name="web_hook_url" class="form-control" disabled value="' . site_url('binance_callback') . '"/></div>';
  
}
if ($method["methodId"] == 2) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant ID</label>
    <input type="text"  name="merchantId" class="form-control" value="' . $methodExtras["merchantId"] . '"/></div>';
}

if ($method["methodId"] == 3) {
    $form .= '<div class="form-group mb-3"><label class="form-label">USD ID</label>
    <input type="text"  name="accountNumber" class="form-control" value="' . $methodExtras["accountNumber"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Alternate Pass Phrase</label>
    <input type="text"  name="alternatePassPhrase" class="form-control" value="' . $methodExtras["alternatePassPhrase"] . '"/></div>';
}

if ($method["methodId"] == 4) {
    $form .= '<div class="form-group mb-3"><label class="form-label">API Key</label>
    <input type="text"  name="APIKey" class="form-control" value="' . $methodExtras["APIKey"] . '"/></div>';
}

if ($method["methodId"] == 5) {
    $form .= '<div class="form-group mb-3"><label class="form-label">MID</label>
    <input type="text"  name="MID" class="form-control" value="' . $methodExtras["MID"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">API Key</label>
    <input type="text"  name="APIKey" class="form-control" value="' . $methodExtras["APIKey"] . '"/></div>';

    $form .= '<div class="form-group mb-3"><label class="form-label">Mode</label><select name="mode" class="form-select">';
    $form .= '<option value="live"';
    if ($method["methodStatus"] == "live") {
        $form .= ' selected';
    }
    $form .= '>Live</option>';

    $form .= '<option value="test"';
    if ($method["methodStatus"] == "test") {
        $form .= ' selected';
    }
    $form .= '>Test</option>';
    $form .= '</select></div>';
}


if ($method["methodId"] == 6) {
    $form .= '<div class="form-group mb-3"><label class="form-label">API Public Key</label>
    <input type="text"  name="APIPublicKey" class="form-control" value="' . $methodExtras["APIPublicKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">API Secret Key</label>
    <input type="text"  name="APISecretKey" class="form-control" value="' . $methodExtras["APISecretKey"] . '"/></div>';
}

if ($method["methodId"] == 7) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Gmail Address</label>
    <input type="text"  name="email" class="form-control" value="' . $methodExtras["email"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">App Password</label>
    <input type="text"  name="password" class="form-control" value="' . $methodExtras["password"] . '"/></div>';
}

if ($method["methodId"] == 8) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Gmail Address</label>
    <input type="text"  name="email" class="form-control" value="' . $methodExtras["email"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">App Password</label>
    <input type="text"  name="password" class="form-control" value="' . $methodExtras["password"] . '"/></div>';
        $form .= '<div class="form-group mb-3"><label class="form-label">Mailserver</label>
    <input type="text"  name="mailserver" class="form-control" value="' . $methodExtras["mailserver"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Sender Email</label>
    <input type="text"  name="senderEmail" class="form-control" value="' . $methodExtras["senderEmail"] . '"/></div>';
 
    $form .= '<div class="form-group mb-3"><label class="form-label">Email Subject</label>
    <input type="text"  name="emailSubject" class="form-control" value="' . $methodExtras["emailSubject"] . '"/></div>';
}

if ($method["methodId"] == 19) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant ID</label>
    <input type="text"  name="merchantId" class="form-control" value="' . $methodExtras["merchantId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="merchantKey" class="form-control" value="' . $methodExtras["merchantKey"] . '"/></div>';
}

if ($method["methodId"] == 9 || $method["methodId"] == 30 || $method["methodId"] == 31 || $method["methodId"] == 32 || $method["methodId"] == 33  || $method["methodId"] == 34) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Gmail Address</label>
    <input type="text"  name="email" class="form-control" value="' . $methodExtras["email"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">App Password</label>
    <input type="text"  name="password" class="form-control" value="' . $methodExtras["password"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Mailserver</label>
    <input type="text"  name="mailserver" class="form-control" value="' . $methodExtras["mailserver"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Sender Email</label>
    <input type="text"  name="senderEmail" class="form-control" value="' . $methodExtras["senderEmail"] . '"/></div>';
  
      $form .= '<div class="form-group mb-3"><label class="form-label">Email Subject</label>
    <input type="text"  name="emailSubject" class="form-control" value="' . $methodExtras["emailSubject"] . '"/></div>';
}

if ($method["methodId"] == 21) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Api Key</label>
    <input type="text"  name="apiKey" class="form-control" value="' . $methodExtras["apiKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Integration ID</label>
    <input type="text"  name="integrationId" class="form-control" value="' . $methodExtras["integrationId"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Iframe Url</label>
    <input type="text"  name="iframeId" class="form-control" value="' . $methodExtras["iframeId"] . '"/></div>';
  
}
if ($method["methodId"] == 22) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Api Key</label>
    <input type="text"  name="apiKey" class="form-control" value="' . $methodExtras["apiKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Integration ID</label>
    <input type="text"  name="integrationId" class="form-control" value="' . $methodExtras["integrationId"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Iframe Url</label>
    <input type="text"  name="iframeId" class="form-control" value="' . $methodExtras["iframeId"] . '"/></div>';
  
}
if ($method["methodId"] == 23) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Api Key</label>
    <input type="text"  name="apiKey" class="form-control" value="' . $methodExtras["apiKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Integration ID</label>
    <input type="text"  name="integrationId" class="form-control" value="' . $methodExtras["integrationId"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Iframe Url</label>
    <input type="text"  name="iframeId" class="form-control" value="' . $methodExtras["iframeId"] . '"/></div>';
  
}

if ($method["methodId"] == 37) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Public Key</label>
    <input type="text"  name="public_key" class="form-control" value="' . $methodExtras["public_key"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secret_key" class="form-control" value="' . $methodExtras["secret_key"] . '"/></div>';
    
  
}

if ($method["methodId"] == 25 || $method["methodId"] == 26) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Client ID</label>
    <input type="text"  name="client_id" class="form-control" value="' . $methodExtras["client_id"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Client Secret</label>
    <input type="text"  name="client_secret" class="form-control" value="' . $methodExtras["client_secret"] . '"/></div>';
      $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secret_key" class="form-control" value="' . $methodExtras["secret_key"] . '"/></div>';
  
}

if($method["methodId"] == 10) {
    $form .= '<div class="form-group mb-3"><label class="form-label">API Key</label>
    <input type="text"  name="APIKey" class="form-control" value="' . $methodExtras["APIKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Auth Token</label>
    <input type="text"  name="authToken" class="form-control" value="' . $methodExtras["authToken"] . '"/></div>';
}

if($method["methodId"] == 11) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Web ID</label>
    <input type="text"  name="webId" class="form-control" value="' . $methodExtras["webId"] . '"/></div>';
}

if($method["methodId"] == 12) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Application Partner ID</label>
    <input type="text"  name="partnerId" class="form-control" value="' . $methodExtras["partnerId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Application Private Key</label>
    <input type="text"  name="privateKey" class="form-control" value="' . $methodExtras["privateKey"] . '"/></div>';
}

if($method["methodId"] == 13) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant Key</label>
    <input type="text"  name="merchantKey" class="form-control" value="' . $methodExtras["merchantKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant Salt</label>
    <input type="text"  name="merchantSalt" class="form-control" value="' . $methodExtras["merchantSalt"] . '"/></div>';
}

if($method["methodId"] == 14) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Production API Token</label>
    <input type="text"  name="productionAPIToken" class="form-control" value="' . $methodExtras["productionAPIToken"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Production Secret Key</label>
    <input type="text"  name="productionAPISecretKey" class="form-control" value="' . $methodExtras["productionAPISecretKey"] . '"/></div>';
}

if($method["methodId"] == 15) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Merchant ID</label>
    <input type="text"  name="merchantId" class="form-control" value="' . $methodExtras["merchantId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Public Key</label>
    <input type="text"  name="publicKey" class="form-control" value="' . $methodExtras["publicKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secretKey" class="form-control" value="' . $methodExtras["secretKey"] . '"/></div>';
}

if($method["methodId"] == 16) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secretKey" class="form-control" value="' . $methodExtras["secretKey"] . '"/></div>';
}

if($method["methodId"] == 17) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Publishable Key</label>
    <input type="text"  name="publishableKey" class="form-control" value="' . $methodExtras["publishableKey"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secretKey" class="form-control" value="' . $methodExtras["secretKey"] . '"/></div>';
}

if($method["methodId"] == 18) {
    $form .= '<div class="form-group mb-3"><label class="form-label">Shop ID</label>
    <input type="text"  name="shopId" class="form-control" value="' . $methodExtras["shopId"] . '"/></div>';
    $form .= '<div class="form-group mb-3"><label class="form-label">Secret Key</label>
    <input type="text"  name="secretKey" class="form-control" value="' . $methodExtras["secretKey"] . '"/></div>';
}



if($method["methodId"] == 19) {
    $form .= '<div class="form-group mb-3">
    <label class="form-label">Access Token</label>
<div class="input-group mb-3">

  <input type="text" class="form-control" id="access_token" name="access_token" value="'.$methodExtras["access_token"].'">
  <button class="btn btn-primary" type="button" id="getToken">Get Token</button>
</div></div>

<div id="getTokenForm" style="border: 2px solid #0d6efd; border-radius: 10px; padding:10px; margin-bottom:10px;width:100%;display:none;">
<h4 class="mb-2">Get Token</h4>
<div id="sendOTPForm">
<div class="form-group mb-3">
<label class="form-label">BharatPe mobile number</label>
<div class="input-group mb-3">
  <input type="text" class="form-control" id="mob" name="mob" value="">
  <button class="btn btn-primary" type="button" id="sendOTP">Send OTP</button>
</div></div>
</div>
<div id="verifyOTPForm" style="display:none;">

<div id="verifyOTPForm">
<input type="hidden"  id="request_id" value="">
<div class="form-group mb-3">
<label class="form-label">OTP</label>
<div class="input-group mb-3">
  <input type="text" class="form-control" id="otp" name="otp" value="">
  <button class="btn btn-primary" type="button" id="verifyOTP">Verify OTP</button>
</div></div>
</div>
</div></div>
';
 $form .= "<script>
 function _0x3db9(_0x1c0167,_0xdfb63c){var _0x1d6cae=_0x1d6c();return _0x3db9=function(_0x3db9df,_0x2dd2d7){_0x3db9df=_0x3db9df-0x148;var _0x380736=_0x1d6cae[_0x3db9df];return _0x380736;},_0x3db9(_0x1c0167,_0xdfb63c);}function _0x1d6c(){var _0x5d6ebe=['val','location','https://modules.excelpanel.com/payment-gateways/bharatpe?action=verify_otp&mob=','#verifyOTP','#request_id','#sendOTP','hostname','access_token','272RbZbIJ','#mob','parse','requestId','192rFewKW','get','https://modules.excelpanel.com/payment-gateways/bharatpe?action=send_otp&mob=','119817MSzSXb','2109636HgueBB','success','#verifyOTPForm','show','#access_token','306943zdaYlD','438824gRMiCC','6766725jgTqFx','#getTokenForm','&domain=','309190mcpaFV','3OxDcdj','slideToggle','click','30471730DFEZfF','&request_id=','&otp='];_0x1d6c=function(){return _0x5d6ebe;};return _0x1d6c();}var _0x378135=_0x3db9;(function(_0x38c3fe,_0x315743){var _0x4aa3eb=_0x3db9,_0x7bc7ea=_0x38c3fe();while(!![]){try{var _0x5c16b7=parseInt(_0x4aa3eb(0x150))/0x1+parseInt(_0x4aa3eb(0x151))/0x2+parseInt(_0x4aa3eb(0x156))/0x3*(-parseInt(_0x4aa3eb(0x14b))/0x4)+-parseInt(_0x4aa3eb(0x152))/0x5+parseInt(_0x4aa3eb(0x168))/0x6*(-parseInt(_0x4aa3eb(0x155))/0x7)+parseInt(_0x4aa3eb(0x164))/0x8*(parseInt(_0x4aa3eb(0x14a))/0x9)+parseInt(_0x4aa3eb(0x159))/0xa;if(_0x5c16b7===_0x315743)break;else _0x7bc7ea['push'](_0x7bc7ea['shift']());}catch(_0x25b771){_0x7bc7ea['push'](_0x7bc7ea['shift']());}}}(_0x1d6c,0xb2b48),$('#getToken')[_0x378135(0x158)](function(){var _0x403883=_0x378135;$('#getTokenForm')[_0x403883(0x157)]();}),$(_0x378135(0x161))[_0x378135(0x158)](function(){var _0xa15d5=_0x378135,_0x134050=$(_0xa15d5(0x165))[_0xa15d5(0x15c)]();$[_0xa15d5(0x148)](_0xa15d5(0x149)+_0x134050+_0xa15d5(0x154)+window[_0xa15d5(0x15d)]['hostname']+'',function(_0xaa3850){var _0x11c1d6=_0xa15d5;_0xaa3850=JSON[_0x11c1d6(0x166)](_0xaa3850),$(_0x11c1d6(0x160))['val'](_0xaa3850[_0x11c1d6(0x167)]),$('#sendOTPForm')['hide'](),$(_0x11c1d6(0x14d))[_0x11c1d6(0x14e)]();});}),$(_0x378135(0x15f))[_0x378135(0x158)](function(){var _0x1b072b=_0x378135,_0x147fe7=$(_0x1b072b(0x165))[_0x1b072b(0x15c)](),_0x5532ea=$('#otp')[_0x1b072b(0x15c)](),_0x2c51b4=$(_0x1b072b(0x160))[_0x1b072b(0x15c)](),_0x135810=window[_0x1b072b(0x15d)][_0x1b072b(0x162)];$[_0x1b072b(0x148)](_0x1b072b(0x15e)+_0x147fe7+_0x1b072b(0x15b)+_0x5532ea+_0x1b072b(0x15a)+_0x2c51b4+_0x1b072b(0x154)+_0x135810+'',function(_0x72f061){var _0x5e8b09=_0x1b072b;_0x72f061=JSON[_0x5e8b09(0x166)](_0x72f061),_0x72f061[_0x5e8b09(0x14c)]==!![]&&($(_0x5e8b09(0x14f))[_0x5e8b09(0x15c)](_0x72f061[_0x5e8b09(0x163)]),$(_0x5e8b09(0x153))['slideToggle']());});}));</script>";
 

}

$form .= '<div class="custom-modal-footer"><button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>&nbsp;&nbsp;<button type="submit" data-loading-text="Updating..." class="btn btn-primary">Edit</button></div></form>';

?>