{include file="sections/header.tpl"}

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-12 col-md-8 col-md-offset-2">
            <div class="card card-primary card-hovered card-stacked mb30">
                <div class="card-header">
                    <h4>{Lang::T('Edit Bank')} - {$bank->name}</h4>
                </div>
                <div class="card-body">
                    <form method="post" action="{$_url}banks/save" class="form-horizontal">
                        <input type="hidden" name="id" value="{$bank->id}">
                        
                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Bank Name')} <span class="text-danger">*</span></label>
                            <div class="col-md-9">
                                <input type="text" name="name" class="form-control" placeholder="{Lang::T('Enter bank name')}" 
                                       value="{$bank->name}" required>
                                <small class="text-muted">{Lang::T('e.g., Safaricom M-Pesa, Equity Bank, KCB Bank')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Account Number')} <span class="text-danger">*</span></label>
                            <div class="col-md-9">
                                <input type="text" name="account_number" class="form-control" placeholder="{Lang::T('Enter account number')}" 
                                       value="{$bank->account_number}" required>
                                <small class="text-muted">{Lang::T('The account number for STK Push payments')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Account Name')} <span class="text-danger">*</span></label>
                            <div class="col-md-9">
                                <input type="text" name="account_name" class="form-control" placeholder="{Lang::T('Enter account holder name')}" 
                                       value="{$bank->account_name}" required>
                                <small class="text-muted">{Lang::T('Name of the account holder')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Bank Code')}</label>
                            <div class="col-md-9">
                                <input type="text" name="bank_code" class="form-control" placeholder="{Lang::T('Enter bank code')}" 
                                       value="{$bank->bank_code}" maxlength="10">
                                <small class="text-muted">{Lang::T('e.g., MPESA, EQTY, KCB')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Paybill Number')}</label>
                            <div class="col-md-9">
                                <input type="text" name="paybill" class="form-control" placeholder="{Lang::T('Enter paybill number')}" 
                                       value="{$bank->paybill}">
                                <small class="text-muted">{Lang::T('M-Pesa paybill number (if applicable)')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('STK Push Support')}</label>
                            <div class="col-md-9">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" name="supports_stk_push" value="1" 
                                               {if $bank->supports_stk_push}checked{/if}>
                                        {Lang::T('This bank supports STK Push payments')}
                                    </label>
                                </div>
                                <small class="text-muted">{Lang::T('Only banks with STK Push support can be used for BankStkPush payments')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Status')}</label>
                            <div class="col-md-9">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" name="is_active" value="1" 
                                               {if $bank->is_active}checked{/if}>
                                        {Lang::T('Active')}
                                    </label>
                                </div>
                                <small class="text-muted">{Lang::T('Only active banks can be used for payments')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-3 control-label">{Lang::T('Set as Default')}</label>
                            <div class="col-md-9">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" name="is_default" value="1" 
                                               {if $bank->is_default}checked{/if}>
                                        {Lang::T('Set as default bank for STK Push')}
                                    </label>
                                </div>
                                <small class="text-muted">{Lang::T('This will make this bank the default selection for BankStkPush configuration')}</small>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-9 col-md-offset-3">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-save"></i> {Lang::T('Update Bank')}
                                </button>
                                <a href="{$_url}banks/list" class="btn btn-secondary">
                                    <i class="fa fa-arrow-left"></i> {Lang::T('Back to List')}
                                </a>
                                <a href="{$_url}banks/delete/{$bank->id}" class="btn btn-danger pull-right" 
                                   onclick="return confirm('{Lang::T('Are you sure you want to delete this bank?')}')">
                                    <i class="fa fa-trash"></i> {Lang::T('Delete')}
                                </a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


{include file="sections/footer.tpl"}
