<?php
/* Smarty version 3.1.33, created on 2020-08-19 11:30:39
  from '/home/superior/public_html/constantwriters.com/content/themes/dashboard/users/customers.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.33',
  'unifunc' => 'content_5f3d0d5f05e4a2_87813125',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'dfbb2a47463bbe3af334a6467ec90be0b0e9c272' => 
    array (
      0 => '/home/superior/public_html/constantwriters.com/content/themes/dashboard/users/customers.tpl',
      1 => 1597047931,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_5f3d0d5f05e4a2_87813125 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>


<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_9631208305f3d0d5f03f5a5_72022800', 'content_wrapper');
?>

<?php $_smarty_tpl->inheritance->endChild($_smarty_tpl, 'dashboard/layout.tpl');
}
/* {block 'content_wrapper'} */
class Block_9631208305f3d0d5f03f5a5_72022800 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content_wrapper' => 
  array (
    0 => 'Block_9631208305f3d0d5f03f5a5_72022800',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

    <div class="card">
        <div class="card-header with-icon">
            <i class="fa fa-users mr10"></i>
            <?php if ($_smarty_tpl->tpl_vars['section']->value == '') {?>
                <div class="pull-right flip">
                    <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/customers/add" class="btn btn-info">
                        <i class="fa fa-plus"></i> Add New Customer
                    </a>
                </div>
            <?php } elseif ($_smarty_tpl->tpl_vars['section']->value == "edit") {?>
                <div class="pull-right flip">
                    <a target="_blank" href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer_site']->value['domain'], ENT_QUOTES, 'UTF-8');?>
/api/v1/auth/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
?authKey=<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['secure_key'], ENT_QUOTES, 'UTF-8');?>
" class="btn btn-warning">
                        <i class="fa fa-user"></i> Impersonate User
                    </a>
                    <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/orders/customer/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
" class="btn btn-info">
                        <i class="fa fa-shopping-basket"></i> View Orders
                    </a>
                </div>
            <?php }?>

            <strong>Customers</strong>
            <?php if ($_smarty_tpl->tpl_vars['section']->value == '') {?>&rsaquo; <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['total_customers']->value, ENT_QUOTES, 'UTF-8');?>
</strong><?php }?>
            <?php if ($_smarty_tpl->tpl_vars['section']->value == "edit") {?>&rsaquo; <strong>Edit</strong> &rsaquo; <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
</strong><?php }?>
            <?php if ($_smarty_tpl->tpl_vars['section']->value == "add") {?>&rsaquo; <strong>Add</strong><?php }?>
        </div>

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

            <div class="card-body">

                <div class="mb20"> 
                    <form class="form-inline" method="get" id="filter_form" autocomplete="off"> 
                        <div class="form-group mb0"> 
                        <div class="input-group"> 
                            <input type="text" class="form-control" name="query" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['query']->value, ENT_QUOTES, 'UTF-8');?>
"> 
                            <div class="input-group-append"> 
                                <button type="submit" class="btn btn-sm btn-info">
                                    <i class="fas fa-search mr5"></i>Search</button> 
                                </div> 
                            </div> 
                        </div> 
                    </form> 
                    <div class="form-text small">
                        Search customer ID, name, email or site ID
                    </div> 
                </div>

                <?php if (count($_smarty_tpl->tpl_vars['customers']->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>ID</td>
                                    <td>Name</td>
                                    <td>Contact</td>
                                    <td>Site</td>
                                    <td>Total spent</td>
                                    <td>Registration</td>
                                    <td>Actions</td>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['customers']->value, 'customer');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['customer']->value) {
?>
                                    <tr>
                                        <td>
                                            <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/customers/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
">#<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
</a>
                                        </td>
                                        <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['name'], ENT_QUOTES, 'UTF-8');?>
</td>
                                        <td>
                                            <div class="h5 mb5"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['email'], ENT_QUOTES, 'UTF-8');?>
</div>
                                            <?php if ($_smarty_tpl->tpl_vars['customer']->value['phone']) {?><div class="h6 mb0"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['phone'], ENT_QUOTES, 'UTF-8');?>
</div><?php }?>
                                        </td>
                                        <td>
                                            <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['site_name'], ENT_QUOTES, 'UTF-8');?>

                                        </td>
                                        <td>
                                            <span class="text_success">$<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['total_spent'], ENT_QUOTES, 'UTF-8');?>
</span>
                                        </td>
                                        <td>
                                            <span class="js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['reg_date'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['reg_date'], ENT_QUOTES, 'UTF-8');?>
</div>
                                        </td>
                                        <td>
                                            <button data-toggle="tooltip" data-placement="top" title="Delete" class="btn btn-xs btn-danger js_admin-deleter" data-handle="customer" data-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->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');?>
/customers/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->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"> <i class="fa fa-users fa-4x"></i>
                        <p class="mb10"><strong>No customers to show</strong></p>
                    </div>
                <?php }?>
            </div>

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

            <div class="card-body">
                <form class="js_ajax-forms col-md-9 form-horizontal" data-url="/customers?do=add">
                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Site
                        </label>
                        <div class="col-sm-9">
                            <select class="form-control" name="site_id" required>
                                <option value="-1">Select Site</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">
                            Email
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control" type="text" name="email" required>
                        </div>
                    </div>

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

                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">
                            Name <small>(optional)</small>
                        </label>
                        <div class="col-sm-9">
                            <input class="form-control" type="text" name="name">
                        </div>
                    </div>

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

                            <!-- error -->
                            <div class="alert alert-danger mt10 x-hidden" role="alert"></div>
                            <!-- error -->

                            <button type="submit" class="btn btn-info">Add Customer</button>
                        </div>
                    </div>

                </form>
            </div>

        <?php } elseif ($_smarty_tpl->tpl_vars['section']->value == "edit") {?>
            <div class="card-body">
                <div class="row">
                    <div class="col-xs-12 col-sm-7 mb10">
                        <ul class="list-group">

                            <li class="list-group-item">
                                <span class="badge badge-primary"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
</span> Customer ID
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['google_analytics_id'], ENT_QUOTES, 'UTF-8');?>
</span> GA Id
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['site_name'], ENT_QUOTES, 'UTF-8');?>
</span> From site
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['reg_date'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['reg_date'], ENT_QUOTES, 'UTF-8');?>
</span> Joined
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['last_login'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['last_login'], ENT_QUOTES, 'UTF-8');?>
</span> Last Login
                            </li>
                        </ul>
                    </div>
                    <div class="col-xs-12 col-sm-5 mb10">
                        <ul class="list-group">
                            <li class="list-group-item">
                                <span class="badge badge-primary">$<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['total_spent'], ENT_QUOTES, 'UTF-8');?>
</span> Total spent
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary">$<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['affiliate_balance'], ENT_QUOTES, 'UTF-8');?>
</span> Affiliate Balance
                            </li>
                            <?php if ($_smarty_tpl->tpl_vars['customer']->value['referrer_id']) {?>
                                <li class="list-group-item">
                                    <a class="badge badge-primary" href="/customers/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['referrer_id'], ENT_QUOTES, 'UTF-8');?>
" target="_blank"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['referrer_id'], ENT_QUOTES, 'UTF-8');?>
</a> Referrer ID
                                </li>
                            <?php }?>
                            <li class="list-group-item">
                                <span class="badge badge-primary"><?php if ($_smarty_tpl->tpl_vars['customer']->value['is_subscribed']) {?>Yes<?php } else { ?>No<?php }?></span> Subscribed
                            </li>
                            <li class="list-group-item">
                                <span class="badge badge-primary js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['last_activity'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['last_activity'], ENT_QUOTES, 'UTF-8');?>
</span> Last Activity
                            </li>
                        </ul>
                    </div>
                </div>

                <ul class="nav nav-tabs mb20"> 
                    <li class="nav-item"> 
                        <a class="nav-link active" href="#account" data-toggle="tab"> 
                            <i class="fa fa-cogs fa-fw mr5"></i><strong class="pr5">Account</strong> 
                        </a> 
                    </li>

                    <?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0], array( array('h'=>'displayAdminEditCustomerNavbar','customerId'=>$_smarty_tpl->tpl_vars['customer']->value['id']),$_smarty_tpl ) );?>


                </ul>

                <div class="tab-content">

                    <div class="tab-pane active" id="account">
                        <form class="js_ajax-forms col-md-9 form-horizontal" data-url="/customers?do=edit">
                            <input type="hidden" name="customer_id" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
"/>

                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Email
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control" type="text" name="email" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['email'], ENT_QUOTES, 'UTF-8');?>
" required <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                </div>
                            </div>

                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Phone
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control" type="text" name="phone" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['phone'], ENT_QUOTES, 'UTF-8');?>
" <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                </div>
                            </div>

                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Name <small>(optional)</small>
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control" type="text" name="name" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['name'], ENT_QUOTES, 'UTF-8');?>
" <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                </div>
                            </div>

                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Site
                                </label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="site_id" required <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                        <option value="-1">Select Site</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['customer']->value['site_id'] == $_smarty_tpl->tpl_vars['site']->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">
                                    Total Spent
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control force-integer" type="text" name="total_spent" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['total_spent'], ENT_QUOTES, 'UTF-8');?>
" <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                </div>
                            </div>

                            <div class="form-group form-row">
                                <label class="col-sm-3 control-label text-left">
                                    Password
                                </label>
                                <div class="col-sm-9">
                                    <input class="form-control" type="text" name="password" <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>
                                </div>
                            </div>

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

                                    <!-- error -->
                                    <div class="alert alert-danger mt10 x-hidden" role="alert"></div>
                                    <!-- error -->

                                    <button type="submit" class="btn btn-info" <?php if (!$_smarty_tpl->tpl_vars['user']->value['is_admin']) {?>disabled=""<?php }?>>Save Changes</button>
                                    <button type="button" class="btn btn-info js_reset-password-link" data-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['id'], ENT_QUOTES, 'UTF-8');?>
" data-handle="customer">Password reset link</button>
                                </div>
                            </div>

                        </form>
                    </div>

                    <?php echo call_user_func_array( $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['hook'][0], array( array('h'=>'displayAdminEditCustomerNavContent','customerId'=>$_smarty_tpl->tpl_vars['customer']->value['id']),$_smarty_tpl ) );?>

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