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

<section class="content">
    <form data-ajax class="form-focus" action="<?= admin_url_to('/donate/gateways/config') ?>" method="post">
        <?= csrf_field() ?>

        <div class="box box-default">
            <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><?= __('Conversions') ?></h5>
                        </div>

                        <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12">
                            <table class="table table-condensed table-hover table-striped">
                                <tbody>
                                    <?php foreach ($currencies as $id => $currency): ?>
                                        <tr>
                                            <td style="vertical-align:middle" width="100">1 <?= $currency ?> = </td>
                                            <td style="white-space:nowrap">
                                                <table style="width:100%">
                                                    <tbody>
                                                    <tr>
                                                        <?php foreach ($currencies as $id2 => $c): ?>
                                                            <?php if ($id === $id2) continue ?>
                                                            <td width="150">
                                                                <input style="width:100px;margin-right:5px;display:inline-block" type="text" value="<?= config('donate.conversion.' . $id . '.' . $id2) ?>" name="conversion_<?= strtolower($id) ?>_<?= strtolower($id2) ?>" class="form-control" /> <?= $c ?>
                                                            </td>
                                                        <?php endforeach ?>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </td>
                                        </tr>
                                    <?php endforeach ?>
                                </tbody>
                            </table>
                        </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">
                            <div class="nav-tabs-custom" style="margin-bottom:0">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#gateway-pagseguro" data-toggle="tab">PagSeguro</a></li>
                                    <li><a href="#gateway-paypal" data-toggle="tab">Paypal</a></li>
                                    <li><a href="#gateway-paymentwall" data-toggle="tab">Paymentwall</a></li>
                                    <?php if (has_plugin_license('PicPayGateway')): ?>
                                        <li><a href="#gateway-picpay" data-toggle="tab">PicPay</a></li>
                                    <?php endif ?>
                                    <li><a href="#gateway-juno" data-toggle="tab">Juno</a></li>
                                    <?php if (has_plugin_license('PagHiper')): ?>
                                        <li><a href="#gateway-paghiper" data-toggle="tab">PagHiper</a></li>
                                    <?php endif ?>
                                    <?php if (has_plugin_license('MercadoPago')): ?>
                                        <li><a href="#gateway-mercadopago" data-toggle="tab">MercadoPago</a></li>
                                    <?php endif ?>
                                </ul>
                                <div class="tab-content" style="padding:10px 0 0">
                                    <div class="tab-pane active" id="gateway-pagseguro">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-pagseguro-active"><?= __('Active') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-pagseguro-active"<?= config('donate.gateways.pagseguro.active') ? 'checked="checked"' : '' ?> value="1" name="pagseguro_active" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-pagseguro-sandbox"><?= __('Sandbox') ?></label>

                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-pagseguro-sandbox"<?= config('donate.gateways.pagseguro.sandbox') ? 'checked="checked"' : '' ?> value="1" name="pagseguro_sandbox" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-pagseguro-email"><?= __('E-mail') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.pagseguro.email') ?>" name="pagseguro_email" id="gateway-pagseguro-email" />
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-pagseguro-token"><?= __('Token') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.pagseguro.token') ?>" name="pagseguro_token" id="gateway-pagseguro-token" />
                                        </div>

                                        <div class="row">
                                            <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-pagseguro-tax"><?= __('Tax') ?></label>
                                                    <div class="input-group">
                                                        <input class="form-control" type="text" value="<?= config('donate.gateways.pagseguro.tax') ?>" name="pagseguro_tax" id="gateway-pagseguro-tax" />

                                                        <span class="input-group-addon">%</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="gateway-paypal">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paypal-active"><?= __('Active') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-paypal-active"<?= config('donate.gateways.paypal.active') ? 'checked="checked"' : '' ?> value="1" name="paypal_active" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paypal-sandbox"><?= __('Sandbox') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-paypal-sandbox"<?= config('donate.gateways.paypal.sandbox') ? 'checked="checked"' : '' ?> value="1" name="paypal_sandbox" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-md-4">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paypal-currencies"><?= __('Allow currencies') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-paypal-currencies"<?= config('donate.gateways.paypal.currency') ? 'checked="checked"' : '' ?> value="1" name="paypal_currencies" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-paypal-client-id"><?= __('Client ID') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.paypal.client_id') ?>" name="paypal_client_id" id="gateway-paypal-client-id" />
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-paypal-client-secret"><?= __('Client secret') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.paypal.client_secret') ?>" name="paypal_client_secret" id="gateway-paypal-client-secret" />
                                        </div>

                                        <div class="row">
                                            <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paypal-tax"><?= __('Tax') ?></label>
                                                    <div class="input-group">
                                                        <input class="form-control" type="text" value="<?= config('donate.gateways.paypal.tax') ?>" name="paypal_tax" id="gateway-paypal-tax" />

                                                        <span class="input-group-addon">%</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="tab-pane" id="gateway-paymentwall">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paymentwall-active"><?= __('Active') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-paymentwall-active"<?= config('donate.gateways.paymentwall.active') ? 'checked="checked"' : '' ?> value="1" name="paymentwall_active" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paymentwall-sandbox"><?= __('Sandbox') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-paymentwall-sandbox"<?= config('donate.gateways.paymentwall.sandbox') ? 'checked="checked"' : '' ?> value="1" name="paymentwall_sandbox" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <label class="control-label" for="gateway-paymentwall-project-key"><?= __('Project key') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.paymentwall.project_key') ?>" name="paymentwall_project_key" id="gateway-paymentwall-project-key" />
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-paymentwall-secret-key"><?= __('Secret key') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.paymentwall.secret_key') ?>" name="paymentwall_secret_key" id="gateway-paymentwall-secret-key" />
                                        </div>

                                        <div class="row">
                                            <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-paymentwall-tax"><?= __('Tax') ?></label>
                                                    <div class="input-group">
                                                        <input class="form-control" type="text" value="<?= config('donate.gateways.paymentwall.tax') ?>" name="paymentwall_tax" id="gateway-paymentwall-tax" />

                                                        <span class="input-group-addon">%</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <?php if (has_plugin_license('PicPayGateway')): ?>
                                        <div class="tab-pane" id="gateway-picpay">
                                            <div class="row">
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-picpay-active"><?= __('Active') ?></label>
                                                        <div>
                                                            <input class="form-control toggle" type="checkbox" id="gateway-picpay-active"<?= config('donate.gateways.picpay.active') ? 'checked="checked"' : '' ?> value="1" name="picpay_active" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="form-group">
                                                <label class="control-label" for="gateway-picpay-token"><?= __('Token') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.picpay.token') ?>" name="picpay_token" id="gateway-picpay-token" />
                                            </div>

                                            <div class="form-group">
                                                <label class="control-label" for="gateway-picpay-seller-token"><?= __('Seller Token') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.picpay.seller_token') ?>" name="picpay_seller_token" id="gateway-picpay-seller-token" />
                                            </div>

                                            <div class="row">
                                                <div class="col-md-3">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-picpay-tax"><?= __('Tax') ?></label>
                                                        <div class="input-group">
                                                            <input class="form-control" type="text" value="<?= config('donate.gateways.picpay.tax') ?>" name="picpay_tax" id="gateway-picpay-tax" />

                                                            <span class="input-group-addon">%</span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif ?>

                                    <div class="tab-pane" id="gateway-juno">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-juno-active"><?= __('Active') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-juno-active"<?= config('donate.gateways.juno.active') ? 'checked="checked"' : '' ?> value="1" name="juno_active" />
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-md-2">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-juno-sandbox"><?= __('Sandbox') ?></label>
                                                    <div>
                                                        <input class="form-control toggle" type="checkbox" id="gateway-juno-sandbox"<?= config('donate.gateways.juno.sandbox') ? 'checked="checked"' : '' ?> value="1" name="juno_sandbox" />
                                                    </div>
                                                </div>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <label class="control-label" for="gateway-juno-client-id"><?= __('Client ID') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.juno.client_id') ?>" name="juno_client_id" id="gateway-juno-client-id" />
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-juno-secret-id"><?= __('Secret ID') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.juno.secret_id') ?>" name="juno_secret_id" id="gateway-juno-secret-id" />
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label" for="gateway-juno-private-token"><?= __('Private Token') ?></label>
                                            <input class="form-control" type="text" value="<?= config('donate.gateways.juno.private_token') ?>" name="juno_private_token" id="gateway-juno-private-token" />
                                        </div>

                                        <div class="row">
                                            <div class="col-md-3">
                                                <div class="form-group">
                                                    <label class="control-label" for="gateway-juno-tax"><?= __('Tax') ?></label>
                                                    <div class="input-group">
                                                        <input class="form-control" type="text" value="<?= config('donate.gateways.juno.tax') ?>" name="juno_tax" id="gateway-juno-tax" />

                                                        <span class="input-group-addon">%</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <?php if (has_plugin_license('PagHiper')): ?>
                                        <div class="tab-pane" id="gateway-paghiper">
                                            <div class="row">
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-paghiper-active"><?= __('Active') ?></label>
                                                        <div>
                                                            <input class="form-control toggle" type="checkbox" id="gateway-paghiper-active"<?= config('donate.gateways.paghiper.active') ? 'checked="checked"' : '' ?> value="1" name="paghiper_active" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>


                                            <div class="form-group">
                                                <label class="control-label" for="gateway-paghiper-token"><?= __('Token') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.paghiper.token') ?>" name="paghiper_token" id="gateway-paghiper-token" />
                                            </div>

                                            <div class="form-group">
                                                <label class="control-label" for="gateway-paghiper-api-key"><?= __('Api Key') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.paghiper.api_key') ?>" name="paghiper_api_key" id="gateway-paghiper-api-key" />
                                            </div>

                                            <div class="row">
                                                <div class="col-md-3">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-paghiper-tax"><?= __('Tax') ?></label>
                                                        <div class="input-group">
                                                            <input class="form-control" type="text" value="<?= config('donate.gateways.paghiper.tax') ?>" name="paghiper_tax" id="gateway-paghiper-tax" />

                                                            <span class="input-group-addon">%</span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif ?>

                                    <?php if (has_plugin_license('MercadoPago')): ?>
                                        <div class="tab-pane" id="gateway-mercadopago">
                                            <div class="row">
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-mercadopago-active"><?= __('Active') ?></label>
                                                        <div>
                                                            <input class="form-control toggle" type="checkbox" id="gateway-mercadopago-active"<?= config('donate.gateways.mercadopago.active') ? 'checked="checked"' : '' ?> value="1" name="mercadopago_active" />
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-mercadopago-sandbox"><?= __('Sandbox') ?></label>
                                                        <div>
                                                            <input class="form-control toggle" type="checkbox" id="gateway-mercadopago-sandbox"<?= config('donate.gateways.mercadopago.sandbox') ? 'checked="checked"' : '' ?> value="1" name="mercadopago_sandbox" />
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-4">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-mercadopago-currencies"><?= __('Allow currencies') ?></label>
                                                        <div>
                                                            <input class="form-control toggle" type="checkbox" id="gateway-mercadopago-currencies"<?= config('donate.gateways.mercadopago.currency') ? 'checked="checked"' : '' ?> value="1" name="mercadopago_currencies" />
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="control-label" for="gateway-mercadopago-public-key"><?= __('Public Key') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.mercadopago.public_key') ?>" name="mercadopago_public_key" id="gateway-mercadopago-public-key" />
                                            </div>

                                            <div class="form-group">
                                                <label class="control-label" for="gateway-mercadopago-access-token"><?= __('Access Token') ?></label>
                                                <input class="form-control" type="text" value="<?= config('donate.gateways.mercadopago.access_token') ?>" name="mercadopago_access_token" id="gateway-mercadopago-access-token" />
                                            </div>

                                            <div class="row">
                                                <div class="col-md-3">
                                                    <div class="form-group">
                                                        <label class="control-label" for="gateway-mercadopago-tax"><?= __('Tax') ?></label>
                                                        <div class="input-group">
                                                            <input class="form-control" type="text" value="<?= config('donate.gateways.mercadopago.tax') ?>" name="mercadopago_tax" id="gateway-mercadopago-tax" />

                                                            <span class="input-group-addon">%</span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    <?php endif ?>
                                </div>
                            </div>
                        </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>
        </div>
    </form>
</section>