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 index c36eebf6..aae7d3aa 100644 --- a/app/Classes/Modules/Currencies/ControllersLogic/History/ListCurrencyRateHistoryLogic.php +++ b/app/Classes/Modules/Currencies/ControllersLogic/History/ListCurrencyRateHistoryLogic.php @@ -5,14 +5,14 @@ namespace App\Classes\Modules\Currencies\ControllersLogic\History; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Currencies\Services\Rates\ListsRateLogs; -use App\Classes\Modules\Currencies\Services\Rates\FetchesRate; +use App\Classes\Modules\Currencies\Services\Rates\ListsRates; use App\Classes\Modules\Currencies\Standards\Rules\Rates\CanListRates; use App\Http\Resources\CurrencyRateLogResource; -use App\Models\CurrencyRate; use App\Models\CurrencyRateLog; use ErrorException; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use Carbon\Carbon; class ListCurrencyRateHistoryLogic extends AbstractControllerLogic { @@ -34,19 +34,19 @@ class ListCurrencyRateHistoryLogic extends AbstractControllerLogic /** @var ListsRateLogs */ private $listsRateLogs; - /** @var FetchesRate */ - private $fetchesRate; + /** @var ListsRate */ + private $listsRates; /** * ListRatesLogic constructor. * @param CanListRates $canListRates * @param ListsRates $listsRates */ - public function __construct(CanListRates $canListRates, ListsRateLogs $listsRateLogs, FetchesRate $fetchesRate) + public function __construct(CanListRates $canListRates, ListsRateLogs $listsRateLogs, listsRates $listsRates) { $this->canListRates = $canListRates; $this->listsRateLogs = $listsRateLogs; - $this->fetchesRate = $fetchesRate; + $this->listsRates = $listsRates; } @@ -64,15 +64,20 @@ class ListCurrencyRateHistoryLogic extends AbstractControllerLogic $rate_filter['currency_id'] = $filterArray->currency_id; $rate_filter['service_id'] = $filterArray->service_id; - $currency_rate_ids = $this->fetchesRate->execute( + $currency_rate_ids = $this->listsRates->execute( [ 'currency_id' => $filterArray->currency_id, 'service_id' => $filterArray->service_id, ] )->pluck('id')->toArray(); - // todo: add in date filters - $query = CurrencyRateLog::whereIn('currency_rate_id', $currency_rate_ids)->get(); + $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/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue b/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue index a6d89538..43d8791e 100644 --- a/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue +++ b/resources/assets/vue/components/bookings/forms/ChooseServiceComponent.vue @@ -1,9 +1,9 @@