mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
add files to project
This commit is contained in:
commit
5cac498444
3729 changed files with 836998 additions and 0 deletions
22
modules/admin/views/wallets/_form.php
Normal file
22
modules/admin/views/wallets/_form.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $model \app\models\Wallet */
|
||||
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use app\models\Site;
|
||||
use app\models\Wallet;
|
||||
|
||||
$form = ActiveForm::begin(['method' => 'POST']);
|
||||
echo $form->field($model, 'type_id')->dropDownList(Wallet::getWalletTypes());
|
||||
echo $form->field($model, 'site_id')->dropDownList(ArrayHelper::map(Site::find()->all(), 'id', 'name'), ['prompt' => 'Нет']);
|
||||
echo $form->field($model, 'wallet_id');
|
||||
echo $form->field($model, 'login');
|
||||
echo $form->field($model, 'password');
|
||||
echo $form->field($model, 'phone');
|
||||
echo $form->field($model, 'status')->checkbox();
|
||||
echo $form->field($model, 'comment')->textarea();
|
||||
echo Html::submitButton('Сохранить', ['class' => 'btn btn-success']);
|
||||
$form::end();
|
8
modules/admin/views/wallets/create.php
Normal file
8
modules/admin/views/wallets/create.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $model \app\models\Wallet */
|
||||
|
||||
$this->title = 'Добавление кошелька';
|
||||
|
||||
echo $this->render('_form', compact('model'));
|
83
modules/admin/views/wallets/index.php
Normal file
83
modules/admin/views/wallets/index.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $dataProvider \yii\data\ActiveDataProvider */
|
||||
|
||||
use yii\grid\ActionColumn;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use app\models\Wallet;
|
||||
|
||||
$this->title = 'Кошельки';
|
||||
|
||||
$total = array_sum(ArrayHelper::getColumn($dataProvider->models, 'balance'));
|
||||
?>
|
||||
|
||||
<?= Html::tag('p', Html::a('Добавить кошелёк', ['wallets/create'], ['class' => 'btn btn-primary'])) ?>
|
||||
|
||||
<b>Всего: <?= Yii::$app->formatter->asCurrency($total, 'RUB') ?></b><br><br>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'rowOptions' => function($model) {
|
||||
if (is_null($model->tm_last_transaction_out)) return [];
|
||||
if (time() - strtotime($model->tm_last_transaction_out) > 60 * 60 * 48) return ['class' => 'danger'];
|
||||
return ['class' => 'success'];
|
||||
},
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'type_id',
|
||||
'header' => 'Тип / сайт',
|
||||
'content' => function($model) {
|
||||
$type = "";
|
||||
switch ($model->type_id) {
|
||||
case Wallet::TYPE_YANDEX: $type = 'Яндекс.Деньги'; break;
|
||||
case Wallet::TYPE_QIWI: $type = 'Qiwi кошелек'; break;
|
||||
}
|
||||
return join("<br />", [$type, ArrayHelper::getValue($model, ['site', 'name'])]);
|
||||
}
|
||||
],
|
||||
[
|
||||
'attribute' => 'wallet_id',
|
||||
'header' => 'Кошелек / номер телефона',
|
||||
'content' => function($model) {
|
||||
$content = [$model->wallet_id];
|
||||
if($model->type_id == Wallet::TYPE_YANDEX) {
|
||||
$content[] = $model->phone;
|
||||
}
|
||||
return join("<br />", $content);
|
||||
}
|
||||
],
|
||||
[
|
||||
"header" => 'Логин / пароль',
|
||||
"content" => function($model) {
|
||||
return join("<br />", [$model->login, $model->password]);
|
||||
}
|
||||
],
|
||||
[
|
||||
"attribute" => 'balance',
|
||||
"content" => function($model) {
|
||||
return Yii::$app->formatter->asCurrency($model->balance, 'RUB');
|
||||
}
|
||||
],
|
||||
'tm_last_balance',
|
||||
[
|
||||
"header" => 'Приход / Расход',
|
||||
'content' => function($model) {
|
||||
return join("<br />", [Yii::$app->formatter->asRelativeTime($model->tm_last_transaction), Yii::$app->formatter->asRelativeTime($model->tm_last_transaction_out)]);
|
||||
}
|
||||
],
|
||||
[
|
||||
"header" => 'Комментарий',
|
||||
'content' => function($model) {
|
||||
return nl2br($model->comment);
|
||||
}
|
||||
],
|
||||
[
|
||||
'class' => ActionColumn::className(),
|
||||
'template' => '{view}',
|
||||
],
|
||||
],
|
||||
]) ?>
|
8
modules/admin/views/wallets/view.php
Normal file
8
modules/admin/views/wallets/view.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
/* @var $this \yii\web\View */
|
||||
/* @var $model \app\models\Wallet */
|
||||
|
||||
$this->title = 'Редактирование кошелька';
|
||||
|
||||
echo $this->render('_form', compact('model'));
|
Loading…
Add table
Add a link
Reference in a new issue