Преглед на файлове

Merge pull request #480 from 1day2die/decimals

decimals in server price and tax
Dennis преди 3 години
родител
ревизия
c18d5d6dfe

+ 32 - 0
database/migrations/2022_07_12_051152_decimals-in-price.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class DecimalsInPrice extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('products', function (Blueprint $table) {
+            $table->decimal('price',['11','2'])->change();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('products', function (Blueprint $table) {
+            $table->integer('price')->change();
+        });
+    }
+}

+ 1 - 1
resources/views/admin/products/create.blade.php

@@ -64,7 +64,7 @@
 
                                         <div class="form-group">
                                             <label for="price">{{__('Price in')}} {{CREDITS_DISPLAY_NAME}}</label>
-                                            <input value="{{$product->price ??  old('price')}}" id="price" name="price"
+                                            <input value="{{$product->price ??  old('price')}}" id="price" name="price" step=".01"
                                                    type="number"
                                                    class="form-control @error('price') is-invalid @enderror"
                                                    required="required">

+ 1 - 1
resources/views/admin/products/edit.blade.php

@@ -76,7 +76,7 @@
 
                                         <div class="form-group">
                                             <label for="price">{{__('Price in')}} {{ CREDITS_DISPLAY_NAME }}</label>
-                                            <input value="{{ $product->price }}" id="price" name="price" type="number"
+                                            <input value="{{ $product->price }}" id="price" name="price" type="number" step=".01"
                                                    class="form-control @error('price') is-invalid @enderror"
                                                    required="required">
                                             @error('price')

+ 1 - 1
resources/views/admin/settings/tabs/payment.blade.php

@@ -130,7 +130,7 @@
                                 data-content="Tax Value that will be added to the total price of the order. <br><br> Example: 19 results in (19%)"
                                 class="fas fa-info-circle"></i>
                         </div>
-                        <input x-model="sales-tax" id="sales-tax" name="sales-tax" type="number"
+                        <input x-model="sales-tax" id="sales-tax" name="sales-tax" type="number" step=".01"
                             value="{{ config('SETTINGS::PAYMENTS:SALES_TAX') }}"
                             class="form-control @error('sales-tax') is-invalid @enderror">
                     </div>