<?php
/* Smarty version 3.1.33, created on 2022-11-02 13:31:57
  from '/home/crescjwi/dashboard.homeworktask.com/content/themes/dashboard/mailing.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.33',
  'unifunc' => 'content_6362714d660794_17825666',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'fc115b64d7a6009d51e7abc699c3c394c8fb1613' => 
    array (
      0 => '/home/crescjwi/dashboard.homeworktask.com/content/themes/dashboard/mailing.tpl',
      1 => 1656689816,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_6362714d660794_17825666 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>
 
 
<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_4686704786362714d624246_72437815', 'content_wrapper');
$_smarty_tpl->inheritance->endChild($_smarty_tpl, 'dashboard/layout.tpl');
}
/* {block 'content_wrapper'} */
class Block_4686704786362714d624246_72437815 extends Smarty_Internal_Block
{
public $subBlocks = array (
  'content_wrapper' => 
  array (
    0 => 'Block_4686704786362714d624246_72437815',
  ),
);
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

    <div class="card">
        <div class="card-header with-icon">
            <i class="fa fa-paper-plane mr10"></i> 
            <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "mails") {?>
                <div class="pull-right flip"> 
                    <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/mailing/add" class="btn btn-info"> 
                        <i class="fa fa-plus"></i> Add New Mail
                    </a> 
                </div>
            <?php }?>

            <strong>Mailing</strong> 
            <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "send") {?> &rsaquo; <strong>Send</strong><?php }?>
            <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "mails") {?> &rsaquo; <strong>Mails</strong> &rsaquo; <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['total_mails']->value, ENT_QUOTES, 'UTF-8');?>
</strong><?php }?>
            <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "add") {?> &rsaquo; <strong>Add New</strong><?php }?>
            <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "edit") {?> &rsaquo; <strong>Edit</strong> &rsaquo; <strong><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['email'], ENT_QUOTES, 'UTF-8');?>
</strong><?php }?>
        </div>

        <?php if ($_smarty_tpl->tpl_vars['sub_view']->value == "send") {?>
            
            <div class="card-body">
                <form class="js_ajax-forms" data-url="/admin/mailing?do=send_mail" autocomplete="off">
                    <div class="form-group form-row">
                        <label class="col-sm-2 control-label text-left">
                            Subject
                        </label>
                        <div class="col-sm-10">  
                            <input class="form-control" type="text" name="subject">
                        </div>
                    </div>
                    <div class="form-group form-row">
                        <label class="col-sm-2 control-label text-left">
                            Message
                        </label>
                        <div class="col-sm-10">  
                            <textarea class="form-control" id="summernote" rows="10" name="message"></textarea>
                        </div>
                    </div>
                    <div class="form-group form-row">
                        <label class="col-sm-2 control-label text-left">
                            Send to
                        </label>
                        <div class="col-sm-10">
                            <select class="form-control" name="recipient" data-combo="recipient">
                                <option value="1">Select from customers</option>
                                <option value="2">Select from writers</option>
                                <option value="3">Select from mailing list</option>
                                <option value="4">All customers</option>
                                <option value="5">All writers</option>
                                <option value="6">All mailing list</option>
                            </select>
                        </div>
                    </div>

                    <div id="recipient">
                        <div class="switch-combo" data-combo-value="1">
                            <div class="form-group form-row">
                                <label class="col-sm-2 control-label text-left">Customer</label>
                                <div class="col-sm-10">
                                    <select class="form-control select_search" name="customer_ids[]" multiple="">
                                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['customers']->value, 'site_customers', false, 'site_name');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['site_name']->value => $_smarty_tpl->tpl_vars['site_customers']->value) {
?>
                                            <optgroup label="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['site_name']->value, ENT_QUOTES, 'UTF-8');?>
">
                                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['site_customers']->value, 'customer');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['customer']->value) {
?>
                                                    <option value="<?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');?>
 - <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['customer']->value['name'], ENT_QUOTES, 'UTF-8');?>
</option>
                                                <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                                            </optgroup>
                                        <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="x-hidden switch-combo" data-combo-value="2">
                            <div class="form-group form-row">
                                <label class="col-sm-2 control-label text-left">Writer</label>
                                <div class="col-sm-10">
                                    <select class="form-control select_search" name="writer_ids[]" multiple="">
                                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['writers']->value, 'writer');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['writer']->value) {
?>
                                            <option value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['writer']->value['employee_id'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['writer']->value['employee_id'], ENT_QUOTES, 'UTF-8');?>
 - <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['writer']->value['first_name'], ENT_QUOTES, 'UTF-8');?>
 <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['writer']->value['last_name'], ENT_QUOTES, 'UTF-8');?>
</option>
                                        <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="x-hidden switch-combo" data-combo-value="3">
                            <div class="form-group form-row">
                                <label class="col-sm-2 control-label text-left">Mail list</label>
                                <div class="col-sm-10">
                                    <select class="form-control select_search" name="mail_ids[]" multiple="">
                                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['mailing_list']->value, 'mail');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['mail']->value) {
?>
                                            <option value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['mail_id'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['name'], ENT_QUOTES, 'UTF-8');?>
 - <?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['email'], ENT_QUOTES, 'UTF-8');?>
</option>
                                        <?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <label class="col-sm-2 control-label">Test email</label>
                        <div class="col-sm-10">
                            <label class="switch" for="test_email">
                                <input type="checkbox" name="test_email" id="test_email">
                                <span class="slider round"></span>
                            </label>
                            <span class="help-block">The message will be sent to Website Email only</span>
                        </div>
                    </div>

                    <div class="form-group form-row">
                        <div class="col-sm-10 col-sm-offset-2">
                            <!-- 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">Send Mail</button>
                        </div>
                    </div>
                </form>
            </div>
            
        <?php } elseif ($_smarty_tpl->tpl_vars['sub_view']->value == "mails") {?>

            <div class="card-body">
                <?php if (count($_smarty_tpl->tpl_vars['mails']->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>Name</td>
                                    <td>Email</td>
                                    <td>Site</td>
                                    <td>Date</td>
                                    <td>Actions</td>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['mails']->value, 'mail');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['mail']->value) {
?>
                                    <tr>
                                        <td>
                                            <a href="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['base_uri']->value, ENT_QUOTES, 'UTF-8');?>
/mailing/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['mail_id'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['name'], ENT_QUOTES, 'UTF-8');?>
</a>
                                        </td>
                                        <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['email'], ENT_QUOTES, 'UTF-8');?>
</td>
                                        <td><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['site_name'], ENT_QUOTES, 'UTF-8');?>
</td>
                                        <td>
                                            <span class="js_moment" data-time="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['date'], ENT_QUOTES, 'UTF-8');?>
"><?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['date'], 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="mail" data-id="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['mail_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');?>
/mailing/edit/<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['mail_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-envelope fa-4x"></i>
                        <p class="mb10"><strong>No emails to show</strong></p>
                    </div>
                <?php }?>
            </div>

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

            <div class="card-body">
                <form class="js_ajax-forms col-md-9 form-horizontal" data-url="/admin/mailing?do=add_mail" autocomplete="off">
                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">Name (optional)</label>
                        <div class="col-sm-9">  
                            <input class="form-control" type="text" name="name" required="">
                        </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">Site ID</label>
                        <div class="col-sm-9">  
                            <select class="form-control select_search" name="site_id" required="">
                                <?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['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">
                        <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 new</button>
                        </div>
                    </div>
                </form>
            </div>

        <?php } elseif ($_smarty_tpl->tpl_vars['sub_view']->value == "edit") {?>
            <div class="card-body">
                <form class="js_ajax-forms col-md-9 form-horizontal" data-url="/admin/mailing?do=edit_mail" autocomplete="off">
                    <input type="hidden" name="mail_id" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['mail_id'], ENT_QUOTES, 'UTF-8');?>
">
                    <div class="form-group form-row">
                        <label class="col-sm-3 control-label text-left">Name (optional)</label>
                        <div class="col-sm-9">  
                            <input class="form-control" type="text" name="name" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['name'], ENT_QUOTES, 'UTF-8');?>
" required="">
                        </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="" value="<?php echo htmlspecialchars($_smarty_tpl->tpl_vars['mail']->value['email'], ENT_QUOTES, 'UTF-8');?>
">
                        </div>
                    </div>
                    <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 select_search" name="site_id" required="">
                                <?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['mail']->value['site_id'] == $_smarty_tpl->tpl_vars['site']->value['site_id']) {?>selected=""<?php }?>><?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">
                        <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">Save changes</button>
                        </div>
                    </div>
                </form>
            </div>
        <?php }?>
    </div>
<?php
}
}
/* {/block 'content_wrapper'} */
}
