feat: Added Notification if Stripe isnt setup (like paypal) in store

This commit is contained in:
IceToast 2021-12-20 11:18:35 +01:00
parent 9d8361641b
commit 7989ff57b9
2 changed files with 64 additions and 34 deletions

View file

@ -12,9 +12,14 @@ class StoreController extends Controller
public function index()
{
$isPaypalSetup = false;
if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true;
if (env('APP_ENV', 'local') == 'local') $isPaypalSetup = true;
$isStripeSetup = false;
if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true;
if (env('APP_ENV', 'local') == 'local') {
$isPaypalSetup = true;
$isStripeSetup = true;
}
if (env('STRIPE_SECRET') && env('STRIPE_ENDPOINT_SECRET') && env('STRIPE_METHODS')) $isStripeSetup = true;
//Required Verification for creating an server
if (Configuration::getValueByKey('FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) {
@ -28,7 +33,8 @@ class StoreController extends Controller
return view('store.index')->with([
'products' => CreditProduct::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
'isPaypalSetup' => $isPaypalSetup
'isPaypalSetup' => $isPaypalSetup,
'isStripeSetup' => $isStripeSetup
]);
}
}

View file

@ -6,13 +6,13 @@
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>{{__('Store')}}</h1>
<h1>{{ __('Store') }}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
href="{{route('admin.store.index')}}">{{__('Store')}}</a></li>
href="{{ route('admin.store.index') }}">{{ __('Store') }}</a></li>
</ol>
</div>
</div>
@ -26,10 +26,18 @@
<div class="row">
<div class="col-lg-4">
@if($isPaypalSetup == false)
@if ($isPaypalSetup == false)
<div class="callout callout-danger">
<h4>{{__('Paypal is not configured.')}}</h4>
<p>{{__('To configure PayPal, head to the .env and add your PayPals client id and secret.')}}</p>
<h4>{{ __('Paypal is not configured.') }}</h4>
<p>{{ __('To configure PayPal, head to the .env and add your PayPals client id and secret.') }}
</p>
</div>
@endif
@if ($isStripeSetup == false)
<div class="callout callout-danger">
<h4>{{ __('Stripe is not configured.') }}</h4>
<p>{{ __('To configure Stripe, head to the .env and add your Stripüe Secret, Endpoint and supported Payment Methods.') }}
</p>
</div>
@endif
</div>
@ -39,9 +47,9 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><i class="fas fa-sliders-h mr-2"></i>{{__('Store')}}</h5>
<a href="{{route('admin.store.create')}}" class="btn btn-sm btn-primary"><i
class="fas fa-plus mr-1"></i>{{__('Create new')}}</a>
<h5 class="card-title"><i class="fas fa-sliders-h mr-2"></i>{{ __('Store') }}</h5>
<a href="{{ route('admin.store.create') }}" class="btn btn-sm btn-primary"><i
class="fas fa-plus mr-1"></i>{{ __('Create new') }}</a>
</div>
</div>
@ -49,15 +57,15 @@
<table id="datatable" class="table table-striped">
<thead>
<tr>
<th>{{__('Active')}}</th>
<th>{{__('Type')}}</th>
<th>{{__('Price')}}</th>
<th>{{__('Display')}}</th>
<th>{{__('Description')}}</th>
<th>{{__('Created at')}}</th>
<th></th>
</tr>
<tr>
<th>{{ __('Active') }}</th>
<th>{{ __('Type') }}</th>
<th>{{ __('Price') }}</th>
<th>{{ __('Display') }}</th>
<th>{{ __('Description') }}</th>
<th>{{ __('Created at') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
@ -78,26 +86,42 @@
return confirm("Are you sure you wish to delete?") !== false;
}
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function() {
$('#datatable').DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{config("app.datatable_locale")}}.json'
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{ config('app.datatable_locale') }}.json'
},
processing: true,
serverSide: true,
stateSave: true,
ajax: "{{route('admin.store.datatable')}}",
order: [[ 2, "desc" ]],
columns: [
{data: 'disabled'},
{data: 'type'},
{data: 'price'},
{data: 'display'},
{data: 'description'},
{data: 'created_at'},
{data: 'actions', sortable: false},
ajax: "{{ route('admin.store.datatable') }}",
order: [
[2, "desc"]
],
fnDrawCallback: function( oSettings ) {
columns: [{
data: 'disabled'
},
{
data: 'type'
},
{
data: 'price'
},
{
data: 'display'
},
{
data: 'description'
},
{
data: 'created_at'
},
{
data: 'actions',
sortable: false
},
],
fnDrawCallback: function(oSettings) {
$('[data-toggle="popover"]').popover();
}
});