From 21c63ece5bbdebdc1627eb3bd9a3639ee4536f47 Mon Sep 17 00:00:00 2001 From: saparatayev Date: Tue, 17 May 2022 16:37:54 +0500 Subject: [PATCH 1/3] bank info api --- modules/system/lang/en/validation.php | 1 + modules/system/lang/ru/validation.php | 1 + modules/system/lang/tm/validation.php | 1 + .../api/TransactionsApiController.php | 19 +++++++++++++++++++ plugins/ahmadfatoni/apigenerator/routes.php | 2 ++ .../apigenerator/template/routes.dot | 2 ++ 6 files changed, 26 insertions(+) diff --git a/modules/system/lang/en/validation.php b/modules/system/lang/en/validation.php index 1be1e2dbb..0e80ae2fb 100644 --- a/modules/system/lang/en/validation.php +++ b/modules/system/lang/en/validation.php @@ -158,6 +158,7 @@ return [ 'phone_verification_code_invalid' => 'Invalid sms code', 'phone_already_exists' => 'This phone number has already been taken.', 'email_already_exists' => 'This email has already been taken.', + 'bank_address_one' => '744013, Türkmenistan, Aşgabat ş., Türkmenistanyň Gahrymany Atamyrat Nyýazow şaýoly, 154', ], /* diff --git a/modules/system/lang/ru/validation.php b/modules/system/lang/ru/validation.php index ee1e79083..97f426434 100644 --- a/modules/system/lang/ru/validation.php +++ b/modules/system/lang/ru/validation.php @@ -158,6 +158,7 @@ return [ 'phone_verification_code_invalid' => 'Неверный СМС код', 'phone_already_exists' => 'Пользователь с таким номером уже существует.', 'email_already_exists' => 'Пользователь с таким email уже существует.', + 'bank_address_one' => '744013, Türkmenistan, Aşgabat ş., Türkmenistanyň Gahrymany Atamyrat Nyýazow şaýoly, 154', ], /* diff --git a/modules/system/lang/tm/validation.php b/modules/system/lang/tm/validation.php index 6bce37056..85428dccf 100644 --- a/modules/system/lang/tm/validation.php +++ b/modules/system/lang/tm/validation.php @@ -160,6 +160,7 @@ return [ 'phone_verification_code_invalid' => 'Nädogry SMS kody', 'phone_already_exists' => 'Bu belgi öňden hasaba alyndy.', 'email_already_exists' => 'Bu el. bukja öňden hasaba alyndy.', + 'bank_address_one' => '744013, Türkmenistan, Aşgabat ş., Türkmenistanyň Gahrymany Atamyrat Nyýazow şaýoly, 154', ], /* diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/TransactionsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/TransactionsApiController.php index e16d7bedf..31d2c85a7 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/TransactionsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/TransactionsApiController.php @@ -8,6 +8,7 @@ use October\Rain\Support\Facades\Event; use TPS\Birzha\Classes\TranslatedErrSucMsgResponseApi; use TPS\Birzha\Models\Payment; use TPS\Birzha\Classes\TransactionResource; +use TPS\Birzha\Models\Settings; class TransactionsApiController extends KabinetAPIController { @@ -128,4 +129,22 @@ class TransactionsApiController extends KabinetAPIController return $newPayment; } + public function getBankInfo(Request $request) { + $data = $request->only(['locale']); + $validator = Validator::make($data, [ + 'locale' => 'required|in:ru,tm,en', + ]); + + if($validator->fails()) { + return response()->json($validator->errors(), 400); + } + + return response()->json([ + 'tax_code' => Settings::getValue('tax_code'), + 'bab' => Settings::getValue('bab'), + 'manat_account' => Settings::getValue('manat_account'), + 'correspondent_account' => Settings::getValue('correspondent_account'), + 'bank_address' => trans("validation.api.bank_address_one", [], $data['locale']) + ], 200); + } } diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php index 434c69781..a9bce4202 100644 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ b/plugins/ahmadfatoni/apigenerator/routes.php @@ -69,6 +69,8 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro Route::post('send-email-verification-link', 'EmailVerificationController@sendEmailVerificationLink'); + Route::get('bank-info', 'TransactionsApiController@getBankInfo'); + }); }); diff --git a/plugins/ahmadfatoni/apigenerator/template/routes.dot b/plugins/ahmadfatoni/apigenerator/template/routes.dot index 8fffb62a8..d940ceab4 100644 --- a/plugins/ahmadfatoni/apigenerator/template/routes.dot +++ b/plugins/ahmadfatoni/apigenerator/template/routes.dot @@ -69,6 +69,8 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro Route::post('send-email-verification-link', 'EmailVerificationController@sendEmailVerificationLink'); + Route::get('bank-info', 'TransactionsApiController@getBankInfo'); + }); }); From 2583fc4e06a494db76c2ec145420c8bdd328f442 Mon Sep 17 00:00:00 2001 From: saparatayev Date: Mon, 23 May 2022 12:20:13 +0500 Subject: [PATCH 2/3] different slider images for different locales --- .../birzha/components/sliders/img_slider.htm | 21 +++++++++++- .../birzha/components/sliders/text_slider.htm | 33 +++++++++++++------ plugins/tps/birzha/models/slider/fields.yaml | 18 ++++++++-- 3 files changed, 59 insertions(+), 13 deletions(-) diff --git a/plugins/tps/birzha/components/sliders/img_slider.htm b/plugins/tps/birzha/components/sliders/img_slider.htm index bf9c7d8b3..8c8b5be83 100644 --- a/plugins/tps/birzha/components/sliders/img_slider.htm +++ b/plugins/tps/birzha/components/sliders/img_slider.htm @@ -1,10 +1,29 @@ {% set slider = __SELF__.slider %} +{% set lng = __SELF__.lng %} diff --git a/plugins/tps/birzha/components/sliders/text_slider.htm b/plugins/tps/birzha/components/sliders/text_slider.htm index 3868d1b07..ac6be08b5 100644 --- a/plugins/tps/birzha/components/sliders/text_slider.htm +++ b/plugins/tps/birzha/components/sliders/text_slider.htm @@ -4,29 +4,42 @@
{% for item in slider.slide_items %}
+ + + {% if lng == 'ru' %}
- {% if lng == 'ru' %} {{ item.slide_title_ru }} - - {% endif %} - {% if lng == 'en' %} +
+
+ +
+ {% endif %} + + + {% if lng == 'en' %} +
{{ item.slide_title_en }} - - {% endif %} - {% if lng == 'tm' %} +
+
+ +
+ {% endif %} + + + {% if lng == 'tm' %} +
- +
+ {% endif %}
{% endfor %} diff --git a/plugins/tps/birzha/models/slider/fields.yaml b/plugins/tps/birzha/models/slider/fields.yaml index e18703329..840b401fb 100644 --- a/plugins/tps/birzha/models/slider/fields.yaml +++ b/plugins/tps/birzha/models/slider/fields.yaml @@ -35,8 +35,8 @@ fields: label: 'Slide text EN' span: auto type: text - slide_img: - label: 'Slide image' + slide_img_ru: + label: 'Slide image RU' mode: image imageWidth: '80' imageHeight: '80' @@ -46,7 +46,21 @@ fields: label: 'Display time' span: auto type: number + slide_img_tm: + label: 'Slide image TM' + mode: image + imageWidth: '80' + imageHeight: '80' + span: auto + type: mediafinder link: label: Link span: auto type: text + slide_img_en: + label: 'Slide image EN' + mode: image + imageWidth: '80' + imageHeight: '80' + span: auto + type: mediafinder From b8de5337d5b02d0bf074c715837e22c36ad3fa0d Mon Sep 17 00:00:00 2001 From: saparatayev Date: Mon, 23 May 2022 16:49:26 +0500 Subject: [PATCH 3/3] sort posts by ends_at field --- .../controllers/api/ProductsApiController.php | 8 ++++---- plugins/tps/birzha/components/Offers.php | 2 +- plugins/tps/birzha/views/mail/product_reviewed.htm | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php index 342433a3a..62eaecd03 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php @@ -50,7 +50,7 @@ class ProductsAPIController extends Controller 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() - ->orderBy('updated_at', $sortOrder); + ->orderBy('ends_at', $sortOrder); if($categoryId) { // fetch offers by the category of the product $category = Category::find($categoryId); @@ -64,7 +64,7 @@ class ProductsAPIController extends Controller 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() - ->orderBy('updated_at', $sortOrder); + ->orderBy('ends_at', $sortOrder); } else { $query = null; } @@ -87,7 +87,7 @@ class ProductsAPIController extends Controller 'currency.translations:locale,model_id,attribute_data' ]) ->approvedAndFreshEndDate() - ->orderBy('updated_at', $sortOrder); + ->orderBy('ends_at', $sortOrder); } else { $query = null; } @@ -101,7 +101,7 @@ class ProductsAPIController extends Controller 'measure.translations:locale,model_id,attribute_data', 'currency.translations:locale,model_id,attribute_data' ]) - ->orderBy('updated_at', $sortOrder); + ->orderBy('ends_at', $sortOrder); } $data = $query ? $query->paginate($perPage) : null; diff --git a/plugins/tps/birzha/components/Offers.php b/plugins/tps/birzha/components/Offers.php index a6049c5d7..71f10aae1 100644 --- a/plugins/tps/birzha/components/Offers.php +++ b/plugins/tps/birzha/components/Offers.php @@ -86,7 +86,7 @@ class Offers extends ComponentBase $productSlug = $this->property('productSlug'); $offerId = $this->property('offerId'); - $query = Product::where('status', 'approved')->where('ends_at','>=',\Carbon\Carbon::now())->orderBy('updated_at', $sortOrder); + $query = Product::where('status', 'approved')->where('ends_at','>=',\Carbon\Carbon::now())->orderBy('ends_at', $sortOrder); if($cSlug != '') { //fetch offers by the category of the product $category = Category::transWhere('slug', $cSlug, Session::get('rainlab.translate.locale'))->first(); diff --git a/plugins/tps/birzha/views/mail/product_reviewed.htm b/plugins/tps/birzha/views/mail/product_reviewed.htm index c1b7aa0d2..8e98d2312 100644 --- a/plugins/tps/birzha/views/mail/product_reviewed.htm +++ b/plugins/tps/birzha/views/mail/product_reviewed.htm @@ -74,7 +74,7 @@ layout="birzha_empty" - +