add send message button

add send message button in customer
 view details
This commit is contained in:
Focuslinkstech 2024-03-18 12:28:54 +01:00
parent 130451e1ae
commit 3d2af75e5b
3 changed files with 161 additions and 151 deletions

View File

@ -40,8 +40,11 @@ document.addEventListener("DOMContentLoaded", function(event) {
}); });
</script> </script>
EOT; EOT;
$c = ORM::for_table('tbl_customers')->find_many(); if (isset($routes['2']) && !empty($routes['2'])) {
$ui->assign('c', $c); $ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
}
$id = $routes['2'];
$ui->assign('id', $id);
$ui->assign('xfooter', $select2_customer); $ui->assign('xfooter', $select2_customer);
$ui->display('message.tpl'); $ui->display('message.tpl');
break; break;

View File

@ -30,26 +30,26 @@
onclick="this.select()"> onclick="this.select()">
</li> </li>
{if $d['pppoe_password'] != ''} {if $d['pppoe_password'] != ''}
<li class="list-group-item"> <li class="list-group-item">
<b>PPPOE {Lang::T('Password')}</b> <input type="password" value="{$d['pppoe_password']}" <b>PPPOE {Lang::T('Password')}</b> <input type="password" value="{$d['pppoe_password']}"
style=" border: 0px; text-align: right;" class="pull-right" style=" border: 0px; text-align: right;" class="pull-right"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"
onclick="this.select()"> onclick="this.select()">
</li> </li>
{/if} {/if}
<!--Customers Attributes view start --> <!--Customers Attributes view start -->
{if $customFields} {if $customFields}
{foreach $customFields as $customField} {foreach $customFields as $customField}
<li class="list-group-item"> <li class="list-group-item">
<b>{$customField.field_name}</b> <span class="pull-right"> <b>{$customField.field_name}</b> <span class="pull-right">
{if strpos($customField.field_value, ':0') === false} {if strpos($customField.field_value, ':0') === false}
{$customField.field_value} {$customField.field_value}
{else} {else}
<b>{Lang::T('Paid')}</b> <b>{Lang::T('Paid')}</b>
{/if} {/if}
</span> </span>
</li> </li>
{/foreach} {/foreach}
{/if} {/if}
<!--Customers Attributes view end --> <!--Customers Attributes view end -->
<li class="list-group-item"> <li class="list-group-item">
@ -74,24 +74,27 @@
</ul> </ul>
<div class="row"> <div class="row">
<div class="col-xs-4"> <div class="col-xs-4">
<a href="{$_url}customers/delete/{$d['id']}" id="{$d['id']}" <a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block">{Lang::T('Back')}</a>
class="btn btn-danger btn-block btn-sm"
onclick="return confirm('{Lang::T('Delete')}?')"><span class="fa fa-trash"></span></a>
</div> </div>
<div class="col-xs-8"> <div class="col-xs-4">
<a href="{$_url}customers/edit/{$d['id']}" <a href="{$_url}customers/sync/{$d['id']}"
class="btn btn-warning btn-sm btn-block">{Lang::T('Edit')}</a> onclick="return confirm('This will sync Customer to Mikrotik?')"
class="btn btn-info btn-sm btn-block">{Lang::T('Sync')}</a>
</div>
<div class="col-xs-4">
<a href="{$_url}message/send/{$d['id']}" class="btn btn-success btn-sm btn-block">{Lang::T('Send
Message')}</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{foreach $packages as $package} {foreach $packages as $package}
<div class="box box-{if $package['status']=='on'}success{else}danger{/if}"> <div class="box box-{if $package['status']=='on'}success{else}danger{/if}">
<div class="box-body box-profile"> <div class="box-body box-profile">
<h4 class="text-center">{$package['type']} - {$package['namebp']}</h4> <h4 class="text-center">{$package['type']} - {$package['namebp']}</h4>
<ul class="list-group list-group-unbordered"> <ul class="list-group list-group-unbordered">
<li class="list-group-item"> <li class="list-group-item">
{Lang::T('Active')} <span class="pull-right">{if {Lang::T('Active')} <span class="pull-right">{if
$package['status']=='on'}yes{else}no $package['status']=='on'}yes{else}no
{/if}</span> {/if}</span>
</li> </li>
@ -104,7 +107,8 @@
class="pull-right">{Lang::dateAndTimeFormat($package['recharged_on'],$package['recharged_time'])}</span> class="pull-right">{Lang::dateAndTimeFormat($package['recharged_on'],$package['recharged_time'])}</span>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
{Lang::T('Expires On')} <span class="pull-right">{Lang::dateAndTimeFormat($package['expiration'], {Lang::T('Expires On')} <span
class="pull-right">{Lang::dateAndTimeFormat($package['expiration'],
$package['time'])}</span> $package['time'])}</span>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
@ -129,11 +133,15 @@
<div class="col-xs-4"> <div class="col-xs-4">
<a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block">{Lang::T('Back')}</a> <a href="{$_url}customers/list" class="btn btn-primary btn-sm btn-block">{Lang::T('Back')}</a>
</div> </div>
<div class="col-xs-8"> <div class="col-xs-4">
<a href="{$_url}customers/sync/{$d['id']}" <a href="{$_url}customers/sync/{$d['id']}"
onclick="return confirm('This will sync Customer to Mikrotik?')" onclick="return confirm('This will sync Customer to Mikrotik?')"
class="btn btn-info btn-sm btn-block">{Lang::T('Sync')}</a> class="btn btn-info btn-sm btn-block">{Lang::T('Sync')}</a>
</div> </div>
<div class="col-xs-4">
<a href="{$_url}message/send/{$d['id']}" class="btn btn-success btn-sm btn-block">{Lang::T('Send
Message')}</a>
</div>
</div> </div>
</div> </div>
<div class="col-sm-8 col-md-8"> <div class="col-sm-8 col-md-8">
@ -146,68 +154,68 @@
<div class="table-responsive" style="background-color: white;"> <div class="table-responsive" style="background-color: white;">
<table id="datatable" class="table table-bordered table-striped"> <table id="datatable" class="table table-bordered table-striped">
{if Lang::arrayCount($activation)} {if Lang::arrayCount($activation)}
<thead> <thead>
<tr> <tr>
<th>{Lang::T('Invoice')}</th> <th>{Lang::T('Invoice')}</th>
<th>{Lang::T('Username')}</th> <th>{Lang::T('Username')}</th>
<th>{Lang::T('Plan Name')}</th> <th>{Lang::T('Plan Name')}</th>
<th>{Lang::T('Plan Price')}</th> <th>{Lang::T('Plan Price')}</th>
<th>{Lang::T('Type')}</th> <th>{Lang::T('Type')}</th>
<th>{Lang::T('Created On')}</th> <th>{Lang::T('Created On')}</th>
<th>{Lang::T('Expires On')}</th> <th>{Lang::T('Expires On')}</th>
<th>{Lang::T('Method')}</th> <th>{Lang::T('Method')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach $activation as $ds} {foreach $activation as $ds}
<tr onclick="window.location.href = '{$_url}plan/view/{$ds['id']}'" style="cursor:pointer;"> <tr onclick="window.location.href = '{$_url}plan/view/{$ds['id']}'" style="cursor:pointer;">
<td>{$ds['invoice']}</td> <td>{$ds['invoice']}</td>
<td>{$ds['username']}</td> <td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td> <td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td> <td>{$ds['type']}</td>
<td class="text-success">{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])} <td class="text-success">{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}
</td> </td>
<td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td> <td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td> <td>{$ds['method']}</td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
{/if} {/if}
{if Lang::arrayCount($order)} {if Lang::arrayCount($order)}
<thead> <thead>
<tr> <tr>
<th>{Lang::T('Plan Name')}</th> <th>{Lang::T('Plan Name')}</th>
<th>{Lang::T('Gateway')}</th> <th>{Lang::T('Gateway')}</th>
<th>{Lang::T('Routers')}</th> <th>{Lang::T('Routers')}</th>
<th>{Lang::T('Type')}</th> <th>{Lang::T('Type')}</th>
<th>{Lang::T('Plan Price')}</th> <th>{Lang::T('Plan Price')}</th>
<th>{Lang::T('Created On')}</th> <th>{Lang::T('Created On')}</th>
<th>{Lang::T('Expires On')}</th> <th>{Lang::T('Expires On')}</th>
<th>{Lang::T('Date Done')}</th> <th>{Lang::T('Date Done')}</th>
<th>{Lang::T('Method')}</th> <th>{Lang::T('Method')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach $order as $ds} {foreach $order as $ds}
<tr> <tr>
<td>{$ds['plan_name']}</td> <td>{$ds['plan_name']}</td>
<td>{$ds['gateway']}</td> <td>{$ds['gateway']}</td>
<td>{$ds['routers']}</td> <td>{$ds['routers']}</td>
<td>{$ds['payment_channel']}</td> <td>{$ds['payment_channel']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td class="text-primary">{Lang::dateTimeFormat($ds['created_date'])}</td> <td class="text-primary">{Lang::dateTimeFormat($ds['created_date'])}</td>
<td class="text-danger">{Lang::dateTimeFormat($ds['expired_date'])}</td> <td class="text-danger">{Lang::dateTimeFormat($ds['expired_date'])}</td>
<td class="text-success">{if $ds['status']!=1}{Lang::dateTimeFormat($ds['paid_date'])}{/if}</td> <td class="text-success">{if $ds['status']!=1}{Lang::dateTimeFormat($ds['paid_date'])}{/if}</td>
<td>{if $ds['status']==1}{Lang::T('UNPAID')} <td>{if $ds['status']==1}{Lang::T('UNPAID')}
{elseif $ds['status']==2}{Lang::T('PAID')} {elseif $ds['status']==2}{Lang::T('PAID')}
{elseif $ds['status']==3}{$_L['FAILED']} {elseif $ds['status']==3}{$_L['FAILED']}
{elseif $ds['status']==4}{Lang::T('CANCELED')} {elseif $ds['status']==4}{Lang::T('CANCELED')}
{elseif $ds['status']==5}{Lang::T('UNKNOWN')} {elseif $ds['status']==5}{Lang::T('UNKNOWN')}
{/if}</td> {/if}</td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
{/if} {/if}
</table> </table>
</div> </div>

View File

@ -1,65 +1,64 @@
{include file="sections/header.tpl"} {include file="sections/header.tpl"}
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12"> <div class="col-sm-12 col-md-12">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">{Lang::T('Send Personal Message')}</div> <div class="panel-heading">{Lang::T('Send Personal Message')}</div>
<div class="panel-body"> <div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}message/send-post" > <form class="form-horizontal" method="post" role="form" action="{$_url}message/send-post">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Customer')}</label> <label class="col-md-2 control-label">{Lang::T('Customer')}</label>
<div class="col-md-6"> <div class="col-md-6">
<select id="personSelect" class="form-control select2" name="id_customer" style="width: 100%" data-placeholder="Select a customer..."> <select {if $cust}{else}id="personSelect" {/if} class="form-control select2"
<option></option> name="id_customer" style="width: 100%"
{foreach $c as $cs} data-placeholder="{Lang::T('Select a customer')}...">
{if $id eq $cs['id']} {if $cust}
<option value="{$cs['id']}" selected>{$cs['username']}</option> <option value="{$cust['id']}">{$cust['username']} &bull; {$cust['fullname']} &bull;
{else} {$cust['email']}</option>
<option value="{$cs['id']}">{$cs['username']}</option> {/if}
{/if} </select>
{/foreach} </div>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Send Via')}</label>
<div class="col-md-6">
<select class="form-control" name="via" id="via">
<option value="sms" selected> {Lang::T('SMS')}</option>
<option value="wa"> {Lang::T('WhatsApp')}</option>
<option value="both"> {Lang::T('SMS and WhatsApp')}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Message')}</label>
<div class="col-md-6">
<textarea class="form-control" id="message" name="message" placeholder="{Lang::T('Compose your message...')}" rows="5"></textarea>
</div>
<p class="help-block col-md-4">
{Lang::T('Use placeholders:')}
<br>
<b>{Lang::T('[[name]]')}</b> - {Lang::T('Customer Name')}
<br>
<b>{Lang::T('[[user_name]]')}</b> - {Lang::T('Customer Username')}
<br>
<b>{Lang::T('[[phone]]')}</b> - {Lang::T('Customer Phone')}
<br>
<b>{Lang::T('[[company_name]]')}</b> - {Lang::T('Your Company Name')}
</p>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Send Message')}</button>
<a href="{$_url}dashboard" class="btn btn-default">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div> </div>
</div> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Send Via')}</label>
<div class="col-md-6">
<select class="form-control" name="via" id="via">
<option value="sms" selected> {Lang::T('SMS')}</option>
<option value="wa"> {Lang::T('WhatsApp')}</option>
<option value="both"> {Lang::T('SMS and WhatsApp')}</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Message')}</label>
<div class="col-md-6">
<textarea class="form-control" id="message" name="message"
placeholder="{Lang::T('Compose your message...')}" rows="5"></textarea>
</div>
<p class="help-block col-md-4">
{Lang::T('Use placeholders:')}
<br>
<b>{Lang::T('[[name]]')}</b> - {Lang::T('Customer Name')}
<br>
<b>{Lang::T('[[user_name]]')}</b> - {Lang::T('Customer Username')}
<br>
<b>{Lang::T('[[phone]]')}</b> - {Lang::T('Customer Phone')}
<br>
<b>{Lang::T('[[company_name]]')}</b> - {Lang::T('Your Company Name')}
</p>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-success" type="submit">{Lang::T('Send Message')}</button>
<a href="{$_url}dashboard" class="btn btn-default">{Lang::T('Cancel')}</a>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div>
</div>
{include file="sections/footer.tpl"} {include file="sections/footer.tpl"}