From 0d81a1c3474f4bc53f512b28f1acbc79f9a5dd8c Mon Sep 17 00:00:00 2001 From: raccoon254 Date: Sun, 19 May 2024 08:19:29 +0300 Subject: [PATCH] Added types to price calculation --- app/Livewire/PriceCalculator.php | 21 ++++++++++--------- resources/views/auth/login.blade.php | 2 +- .../views/components/text-input.blade.php | 2 +- resources/views/dashboard.blade.php | 5 ++++- .../views/livewire/price-calculator.blade.php | 12 ++++++----- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/app/Livewire/PriceCalculator.php b/app/Livewire/PriceCalculator.php index 526b191..af5eb5b 100644 --- a/app/Livewire/PriceCalculator.php +++ b/app/Livewire/PriceCalculator.php @@ -2,23 +2,24 @@ namespace App\Livewire; +use Illuminate\Support\Facades\Date; use Illuminate\View\View; use Livewire\Component; class PriceCalculator extends Component { - public $topic; - public $subject; - public $deadline; - public $wordCount; - public $isWords = true; - public $price = 0; + public string $topic; + public string $subject; + public Date $deadline; + public int $wordCount; + public bool $isWords = true; + public int $price = 0; - public function calculatePrice() + public function calculatePrice(): void { - // Dummy price calculation logic - $ratePerWord = 0.10; - $ratePerPage = 5.00; + // TODO ! Admin should be able to set the rate per word and rate per page + $ratePerWord = 15 / 500; + $ratePerPage = 15.00; $this->price = $this->isWords ? $this->wordCount * $ratePerWord : $this->wordCount * $ratePerPage; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index de18a96..4d68c54 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -54,7 +54,7 @@ function togglePasswordVisibility() {
diff --git a/resources/views/components/text-input.blade.php b/resources/views/components/text-input.blade.php index 1df7f0d..c91ba24 100644 --- a/resources/views/components/text-input.blade.php +++ b/resources/views/components/text-input.blade.php @@ -1,3 +1,3 @@ @props(['disabled' => false]) -merge(['class' => 'border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm']) !!}> +merge(['class' => 'w-full p-2 border border-gray-300 rounded-lg rounded-md shadow-sm']) !!}> diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 842ffd8..210c362 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -30,8 +30,11 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-
- +
+ +
+ {{-- TODO ! Previous Actions --}}
diff --git a/resources/views/livewire/price-calculator.blade.php b/resources/views/livewire/price-calculator.blade.php index 080a896..247868d 100644 --- a/resources/views/livewire/price-calculator.blade.php +++ b/resources/views/livewire/price-calculator.blade.php @@ -1,7 +1,7 @@ -
+
- +

Calculate Order Price

@@ -23,10 +23,12 @@
- +
- - + +