Quellcode durchsuchen

feat: ✨ Added conditional payment methods options

IceToast vor 3 Jahren
Ursprung
Commit
9d8361641b
1 geänderte Dateien mit 23 neuen und 19 gelöschten Zeilen
  1. 23 19
      resources/views/store/checkout.blade.php

+ 23 - 19
resources/views/store/checkout.blade.php

@@ -104,22 +104,25 @@
                                 <p class="lead">{{ __('Payment Methods') }}:</p>
                                 <p class="lead">{{ __('Payment Methods') }}:</p>
 
 
                                 <div>
                                 <div>
-                                    <label class="text-center " for="paypal">
-                                        <img class="mb-3" height="50"
-                                            src="{{ url('/images/paypal_logo.png') }}"></br>
-
-                                        <input x-model="paymentMethod" type="radio" id="paypal" value="paypal"
-                                            name="payment_method">
-                                        </input>
-                                    </label>
-
-                                    <label class="ml-5 text-center " for="stripe">
-                                        <img class="mb-3" height="50"
-                                            src="{{ url('/images/stripe_logo.png') }}" /></br>
-                                        <input x-model="paymentMethod" type="radio" id="stripe" value="stripe"
-                                            name="payment_method">
-                                        </input>
-                                    </label>
+                                    @if (env('PAYPAL_SANDBOX_SECRET') || env('PAYPAL_SECRET'))
+                                        <label class="text-center " for="paypal">
+                                            <img class="mb-3" height="50"
+                                                src="{{ url('/images/paypal_logo.png') }}"></br>
+
+                                            <input x-model="paymentMethod" type="radio" id="paypal" value="paypal"
+                                                name="payment_method">
+                                            </input>
+                                        </label>
+                                    @endif
+                                    @if (env('STRIPE_TEST_SECRET') || env('STRIPE_SECRET'))
+                                        <label class="ml-5 text-center " for="stripe">
+                                            <img class="mb-3" height="50"
+                                                src="{{ url('/images/stripe_logo.png') }}" /></br>
+                                            <input x-model="paymentMethod" type="radio" id="stripe" value="stripe"
+                                                name="payment_method">
+                                            </input>
+                                        </label>
+                                    @endif
                                 </div>
                                 </div>
 
 
                             </div>
                             </div>
@@ -135,7 +138,7 @@
                                             <td>{{ $product->formatToCurrency($product->price) }}</td>
                                             <td>{{ $product->formatToCurrency($product->price) }}</td>
                                         </tr>
                                         </tr>
                                         <tr>
                                         <tr>
-                                            <th>Tax ({{ $taxpercent }}%)</th>
+                                            <th>{{ __('Tax') }} ({{ $taxpercent }}%)</th>
                                             <td>{{ $product->formatToCurrency($taxvalue) }}</td>
                                             <td>{{ $product->formatToCurrency($taxvalue) }}</td>
                                         </tr>
                                         </tr>
                                         <tr>
                                         <tr>
@@ -143,7 +146,7 @@
                                             <td>1</td>
                                             <td>1</td>
                                         </tr>
                                         </tr>
                                         <tr>
                                         <tr>
-                                            <th>Total:</th>
+                                            <th>{{ __('Total') }}:</th>
                                             <td>{{ $product->formatToCurrency($total) }}</td>
                                             <td>{{ $product->formatToCurrency($total) }}</td>
                                         </tr>
                                         </tr>
                                     </table>
                                     </table>
@@ -156,7 +159,8 @@
                         <!-- this row will not appear when printing -->
                         <!-- this row will not appear when printing -->
                         <div class="row no-print">
                         <div class="row no-print">
                             <div class="col-12">
                             <div class="col-12">
-                                <a type="button" :href="paymentRoute" class="btn btn-success float-right"><i
+                                <a type="button" :href="paymentRoute" :disabled="!paymentRoute"
+                                    :class="!paymentRoute ? 'disabled' : ''" class="btn btn-success float-right"><i
                                         class="far fa-credit-card mr-2"></i>
                                         class="far fa-credit-card mr-2"></i>
                                     {{ __('Submit Payment') }}
                                     {{ __('Submit Payment') }}
                                 </a>
                                 </a>