diff --git a/app/Classes/General/Eloquent/Filters/CreatedAtBetween.php b/app/Classes/General/Eloquent/Filters/CreatedAtBetween.php new file mode 100644 index 00000000..4aeebb8c --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/CreatedAtBetween.php @@ -0,0 +1,20 @@ +whereBetween('created_at', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/CurrencyRateIdIn.php b/app/Classes/General/Eloquent/Filters/CurrencyRateIdIn.php new file mode 100644 index 00000000..f80d0855 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/CurrencyRateIdIn.php @@ -0,0 +1,20 @@ +whereIn('currency_rate_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Currencies/ControllersLogic/History/ListCurrencyRateHistoryLogic.php b/app/Classes/Modules/Currencies/ControllersLogic/History/ListCurrencyRateHistoryLogic.php new file mode 100644 index 00000000..aae7d3aa --- /dev/null +++ b/app/Classes/Modules/Currencies/ControllersLogic/History/ListCurrencyRateHistoryLogic.php @@ -0,0 +1,84 @@ + 'Retrieved Currency Rate History', + 'message' => 'You have successfully retrieved a list of Currency Rate History' + ]; + } + + /** @var CanListRates */ + private $canListRates; + + /** @var ListsRateLogs */ + private $listsRateLogs; + + /** @var ListsRate */ + private $listsRates; + + /** + * ListRatesLogic constructor. + * @param CanListRates $canListRates + * @param ListsRates $listsRates + */ + public function __construct(CanListRates $canListRates, ListsRateLogs $listsRateLogs, listsRates $listsRates) + { + $this->canListRates = $canListRates; + $this->listsRateLogs = $listsRateLogs; + $this->listsRates = $listsRates; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request): JsonResponse + { + //$this->canListRates->passes(); + + $filterArray = json_decode($request->input('filters')); + + $rate_filter['currency_id'] = $filterArray->currency_id; + $rate_filter['service_id'] = $filterArray->service_id; + + $currency_rate_ids = $this->listsRates->execute( + [ + 'currency_id' => $filterArray->currency_id, + 'service_id' => $filterArray->service_id, + ] + )->pluck('id')->toArray(); + + $query = $this->listsRateLogs->execute( + [ + 'currency_rate_id_in' => $currency_rate_ids, + 'date_start' => new Carbon($filterArray->date_from), + 'date_end' => new Carbon($filterArray->date_to), + ] + ); + + return $this->collectionResponse(CurrencyRateLogResource::collection($query)); + } +} diff --git a/app/Classes/Modules/Currencies/Services/Rates/ListsRateLogs.php b/app/Classes/Modules/Currencies/Services/Rates/ListsRateLogs.php new file mode 100644 index 00000000..d3cfa469 --- /dev/null +++ b/app/Classes/Modules/Currencies/Services/Rates/ListsRateLogs.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Currencies/History/ListCurrencyRateHistory.php b/app/Http/Controllers/Currencies/History/ListCurrencyRateHistory.php new file mode 100644 index 00000000..7e7db955 --- /dev/null +++ b/app/Http/Controllers/Currencies/History/ListCurrencyRateHistory.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Resources/CurrencyRateLogResource.php b/app/Http/Resources/CurrencyRateLogResource.php new file mode 100644 index 00000000..f8560dd8 --- /dev/null +++ b/app/Http/Resources/CurrencyRateLogResource.php @@ -0,0 +1,26 @@ +currencyRate; + + return [ + 'currency_rate_id' => $this->currency_rate_id, + 'rate' => $this->selling, + 'created_at' => $this->created_at->format('d-m-Y'), + 'payment_method_type' => $currencyRate->payment_method_type, + ]; + } +} diff --git a/app/Models/CurrencyRateLog.php b/app/Models/CurrencyRateLog.php index 38130956..85b0eecf 100644 --- a/app/Models/CurrencyRateLog.php +++ b/app/Models/CurrencyRateLog.php @@ -1,10 +1,19 @@ BelongsTo(CurrencyRate::class, 'currency_rate_id', 'id'); + } } diff --git a/resources/assets/vue/components/bookings/forms/ChooseCurrencyComponent.vue b/resources/assets/vue/components/bookings/forms/ChooseCurrencyComponent.vue new file mode 100644 index 00000000..e670a450 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/ChooseCurrencyComponent.vue @@ -0,0 +1,118 @@ + + + diff --git a/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue b/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue new file mode 100644 index 00000000..43d8791e --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue @@ -0,0 +1,97 @@ + + + diff --git a/resources/assets/vue/components/bookings/forms/RateHistoriesComponent.vue b/resources/assets/vue/components/bookings/forms/RateHistoriesComponent.vue new file mode 100644 index 00000000..b55d39c9 --- /dev/null +++ b/resources/assets/vue/components/bookings/forms/RateHistoriesComponent.vue @@ -0,0 +1,168 @@ + + + diff --git a/resources/views/pages/rate_histories.blade.php b/resources/views/pages/rate_histories.blade.php new file mode 100644 index 00000000..accb0591 --- /dev/null +++ b/resources/views/pages/rate_histories.blade.php @@ -0,0 +1,8 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+ +
+
+@endsection diff --git a/routes/currency.php b/routes/currency.php index ba308402..b621aad6 100644 --- a/routes/currency.php +++ b/routes/currency.php @@ -7,4 +7,8 @@ Route::group(['namespace' => 'Currencies', 'as' => 'currency.', 'prefix' => 'cur Route::get('/list', 'ListCurrencyController@list')->name('list'); Route::post('/create', 'CreateCurrencyController@create')->name('create'); Route::delete('/delete/{id}', 'DeleteCurrencyController@delete')->name('delete'); -}); \ No newline at end of file + + Route::group(['prefix' => 'history', 'namespace' => 'History', 'as' => 'history.'], function () { + Route::get('/list', 'ListCurrencyRateHistory@list')->name('list'); + }); +}); diff --git a/routes/web.php b/routes/web.php index 4efc4afb..3ab24076 100644 --- a/routes/web.php +++ b/routes/web.php @@ -542,5 +542,8 @@ Route::get('/refund/fix', function(){ }); +Route::get('/currency-rate-history', function () { + return view('pages.rate_histories'); +})->name('currency_rate.history');