User Inbox
This commit is contained in:
parent
150f9a5c41
commit
be507a013a
@ -229,7 +229,7 @@ CREATE TABLE `tbl_customers_inbox` (
|
|||||||
`date_created` datetime NOT NULL,
|
`date_created` datetime NOT NULL,
|
||||||
`date_read` datetime DEFAULT NULL,
|
`date_read` datetime DEFAULT NULL,
|
||||||
`subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
|
`subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL,
|
||||||
`body` varchar(512) COLLATE utf8mb4_general_ci NOT NULL,
|
`body` TEXT NULL DEFAULT NULL,
|
||||||
`from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',
|
`from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',
|
||||||
`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0',
|
`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
|
@ -44,16 +44,17 @@ class Text
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function maskText($text){
|
public static function maskText($text)
|
||||||
|
{
|
||||||
$len = strlen($text);
|
$len = strlen($text);
|
||||||
if($len < 3){
|
if ($len < 3) {
|
||||||
return "***";
|
return "***";
|
||||||
}else if($len<5){
|
} else if ($len < 5) {
|
||||||
return substr($text,0,1)."***".substr($text,-1,1);
|
return substr($text, 0, 1) . "***" . substr($text, -1, 1);
|
||||||
}else if($len<8){
|
} else if ($len < 8) {
|
||||||
return substr($text,0,2)."***".substr($text,-2,2);
|
return substr($text, 0, 2) . "***" . substr($text, -2, 2);
|
||||||
}else{
|
} else {
|
||||||
return substr($text,0,4)."******".substr($text,-3,3);
|
return substr($text, 0, 4) . "******" . substr($text, -3, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,4 +62,9 @@ class Text
|
|||||||
{
|
{
|
||||||
return preg_replace("/[^A-Za-z0-9]/", '_', $str);;
|
return preg_replace("/[^A-Za-z0-9]/", '_', $str);;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function is_html($string)
|
||||||
|
{
|
||||||
|
return preg_match("/<[^<]+>/", $string, $m) != 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,26 @@ switch ($action) {
|
|||||||
$mail->date_read = date('Y-m-d H:i:s');
|
$mail->date_read = date('Y-m-d H:i:s');
|
||||||
$mail->save();
|
$mail->save();
|
||||||
}
|
}
|
||||||
|
$next = ORM::for_table('tbl_customers_inbox')->select("id")->where('customer_id', $user['id'])->where_gt("id", $routes['2'])->order_by_asc("id")->find_one();
|
||||||
|
$prev = ORM::for_table('tbl_customers_inbox')->select("id")->where('customer_id', $user['id'])->where_lt("id", $routes['2'])->order_by_desc("id")->find_one();
|
||||||
|
|
||||||
|
$ui->assign('next', $next['id']);
|
||||||
|
$ui->assign('prev', $prev['id']);
|
||||||
$ui->assign('mail', $mail);
|
$ui->assign('mail', $mail);
|
||||||
$ui->assign('tipe', 'view');
|
$ui->assign('tipe', 'view');
|
||||||
$ui->assign('_system_menu', 'inbox');
|
$ui->assign('_system_menu', 'inbox');
|
||||||
$ui->assign('_title', Lang::T('Inbox'));
|
$ui->assign('_title', Lang::T('Inbox'));
|
||||||
$ui->display('user-inbox.tpl');
|
$ui->display('user-inbox.tpl');
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
if($routes['2']){
|
||||||
|
if(ORM::for_table('tbl_customers_inbox')->where('customer_id', $user['id'])->where('id', $routes['2'])->find_one()->delete()){
|
||||||
|
r2(U. 'mail', 's', Lang::T('Mail Deleted Successfully'));
|
||||||
|
}else{
|
||||||
|
r2(U. 'home', 'e', Lang::T('Failed to Delete Message'));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
$q = _req('q');
|
$q = _req('q');
|
||||||
$limit = 40;
|
$limit = 40;
|
||||||
|
@ -685,6 +685,8 @@
|
|||||||
"Channel": "Channel",
|
"Channel": "Channel",
|
||||||
"Payment_Link": "Payment Link",
|
"Payment_Link": "Payment Link",
|
||||||
"Created": "Created",
|
"Created": "Created",
|
||||||
"2": "2",
|
"Previous": "Previous",
|
||||||
"_": "-"
|
"Share": "Share",
|
||||||
|
"Mail_Deleted_Successfully": "Mail Deleted Successfully",
|
||||||
|
"Message_Not_Found": "Message Not Found"
|
||||||
}
|
}
|
@ -135,6 +135,6 @@
|
|||||||
"ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';"
|
"ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';"
|
||||||
],
|
],
|
||||||
"2024.8.2" : [
|
"2024.8.2" : [
|
||||||
"CREATE TABLE IF NOT EXISTS `tbl_customers_inbox` (`id` int UNSIGNED NOT NULL AUTO_INCREMENT, `customer_id` int NOT NULL, `date_created` datetime NOT NULL, `date_read` datetime DEFAULT NULL, `subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL, `body` varchar(512) COLLATE utf8mb4_general_ci NOT NULL, `from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"
|
"CREATE TABLE IF NOT EXISTS `tbl_customers_inbox` (`id` int UNSIGNED NOT NULL AUTO_INCREMENT, `customer_id` int NOT NULL, `date_created` datetime NOT NULL, `date_read` datetime DEFAULT NULL, `subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL, `body` TEXT NULL DEFAULT NULL, `from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,11 +1,44 @@
|
|||||||
{include file="sections/user-header.tpl"}
|
{include file="sections/user-header.tpl"}
|
||||||
|
|
||||||
{if $tipe == 'view'}
|
{if $tipe == 'view'}
|
||||||
|
|
||||||
{else}
|
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
|
<div class="box-body no-padding">
|
||||||
|
<div class="mailbox-read-info">
|
||||||
|
<h3>{$mail['subject']}</h3>
|
||||||
|
<h5>From: {$mail['from']}
|
||||||
|
<span class="mailbox-read-time pull-right" data-toggle="tooltip" data-placement="top"
|
||||||
|
title="Read at {Lang::dateTimeFormat($mail['date_read'])}">{Lang::dateTimeFormat($mail['date_created'])}</span>
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
|
<div class="mailbox-read-message">
|
||||||
|
{if Text::is_html($mail['body'])}
|
||||||
|
{$mail['body']}
|
||||||
|
{else}
|
||||||
|
{nl2br($mail['body'])}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-footer">
|
||||||
|
<div class="pull-right">
|
||||||
|
{if $prev}
|
||||||
|
<a href="{$_url}mail/view/{$prev}" class="btn btn-default"><i class="fa fa-chevron-left"></i>
|
||||||
|
{Lang::T("Previous")}</a>
|
||||||
|
{/if}
|
||||||
|
{if $next}
|
||||||
|
<a href="{$_url}mail/view/{$next}" class="btn btn-default"><i class="fa fa-chevron-right"></i>
|
||||||
|
{Lang::T("Next")}</a>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<a href="{$_url}mail/delete/{$mail['id']}" class="btn btn-danger"
|
||||||
|
onclick="return confirm('{Lang::T("Delete")}?')"><i class="fa fa-trash-o"></i>
|
||||||
|
{Lang::T("Delete")}</a>
|
||||||
|
<a href="https://api.whatsapp.com/send?text={if Text::is_html($mail['body'])}{urlencode(strip_tags($mail['body']))}{else}{urlencode($mail['body'])}{/if}" class="btn btn-primary"><i class="fa fa-share"></i> {Lang::T("Share")}</a>
|
||||||
|
</div>
|
||||||
|
<!-- /.box-footer -->
|
||||||
|
</div>
|
||||||
|
{else}
|
||||||
|
<div class="box box-primary">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h3 class="box-title">Inbox</h3>
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<div class="box-tools pull-right">
|
<div class="box-tools pull-right">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@ -38,11 +71,16 @@
|
|||||||
{foreach $mails as $mail}
|
{foreach $mails as $mail}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="mailbox-subject">
|
<td class="mailbox-subject">
|
||||||
|
<a href="{$_url}mail/view/{$mail['id']}">
|
||||||
|
<div>
|
||||||
{if $mail['date_read'] == null}
|
{if $mail['date_read'] == null}
|
||||||
<i class="fa fa-envelope text-yellow" title="unread"></i>
|
<i class="fa fa-envelope text-yellow" title="unread"></i>
|
||||||
{else}
|
{else}
|
||||||
<i class="fa fa-envelope-o text-yellow" title="read"></i>
|
<i class="fa fa-envelope-o text-yellow" title="read"></i>
|
||||||
{/if}<a href="{$_url}mail/view/{$mail['id']}"><b>{$mail['subject']}</b></a>
|
{/if}
|
||||||
|
<b>{$mail['subject']}</b>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="mailbox-name">{$mail['from']}</td>
|
<td class="mailbox-name">{$mail['from']}</td>
|
||||||
<td class="mailbox-attachment"></td>
|
<td class="mailbox-attachment"></td>
|
||||||
@ -68,7 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user