<?php
/* Smarty version 3.1.33, created on 2022-11-07 06:23:43
  from '/home/crescjwi/dashboard.homeworktask.com/content/themes/dashboard/coupons.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.33',
  'unifunc' => 'content_6368a46f7677f0_73738934',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'e3e24c91967cc46c1232984c20640f659eb22909' => 
    array (
      0 => '/home/crescjwi/dashboard.homeworktask.com/content/themes/dashboard/coupons.tpl',
      1 => 1656689816,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_6368a46f7677f0_73738934 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>
 

<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_17182636446368a46f7035f1_98651794', 'content_wrapper');
$_smarty_tpl->inheritance->endChild($_smarty_tpl, 'dashboard/layout.tpl');
}
/* {block 'content_wrapper'} */
class Block_17182636446368a46f7035f1_98651794 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content_wrapper' => 
  array (
    0 => 'Block_17182636446368a46f7035f1_98651794',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/home/crescjwi/dashboard.homeworktask.com/vendor/smarty/smarty/libs/plugins/modifier.date_format.php','function'=>'smarty_modifier_date_format',),));
?>

<div class="card">
    <div class="card-header with-icon">

        <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "coupons") {?>
            <div class="pull-right flip">
                <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/coupons/add" class="btn btn-info">
                    <i class="fa fa-plus"></i> Add New Coupon
                </a>
            </div>
        <?php }?>

        <i class="fa fa-tags mr10"></i>
        <strong>Coupon</strong>
        <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "edit") {?> &rsaquo; <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_code'], ENT_QUOTES, 'UTF-8');?>
</strong><?php }?>
        <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "add") {?> &rsaquo; <strong>Add New</strong><?php }?>
    </div>

    <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "coupons") {?>

        <div class="card-body">

        <?php if (count($_smarty_tpl->tpl_vars['coupons']->value)) {?>
                <div class="table-responsive">
                    <table class="table <?php if ($_smarty_tpl->tpl_vars['theme_mode_night']->value) {?>table-dark<?php }?> table-striped table-bordered table-hover js_dataTable">
                        <thead>
                            <tr>
                                <td>Coupon</td>
                                <td>Site Name</td>
                                <td>Type</td>
                                <td>Value</td>
                                <td>Expiry</td>
                                <td>Actions</td>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['coupons']->value, 'coupon');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['coupon']->value) {
?>
                                <tr>
                                    <td>
                                        <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/coupons/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['id'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_code'], ENT_QUOTES, 'UTF-8');?>
</a>
                                    </td>
                                    <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['site_name'], ENT_QUOTES, 'UTF-8');?>
</td>
                                    <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'], ENT_QUOTES, 'UTF-8');?>
</td>
                                    <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_value'], ENT_QUOTES, 'UTF-8');?>
</td>
                                    <td>
                                        <span class="js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['expiry'], ENT_QUOTES, 'UTF-8');?>
"><span>
                                    </td>
                                    <td>
                                        <button data-toggle="tooltip" data-placement="top" title="Delete" class="btn btn-xs btn-danger js_admin-deleter" data-handle="coupon" data-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['id'], ENT_QUOTES, 'UTF-8');?>
">
                                            <i class="fa fa-trash-alt"></i>
                                        </button>
                                        <a data-toggle="tooltip" data-placement="top" title="Edit" href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/coupons/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['id'], ENT_QUOTES, 'UTF-8');?>
" class="btn btn-xs btn-info">
                                            <i class="fa fa-pencil-alt"></i>
                                        </a>
                                    </td>
                                </tr>
                            <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                        </tbody>
                    </table>

                    <?php echo $_smarty_tpl->tpl_vars['pager']->value;?>

                </div>
            <?php } else { ?>
                <div class="text-center x-muted"> 
                    <img class="mb20" width="15%" src="/static/images/no_results.png">
                    <p class="mb10"><strong>No coupons to show</strong></p>
                </div>
            <?php }?>
        </div>

    <?php } elseif ($_smarty_tpl->tpl_vars['sub_view']->value == "edit") {?>

        <form class="js_ajax-forms" data-url="/admin/coupon?do=edit" autocomplete="off">
            <div class="card-body">
                <div class="col-md-9">
                    <input type="hidden" name="coupon_id" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['id'], ENT_QUOTES, 'UTF-8');?>
"/>
                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Site ID
                        </label>
                        <div class="col-sm-9">
                            <select class="form-control" name="site_id">
                                <option value="0">Select website</option>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['sites']->value, 'site');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['site']->value) {
?>
                                    <option value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['site']->value['site_id'], ENT_QUOTES, 'UTF-8');?>
" <?php if ($_smarty_tpl->tpl_vars['site']->value['site_id'] == $_smarty_tpl->tpl_vars['coupon']->value['site_id']) {?>selected=""<?php }?>><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['site']->value['name'], ENT_QUOTES, 'UTF-8');?>
</option>
                                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </select>                        
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Coupon Code
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control" type="text" name="coupon_code" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_code'], ENT_QUOTES, 'UTF-8');?>
" required>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Coupon Type
                        </label>
                        <div class="col-sm-9">
                            <select class="form-control" name="coupon_type" data-combo="coupon_type">
                                <option value="1" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "1") {?>selected=''<?php }?>>Percent</option>
                                <option value="3" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "3") {?>selected=''<?php }?>>Amount</option>
                                <option value="9" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "9") {?>selected=''<?php }?>>Fixed CPP</option>
                                <option value="5" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "5") {?>selected=''<?php }?>>Free Unit</option>
                                <option value="7" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "7") {?>selected=''<?php }?>>Writer Category</option>
                            </select>
                        </div>
                    </div>

                    <div id="coupon_type">
                        <div <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "1") {?> class="switch-combo" <?php } else { ?> class="x-hidden switch-combo" <?php }?> data-combo-value="1">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Percent Discount
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-integer" type="text" name="coupon_percent" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_value'], ENT_QUOTES, 'UTF-8');?>
">
                                </div>
                            </div>
                        </div>

                        <div <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "3") {?> class="switch-combo" <?php } else { ?> class="x-hidden switch-combo" <?php }?> data-combo-value="3">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Amount Discount
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-integer" type="text" name="coupon_amount" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_value'], ENT_QUOTES, 'UTF-8');?>
">
                                </div>
                            </div>
                        </div>
                        
                        <div <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "5") {?> class="switch-combo" <?php } else { ?> class="x-hidden switch-combo" <?php }?> data-combo-value="5">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Free Unit
                                </label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="service_type_id">
                                        <option value="3" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "3") {?>selected=''<?php }?>>Writer Category</option>
                                        <option value="21" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "21") {?>selected=''<?php }?>>Used Sources</option>
                                        <option value="4" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "4") {?>selected=''<?php }?>>Writer Samples</option>
                                        <option value="37" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "37") {?>selected=''<?php }?>>Complex Assignment</option>
                                        <option value="41" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "41") {?>selected=''<?php }?>>Expert Proofreading</option>
                                        <option value="5" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['service_type_id'] == "5") {?>selected=''<?php }?>>Progressive Delivery</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "7") {?> class="switch-combo" <?php } else { ?> class="x-hidden switch-combo" <?php }?> data-combo-value="7">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Writer Category
                                </label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="writer_category_id">
                                        <option value="3" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['writer_category_id'] == "3") {?>selected=''<?php }?>>ESL advanced</option>
                                        <option value="4" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['writer_category_id'] == "4") {?>selected=''<?php }?>>ENL (English Native Language)</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div <?php if ($_smarty_tpl->tpl_vars['coupon']->value['coupon_type'] == "9") {?> class="switch-combo" <?php } else { ?> class="x-hidden switch-combo" <?php }?> data-combo-value="9">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Cost Per Page
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-integer" type="text" name="coupon_cpp_amount" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['coupon_value'], ENT_QUOTES, 'UTF-8');?>
">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Customer ID
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control force-integer" type="text" name="user_id" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['user_id']) {?>value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['user_id'], ENT_QUOTES, 'UTF-8');?>
"<?php }?>> 
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Order ID
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control force-integer" type="text" name="order_id" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['order_id']) {?>value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['coupon']->value['order_id'], ENT_QUOTES, 'UTF-8');?>
"<?php }?>>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">Expiry</label>
                        <div class="col-sm-9">
                            <div class="input-group date js_datetimepicker" id="coupon_expiry" data-target-input="nearest">
                                <input type='text' class="form-control datetimepicker-input" value='<?php echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['coupon']->value['expiry'],"%d/%m/%Y %H:%I:%S %p"), ENT_QUOTES, 'UTF-8');?>
' data-target="#coupon_expiry" name="coupon_expiry" />
                                <div class="input-group-append" data-target="#coupon_expiry" data-toggle="datetimepicker">
                                    <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            One-time use
                        </label>
                        <div class="col-sm-9">
                            <label class="switch" for="one_time">
                                <input type="checkbox" name="one_time" id="one_time" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['one_time'] == '1') {?>checked="checked"<?php }?>>
                                <span class="slider round"></span>
                            </label>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Active
                        </label>
                        <div class="col-sm-9">
                            <label class="switch" for="active">
                                <input type="checkbox" name="active" id="active" <?php if ($_smarty_tpl->tpl_vars['coupon']->value['active'] == '1') {?>checked="checked"<?php }?>>
                                <span class="slider round"></span>
                            </label>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <div class="col-sm-9 offset-sm-3">
                            <!-- success -->
                            <div class="alert alert-success mb0 mt10 x-hidden" role="alert"></div>
                            <!-- success -->

                            <!-- error -->
                            <div class="alert alert-danger mb0 mt10 x-hidden" role="alert"></div>
                            <!-- error -->
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-footer text-right">
                <div class="row">
                    <div class="col-md-9 text-right">
                        <button type="submit" class="btn btn-info">Save Changes</button>
                    </div>
                </div>
            </div>
        </form>

    <?php } elseif ($_smarty_tpl->tpl_vars['sub_view']->value == "add") {?>
        <form class="js_ajax-forms" data-url="/admin/coupon?do=add" autocomplete="off">
            <div class="card-body">
                <div class="col-md-9">
                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Site ID
                        </label>
                        <div class="col-sm-9">
                            <select class="form-control" name="site_id">
                                <option value="0">Select website</option>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['sites']->value, 'site');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['site']->value) {
?>
                                    <option value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['site']->value['site_id'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['site']->value['name'], ENT_QUOTES, 'UTF-8');?>
</option>
                                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                            </select>                        
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Coupon Code
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control" type="text" name="coupon_code" required>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Coupon Type
                        </label>
                        <div class="col-sm-9">
                            <select class="form-control" name="coupon_type" data-combo="coupon_type">
                                <option value="1" selected="">Percent</option>
                                <option value="3">Amount</option>
                                <option value="5">Free Unit</option>
                                <option value="7">Writer Category</option>
                                <option value="9">Fixed CPP</option>
                            </select>
                        </div>
                    </div>

                    <div id="coupon_type">
                        <div class="switch-combo" data-combo-value="1">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Percent Discount
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-int" type="text" name="coupon_percent">
                                </div>
                            </div>
                        </div>
                        <div class="switch-combo x-hidden" data-combo-value="3">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Amount Discount
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-int" type="text" name="coupon_amount">
                                </div>
                            </div>
                        </div>
                        <div class="switch-combo x-hidden" data-combo-value="5">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Free Unit
                                </label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="service_type_id">
                                        <option value="3">Writer Category</option>
                                        <option value="21">Used Sources</option>
                                        <option value="4">Writer Samples</option>
                                        <option value="37">Complex Assignment</option>
                                        <option value="41">Expert Proofreading</option>
                                        <option value="5">Progressive Delivery</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="switch-combo x-hidden" data-combo-value="7">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Writer Category
                                </label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="writer_category_id">
                                        <option value="3">ESL advanced</option>
                                        <option value="4">ENL (English Native Language)</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="switch-combo x-hidden" data-combo-value="9">
                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Cost Per Page
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-int" type="text" name="coupon_cpp_amount">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">Expiry</label>
                        <div class="col-sm-9">
                            <div class="input-group date js_datetimepicker" id="coupon_expiry" data-target-input="nearest">
                                <input type='text' class="form-control datetimepicker-input" data-target="#coupon_expiry" name="coupon_expiry" />
                                <div class="input-group-append" data-target="#coupon_expiry" data-toggle="datetimepicker">
                                    <span class="input-group-text"><i class="fa fa-calendar"></i></span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <div class="col-sm-9 offset-sm-3">
                            <!-- success -->
                            <div class="alert alert-success mb0 mt10 x-hidden" role="alert"></div>
                            <!-- success -->

                            <!-- error -->
                            <div class="alert alert-danger mb0 mt10 x-hidden" role="alert"></div>
                            <!-- error -->
                        </div>
                    </div>
                </div>
            </div>
            <div class="card-footer">
                <div class="row">
                    <div class="col-md-9 text-right">
                        <button type="submit" class="btn btn-info">Add Coupon</button>
                    </div>
                </div>
            </div>
        </form>
    <?php }?>

</div>
<?php
}
}
/* {/block 'content_wrapper'} */
}
