Sending balance Notification
This commit is contained in:
parent
15b9744b18
commit
a175f96039
@ -25,6 +25,9 @@ if (_post('send') == 'balance') {
|
||||
if ($user['balance'] < $balance) {
|
||||
r2(U . 'home', 'd', Lang::T('insufficient balance'));
|
||||
}
|
||||
if (intval($config['minimum_transfer']) >= intval($balance)) {
|
||||
r2(U . 'home', 'd', Lang::T('Minimum Transfer') . ' ' . Lang::moneyFormat($config['minimum_transfer']));
|
||||
}
|
||||
if ($user['username'] == $target['username']) {
|
||||
r2(U . 'home', 'd', Lang::T('Cannot send to yourself'));
|
||||
}
|
||||
@ -46,7 +49,6 @@ if (_post('send') == 'balance') {
|
||||
$d->pg_url_payment = 'balance';
|
||||
$d->status = 2;
|
||||
$d->save();
|
||||
Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, Lang::getNotifText('balance_send'), $config['user_notification_reminder']);
|
||||
//receiver
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $target['username'];
|
||||
@ -64,7 +66,8 @@ if (_post('send') == 'balance') {
|
||||
$d->pg_url_payment = 'balance';
|
||||
$d->status = 2;
|
||||
$d->save();
|
||||
Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, Lang::getNotifText('balance_received'), $config['user_notification_reminder']);
|
||||
Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, Lang::getNotifText('balance_send'), $config['user_notification_payment']);
|
||||
Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, Lang::getNotifText('balance_received'), $config['user_notification_payment']);
|
||||
Message::sendTelegram("#u$user[username] send balance to #u$target[username] \n" . Lang::moneyFormat($balance));
|
||||
r2(U . 'home', 's', Lang::T('Sending balance success'));
|
||||
}
|
||||
|
@ -213,6 +213,7 @@ switch ($action) {
|
||||
$telegram_target_id = _post('telegram_target_id');
|
||||
$sms_url = _post('sms_url');
|
||||
$wa_url = _post('wa_url');
|
||||
$minimum_transfer = _post('minimum_transfer');
|
||||
$user_notification_expired = _post('user_notification_expired');
|
||||
$user_notification_reminder = _post('user_notification_reminder');
|
||||
$user_notification_payment = _post('user_notification_payment');
|
||||
@ -281,6 +282,17 @@ switch ($action) {
|
||||
$d->save();
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'minimum_transfer')->find_one();
|
||||
if($d){
|
||||
$d->value = $minimum_transfer;
|
||||
$d->save();
|
||||
}else{
|
||||
$d = ORM::for_table('tbl_appconfig')->create();
|
||||
$d->setting = 'minimum_transfer';
|
||||
$d->value = $minimum_transfer;
|
||||
$d->save();
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_bot')->find_one();
|
||||
if($d){
|
||||
$d->value = $telegram_bot;
|
||||
|
@ -382,3 +382,5 @@ $_L['To'] = 'To';
|
||||
$_L['insufficient_balance'] = 'insufficient balance';
|
||||
$_L['Send_Balance'] = 'Send Balance';
|
||||
$_L['Received_Balance'] = 'Received Balance';
|
||||
$_L['Minimum_Balance_Transfer'] = 'Minimum Balance Transfer';
|
||||
$_L['Minimum_Transfer'] = 'Minimum Transfer';
|
||||
|
@ -107,6 +107,13 @@
|
||||
</div>
|
||||
<p class="help-block col-md-4">{Lang::T('Allow balance transfer between customers')}</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Minimum Balance Transfer')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="number" class="form-control" id="minimum_transfer" name="minimum_transfer"
|
||||
value="{$_c['minimum_transfer']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
|
@ -144,7 +144,7 @@
|
||||
<h4 class="box-title">{Lang::T("Transfer Balance")}</h4>
|
||||
</div>
|
||||
<div class="box-body p-0">
|
||||
<form method="post" onsubmit="return confirm('{Lang::T('Send your balance?')}')" role="form" action="{$_url}home">
|
||||
<form method="post" onsubmit="return askConfirm()" role="form" action="{$_url}home">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-5">
|
||||
<input type="text" id="username" name="username" class="form-control" required
|
||||
@ -155,10 +155,19 @@
|
||||
placeholder="{$_L['Balance']}">
|
||||
</div>
|
||||
<div class="form-group col-sm-2" align="center">
|
||||
<button class="btn btn-success btn-block" type="submit" name="send" value="balance"><i class="glyphicon glyphicon-send"></i></button>
|
||||
<button class="btn btn-success btn-block" id="sendBtn" type="submit" name="send" value="balance"><i class="glyphicon glyphicon-send"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function askConfirm(){
|
||||
if(confirm('{Lang::T('Send your balance?')}')){
|
||||
document.getElementById('sendBtn').setAttribute('disabled', '');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
Loading…
x
Reference in New Issue
Block a user