<?php echo $header; ?><?php echo $column_left; ?>
<div id="content">
    <div class="page-header">
        <div class="container-fluid">
            <div class="pull-right">
                <button type="submit" form="form-useepay" data-toggle="tooltip" title="<?php echo $button_save; ?>"
                        class="btn btn-primary"><i class="fa fa-save"></i></button>
                <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>"
                   class="btn btn-default"><i class="fa fa-reply"></i></a></div>
            <h1><?php echo $heading_title; ?></h1>
            <ul class="breadcrumb">
                <?php foreach ($breadcrumbs as $breadcrumb) { ?>
                <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
                <?php } ?>
            </ul>
        </div>
    </div>
    <div class="container-fluid">
        <?php if ($error_warning) { ?>
        <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
            <button type="button" class="close" data-dismiss="alert">&times;</button>
        </div>
        <?php } ?>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
        </div>
        <div class="panel-body">
            <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-useepay"
                  class="form-horizontal">
                <!-- title -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label" for="input-payment-title"><?php echo $entry_payment_title; ?></label>
                    <div class="col-sm-10">
                        <input type="text" name="useepay_payment_title" value="<?php echo $useepay_payment_title; ?>"
                               placeholder="<?php echo $entry_payment_title; ?>" id="input-title" class="form-control"/>
                        <?php if ($error_payment_title) { ?>
                        <div class="text-danger"><?php echo $error_payment_title; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- merchant_no -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label"
                           for="input-merchant"><?php echo $entry_merchant_no; ?></label>
                    <div class="col-sm-10">
                        <input id="input-merchant" type="text" name="useepay_merchant_no"
                               value="<?php echo $useepay_merchant_no; ?>"
                               placeholder="<?php echo $entry_merchant_no; ?>"
                               class="form-control"/>
                        <?php if ($error_merchant_no) { ?>
                        <div class="text-danger"><?php echo $error_merchant_no; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- sign type -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label"
                           for="input-sign-type"><?php echo $entry_sign_type; ?></label>
                    <div class="col-sm-10">
                        <select id="input-sign-type" name="useepay_sign_type" class="form-control">
                            <?php foreach ($sign_types as $sign_type) { ?>
                            <?php if ($sign_type == $useepay_sign_type) { ?>
                            <option value="<?php echo $sign_type; ?>"
                                    selected="selected"><?php echo $sign_type; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $sign_type; ?>"><?php echo $sign_type; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- sign key -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label" for="input-sign-key"><?php echo $entry_sign_key; ?></label>
                    <div class="col-sm-10">
                        <input id="input-sign-key" type="text" name="useepay_sign_key" value="<?php echo $useepay_sign_key; ?>"
                               placeholder="<?php echo $entry_sign_key; ?>" class="form-control"/>
                        <?php if ($error_sign_key) { ?>
                        <div class="text-danger"><?php echo $error_sign_key; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- app id -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label"
                           for="input-app-id"><?php echo $entry_app_id; ?></label>
                    <div class="col-sm-10">
                        <input id="input-app-id" type="text" name="useepay_app_id"
                               value="<?php echo $useepay_app_id; ?>"
                               placeholder="<?php echo $entry_app_id; ?>"
                               class="form-control"/>
                        <?php if ($error_app_id) { ?>
                        <div class="text-danger"><?php echo $error_app_id; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- transaction expiration time -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label"
                           for="input-transaction-expiration-time"><?php echo $entry_transaction_expiration_time; ?></label>
                    <div class="col-sm-10">
                        <input id="input-transaction-expiration-time" type="text" name="useepay_transaction_expiration_time"
                               value="<?php echo $useepay_transaction_expiration_time ? $useepay_transaction_expiration_time : 30; ?>"
                               placeholder="<?php echo $entry_transaction_expiration_time; ?>"
                               class="form-control"/>
                        <?php if ($error_transaction_expiration_time) { ?>
                        <div class="text-danger"><?php echo $error_transaction_expiration_time; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- 支付页面显示'支持的卡组织图标'的配置 -->
                <div class="form-group required">
                    <label class="col-sm-2 control-label"
                           for="input-supported-pay-type"><?php echo $entry_supported_card_type; ?></label>
                    <div class="col-sm-10">
                        <?php foreach($card_types as $card_type){ ?>
                        <?php if(isset($useepay_supported_card_type) && in_array($card_type,$useepay_supported_card_type)){ ?>
                        <label class="checkbox-inline"><input type="checkbox"
                                                              name="useepay_supported_card_type[]"
                                                              value="<?php echo $card_type; ?>"
                                                              checked>&nbsp; <?php echo $card_type; ?>
                        </label>
                        <?php } else { ?>
                        <label class="checkbox-inline"><input type="checkbox"
                                                              name="useepay_supported_card_type[]"
                                                              value="<?php echo $card_type; ?>">&nbsp; <?php echo $card_type; ?>
                        </label>
                        <?php } ?>
                        <?php } ?>
                        <?php if($error_supported_card_type){ ?>
                        <div class="text-danger"><?php echo $error_supported_card_type; ?></div>
                        <?php } ?>
                    </div>
                </div>

                <!-- order status -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="useepay-order-status"><?php echo $entry_order_status; ?></label>
                    <div class="col-sm-10">
                        <select id="useepay-order-status" name="useepay_order_status_id" class="form-control">
                            <?php foreach ($order_statuses as $order_status) { ?>
                            <?php if ($order_status['order_status_id'] == $useepay_order_status_id) { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"
                                    selected="selected"><?php echo $order_status['name']; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"><?php echo $order_status['name']; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- success order status -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="useepay-success-order-status"><?php echo $entry_success_order_status; ?></label>
                    <div class="col-sm-10">
                        <select id="useepay-success-order-status" name="useepay_succeed_order_status_id" class="form-control">
                            <?php foreach ($order_statuses as $order_status) { ?>
                            <?php if ($order_status['order_status_id'] == $useepay_succeed_order_status_id) { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"
                                    selected="selected"><?php echo $order_status['name']; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"><?php echo $order_status['name']; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- failed order status -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="useepay-failed-order-status"><?php echo $entry_failed_order_status; ?></label>
                    <div class="col-sm-10">
                        <select id="useepay-failed-order-status" name="useepay_failed_order_status_id" class="form-control">
                            <?php foreach ($order_statuses as $order_status) { ?>
                            <?php if ($order_status['order_status_id'] == $useepay_failed_order_status_id) { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"
                                    selected="selected"><?php echo $order_status['name']; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $order_status['order_status_id']; ?>"><?php echo $order_status['name']; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- Geo Zone -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="useepay-geo-zone"><?php echo $entry_geo_zone; ?></label>
                    <div class="col-sm-10">
                        <select id="useepay-geo-zone" name="useepay_geo_zone_id" class="form-control">
                            <option value="0"><?php echo $text_all_zones; ?></option>
                            <?php foreach ($geo_zones as $geo_zone) { ?>
                            <?php if ($geo_zone['geo_zone_id'] == $useepay_geo_zone_id) { ?>
                            <option value="<?php echo $geo_zone['geo_zone_id']; ?>"
                                    selected="selected"><?php echo $geo_zone['name']; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $geo_zone['geo_zone_id']; ?>"><?php echo $geo_zone['name']; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- status:插件状态 -->
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-status"><?php echo $entry_status; ?></label>
                    <div class="col-sm-10">
                        <select id="input-status" name="useepay_status" class="form-control">
                            <?php if ($useepay_status) { ?>
                            <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                            <option value="0"><?php echo $text_disabled; ?></option>
                            <?php } else { ?>
                            <option value="1"><?php echo $text_enabled; ?></option>
                            <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- sort order -->
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="input-sort"><?php echo $entry_sort_order; ?></label>
                    <div class="col-sm-10">
                        <input id="input-sort" type="text" name="useepay_sort_order"
                               value="<?php echo $useepay_sort_order; ?>"
                               size="1" class="form-control"/>
                    </div>
                </div>

                <!-- transaction type -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="input-transaction-type"><?php echo $entry_transaction_type; ?></label>
                    <div class="col-sm-10">
                        <select id="input-transaction-type" name="useepay_transaction_type" class="form-control">
                            <?php foreach ($transaction_types as $transaction_type) { ?>
                            <?php if ($transaction_type == $useepay_transaction_type) { ?>
                            <option value="<?php echo $transaction_type; ?>"
                                    selected="selected"><?php echo $transaction_type; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $transaction_type; ?>"><?php echo $transaction_type; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- payment method -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="input-payment-method"><?php echo $entry_payment_method; ?></label>
                    <div class="col-sm-10">
                        <select id="input-payment-method" name="useepay_payment_method" class="form-control">
                            <?php foreach ($payment_methods as $payment_method) { ?>
                            <?php if ($payment_method == $useepay_payment_method) { ?>
                            <option value="<?php echo $payment_method; ?>"
                                    selected="selected"><?php echo $payment_method; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $payment_method; ?>"><?php echo $payment_method; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

                <!-- env setting -->
                <div class="form-group">
                    <label class="col-sm-2 control-label"
                           for="input-payment-env"><?php echo $entry_payment_env; ?></label>
                    <div class="col-sm-10">
                        <select id="input-payment-env" name="useepay_env" class="form-control">
                            <?php foreach ($environments as $env) { ?>
                            <?php if ($env['value'] == $useepay_env) { ?>
                            <option value="<?php echo $env['value']; ?>"
                                    selected="selected"><?php echo $env['key']; ?></option>
                            <?php } else { ?>
                            <option value="<?php echo $env['value']; ?>"><?php echo $env['key']; ?></option>
                            <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</div>
<?php echo $footer; ?>