MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/artinside/www/finance/themes/admin/widgets/coupon/coupon.php
<?php $v->layout("_admin"); ?>
<?php $v->start("css")?>
<link href="<?= url("admin-assets/assets/select2/css/select2.css")?>" rel="stylesheet">
<?php $v->end(); ?>

<section class="wrapper">
    <!-- page start-->

    <?php if (!$coupon): ?>
        <div class="row">
            <div class="col-12 text-center my-4 text-sm-center">
                <h3> Novo Cupom</h3>
                <p>Crie um novo cupom </p>
            </div>

            <div class="col-lg-12">
                <section class="card">
                    <header class="card-header infinity-bg white-text">
                        Cadastrar Cupom
                    </header>
                    <div class="card-body">
                        <form class="form-horizontal tasi-form" method="post" action="<?= url("admin/coupon/coupon"); ?>">
                            <input type="hidden" name="action" value="create"/>


                            <div class="form-group row">

                                <div class="col-md-12">
                                    <label class="control-label">Título*</label>
                                    <input type="text" class="form-control" name="title">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>

                            </div>
                            <div class="form-group row">

                                <div class="col-md-6">
                                    <label class="control-label">Código*</label>
                                    <input type="text" class="form-control" name="code">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-6">
                                    <label class="control-label">Validade*</label>
                                    <input type="text" class="form-control mask-date" name="valid_at">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>

                            </div>

                            <?php if($partners):?>

                            <div class="form-group row">

                                <div class="col-md-6">
                                    <label class="control-label">Parceiro</label>
                                    <div class="form-group">
                                        <select class="js-example-basic-single form-control" name="partner" style="height: 50px !important;">
                                            <option value="" disabled selected>Selecione um parceiro</option>
                                            <?php foreach ($partners as $partner): ?>
                                            <option value="<?= $partner->id ?>"><?= $partner->fullName() ?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <label class="control-label">Comissão ao Parceiro em %</label>
                                    <input type="text" class="form-control" name="partner_commission" value="0.00">
                                     <span class="help-block">Comissão no valor final da compra descontando frete</span>
                                </div>

                            </div>
                            <?php endif;?>

                            <div class="form-group row">
                                <div class="col-md-4">
                                    <label class="control-label">(%) Desconto*</label>
                                    <input type="text" class="form-control" name="value" >
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-4">
                                    <label class="control-label">Quantidade*</label>
                                    <input type="text" class="form-control" name="quantity">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-4">
                                    <label class="control-label">Usados</label>
                                    <input type="text" class="form-control" name="uses" disabled>
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-sm-12">
                                    <label class="control-label">Conteúdo</label>
                                    <textarea name="content" class="form-control"></textarea>
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                            </div>



                            <button class="btn btn-primary" type="submit">Enviar</button>
                            <a class="btn btn-danger" href="<?= url("/admin/coupon/home"); ?>">Cancelar</a>

                        </form>
                    </div>
                </section>
            </div>

        </div>
    <?php else: ?>
        <div class="row">
            <div class="col-12 text-center my-4 text-sm-center">
                <h3> Edição de Cupom</h3>
                <p>Crie um novo cupom </p>
            </div>

            <div class="col-lg-12">
                <section class="card">
                    <header class="card-header infinity-bg white-text">
                        Editar Cupom
                    </header>
                    <div class="card-body">
                        <form class="form-horizontal tasi-form" method="post" action="<?= url("admin/coupon/coupon"); ?>">
                            <input type="hidden" name="action" value="update"/>
                            <input type="hidden" name="coupon_id" value="<?= $coupon->id ?>"/>


                            <div class="form-group row">

                                <div class="col-md-12">
                                    <label class="control-label">Título*</label>
                                    <input type="text" class="form-control" name="title" value="<?= $coupon->title?>">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>

                            </div>
                            <div class="form-group row">

                                <div class="col-md-6">
                                    <label class="control-label">Código*</label>
                                    <input type="text" class="form-control" name="code" value="<?= $coupon->code?>" disabled>
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-6">
                                    <label class="control-label">Validade*</label>
                                    <input type="text" class="form-control mask-date" name="valid_at" value="<?= date_fmt($coupon->valid_at)?>">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                            </div>

                            <?php if($partners):?>

                                <div class="form-group row">

                                    <div class="col-md-6">
                                        <label class="control-label">Parceiro</label>
                                        <div class="form-group">
                                            <select class="js-example-basic-single form-control" name="partner" style="height: 50px !important;">
                                                <option value="" disabled selected>Selecione um parceiro</option>
                                                <?php
                                                $user = $coupon->partner;
                                                $select = function ($value) use ($user) {
                                                    return ($user == $value ? "selected" : "");
                                                };
                                                 foreach ($partners as $partner):
                                                     ?>
                                                    <option <?= $select($partner->id); ?> value="<?= $partner->id ?>"><?= $partner->fullName() ?></option>
                                                <?php endforeach;?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-6">
                                        <label class="control-label">Comissão ao Parceiro em %</label>
                                        <input type="text" class="form-control" name="partner_commission" value="<?= $coupon->partner_commission?>">
                                        <span class="help-block">Comissão no valor final da compra descontando frete</span>
                                    </div>

                                </div>
                            <?php endif;?>

                            <div class="form-group row">
                                <div class="col-md-4">
                                    <label class="control-label">(%) Desconto*</label>
                                    <input type="text" class="form-control" name="value"  value="<?= $coupon->value?>">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-4">
                                    <label class="control-label">Quantidade*</label>
                                    <input type="text" class="form-control" name="quantity" value="<?= $coupon->quantity?>">
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                                <div class="col-md-4">
                                    <label class="control-label">Usados</label>
                                    <input type="text" class="form-control" name="uses" value="<?= $coupon->uses?>" disabled>
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-sm-12">
                                    <label class="control-label">Conteúdo</label>
                                    <textarea name="content" class="form-control"> <?= $coupon->content?></textarea>
                                    <!-- <span class="help-block">A block of help text that breaks onto a new line and may extend beyond one line.</span>-->
                                </div>
                            </div>
                            <button class="btn btn-primary" type="submit">Enviar</button>
                            <a class="btn btn-danger" href="<?= url("/admin/coupon/home"); ?>">Cancelar</a>
                        </form>
                    </div>
                </section>
            </div>

        </div>

    <?php endif; ?>
    <!-- page end-->
</section>
<?php $v->start("scripts")?>
<script src="<?= url("admin-assets/js/toucheffects.js")?>"></script>
<script src="<?= url("admin-assets/js/modernizr.custom.js")?>"></script>
<script src="<?= url("admin-assets/js/form-component.js")?>"></script>
<script src="<?= url("shared/scripts/bootstrap-tokenfield.min.js")?>"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?= url("admin-assets/assets/select2/js/select2.js")?>"></script>

<script type="text/javascript">

    $(document).ready(function () {
        $(".js-example-basic-single").select2();

    });

</script>

<?php $v->end(); ?>