account replenishment

This commit is contained in:
gerchek 2022-11-21 16:34:41 +05:00
parent 35db57fd37
commit 06f0d9e165
39 changed files with 1008 additions and 175 deletions

1
.~lock.bank_api.docx# Normal file
View File

@ -0,0 +1 @@
,ata,ata,21.11.2022 16:24,file:///home/ata/.config/libreoffice/4;

View File

@ -0,0 +1,100 @@
<?php namespace AhmadFatoni\ApiGenerator\Controllers\API;
use Cms\Classes\Controller;
use BackendMenu;
use Illuminate\Http\Request;
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
use Illuminate\Support\Facades\Validator;
use Atash\Contact\Models\TypeAccountReplenishment;
class typeAccountReplenishmentController extends Controller
{
protected $TypeAccountReplenishment;
protected $helpers;
public function __construct(TypeAccountReplenishment $TypeAccountReplenishment, Helpers $helpers)
{
parent::__construct();
$this->TypeAccountReplenishment = $TypeAccountReplenishment;
$this->helpers = $helpers;
}
public function index(){
// $data = $this->TypeAccountReplenishment->all()->toArray();
$data = $this->TypeAccountReplenishment->with(['translations:locale,model_id,attribute_data'])->get();
return $this->helpers->apiArrayResponseBuilder(200, 'success', $data);
}
public function show($id){
$data = $this->TypeAccountReplenishment::find($id);
if ($data){
return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]);
} else {
$this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']);
}
}
public function store(Request $request){
$arr = $request->all();
while ( $data = current($arr)) {
$this->TypeAccountReplenishment->{key($arr)} = $data;
next($arr);
}
$validation = Validator::make($request->all(), $this->TypeAccountReplenishment->rules);
if( $validation->passes() ){
$this->TypeAccountReplenishment->save();
return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->TypeAccountReplenishment->id]);
}else{
return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() );
}
}
public function update($id, Request $request){
$status = $this->TypeAccountReplenishment->where('id',$id)->update($data);
if( $status ){
return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.');
}else{
return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.');
}
}
public function delete($id){
$this->TypeAccountReplenishment->where('id',$id)->delete();
return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.');
}
public function destroy($id){
$this->TypeAccountReplenishment->where('id',$id)->delete();
return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.');
}
public static function getAfterFilters() {return [];}
public static function getBeforeFilters() {return [];}
public static function getMiddleware() {return [];}
public function callAction($method, $parameters=false) {
return call_user_func_array(array($this, $method), $parameters);
}
}

View File

@ -4,7 +4,9 @@ Route::post('fatoni/generate/api', array('as' => 'fatoni.generate.api', 'uses' =
Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi'));
Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi'));
Route::resource('api/v1/credit_data', 'AhmadFatoni\ApiGenerator\Controllers\API\creditController', ['except' => ['destroy', 'create', 'edit']]);
Route::get('api/v1/credit_data/{id}/delete', ['as' => 'api/v1/credit_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\creditController@destroy']);
Route::resource('api/v1/card_data', 'AhmadFatoni\ApiGenerator\Controllers\API\cardController', ['except' => ['destroy', 'create', 'edit']]);
Route::get('api/v1/card_data/{id}/delete', ['as' => 'api/v1/card_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\cardController@destroy']);
Route::resource('api/v1/credit_data', 'AhmadFatoni\ApiGenerator\Controllers\API\creditController', ['except' => ['destroy', 'create', 'edit']]);
Route::get('api/v1/credit_data/{id}/delete', ['as' => 'api/v1/credit_data.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\creditController@destroy']);
Route::resource('api/v1/type_account_replenishment', 'AhmadFatoni\ApiGenerator\Controllers\API\typeAccountReplenishmentController', ['except' => ['destroy', 'create', 'edit']]);
Route::get('api/v1/type_account_replenishment/{id}/delete', ['as' => 'api/v1/type_account_replenishment.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\typeAccountReplenishmentController@destroy']);

View File

@ -0,0 +1,19 @@
<?php namespace Atash\Contact\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class AccountReplenishmentController extends Controller
{
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController' ];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $reorderConfig = 'config_reorder.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Atash.Contact', 'main-menu-item', 'side-menu-item6');
}
}

View File

@ -0,0 +1,19 @@
<?php namespace Atash\Contact\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class TypeAccountReplenishmentController extends Controller
{
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController', 'Backend\Behaviors\ReorderController' ];
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $reorderConfig = 'config_reorder.yaml';
public function __construct()
{
parent::__construct();
BackendMenu::setContext('Atash.Contact', 'main-menu-item', 'side-menu-item5');
}
}

View File

@ -0,0 +1,19 @@
<div data-control="toolbar">
<a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
<a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator>
<?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div>

View File

@ -0,0 +1,3 @@
<div data-control="toolbar">
<a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('backend::lang.form.return_to_list')) ?></a>
</div>

View File

@ -0,0 +1,10 @@
name: AccountReplenishmentController
form: $/atash/contact/models/accountreplenishment/fields.yaml
modelClass: Atash\Contact\Models\AccountReplenishment
defaultRedirect: atash/contact/accountreplenishmentcontroller
create:
redirect: 'atash/contact/accountreplenishmentcontroller/update/:id'
redirectClose: atash/contact/accountreplenishmentcontroller
update:
redirect: atash/contact/accountreplenishmentcontroller
redirectClose: atash/contact/accountreplenishmentcontroller

View File

@ -0,0 +1,12 @@
list: $/atash/contact/models/accountreplenishment/columns.yaml
modelClass: Atash\Contact\Models\AccountReplenishment
title: AccountReplenishmentController
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
buttons: list_toolbar
search:
prompt: 'backend::lang.list.search_prompt'
recordUrl: 'atash/contact/accountreplenishmentcontroller/update/:id'

View File

@ -0,0 +1,4 @@
title: AccountReplenishmentController
modelClass: Atash\Contact\Models\AccountReplenishment
toolbar:
buttons: reorder_toolbar

View File

@ -0,0 +1,46 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>">AccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

View File

@ -0,0 +1,22 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>">AccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<?php endif ?>
<p>
<a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>" class="btn btn-default oc-icon-chevron-left">
<?= e(trans('backend::lang.form.return_to_list')) ?>
</a>
</p>

View File

@ -0,0 +1,8 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>">AccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?= $this->reorderRender() ?>

View File

@ -0,0 +1,54 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>">AccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('atash/contact/accountreplenishmentcontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,19 @@
<div data-control="toolbar">
<a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
<a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller/reorder') ?>" class="btn btn-default oc-icon-list"><?= e(trans('backend::lang.reorder.default_title')) ?></a>
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator>
<?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div>

View File

@ -0,0 +1,3 @@
<div data-control="toolbar">
<a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>" class="btn btn-primary oc-icon-caret-left"><?= e(trans('backend::lang.form.return_to_list')) ?></a>
</div>

View File

@ -0,0 +1,10 @@
name: TypeAccountReplenishmentController
form: $/atash/contact/models/typeaccountreplenishment/fields.yaml
modelClass: Atash\Contact\Models\TypeAccountReplenishment
defaultRedirect: atash/contact/typeaccountreplenishmentcontroller
create:
redirect: 'atash/contact/typeaccountreplenishmentcontroller/update/:id'
redirectClose: atash/contact/typeaccountreplenishmentcontroller
update:
redirect: atash/contact/typeaccountreplenishmentcontroller
redirectClose: atash/contact/typeaccountreplenishmentcontroller

View File

@ -0,0 +1,12 @@
list: $/atash/contact/models/typeaccountreplenishment/columns.yaml
modelClass: Atash\Contact\Models\TypeAccountReplenishment
title: TypeAccountReplenishmentController
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
buttons: list_toolbar
search:
prompt: 'backend::lang.list.search_prompt'
recordUrl: 'atash/contact/typeaccountreplenishmentcontroller/update/:id'

View File

@ -0,0 +1,4 @@
title: TypeAccountReplenishmentController
modelClass: Atash\Contact\Models\TypeAccountReplenishment
toolbar:
buttons: reorder_toolbar

View File

@ -0,0 +1,46 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>">TypeAccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.create')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.create_and_close')) ?>
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

View File

@ -0,0 +1,22 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>">TypeAccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<div class="form-preview">
<?= $this->formRenderPreview() ?>
</div>
<?php else: ?>
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
<?php endif ?>
<p>
<a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>" class="btn btn-default oc-icon-chevron-left">
<?= e(trans('backend::lang.form.return_to_list')) ?>
</a>
</p>

View File

@ -0,0 +1,8 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>">TypeAccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?= $this->reorderRender() ?>

View File

@ -0,0 +1,54 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>">TypeAccountReplenishmentController</a></li>
<li><?= e($this->pageTitle) ?></li>
</ul>
<?php Block::endPut() ?>
<?php if (!$this->fatalError): ?>
<?= Form::open(['class' => 'layout']) ?>
<div class="layout-row">
<?= $this->formRender() ?>
</div>
<div class="form-buttons">
<div class="loading-indicator-container">
<button
type="submit"
data-request="onSave"
data-request-data="redirect:0"
data-hotkey="ctrl+s, cmd+s"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-primary">
<?= e(trans('backend::lang.form.save')) ?>
</button>
<button
type="button"
data-request="onSave"
data-request-data="close:1"
data-hotkey="ctrl+enter, cmd+enter"
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
class="btn btn-default">
<?= e(trans('backend::lang.form.save_and_close')) ?>
</button>
<button
type="button"
class="oc-icon-trash-o btn-icon danger pull-right"
data-request="onDelete"
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
</button>
<span class="btn-text">
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
</span>
</div>
</div>
<?= Form::close() ?>
<?php else: ?>
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
<p><a href="<?= Backend::url('atash/contact/typeaccountreplenishmentcontroller') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,27 @@
<?php namespace Atash\Contact\Models;
use Model;
/**
* Model
*/
class AccountReplenishment extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'atash_contact_account_replenishment';
/**
* @var array Validation rules
*/
public $rules = [
];
public $attachMany = [
'file' => 'System\Models\File'
];
}

View File

@ -0,0 +1,27 @@
<?php namespace Atash\Contact\Models;
use Model;
/**
* Model
*/
class TypeAccountReplenishment extends Model
{
use \October\Rain\Database\Traits\Validation;
/**
* @var string The database table used by the model.
*/
public $table = 'atash_contact_type_account_replenishment';
/**
* @var array Validation rules
*/
public $rules = [
];
public $implement = ['RainLab.Translate.Behaviors.TranslatableModel'];
public $translatable = ['type'];
}

View File

@ -0,0 +1,25 @@
columns:
id:
label: id
type: number
selected_type_account_replenishment:
label: selected_type_account_replenishment
type: text
name:
label: name
type: text
surname:
label: surname
type: text
middlename:
label: middlename
type: text
email:
label: email
type: text
created_at:
label: created_at
type: datetime
updated_at:
label: updated_at
type: datetime

View File

@ -0,0 +1,67 @@
fields:
selected_type_account_replenishment:
label: 'Вид пополнения счета'
span: auto
type: text
name:
label: 'First name'
span: auto
type: text
surname:
label: 'Last name'
span: auto
type: text
middlename:
label: 'Middle name'
span: auto
type: text
birthdate:
label: Birthday
span: auto
type: text
phone_number:
label: 'Phone number'
span: auto
type: text
home_phone_number:
label: 'Home phone number'
span: auto
type: text
email:
label: Email
span: auto
type: text
passport_series:
label: 'Passport ID'
span: auto
type: text
passport_by:
label: 'Passport issued by'
span: auto
type: text
place_of_residence:
label: 'Адрес прописки:'
span: auto
type: text
region:
label: 'Регион:'
span: auto
type: text
branch:
label: 'Филиал:'
span: auto
type: text
comment:
label: Комментария
size: small
span: auto
type: textarea
file:
label: File
mode: file
useCaption: true
thumbOptions:
mode: crop
extension: auto
span: auto
type: fileupload

View File

@ -0,0 +1,13 @@
columns:
id:
label: id
type: number
type:
label: type
type: text
created_at:
label: created_at
type: datetime
updated_at:
label: updated_at
type: datetime

View File

@ -0,0 +1,5 @@
fields:
type:
label: 'Вид пополнения счета'
span: auto
type: text

View File

@ -24,6 +24,10 @@ navigation:
icon: icon-envelope
permissions:
- carddata
side-menu-item5:
label: 'Вид пополнения счета'
url: atash/contact/typeaccountreplenishmentcontroller
icon: icon-signal
side-menu-item:
label: 'Online Card'
url: /atash/contact/onlinecardcontroller
@ -36,6 +40,10 @@ navigation:
icon: icon-dedent
permissions:
- onlinecredit
side-menu-item6:
label: 'Пополнения счета'
url: atash/contact/accountreplenishmentcontroller
icon: icon-line-chart
permissions:
online_card_form:
tab: other

View File

@ -0,0 +1,38 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateAtashContactAccountReplenishment extends Migration
{
public function up()
{
Schema::create('atash_contact_account_replenishment', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('selected_type_account_replenishment')->nullable();
$table->string('name')->nullable();
$table->string('surname')->nullable();
$table->string('middlename')->nullable();
$table->text('birthdate')->nullable();
$table->text('phone_number')->nullable();
$table->text('home_phone_number')->nullable();
$table->string('email')->nullable();
$table->text('passport_series')->nullable();
$table->text('date_of_passport')->nullable();
$table->text('passport_by')->nullable();
$table->text('place_of_residence')->nullable();
$table->text('region')->nullable();
$table->text('branch')->nullable();
$table->text('comment')->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
});
}
public function down()
{
Schema::dropIfExists('atash_contact_account_replenishment');
}
}

View File

@ -0,0 +1,24 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateAtashContactTypeAccountReplenishment extends Migration
{
public function up()
{
Schema::create('atash_contact_type_account_replenishment', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('type');
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
});
}
public function down()
{
Schema::dropIfExists('atash_contact_type_account_replenishment');
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactAccountReplenishment extends Migration
{
public function up()
{
Schema::table('atash_contact_account_replenishment', function($table)
{
$table->integer('user_id');
});
}
public function down()
{
Schema::table('atash_contact_account_replenishment', function($table)
{
$table->dropColumn('user_id');
});
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Atash\Contact\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateAtashContactAccountReplenishment2 extends Migration
{
public function up()
{
Schema::table('atash_contact_account_replenishment', function($table)
{
$table->dropColumn('date_of_passport');
});
}
public function down()
{
Schema::table('atash_contact_account_replenishment', function($table)
{
$table->text('date_of_passport')->nullable();
});
}
}

View File

@ -120,3 +120,15 @@
1.0.41:
- 'Updated table atash_contact_filter_card_data'
- builder_table_update_atash_contact_filter_card_data_2.php
1.0.42:
- 'Created table atash_contact_type_account_replenishment'
- builder_table_create_atash_contact_type_account_replenishment.php
1.0.43:
- 'Created table atash_contact_account_replenishment'
- builder_table_create_atash_contact_account_replenishment.php
1.0.44:
- 'Updated table atash_contact_account_replenishment'
- builder_table_update_atash_contact_account_replenishment.php
1.0.45:
- 'Updated table atash_contact_account_replenishment'
- builder_table_update_atash_contact_account_replenishment_2.php

View File

@ -546,6 +546,7 @@ class User extends UserBase
public $hasMany = [
'message' => \Atash\Contact\Models\ContactClass::class,
'online_credit' => \Atash\Contact\Models\CreditClass::class,
'online_card' => \Atash\Contact\Models\OnlineCard::class
'online_card' => \Atash\Contact\Models\OnlineCard::class,
'account_replenishment' => \Atash\Contact\Models\AccountReplenishment::class
];
}

View File

@ -5,114 +5,114 @@ use Vdomah\JWTAuth\Models\Settings;
use Illuminate\Http\Request;
use Atash\Contact\Models\ContactClass;
use Atash\Contact\Models\CreditClass;
use Atash\Contact\Models\AccountReplenishment;
use Atash\Contact\Models\OnlineCard as CardApp;
use Atash\Contact\Classes\Payment;
use Validator;
// use Validator;
Route::group(['prefix' => 'api'], function() {
Route::post('reset', function (Request $request) {
$rules = [
'code' => 'required',
'password' => 'required|between:' . UserModel::getMinPasswordLength() . ',255'
];
Route::post('reset', function (Request $request) {
$rules = [
'code' => 'required',
'password' => 'required|between:' . UserModel::getMinPasswordLength() . ',255'
];
$validation = Validator::make(post(), $rules);
if ($validation->fails()) {
throw new ValidationException($validation);
}
$validation = Validator::make(post(), $rules);
if ($validation->fails()) {
throw new ValidationException($validation);
}
$errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')];
$errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')];
/*
* Break up the code parts
*/
$parts = explode('!', post('code'));
if (count($parts) != 2) {
throw new ValidationException($errorFields);
}
/*
* Break up the code parts
*/
$parts = explode('!', post('code'));
if (count($parts) != 2) {
throw new ValidationException($errorFields);
}
list($userId, $code) = $parts;
list($userId, $code) = $parts;
if (!strlen(trim($userId)) || !strlen(trim($code)) || !$code) {
throw new ValidationException($errorFields);
}
if (!strlen(trim($userId)) || !strlen(trim($code)) || !$code) {
throw new ValidationException($errorFields);
}
if (!$user = Auth::findUserById($userId)) {
throw new ValidationException($errorFields);
}
if (!$user = Auth::findUserById($userId)) {
throw new ValidationException($errorFields);
}
if (!$user->attemptResetPassword($code, post('password'))) {
throw new ValidationException($errorFields);
}
if (!$user->attemptResetPassword($code, post('password'))) {
throw new ValidationException($errorFields);
}
// Check needed for compatibility with legacy systems
if (method_exists(\RainLab\User\Classes\AuthManager::class, 'clearThrottleForUserId')) {
Auth::clearThrottleForUserId($user->id);
}
return response()->json([
'data' => 'success',
]);
});
Route::post('restore', function (Request $request) {
$rules = [
'email' => 'required|email|between:6,255'
];
$validation = Validator::make(post(), $rules);
if ($validation->fails()) {
throw new ValidationException($validation);
}
$user = UserModel::findByEmail(post('email'));
// if (!$user || $user->is_guest) {
// throw new ApplicationException(Lang::get(/*A user was not found with the given credentials.*/'rainlab.user::lang.account.invalid_user'));
// }
$code = implode('!', [$user->id, $user->getResetPasswordCode()]);
// $params = [
// $this->property('paramCode') => $code
// ];
// if ($pageName = $this->property('resetPage')) {
// $url = $this->pageUrl($pageName, $params);
// }
// else {
// $url = $this->currentPageUrl($params);
// }
// if (strpos($url, $code) === false) {
// $url .= '?reset=' . $code;
// }
// $link = $url;
$data = [
'name' => $user->name,
'username' => $user->username,
'link' => 'https://shahsyotag.halkbank.gov.tm/sign-in',
'code' => $code
];
Mail::send('rainlab.user::mail.restore', $data, function($message) use ($user) {
$message->to($user->email, $user->full_name);
});
return response()->json([
// Check needed for compatibility with legacy systems
if (method_exists(\RainLab\User\Classes\AuthManager::class, 'clearThrottleForUserId')) {
Auth::clearThrottleForUserId($user->id);
}
return response()->json([
'data' => 'success',
]);
});
]);
});
Route::post('restore', function (Request $request) {
$rules = [
'email' => 'required|email|between:6,255'
];
$validation = Validator::make(post(), $rules);
if ($validation->fails()) {
throw new ValidationException($validation);
}
$user = UserModel::findByEmail(post('email'));
// if (!$user || $user->is_guest) {
// throw new ApplicationException(Lang::get(/*A user was not found with the given credentials.*/'rainlab.user::lang.account.invalid_user'));
// }
$code = implode('!', [$user->id, $user->getResetPasswordCode()]);
// $params = [
// $this->property('paramCode') => $code
// ];
// if ($pageName = $this->property('resetPage')) {
// $url = $this->pageUrl($pageName, $params);
// }
// else {
// $url = $this->currentPageUrl($params);
// }
// if (strpos($url, $code) === false) {
// $url .= '?reset=' . $code;
// }
// $link = $url;
$data = [
'name' => $user->name,
'username' => $user->username,
'link' => 'https://shahsyotag.halkbank.gov.tm/sign-in',
'code' => $code
];
Mail::send('rainlab.user::mail.restore', $data, function($message) use ($user) {
$message->to($user->email, $user->full_name);
});
return response()->json([
'data' => 'success',
]);
});
Route::post('login', function (Request $request) {
if (Settings::get('is_login_disabled'))
App::abort(404, 'Page not found');
$login_fields = Settings::get('login_fields', ['email', 'password']);
$credentials = Input::only('email', 'password');
// dd($credentials);
try {
// verify the credentials and create a token for the user
if (! $token = JWTAuth::attempt($credentials)) {
@ -122,7 +122,6 @@ Route::post('restore', function (Request $request) {
// something went wrong
return response()->json(['error' => 'could_not_create_token'], 500);
}
//dd($credentials);
$userModel = JWTAuth::authenticate($token);
if ($userModel->methodExists('getAuthApiSigninAttributes')) {
@ -193,11 +192,9 @@ Route::post('restore', function (Request $request) {
App::abort(404, 'Page not found');
$login_fields = Settings::get('signup_fields', ['email', 'password', 'password_confirmation','surname','name','middle_name','date_birth','passport','place_passport','address_residence','mobile_phone','home_phone','username']);
// $login_fields['is_activated'] = 1;
//dd();
$credentials = Input::only($login_fields);
// $credentials['is_activated'] = 1;
// dd($credentials);
try {
$userModel = UserModel::create($credentials);
@ -234,8 +231,7 @@ Route::post('restore', function (Request $request) {
Route::get('me', function() {
$me = \JWTAuth::parseToken()->authenticate()
// ->only(['email', 'password', 'password_confirmation']);
->only(['online_card','online_credit','message','email','surname','name','middle_name','date_birth','passport','place_passport','address_residence','mobile_phone','home_phone','username','is_activated']);
->only(['account_replenishment','online_card','online_credit','message','email','surname','name','middle_name','date_birth','passport','place_passport','address_residence','mobile_phone','home_phone','username','is_activated']);
return Response::json(compact('me'));
@ -250,20 +246,11 @@ Route::post('restore', function (Request $request) {
$data = Input::except(['username']);
// dd($data);
$rules = [
// 'email' => 'required|between:6,191|email',
'name' => 'required',
// 'surname' => 'required',
// 'username' => 'required|digits_between:8,20|numeric',
// 'company' => 'max:191',
];
// $validation = \Validator::make($request, $rules);
// if ($validation->fails()) {
// return Response::json(['error' => $validation->errors()], 400);
// }
/**
* If password in input data, add rules for password
@ -273,24 +260,14 @@ Route::post('restore', function (Request $request) {
'password' => 'required:create|between:8,255|confirmed',
'password_confirmation' => 'required_with:password|between:8,255'
];
// $validation = \Validator::make($data, $rules,(new UserModel)->messages);
// if ($validation->fails()) {
// return Response::json(['error' => $validation->errors()], 400);
// }
}
// if($me->email != $data['email']) {
// $me->email_verified = false;
// $me->save();
// }
$me->fill($data);
$me->save();
/*
* Password has changed, reauthenticate the user - send new token
*/
* Password has changed, reauthenticate the user - send new token
*/
if (array_key_exists('password', $data) && strlen($data['password'])) {
$credentials['username'] = $me->username;
@ -357,9 +334,8 @@ Route::post('restore', function (Request $request) {
Route::post('message', function() {
$me = \JWTAuth::parseToken()->authenticate();
// ->only(['id']);
$Contact = new ContactClass();
// dd($me);
$data = post();
$user_id=$Contact->user_id=$me['id'];
$name = $Contact->name =$me['username'];
@ -368,7 +344,8 @@ Route::post('restore', function (Request $request) {
$date = $Contact->date =$data['date'];
$type = $data['type'];
// dd($data);
$int_type = intval( $type );
$Contact->save();
@ -378,37 +355,39 @@ Route::post('restore', function (Request $request) {
'messsage' => $message,
'type' => $type
];
// dd($type);
if($subject == "Plastik kartlar" || $subject == "Пластиковые карты")
// dd(gettype($int_value));
if($int_type == 1)
{
Mail::send('vdomah.jwtauth::mail.message', $vars, function($message) {
$message->to('bank_kart@halkbank.gov.tm', 'Admin Person');
$message->subject('This is a reminder');
});
$message->to('gerchekgerchek1@gmail.com', 'Admin Person');
$message->subject('Plastik kartlar');
});
}
else
{
Mail::send('vdomah.jwtauth::mail.message', $vars, function($message) {
$message->to('karzonline@halkbank.gov.tm', 'Admin Person');
$message->subject('This is a reminder');
});
$message->to('gerchekgerchek1@gmail.com', 'Admin Person');
$message->subject('Plastik kartlar DALLER');
});
}
return Response::json(compact('type'));
// return Response::json(compact('type'));
return response()->json([
'data' => 'success',
]);
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
Route::post('online_credit', function() {
$me = \JWTAuth::parseToken()->authenticate();
// ->only(['id']);
$Credit = new CreditClass();
$data = post();
@ -466,24 +445,24 @@ Route::post('restore', function (Request $request) {
Mail::send('vdomah.jwtauth::mail.credit', $vars, function($message) {
$message->to('karzonline@halkbank.gov.tm', 'Admin Person');
// $message->subject('This is a reminder');
// $message->attach(
// $file->getRealPath(),array(
// 'as'=>$file->getClientOriginalName(),
// 'mime'=>$file->getMimeType()
// )
// );
});
// $message->subject('This is a reminder');
// $message->attach(
// $file->getRealPath(),array(
// 'as'=>$file->getClientOriginalName(),
// 'mime'=>$file->getMimeType()
// )
// );
});
return Response::json(compact('data'));
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
// Check online payment successfull or failed
Route::get('check-payment', function() {
@ -512,13 +491,13 @@ Route::post('restore', function (Request $request) {
$message->to('bank_kart@halkbank.gov.tm', 'Admin Person');
// $message->subject('This is a reminder');
//$message->attach(
// $file->getRealPath(),array(
// $file->getRealPath(),array(
// 'as'=>$file->getClientOriginalName(),
// 'mime'=>$file->getMimeType()
// )
// 'mime'=>$file->getMimeType()
// )
//);
});
});
} catch(\Throwable $e){
\Log::info($e);
@ -542,11 +521,6 @@ Route::post('restore', function (Request $request) {
Route::post('online_card', function() {
$me = \JWTAuth::parseToken()->authenticate();
// ->only(['id']);
// $Credit = new CreditClass();
// $data = post();
// $user_id = $Credit->user_id =$me['id'];
// dd($data);
$data = \Input::only([
'selected_card',
@ -574,18 +548,13 @@ Route::post('restore', function (Request $request) {
$price_str = Input::get('price');
$price = (int)$price_str;
// dd($price);
// $data = \Input::only([
// 'region',
// ]);
$data['user_id']=$me['id'];
// dd($data);
// $data['file'] = \Input::file('file');
$application = CardApp::create($data);
$application_id = time();
// dd($application->id);
// dd($application->id);
$response = Payment::registerOrder($application->id,$price);
// dd($response);
@ -605,27 +574,99 @@ Route::post('restore', function (Request $request) {
if (!$result || $result == null) {
return false;
return false;
}
if ($result) {
//dump('result1:');
// dd($result);
if($result['errorCode'] == 0){
$application->order_id = $result['orderId'];
$application->save();
// $this->sendNotification($application);
return response()->json($result['formUrl'], 201);
//return Redirect::to($result['formUrl']);
}
else{
throw new AjaxException($result['errorMessage']);
}
if($result['errorCode'] == 0){
$application->order_id = $result['orderId'];
$application->save();
// $this->sendNotification($application);
return response()->json($result['formUrl'], 201);
//return Redirect::to($result['formUrl']);
}
else{
throw new AjaxException($result['errorMessage']);
}
}
return Response::json(compact('data'));
//return Redirect::to($result['formUrl']);
//return Redirect::to($result['formUrl']);
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
Route::post('account_replenishment', function() {
$me = \JWTAuth::parseToken()->authenticate();
$AccountReplenishment = new AccountReplenishment();
$data = post();
// dd($data);
$user_id = $AccountReplenishment->user_id =$me['id'];
$selected_type = $AccountReplenishment->selected_type_account_replenishment =Input::get('selected_type');
$name = $AccountReplenishment->name =Input::get('name');
$surname = $AccountReplenishment->surname =Input::get('surname');
$middlename = $AccountReplenishment->middlename =Input::get('middlename');
$birthdate = $AccountReplenishment->birthdate =Input::get('birthdate');
$phone_number = $AccountReplenishment->phone_number =Input::get('phone_number');
$home_phone_number = $AccountReplenishment->home_phone_number =Input::get('home_phone_number');
$email = $AccountReplenishment->email =Input::get('email');
$passport_series = $AccountReplenishment->passport_series =Input::get('passport_series');
$passport_by = $AccountReplenishment->passport_by =Input::get('passport_by');
$place_of_residence = $AccountReplenishment->place_of_residence =Input::get('place_of_residence');
$region = $AccountReplenishment->region =Input::get('region');
$branch = $AccountReplenishment->branch =Input::get('branch');
$comment = $AccountReplenishment->comment =Input::get('comment');
$file = $AccountReplenishment->file =Input::file('file');
// dd($file);
$AccountReplenishment->save();
// $vars = [
// 'name' => $name,
// 'last_name' => $last_name,
// 'addres' => $addres,
// 'email' => $email,
// 'branch' => $branch,
// 'birth' => $birth,
// 'type' => $type,
// 'middle_name' => $middle_name,
// 'mobile_phone' => $mobile_phone,
// 'home_phone' => $home_phone,
// 'passport_series' => $passport_series,
// 'passport_issued_by' => $passport_issued_by,
// 'place_of_work' => $place_of_work,
// 'amount_of_salary' => $amount_of_salary,
// 'position' => $position,
// 'work_experience' => $work_experience,
// 'date' => $date,
// 'region' => $region
// ];
// Mail::send('vdomah.jwtauth::mail.credit', $vars, function($message) {
// $message->to('karzonline@halkbank.gov.tm', 'Admin Person');
// // $message->subject('This is a reminder');
// // $message->attach(
// // $file->getRealPath(),array(
// // 'as'=>$file->getClientOriginalName(),
// // 'mime'=>$file->getMimeType()
// // )
// // );
// });
return Response::json(compact('data'));
})->middleware('\Tymon\JWTAuth\Middleware\GetUserFromToken');
});