notification
This commit is contained in:
@ -35,4 +35,9 @@ use kernel\helpers\Html;
|
||||
<div class="col-12 m-1">
|
||||
<a class="btn btn-primary w-100" href="/miniapp/card_action_step_2?type=withdraw&card_id=<?=$card->id?>">Списать</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 20px;">
|
||||
<div class="col-12 m-1">
|
||||
<a class="btn btn-primary w-100" href="/miniapp/card_info/<?=$card->id?>">Информация о карте</a>
|
||||
</div>
|
||||
</div>
|
80
app/modules/tgbot/views/tgbot/main/card_info.php
Normal file
80
app/modules/tgbot/views/tgbot/main/card_info.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @var \kernel\app_modules\card\models\Card $card
|
||||
* @var \Illuminate\Database\Eloquent\Collection $transactions
|
||||
*/
|
||||
|
||||
use Itguild\EloquentTable\ViewEloquentTable;
|
||||
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
|
||||
use kernel\app_modules\card\models\Card;
|
||||
use kernel\modules\user\models\User;
|
||||
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnListWidget;
|
||||
|
||||
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($card, [
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/card",
|
||||
]));
|
||||
|
||||
$table->beforePrint(function () use ($card) {
|
||||
$btn = "<h2>Информация о карте</h2>";
|
||||
$btn .= IconBtnListWidget::create(['url' => '/miniapp/card_action/' . $card->id])->run();
|
||||
|
||||
return $btn;
|
||||
});
|
||||
|
||||
$table->rows([
|
||||
'user_id' => (function ($data) {
|
||||
return User::find($data)->username;
|
||||
}),
|
||||
'status' => function ($data) {
|
||||
return \kernel\app_modules\card\models\Card::getStatus()[$data];
|
||||
}
|
||||
]);
|
||||
|
||||
$table->create();
|
||||
$table->render();
|
||||
|
||||
echo "<h3>Тразакции</h3>";
|
||||
|
||||
foreach ($transactions as $transaction){
|
||||
$table = new ViewEloquentTable(new ViewJsonTableEloquentModel($transaction, [
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/card_program",
|
||||
]));
|
||||
|
||||
$table->rows([
|
||||
'status' => [
|
||||
'value' => function ($data) {
|
||||
return \kernel\app_modules\card\models\CardProgram::getStatus()[$data];
|
||||
}
|
||||
],
|
||||
'from' => [
|
||||
'value' => function ($data) {
|
||||
if ((int)$data === 1001){
|
||||
$username = "System";
|
||||
}
|
||||
else {
|
||||
$username = Card::find($data)->username ?? '';
|
||||
}
|
||||
return $username;
|
||||
}
|
||||
],
|
||||
'to' => [
|
||||
'value' => function ($data) {
|
||||
if ((int)$data === 1001){
|
||||
$username = "System";
|
||||
}
|
||||
else {
|
||||
$username = Card::find($data)->username ?? '';
|
||||
}
|
||||
return $username;
|
||||
}
|
||||
],
|
||||
]);
|
||||
|
||||
$table->create();
|
||||
$table->render();
|
||||
}
|
Reference in New Issue
Block a user