Skip to content

Commit

Permalink
seller order ui fix , modal fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shivishbrahma committed Jul 9, 2021
1 parent 58fafbf commit 56799e4
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 73 deletions.
85 changes: 63 additions & 22 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Helpers\Notiflix;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
Expand Down Expand Up @@ -46,33 +47,46 @@ protected function authenticated(Request $request, $user)
{
switch ($user->role) {
case 'admin':
return redirect('/admin')->with('alert', [
'code' => 'success',
'title' => 'Success!',
'subtitle' => 'You have been logged in as an admin!',
]);
return redirect('/admin')->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Bonjour!',
'subtitle' => 'You have been logged in as an admin!',
])
);
break;
case 'sysadmin':
return redirect('/admin')->with('alert', [
'code' => 'success',
'title' => 'Success!',
'subtitle' => 'You have been logged in as an system admin!',
]);
return redirect('/admin')->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Bonjour!',
'subtitle' =>
'You have been logged in as an system admin!',
])
);
break;
case 'seller':
return redirect('/seller')->with('alert', [
'code' => 'success',
'title' => 'Success!',
'subtitle' => 'You have been logged in as an seller!',
]);
return redirect('/seller')->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Bonjour!',
'subtitle' => 'You have been logged in as an seller!',
])
);
break;

default:
return redirect('home')->with('alert', [
'code' => 'success',
'title' => 'Success!',
'subtitle' => 'You have been logged in as an customer!',
]);
return redirect('home')->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Bonjour!',
'subtitle' => 'You have been logged in as an customer!',
])
);
break;
}
}
Expand All @@ -92,9 +106,21 @@ public function login(Request $request)
}

if (Auth::attempt($credentials)) {
return redirect()->intended($this->redirectPath());
return redirect()
->intended($this->redirectPath())
->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Bonjour!',
'subtitle' =>
'You have been logged in as an ' .
Auth::user()->role .
'!',
])
);
}

return redirect()
->back()
->withInput()
Expand Down Expand Up @@ -147,4 +173,19 @@ public function validateLogin(Request $request)
'errors' => ['email' => 'Invalid credentials.'],
]);
}

public function logout(Request $request)
{
Auth::logout();
return redirect()
->route('welcome')
->with(
'alert',
Notiflix::make([
'code' => 'success',
'title' => 'Adieu!',
'subtitle' => 'You have been logged out!',
])
);
}
}
19 changes: 9 additions & 10 deletions app/Http/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function showall()
->orderBy('order_id', 'desc')
->orderBy('created_at', 'desc')
->paginate(8);
return view('profile.orders', compact('orders'));
return view('profile.order.list', compact('orders'));
}

/**
Expand All @@ -241,21 +241,22 @@ public function showone($id)
'order_id' => $id,
])->get();
if (count($orders) > 0) {
return view('profile.order', compact('orders'));
return view('profile.order.show', compact('orders'));
}
abort(404);
}
public function cancel_delete(Request $req)
{
$ostatus = $req->input('input');
$oid = $req->input('id');
$order = Order::all()->where('id',"=",$oid)->first();
if($ostatus=="Cancel")
{
$order = Order::all()
->where('id', '=', $oid)
->first();
if ($ostatus == 'Cancel') {
$order->status = 'Cancelled';
$order->save();
return redirect()
->route('orders.show',$order->order_id)
->route('orders.show', $order->order_id)
->with(
'alert',
Notiflix::make([
Expand All @@ -265,9 +266,7 @@ public function cancel_delete(Request $req)
'subtitle' => 'Order is successfully Cancellerd!',
])
);
}
elseif($ostatus=="Delete")
{
} elseif ($ostatus == 'Delete') {
Order::find($oid)->delete();
return redirect()
->route('orders')
Expand All @@ -280,7 +279,7 @@ public function cancel_delete(Request $req)
'subtitle' => 'Order is successfully Deleted!',
])
);
}
}
}
/**
* Update the specified resource in storage.
Expand Down
13 changes: 7 additions & 6 deletions app/Http/Controllers/SellerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ public function __construct()
public function seller_form()
{
if (Auth::user()->is_seller || Auth::user()->is_admin) {
return redirect()->back()
return redirect()
->back()
->with(
'alert',
Notiflix::make([
'code' => 'info',
'subtitle' =>
'You are already registered as ' .
'You are already registered as ' .
Auth::user()->role .
'!',
])
Expand All @@ -48,7 +49,7 @@ public function seller_form()
'type' => 'Report',
'title' => 'Waiting!',
'subtitle' =>
'Already signed for ' .
'Already signed for ' .
str_replace('_', ' ', $approval->type) .
'!',
])
Expand Down Expand Up @@ -131,7 +132,7 @@ protected function create_seller(Request $req)
'title' => 'Yippee!',
'type' => 'Report',
'subtitle' =>
'Your registration as a seller is in progress!',
'Your registration as a seller is in progress!',
])
);
}
Expand Down Expand Up @@ -162,7 +163,7 @@ public function product_orders()
->orderBy('created_at', 'desc')
->paginate(8);

return view('seller.orders')->with('orders', $orders);
return view('seller.order.list')->with('orders', $orders);
}

public function show_one_order($id)
Expand All @@ -175,7 +176,7 @@ public function show_one_order($id)
->where('order_id', $id)
->get();
if (count($orders) > 0) {
return view('profile.order', compact('orders'));
return view('seller.order.show', compact('orders'));
}
abort(404);
}
Expand Down
2 changes: 1 addition & 1 deletion database/seeds/ProductSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public function run()
'ref_id' => $product12->id,
]);

for ($i = 0; $i < 0; $i++) {
for ($i = 0; $i < 50; $i++) {
$product_name = $this->faker->bothify('Product**##');
$product = Product::create([
'type' => array_rand(Product::$categories),
Expand Down
12 changes: 12 additions & 0 deletions database/seeds/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,17 @@ public function run()
'landmark' => $this->faker->secondaryAddress(),
'type' => $this->faker->randomElement(['Home', 'Work']),
]);
$address2 = Address::create([
'user_id' => $user3->id,
'name' => $this->faker->name(),
'mobile' => (int) $this->faker->regexify('[1-9]{1}[0-9]{9}'),
'address1' => $this->faker->buildingNumber(),
'address2' => $this->faker->streetName(),
'city' => $this->faker->city(),
'state' => $this->faker->state(),
'pincode' => (int) $this->faker->postcode(),
'landmark' => $this->faker->secondaryAddress(),
'type' => $this->faker->randomElement(['Home', 'Work']),
]);
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,25 @@
<section class="container orders-container">
<div class="uk-padding uk-flex uk-flex-middle uk-flex-column">
<div class="uk-width-1-1 uk-width-2-3@m">
<h1 class="uk-text-large uk-text-bold uk-text-uppercase text-theme-color1 uk-card-title">My Received Orders
</h1>
<h1 class="uk-text-large uk-text-bold uk-text-uppercase text-theme-color1 uk-card-title">My Orders</h1>
<hr />

@if (count($orders) > 0)
@foreach ($orders as $o)
<div class="uk-padding-small uk-margin-bottom order-card">

<div class="uk-flex uk-flex-row uk-flex-between uk-flex-wrap">

<div class="uk-flex uk-flex-row uk-flex-middle uk-flex-around uk-flex-wrap">
<a href="{{ route('seller.product.view', $o->product->slug) }}"
class="uk-margin-right">
<img src="{{ isset($o->product->coverPhotos) ? asset('uploads/products/' . $o->product->coverPhotos[0]->name) : asset('images/icons/no_preview.png') }}"
width="100rem" uk-img />
</a>
<img src="{{ isset($o->product->coverPhotos) ? asset('uploads/products/' . $o->product->coverPhotos[0]->name) : asset('images/icons/no_preview.png') }}"
width="100rem" uk-img class="uk-margin-right" />
<div class="uk-margin-left">
<div class="uk-text-bold uk-text-emphasis">
<a href="{{ route('seller.product.view', $o->product->slug) }}"
class="text-theme-color2">
<span style="font-family: monospace">
{{ $o->product->name }}
</span>
</a>
<div class="uk-text-bold uk-text-emphasis uk-margin-small-bottom">
{{ $o->product->name }}
,
<a href="{{ route('explore') . '?c=' . $o->product->type }}"
class="text-theme-color2">
<span class="uk-text-bold">{{ $o->product->category }}</span>
</a> - {{ $o->qty . ' ' . $o->product->unit }}
{{ $o->product->category }} - 1 {{ $o->product->unit }}
</div>
<div class="uk-text-emphasis uk-margin-small-bottom">
<a href="{{ route('explore') . '?s=' . $o->product->seller->id }}">
{{ $o->product->seller->trade_name }}
</a>
{{ $o->product->seller->trade_name }}
</div>
<div class="uk-text-bold uk-margin-small-bottom sdetail-price">
{{ sprintf('%.2f', $o->total_discounted_price) }}
Expand All @@ -56,19 +41,21 @@ class="uk-text-muted uk-text-strikethrough uk-text-small uk-margin-small-left">
<br>
<span class="uk-text-emphasis"> Ordered On:
</span><span>{{ $o->created_at }}</span>
<br>
<span class="uk-text-emphasis">Order Status : </span>
<span>{{ $o->status }}</span>
</div>
</div>
</div>

@endforeach
{{ $orders->links() }}
@else
<div class="uk-card uk-card-default uk-padding uk-margin-bottom">
<p class="uk-text-bold uk-text-center">You have not orders yet</p>
<p class="uk-text-bold uk-text-center">No Order History</p>
</div>
@endif
<a class="uk-button order-home" href="{{ route('seller.index') }}">
<span uk-icon="icon: chevron-double-left"></span> Back To Dashboard
<a class="uk-button order-home" href="{{ route('home') }}">
<span uk-icon="icon: chevron-double-left"></span> Back To Home
</a>
</div>
</div>
Expand Down
Loading

0 comments on commit 56799e4

Please sign in to comment.