From 06f0d9e165ca274aa84da54b262dea365d7b2a93 Mon Sep 17 00:00:00 2001 From: gerchek Date: Mon, 21 Nov 2022 16:34:41 +0500 Subject: [PATCH] account replenishment --- .~lock.bank_api.docx# | 1 + .../typeAccountReplenishmentController.php | 100 +++++ plugins/ahmadfatoni/apigenerator/routes.php | 6 +- .../AccountReplenishmentController.php | 19 + .../TypeAccountReplenishmentController.php | 19 + .../_list_toolbar.htm | 19 + .../_reorder_toolbar.htm | 3 + .../config_form.yaml | 10 + .../config_list.yaml | 12 + .../config_reorder.yaml | 4 + .../accountreplenishmentcontroller/create.htm | 46 +++ .../accountreplenishmentcontroller/index.htm | 1 + .../preview.htm | 22 + .../reorder.htm | 8 + .../accountreplenishmentcontroller/update.htm | 54 +++ .../_list_toolbar.htm | 19 + .../_reorder_toolbar.htm | 3 + .../config_form.yaml | 10 + .../config_list.yaml | 12 + .../config_reorder.yaml | 4 + .../create.htm | 46 +++ .../index.htm | 1 + .../preview.htm | 22 + .../reorder.htm | 8 + .../update.htm | 54 +++ .../contact/models/AccountReplenishment.php | 27 ++ .../models/TypeAccountReplenishment.php | 27 ++ .../models/accountreplenishment/columns.yaml | 25 ++ .../models/accountreplenishment/fields.yaml | 67 +++ .../typeaccountreplenishment/columns.yaml | 13 + .../typeaccountreplenishment/fields.yaml | 5 + plugins/atash/contact/plugin.yaml | 8 + ...te_atash_contact_account_replenishment.php | 38 ++ ...ash_contact_type_account_replenishment.php | 24 ++ ...te_atash_contact_account_replenishment.php | 23 ++ ..._atash_contact_account_replenishment_2.php | 23 ++ plugins/atash/contact/updates/version.yaml | 12 + plugins/rainlab/user/models/User.php | 3 +- plugins/vdomah/jwtauth/routes.php | 385 ++++++++++-------- 39 files changed, 1008 insertions(+), 175 deletions(-) create mode 100644 .~lock.bank_api.docx# create mode 100644 plugins/ahmadfatoni/apigenerator/controllers/api/typeAccountReplenishmentController.php create mode 100644 plugins/atash/contact/controllers/AccountReplenishmentController.php create mode 100644 plugins/atash/contact/controllers/TypeAccountReplenishmentController.php create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/_list_toolbar.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/_reorder_toolbar.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/config_form.yaml create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/config_list.yaml create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/config_reorder.yaml create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/create.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/index.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/preview.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/reorder.htm create mode 100644 plugins/atash/contact/controllers/accountreplenishmentcontroller/update.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_list_toolbar.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_reorder_toolbar.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_form.yaml create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_list.yaml create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_reorder.yaml create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/create.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/index.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/preview.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/reorder.htm create mode 100644 plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/update.htm create mode 100644 plugins/atash/contact/models/AccountReplenishment.php create mode 100644 plugins/atash/contact/models/TypeAccountReplenishment.php create mode 100644 plugins/atash/contact/models/accountreplenishment/columns.yaml create mode 100644 plugins/atash/contact/models/accountreplenishment/fields.yaml create mode 100644 plugins/atash/contact/models/typeaccountreplenishment/columns.yaml create mode 100644 plugins/atash/contact/models/typeaccountreplenishment/fields.yaml create mode 100644 plugins/atash/contact/updates/builder_table_create_atash_contact_account_replenishment.php create mode 100644 plugins/atash/contact/updates/builder_table_create_atash_contact_type_account_replenishment.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment.php create mode 100644 plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment_2.php diff --git a/.~lock.bank_api.docx# b/.~lock.bank_api.docx# new file mode 100644 index 0000000..b090573 --- /dev/null +++ b/.~lock.bank_api.docx# @@ -0,0 +1 @@ +,ata,ata,21.11.2022 16:24,file:///home/ata/.config/libreoffice/4; \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/typeAccountReplenishmentController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/typeAccountReplenishmentController.php new file mode 100644 index 0000000..37b2df0 --- /dev/null +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/typeAccountReplenishmentController.php @@ -0,0 +1,100 @@ +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); + } + +} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index 217e74a..fcb83a5 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -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']); \ No newline at end of file +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']); \ No newline at end of file diff --git a/plugins/atash/contact/controllers/AccountReplenishmentController.php b/plugins/atash/contact/controllers/AccountReplenishmentController.php new file mode 100644 index 0000000..c7ec75f --- /dev/null +++ b/plugins/atash/contact/controllers/AccountReplenishmentController.php @@ -0,0 +1,19 @@ + + + + + diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/_reorder_toolbar.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/_reorder_toolbar.htm new file mode 100644 index 0000000..3b3005b --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/_reorder_toolbar.htm @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_form.yaml b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_form.yaml new file mode 100644 index 0000000..19019ec --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_form.yaml @@ -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 diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_list.yaml b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_list.yaml new file mode 100644 index 0000000..92c099b --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_list.yaml @@ -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' diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_reorder.yaml b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_reorder.yaml new file mode 100644 index 0000000..4d389d3 --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/config_reorder.yaml @@ -0,0 +1,4 @@ +title: AccountReplenishmentController +modelClass: Atash\Contact\Models\AccountReplenishment +toolbar: + buttons: reorder_toolbar diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/create.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/create.htm new file mode 100644 index 0000000..c4e4b8b --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/index.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/preview.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/preview.htm new file mode 100644 index 0000000..17de982 --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/reorder.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/reorder.htm new file mode 100644 index 0000000..81e9b16 --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/reorder.htm @@ -0,0 +1,8 @@ + + + + +reorderRender() ?> \ No newline at end of file diff --git a/plugins/atash/contact/controllers/accountreplenishmentcontroller/update.htm b/plugins/atash/contact/controllers/accountreplenishmentcontroller/update.htm new file mode 100644 index 0000000..e21e5c8 --- /dev/null +++ b/plugins/atash/contact/controllers/accountreplenishmentcontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_list_toolbar.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_list_toolbar.htm new file mode 100644 index 0000000..9cf68f5 --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_list_toolbar.htm @@ -0,0 +1,19 @@ +
+ + + +
diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_reorder_toolbar.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_reorder_toolbar.htm new file mode 100644 index 0000000..ed9d8a4 --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/_reorder_toolbar.htm @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_form.yaml b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_form.yaml new file mode 100644 index 0000000..15c2034 --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_form.yaml @@ -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 diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_list.yaml b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_list.yaml new file mode 100644 index 0000000..bb3db8e --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_list.yaml @@ -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' diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_reorder.yaml b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_reorder.yaml new file mode 100644 index 0000000..c8697cb --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/config_reorder.yaml @@ -0,0 +1,4 @@ +title: TypeAccountReplenishmentController +modelClass: Atash\Contact\Models\TypeAccountReplenishment +toolbar: + buttons: reorder_toolbar diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/create.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/create.htm new file mode 100644 index 0000000..8ffda65 --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/create.htm @@ -0,0 +1,46 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + +
+
+ + + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/index.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/index.htm new file mode 100644 index 0000000..ea43a36 --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/index.htm @@ -0,0 +1 @@ +listRender() ?> diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/preview.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/preview.htm new file mode 100644 index 0000000..c2528df --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/preview.htm @@ -0,0 +1,22 @@ + + + + +fatalError): ?> + +
+ formRenderPreview() ?> +
+ + +

fatalError) ?>

+ + +

+ + + +

\ No newline at end of file diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/reorder.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/reorder.htm new file mode 100644 index 0000000..156c20b --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/reorder.htm @@ -0,0 +1,8 @@ + + + + +reorderRender() ?> \ No newline at end of file diff --git a/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/update.htm b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/update.htm new file mode 100644 index 0000000..a1a113f --- /dev/null +++ b/plugins/atash/contact/controllers/typeaccountreplenishmentcontroller/update.htm @@ -0,0 +1,54 @@ + + + + +fatalError): ?> + + 'layout']) ?> + +
+ formRender() ?> +
+ +
+
+ + + + + + + +
+
+ + + +

fatalError)) ?>

+

+ \ No newline at end of file diff --git a/plugins/atash/contact/models/AccountReplenishment.php b/plugins/atash/contact/models/AccountReplenishment.php new file mode 100644 index 0000000..36ee689 --- /dev/null +++ b/plugins/atash/contact/models/AccountReplenishment.php @@ -0,0 +1,27 @@ + 'System\Models\File' + ]; +} diff --git a/plugins/atash/contact/models/TypeAccountReplenishment.php b/plugins/atash/contact/models/TypeAccountReplenishment.php new file mode 100644 index 0000000..feb1162 --- /dev/null +++ b/plugins/atash/contact/models/TypeAccountReplenishment.php @@ -0,0 +1,27 @@ +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'); + } +} diff --git a/plugins/atash/contact/updates/builder_table_create_atash_contact_type_account_replenishment.php b/plugins/atash/contact/updates/builder_table_create_atash_contact_type_account_replenishment.php new file mode 100644 index 0000000..a6f24e6 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_create_atash_contact_type_account_replenishment.php @@ -0,0 +1,24 @@ +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'); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment.php new file mode 100644 index 0000000..e4bf429 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment.php @@ -0,0 +1,23 @@ +integer('user_id'); + }); + } + + public function down() + { + Schema::table('atash_contact_account_replenishment', function($table) + { + $table->dropColumn('user_id'); + }); + } +} diff --git a/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment_2.php b/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment_2.php new file mode 100644 index 0000000..faeb9a6 --- /dev/null +++ b/plugins/atash/contact/updates/builder_table_update_atash_contact_account_replenishment_2.php @@ -0,0 +1,23 @@ +dropColumn('date_of_passport'); + }); + } + + public function down() + { + Schema::table('atash_contact_account_replenishment', function($table) + { + $table->text('date_of_passport')->nullable(); + }); + } +} diff --git a/plugins/atash/contact/updates/version.yaml b/plugins/atash/contact/updates/version.yaml index 83a870a..cb3927c 100644 --- a/plugins/atash/contact/updates/version.yaml +++ b/plugins/atash/contact/updates/version.yaml @@ -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 diff --git a/plugins/rainlab/user/models/User.php b/plugins/rainlab/user/models/User.php index 41bb818..bfc81fa 100644 --- a/plugins/rainlab/user/models/User.php +++ b/plugins/rainlab/user/models/User.php @@ -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 ]; } diff --git a/plugins/vdomah/jwtauth/routes.php b/plugins/vdomah/jwtauth/routes.php index 507ea78..2fefbd9 100644 --- a/plugins/vdomah/jwtauth/routes.php +++ b/plugins/vdomah/jwtauth/routes.php @@ -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'); + + + });