<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- Message Error -->
            <div class="col-sm-12">
            <?php $this->load->view(AdminPanel::TemplatePath."/include/messages"); ?>
            </div>
        </div>

        <div class="row" id="form">
            <div class="col-sm-12">
                <div class="box box-solid">
                    <div class="box-header">

                        <div class="box-title">
                            <b><?= Translate::sprint("Edit payout") ?></b>
                        </div>

                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-6">
                                <!-- Businss owner  dropdown list -->
                                <div class="form-group">
                                    <label><?= Translate::sprint("Select owner") ?></label>
                                    <select id="select_owner" name="select_owner" class="form-control select2">
                                        <option selected="" value="<?= $payout['user_id']?>"><?= $this->mUserModel->getUserNameById($payout['user_id']) ?></option>
                                    </select>
                                </div>

                                <!-- Payment Method -->
                                <div class="form-group">
                                    <label><?= Translate::sprint("Payment method") ?></label>
                                    <select id="method" class="form-control select2 method"
                                            style="width: 100%;">
                                        <option value="Bank" <?=$payout['method']=="bank"?"selected":""?> ><?= Translate::sprint("Bank") ?></option>
                                        <option value="Cash" <?=$payout['method']=="cash"?"selected":""?>><?= Translate::sprint("Cash") ?></option>
                                        <option  value="Wallet" <?=$payout['method']=="wallet"?"selected":""?>><?= Translate::sprint("Digital Wallet") ?></option>
                                    </select>
                                </div>


                                <!-- Payment Method -->
                                <div class="form-group">
                                    <label><?= Translate::sprint("Payment Status") ?></label>
                                    <select id="status" class="form-control select2 status"
                                            style="width: 100%;" <?=$payout['status']=="cancel"?"disabled":""?>>
                                        <option value="request" <?=$payout['status']=="request"?"selected":""?>><?= Translate::sprint("Request") ?></option>
                                        <option value="processing" <?=$payout['status']=="processing"?"selected":""?>><?= Translate::sprint("Processing") ?></option>
                                        <option value="paid" <?=$payout['status']=="paid"?"selected":""?>><?= Translate::sprint("Paid") ?></option>
                                        <option value="cancel" <?=$payout['status']=="cancel"?"selected":""?>><?= Translate::sprint("Cancel") ?></option>
                                    </select>
                                </div>

                                <!-- Amount -->
                                <div class="form-group">
                                    <label><?= Translate::sprint("Amount") ?></label>
                                    <input type="text" class="form-control" name="amount" id="amount" value="<?=$payout['amount']?>"
                                           placeholder="Ex: 8000.00$" disabled>
                                </div>

                            </div>
                            <div class="col-sm-6">

                                <?php if($payout['method']=="bank"): ?>
                                    <?php
                                        $bank = $this->mWalletModel->getBank(explode("=",$payout['info'])[1]);
                                    ?>
                                    <div class="form-group">
                                        <label><?= Translate::sprint("Bank information") ?></label>
                                        <div>
                                            <table>
                                                <tr>
                                                    <td><?=_lang("Bank Name")?>:&nbsp;</td>
                                                    <td><?=$bank['name']?></td>
                                                </tr>
                                                <tr>
                                                    <td><?=_lang("Bank Account (IBAN/RIB)")?>:&nbsp;&nbsp;</td>
                                                    <td><?=$bank['account_number']?></td>
                                                </tr>
                                                <tr>
                                                    <td><?=_lang("Bank Holder Name")?>:&nbsp;</td>
                                                    <td><?=$bank['holder_name']?></td>
                                                </tr>
                                                <tr>
                                                    <td><?=_lang("Country")?>:&nbsp;</td>
                                                    <td><?=$bank['country']?></td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                <?php endif;?>
                                <!-- Note -->
                                <div class="form-group">
                                    <label><?= Translate::sprint("Note", "") ?></label>
                                    <textarea class="form-control" rows="5" id="editable-textarea"
                                              placeholder="<?= Translate::sprint("Enter") ?> ..."><?=$payout['note']?></textarea>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="box-footer">
                        <button type="button" class="btn  btn-primary pull-right" id="btnEdit"><span
                                    class="glyphicon glyphicon-check"></span>
                            <?= Translate::sprint("Save Payout") ?>
                        </button>
                    </div>
                </div>
            </div>

        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -- -->


<?php
$data['id'] = $payout['id'];
$data['payout'] = $payout;
$script = $this->load->view('payout/backend/payouts/scripts/edit-payout-script', $data, TRUE);
AdminTemplateManager::addScript($script);

?>