From f25ab53f8705d98fd02fdb1422de1dc1877bad63 Mon Sep 17 00:00:00 2001 From: raccoon254 Date: Sun, 19 May 2024 07:57:14 +0300 Subject: [PATCH] Price calculator -Livewire component create --- app/Livewire/PriceCalculator.php | 31 ++++++++++++++ resources/views/dashboard.blade.php | 14 ++++--- resources/views/layouts/sidebar.blade.php | 4 +- .../views/livewire/price-calculator.blade.php | 40 +++++++++++++++++++ 4 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 app/Livewire/PriceCalculator.php create mode 100644 resources/views/livewire/price-calculator.blade.php diff --git a/app/Livewire/PriceCalculator.php b/app/Livewire/PriceCalculator.php new file mode 100644 index 0000000..526b191 --- /dev/null +++ b/app/Livewire/PriceCalculator.php @@ -0,0 +1,31 @@ +price = $this->isWords + ? $this->wordCount * $ratePerWord + : $this->wordCount * $ratePerPage; + } + + public function render(): View + { + return view('livewire.price-calculator'); + } +} diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index e42385a..842ffd8 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -1,4 +1,4 @@ -
+

@@ -29,11 +29,13 @@ class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-

-
- - Recent Records - -
+
+ +
+
+
+ +
diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index 34b4bd4..fc2ad7d 100644 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -47,10 +47,10 @@ -
+
@csrf - diff --git a/resources/views/livewire/price-calculator.blade.php b/resources/views/livewire/price-calculator.blade.php new file mode 100644 index 0000000..080a896 --- /dev/null +++ b/resources/views/livewire/price-calculator.blade.php @@ -0,0 +1,40 @@ +
+ + + + +

Calculate Order Price

+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+
+ +
+

Total Price: ${{ number_format($price, 2) }}

+
+ + +