From 9332f1e9d2e4bfa141532cb271446d90fc7555b5 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 3 Sep 2024 01:46:02 +0330 Subject: [PATCH] optimized ui/ux --- .env.example | 3 ++- app/Helpers/Helper.php | 1 + app/Http/Controllers/CardController.php | 7 +++--- .../Payment/GatewayVerifyController.php | 2 ++ config/app.php | 6 +++++ .../components/panel-breadcrumb.blade.php | 2 +- .../AvisaCustomer/AvisaCustomer.blade.php | 2 +- .../segments/menu/AplMenu/AplMenu.blade.php | 12 +++++----- .../menu/RecetMenu/RecetMenu.blade.php | 22 ++++++++++++++----- .../segments/menu/RecetMenu/RecetMenu.scss | 8 +++++++ routes/web.php | 11 +++++++--- 11 files changed, 55 insertions(+), 21 deletions(-) diff --git a/.env.example b/.env.example index a13d916..647cb09 100644 --- a/.env.example +++ b/.env.example @@ -77,4 +77,5 @@ SIGN_SMS=true SIGN_DRIVER=Kavenegar ZARINPAL_MERCHANT=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -PAY_GATEWAY=zarinpal +ZIBAL_MERCHANT=zibal +PAY_GATEWAY=zibal diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index d7cedae..b702583 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -315,6 +315,7 @@ function sluger($name, $replace_char = '-') */ function lastCrump() { + $routes = explode('.', Route::currentRouteName()); if (count($routes) != 3) { echo '
  • diff --git a/app/Http/Controllers/CardController.php b/app/Http/Controllers/CardController.php index 58aaff1..057e29f 100644 --- a/app/Http/Controllers/CardController.php +++ b/app/Http/Controllers/CardController.php @@ -154,8 +154,8 @@ class CardController extends Controller $callbackUrl = route('pay.check', ['invoice_hash' => $invoice->hash, 'gateway' => $gateway->getName()]); $payment = null; try { - $response = $gateway->request(($invoice->total_price - $invoice->credit_price), $callbackUrl); - $payment = $invoice->storePaymentRequest($response['order_id'], ($invoice->total_price - $invoice->credit_price), $response['token'] ?? null, null, $gateway->getName()); + $response = $gateway->request((($invoice->total_price - $invoice->credit_price) * config('app.currency.factor')), $callbackUrl); + $payment = $invoice->storePaymentRequest($response['order_id'], (($invoice->total_price - $invoice->credit_price) * config('app.currency.factor')), $response['token'] ?? null, null, $gateway->getName()); session(["payment_id" => $payment->id]); \Session::save(); @@ -218,7 +218,6 @@ class CardController extends Controller } - public function productCompareToggle($slug) { @@ -230,7 +229,7 @@ class CardController extends Controller unset($compares[array_search($product->id, $compares)]); } else { $compares[] = $product->id; - $msg = __( "Product added to compare"); + $msg = __("Product added to compare"); } \Cookie::queue('compares', json_encode($compares), 2000); } else { diff --git a/app/Http/Controllers/Payment/GatewayVerifyController.php b/app/Http/Controllers/Payment/GatewayVerifyController.php index 91703cb..570d00d 100755 --- a/app/Http/Controllers/Payment/GatewayVerifyController.php +++ b/app/Http/Controllers/Payment/GatewayVerifyController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Payment; use App\Contracts\Payment; +use App\Http\Controllers\CardController; use App\Models\Invoice; class GatewayVerifyController @@ -31,6 +32,7 @@ class GatewayVerifyController return redirect()->route('client.card')->withErrors(__("error in payment.").$message); } + CardController::clear(); return redirect()->route('client.profile')->with('message' , __("payment success")); } diff --git a/config/app.php b/config/app.php index 8238241..57262c5 100644 --- a/config/app.php +++ b/config/app.php @@ -183,6 +183,12 @@ return [ 'main' => env('XLANG_MAIN','en'), 'api_url' => env('XLANG_API_URL',''), ], + 'xshop' =>[ + 'payment' => [ + 'gateway' => env('PAY_GATEWAY',''), + 'merchant_id' => env('MERCHANT_ID',''), + ] + ], diff --git a/resources/views/components/panel-breadcrumb.blade.php b/resources/views/components/panel-breadcrumb.blade.php index 72c6dee..4920e5c 100644 --- a/resources/views/components/panel-breadcrumb.blade.php +++ b/resources/views/components/panel-breadcrumb.blade.php @@ -7,7 +7,7 @@
  • - + {{__("Dashboard")}} diff --git a/resources/views/segments/customer/AvisaCustomer/AvisaCustomer.blade.php b/resources/views/segments/customer/AvisaCustomer/AvisaCustomer.blade.php index 43989d9..e84dc8b 100644 --- a/resources/views/segments/customer/AvisaCustomer/AvisaCustomer.blade.php +++ b/resources/views/segments/customer/AvisaCustomer/AvisaCustomer.blade.php @@ -226,7 +226,7 @@ class="btn btn-outline-primary btn-sm "> - @if($inv->status == 'PENDING') + @if($inv->status != 'COMPLETED' && $inv->created_at->timestamp < (time() - 3600) ) {{__("Pay now")}} diff --git a/resources/views/segments/menu/AplMenu/AplMenu.blade.php b/resources/views/segments/menu/AplMenu/AplMenu.blade.php index 964c025..4ceff90 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.blade.php +++ b/resources/views/segments/menu/AplMenu/AplMenu.blade.php @@ -3,7 +3,7 @@
  • -{{-- --}} + {{-- --}}
  • @@ -86,8 +86,8 @@ -
  • - +
  • + @if(cardCount() > 0) @@ -126,9 +126,9 @@ -{{-- --}} + {{-- --}} diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php index 31696be..2c01def 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php @@ -13,11 +13,23 @@
  • @endforeach
  • - @foreach(\App\Models\XLang::all() as $lang) - - {{$lang->emoji}} - - @endforeach + + + + @if(cardCount() > 0) + {{cardCount()}} + @endif + + + @if(config('app.xlang.active')) + @foreach(\App\Models\XLang::all() as $lang) + @if($lang->tag != app()->getLocale()) + + {{$lang->emoji}} + + @endif + @endforeach + @endif
  • diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.scss b/resources/views/segments/menu/RecetMenu/RecetMenu.scss index 58dc2a8..8c929c0 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.scss +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.scss @@ -27,8 +27,16 @@ &:first-child{ display: none; } + } } + .card-link{ + padding: 5px !important; + margin: 0; + i{ + font-size: 25px; + } + } } /*-768px width*/ diff --git a/routes/web.php b/routes/web.php index 89337e3..036aadc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,7 +16,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group( function () { - Route::get('/', [\App\Http\Controllers\HomeController::class, 'index'])->name('dash'); + Route::get('/', [\App\Http\Controllers\HomeController::class, 'index'])->name('home'); Route::post('ckeditor/upload', [\App\Http\Controllers\Admin\CkeditorController::class, 'upload'])->name('ckeditor.upload'); Route::get('adminlogs', [\App\Http\Controllers\Admin\AdminLogController::class, 'index'])->name('adminlog.index'); @@ -416,8 +416,13 @@ Route::get('/sitemap.xml', [ClientController::class, 'sitemap'])->name('sitemap' // to developer test Route::get('login/as/{mobile}', function ($mobile) { if (auth()->check() && auth()->user()->hasRole('developer')) { - return \Auth::guard('customer') - ->loginUsingId(\App\Models\Customer::where('mobile', $mobile)->first()->id); + if ($mobile = 1){ + return \Auth::guard('customer') + ->loginUsingId(\App\Models\Customer::inRandomOrder()->first()->id); + }else{ + return \Auth::guard('customer') + ->loginUsingId(\App\Models\Customer::where('mobile', $mobile)->first()->id); + } } else { return abort(403); }