Edit form, logout route for customer

This commit is contained in:
prashant-webkul 2018-07-27 19:07:56 +05:30
parent 587aaf3961
commit 15043a249b
12 changed files with 173 additions and 85 deletions

View File

@ -5,6 +5,7 @@ namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Webkul\Customer\Models\Customer;
/**
* Customer controlller for the customer
@ -35,8 +36,23 @@ class CustomerController extends Controller
* authentication
* @return view
*/
private function getCustomer($id)
{
$customer = collect(Customer::find($id));
return $customer;
}
public function dashboard()
{
return view($this->_config['view']);
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
public function editProfile()
{
$id = auth()->guard('customer')->user()->id;
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
}
}

View File

@ -4,21 +4,21 @@ Route::group(['middleware' => ['web']], function () {
Route::prefix('customer')->group(function () {
// Login Routes
Route::get('/login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [
'view' => 'shop::login.index',
Route::get('login', 'Webkul\Customer\Http\Controllers\SessionController@show')->defaults('_config', [
'view' => 'shop::customers.login.index',
])->name('customer.session.index');
Route::post('/login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
Route::post('login', 'Webkul\Customer\Http\Controllers\SessionController@create')->defaults('_config', [
'redirect' => 'customer.dashboard.index'
])->name('customer.session.create');
// Registration Routes
Route::get('/register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [
'view' => 'shop::signup.index' //hint path
Route::get('register', 'Webkul\Customer\Http\Controllers\RegistrationController@show')->defaults('_config', [
'view' => 'shop::customers.signup.index' //hint path
])->name('customer.register.index');
Route::post('/register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
'redirect' => 'customer.dashboard.index',
])->name('customer.register.create');
@ -26,14 +26,19 @@ Route::group(['middleware' => ['web']], function () {
Route::group(['middleware' => ['customer']], function () {
//route for logout which will be under the auth guard of the customer by default
Route::get('/logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [
Route::get('logout', 'Webkul\Customer\Http\Controllers\SessionController@destroy')->defaults('_config', [
'redirect' => 'customer.session.index'
])->name('customer.session.destroy');
//customer dashboard
Route::get('/dashboard', 'Webkul\Customer\Http\Controllers\CustomerController@dashboard')->defaults('_config', [
'view' => 'shop::dashboard.index'
Route::get('dashboard', 'Webkul\Customer\Http\Controllers\CustomerController@dashboard')->defaults('_config', [
'view' => 'shop::customers.dashboard.index'
])->name('customer.dashboard.index');
//profile edit
Route::get('profile/edit', 'Webkul\Customer\Http\Controllers\CustomerController@editProfile')->defaults('_config', [
'view' => 'shop::customers.profile.edit'
])->name('customer.profile.edit');
});
});
});

View File

@ -15,4 +15,5 @@ class Customer extends Authenticatable
use Notifiable;
protected $table = 'customers';
protected $hidden = ['password','remember_token'];
}

View File

@ -472,11 +472,12 @@ body {
}
}
//customer pages styles goes here
//dashboard
.dashboard-content {
width: 100%;
display: flex;
flex-direction: row;
// border: 1px solid red;
margin-top: 5.5%;
margin-bottom: 5.5%;
@ -556,12 +557,51 @@ body {
td {
width: 250px;
text-transform: capitalize;
}
}
}
}
}
}
//dashboard ends here
//edit form
.edit-form-content {
margin-top: 5%;
margin-bottom: 5%;
.edit-text {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 24px;
text-align: center;
}
.edit-form {
margin-left: auto;
margin-right: auto;
display: flex;
background: $background-color;
border: 1px solid $border-color;
flex-direction: column;
max-width: 530px;
min-width: 380px;
min-height: 345px;
padding: 25px;
.control-group {
input,
select {
font-family: "monserrat", sans-serif;
width: 100%;
}
}
}
}
//edit form ends
//customers page css ends here

View File

@ -19,27 +19,27 @@
<tbody>
<tr>
<td>First Name</td>
<td>Prashant</td>
<td>{{ $customer['first_name'] }}</td>
</tr>
<tr>
<td>Last Name</td>
<td>Singh</td>
<td>{{ $customer['last_name'] }}</td>
</tr>
<tr>
<td>Gender Name</td>
<td>Male</td>
<td>{{ $customer['gender'] }}</td>
</tr>
<tr>
<td>Date of Birth</td>
<td>1/1/1993</td>
<td>{{ $customer['date_of_birth'] }}</td>
</tr>
<tr>
<td>Email Address</td>
<td>Prashant@webkul.com</td>
<td>{{ $customer['email'] }}</td>
</tr>
<tr>
<td>Mobile</td>
<td>+91-9988887744</td>
<td>{{ $customer['phone'] }}</td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,53 @@
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="edit-form-content">
<div class="edit-text">Edit Profile</div>
<form method="post" action="{{ route('customer.register.create') }}">
<div class="edit-form">
{{ csrf_field() }}
<div class="control-group">
<label for="first_name">First Name</label>
<input type="text" class="control" name="first_name" value="{{ $customer['first_name'] }}" v-validate="'required'">
{{-- <span>@{{ errors.first('first_name') }}</span> --}}
</div>
<div class="control-group">
<label for="last_name">Last Name</label>
<input type="text" class="control" name="last_name" value="{{ $customer['last_name'] }}" v-validate="'required'">
{{-- <span>@{{ errors.first('last_name') }}</span> --}}
</div>
<div class="control-group">
<label for="email">Email</label>
<input type="email" class="control" name="email" value="{{ $customer['email'] }}" v-validate="'required'">
{{-- <span>@{{ errors.first('email') }}</span> --}}
</div>
<div class="control-group">
<label for="email">Gender</label>
<select name="gender" class="control" value="{{ $customer['gender'] }}" v-validate="'required'">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
{{-- <span>@{{ errors.first('gender') }}</span> --}}
</div>
<div class="control-group">
<label for="dob">Date of Birth</label>
<input type="date" class="control" name="dob" value="{{ $customer['date_of_birth'] }}" v-validate="'required'">
{{-- <span>@{{ errors.first('first_name') }}</span> --}}
</div>
<div class="control-group">
<label for="phone">Phone</label>
<input type="text" class="control" name="phone" value="{{ $customer['phone'] }}" v-validate="'required'">
{{-- <span>@{{ errors.first('phone') }}</span> --}}
</div>
<div class="control-group">
<label for="password">Password</label>
<input type="password" class="control" name="password">
</div>
<div class="control-group">
<label for="password">Confirm Password</label>
<input type="password" class="control" name="password">
</div>
<input class="btn btn-primary btn-lg" type="submit" value="Update Profile">
</div>
</form>
</div>
@endsection

View File

@ -16,7 +16,8 @@
<body>
<div id="app">
@include('shop::layouts.header') @yield('slider')
@include('shop::layouts.header')
@yield('slider')
<div class="main-container-wrapper">
<div class="content-container">
@yield('content-wrapper')

View File

@ -1,67 +0,0 @@
<template>
<div class="{{ $css->filter }}filter-wrapper">
<div class="filter-row-one">
<div class="search-filter" style="display: inline-flex; align-items: center;">
<input type="search" class="control filter-value" placeholder="Search Users" style="border-radius: 0px;border-right:0px;" value=""/>
<span class="btn-filter icon search-icon" style="border:2px solid #c7c7c7; height:36px; width:39px;"></span>
</div>
<div class="dropdown-filters">
<div class="column-filter">
<select class="control filter-col">
<option selected disabled>Columns</option>
@foreach($columns as $column)
<option value="{{ $column->name }}">{{ $column->label }}</option>
@endforeach
</select>
</div>
<div class="more-filters">
<select class="control filter-cond">
<option selected disabled>Filters</option>
@foreach($operators as $key=>$value)
<option>{{ $key }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="filter-row-two">
{{ $columns }}<br/>
{{ json_encode($operators) }}
<span class="filter-one">
<span class="filter-name">
Stock
</span>
<span class="filter-value">
Available
<span class="icon cross-icon"></span>
</span>
</span>
<span class="filter-one">
<span class="filter-name">
Stock
</span>
<span class="filter-value">
Available
<span class="icon cross-icon"></span>
</span>
</span>
<span class="filter-one">
<span class="filter-name">
Stock
</span>
<span class="filter-value">
Available
<span class="icon cross-icon"></span>
</span>
</span>
</div>
</div>
</template>
<script>
export default {
mounted: function() {
console.log("Filter compoenent mounted");
}
};
</script>

View File

@ -668,6 +668,45 @@
.dashboard-content .profile-content table tbody tr td {
width: 250px;
text-transform: capitalize;
}
.edit-form-content {
margin-top: 5%;
margin-bottom: 5%;
}
.edit-form-content .edit-text {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 24px;
text-align: center;
}
.edit-form-content .edit-form {
margin-left: auto;
margin-right: auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
background: #ffffff;
border: 1px solid #ffe8e8e8;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
max-width: 530px;
min-width: 380px;
min-height: 345px;
padding: 25px;
}
.edit-form-content .edit-form .control-group input,
.edit-form-content .edit-form .control-group select {
font-family: "monserrat", sans-serif;
width: 100%;
}
@media all and (max-width: 480px) {