<section class="content-header">
    <h1><?= __('Direct market plugin settings') ?></h1>
</section>

<section class="content">

    <div class="box box-default">
        <form data-ajax class="form-focus" action="<?= admin_url_to('/direct-market/config') ?>" method="post">
            <?= csrf_field() ?>

            <div class="box-body">
                <div class="section">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
                            <h5><?= __('Settings') ?></h5>
                        </div>

                        <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
                            <div class="row">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label class="control-label" for="rescue-percentage"><?= __('Rescue percentage') ?></label>
                                        <input class="form-control" id="rescue-percentage" value="<?= config('direct-market.rescue_percentage') ?>" name="rescue_percentage" />
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label class="control-label" for="min-price"><?= __('Min price') ?></label>
                                        <input class="form-control money" id="min-price" value="<?= util('Number')->format(config('direct-market.min_price', 0), 2, ',', '.') ?>" name="min_price" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="section">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
                            <h5><?= __('Gateways') ?></h5>
                        </div>

                        <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
                            <?php foreach ($gateways as $gateway => $config): ?>
                                <?php if ($config['active']): ?>
                                    <div style="width:50%;margin-bottom:5px;float:left">
                                        <input<?= in_array($gateway, config('direct-market.gateways', [])) ? ' checked' : '' ?> type="checkbox" name="gateways[]" id="gateway-<?= $gateway ?>" value="<?= $gateway ?>" /> <label for="gateway-<?= $gateway ?>"><?= $gateway ?></label>
                                    </div>
                                <?php endif ?>
                            <?php endforeach ?>
                        </div>
                    </div>
                </div>
            </div>

            <div class="box-footer">
                <div class="row">
                    <div class="col-sm-offset-3" style="padding-left:15px">
                        <input type="submit" class="btn btn-primary" value="<?= __('Save') ?>" />
                    </div>
                </div>
            </div>
        </form>
    </div>
</section>