<?php
/* Smarty version 4.5.3, created on 2026-02-21 09:32:09
  from '/var/www/html/kaptembwa/system/paymentgateway/ui/paybilltillsbankmpesa.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.3',
  'unifunc' => 'content_699951690867b3_48453751',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '3fae98fa20798546f6f41cfd9796bfef6d1f47d0' => 
    array (
      0 => '/var/www/html/kaptembwa/system/paymentgateway/ui/paybilltillsbankmpesa.tpl',
      1 => 1770492507,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:sections/header.tpl' => 1,
    'file:sections/footer.tpl' => 1,
  ),
),false)) {
function content_699951690867b3_48453751 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>

<style>
    .payment-header {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        padding: 30px;
        border-radius: 15px;
        margin-bottom: 30px;
        box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
    }
    
    .payment-header h2 {
        margin: 0 0 10px 0;
        font-size: 28px;
        font-weight: 700;
        color: white;
    }
    
    .payment-header p {
        margin: 0;
        opacity: 0.9;
    }
    
    .payment-card {
        background: white;
        border-radius: 15px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        border: 1px solid rgba(0, 0, 0, 0.06);
        overflow: hidden;
        margin-bottom: 25px;
    }
    
    .payment-card-header {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        padding: 20px 25px;
        font-size: 18px;
        font-weight: 600;
        border-bottom: none;
    }
    
    .payment-section {
        padding: 25px;
    }
    
    .form-label {
        font-weight: 600;
        color: #1e293b;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
    }
    
    .form-control, .form-select {
        border-radius: 10px;
        border: 2px solid #e2e8f0;
        padding: 12px 15px;
        transition: all 0.3s ease;
        font-size: 15px;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
    
    .payment-option {
        background: #f8fafc;
        border: 2px solid #e2e8f0;
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 20px;
        transition: all 0.3s ease;
    }
    
    .payment-option:hover {
        border-color: #3b82f6;
        background: #eff6ff;
    }
    
    .btn-submit {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        border: none;
        padding: 15px;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 600;
        color: white;
        transition: all 0.3s ease;
    }
    
    .btn-submit:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
        color: white;
    }
    
    .info-box {
        background: #eff6ff;
        border-left: 4px solid #3b82f6;
        padding: 15px;
        border-radius: 10px;
        margin-top: 10px;
    }
</style>

<div class="payment-header">
    <h2><i class="isax isax-money-recive me-2"></i>Payment Configuration</h2>
    <p>Configure Paybill, Till, or Bank account payment options</p>
</div>

<form method="post" role="form" action="<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
paymentgateway/paybilltillsbankmpesa">
  <div class="row">
    <div class="col-lg-8 offset-lg-2">
      <div class="payment-card">
        <div class="payment-card-header">
          <i class="isax isax-card-tick me-2"></i>Payment Method Setup
        </div>
        <div class="card-body payment-section">

          <!-- Payment Type Selection -->
          <div class="mb-4">
            <label class="form-label"><i class="isax isax-category-2 me-2"></i>Choose Payment Type</label>
            <select class="form-select" name="mpesa_bank_paybill_till_type" id="paymenttype">
              <option value="none" <?php if ($_smarty_tpl->tpl_vars['_c']->value['mpesa_bank_paybill_till_type'] == 'none') {?>selected<?php }?>>📋 -- Select Payment Type --</option>
              <option value="paybill" <?php if ($_smarty_tpl->tpl_vars['_c']->value['mpesa_bank_paybill_till_type'] == 'paybill') {?>selected<?php }?>>💳 Paybill Number</option>
              <option value="till" <?php if ($_smarty_tpl->tpl_vars['_c']->value['mpesa_bank_paybill_till_type'] == 'till') {?>selected<?php }?>>🛒 Buy Goods Till Number</option>
              <option value="bank" <?php if ($_smarty_tpl->tpl_vars['_c']->value['mpesa_bank_paybill_till_type'] == 'bank') {?>selected<?php }?>>🏦 Bank Account</option>
            </select>
          </div>

          <!-- Paybill Input -->
          <div id="paybill-group" class="payment-option" style="display:none;">
            <label class="form-label"><i class="isax isax-wallet-add me-2"></i>Paybill Number</label>
            <input type="text" class="form-control" name="paybilltillsbankmpesa_paybill" placeholder="Enter paybill number (e.g. 123456)"
              value="<?php echo $_smarty_tpl->tpl_vars['_c']->value['paybilltillsbankmpesa_paybill'];?>
">
            <div class="info-box mt-3">
              <small><strong>ℹ️ Info:</strong> Enter your M-Pesa paybill business number.</small>
            </div>
          </div>

          <!-- Till Input -->
          <div id="till-group" class="payment-option" style="display:none;">
            <label class="form-label"><i class="isax isax-shop-add me-2"></i>Till Number</label>
            <input type="text" class="form-control" name="paybilltillsbankmpesa_till" placeholder="Enter till number (e.g. 567890)"
              value="<?php echo $_smarty_tpl->tpl_vars['_c']->value['paybilltillsbankmpesa_till'];?>
">
            <div class="info-box mt-3">
              <small><strong>ℹ️ Info:</strong> Enter your M-Pesa Buy Goods till number.</small>
            </div>
          </div>

          <!-- Bank Account Details -->
          <div id="bank-group" class="payment-option" style="display:none;">
            <div class="mb-3">
              <label class="form-label"><i class="isax isax-bank me-2"></i>Bank Name</label>
              <select class="form-select" name="paybilltillsbankmpesa__bank_paybill_number">
                <option value="">🏦 -- Select Your Bank --</option>
                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['banks']->value, 'bank');
$_smarty_tpl->tpl_vars['bank']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['bank']->value) {
$_smarty_tpl->tpl_vars['bank']->do_else = false;
?>
                  <option value="<?php echo $_smarty_tpl->tpl_vars['bank']->value['paybill'];?>
" <?php if ($_smarty_tpl->tpl_vars['_c']->value['paybilltillsbankmpesa__bank_paybill_number'] == $_smarty_tpl->tpl_vars['bank']->value['paybill']) {?>selected<?php }?>>
                    🏦 <?php echo $_smarty_tpl->tpl_vars['bank']->value['name'];?>
 Bank
                  </option>
                <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
              </select>
            </div>

            <div class="mb-3">
              <label class="form-label"><i class="isax isax-card-pos me-2"></i>Bank Account Number</label>
              <input type="text" class="form-control" name="paybilltillsbankmpesa__mpesa_bank_account_number"
                placeholder="Enter your bank account number" value="<?php echo $_smarty_tpl->tpl_vars['_c']->value['paybilltillsbankmpesa__mpesa_bank_account_number'];?>
">
              <div class="info-box mt-3">
                <small><strong>ℹ️ Info:</strong> Enter the account number linked to your selected bank.</small>
              </div>
            </div>
          </div>

          <!-- Submit Button -->
          <div class="mt-4">
            <button class="btn btn-submit w-100" type="submit">
              <i class="isax isax-save-2 me-2"></i>Save Payment Configuration
            </button>
          </div>

        </div>
      </div>
    </div>
  </div>
</form>

<!-- Include JavaScript for Dynamic Field Handling -->
<?php echo '<script'; ?>
>
  document.addEventListener('DOMContentLoaded', function () {
    const paymentType = document.getElementById('paymenttype');
    const paybillGroup = document.getElementById('paybill-group');
    const tillGroup = document.getElementById('till-group');
    const bankGroup = document.getElementById('bank-group');

    function updateFields() {
      const selected = paymentType.value;
      paybillGroup.style.display = selected === 'paybill' ? 'block' : 'none';
      tillGroup.style.display = selected === 'till' ? 'block' : 'none';
      bankGroup.style.display = selected === 'bank' ? 'block' : 'none';
    }

    paymentType.addEventListener('change', updateFields);
    updateFields(); // Show relevant fields on load
  });
<?php echo '</script'; ?>
>

<?php $_smarty_tpl->_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
}
}
