Mass actions working and created structure for customer package and removed some bugs from data grid and home page and made layouts for sign in and sign up package of customers and made the customer guard for customer also with model named customer

This commit is contained in:
prashant-webkul 2018-07-20 20:37:16 +05:30
parent 6da3b5bc83
commit e4581fc725
27 changed files with 563 additions and 72 deletions

View File

@ -12,6 +12,11 @@ return [
'provider' => 'users',
],
'customer' =>[
'driver' => 'session',
'provider' => 'customers'
],
'admin' => [
'driver' => 'session',
'provider' => 'admins'
@ -27,7 +32,12 @@ return [
'users' => [
'driver' => 'eloquent',
'model' => Webkul\User\Models\User::class,
],
],
'customers' => [
'driver' => 'eloquent',
'model' => Webkul\Customer\Models\Customer::class,
],
'admins' => [
'driver' => 'eloquent',
@ -41,5 +51,10 @@ return [
'table' => 'admin_password_resets',
'expire' => 60,
],
'admins' => [
'provider' => 'customers',
'table' => 'customers_password_resets',
'expire' => 60,
],
],
];
];

View File

@ -24,15 +24,9 @@ class DashboardController extends Controller
public function __construct()
{
$this->_config = request('_config');
}
public function index()
{
return view('admin::dashboard.index');
}
public function loadCatalog()
{
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
/**
* Dashboard controller
*
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class CustomerController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
public function __construct()
{
$this->_config = request('_config');
}
public function index()
{
return view('customer::login.index');
}
public function login()
{
return view($this->_config['view']);
}
public function signup()
{
return view($this->_config['view']);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Webkul\User\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfNotCustomer
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = 'customer')
{
if (! Auth::guard($guard)->check()) {
return redirect()->route('admin.login');
}
return $next($request);
}
}

View File

@ -1,5 +1,21 @@
<?php
Route::get('/customer/profile', function () {
return "hello from customers package";
Route::group(['middleware' => ['web']], function () {
Route::prefix('customer')->group(function () {
// Login Routes
Route::get('/login', 'Webkul\Customer\Http\Controllers\CustomerController@login')->defaults('_config', [
'view' => 'customer::login.index'
])->name('customer.login');
Route::get('/register', 'Webkul\Customer\Http\Controllers\CustomerController@signup')->defaults('_config', [
'view' => 'customer::signup.index'
])->name('customer.register');
// Auth Routes
Route::group(['middleware' => ['customer']], function () {
Route::get('/logout', 'Webkul\Customer\Http\Controllers\CustomerController@logout')->defaults('_config', [
'redirect' => 'customer.session.index'
])->name('customer.session.destroy');
});
});
});

View File

@ -0,0 +1,9 @@
<?php
namespace Webkul\Customer\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
protected $table = 'customers';
}

View File

@ -0,0 +1,28 @@
<?php
namespace Webkul\User\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Auth\Notifications\ResetPassword;
class CustomerResetPassword extends ResetPassword
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
return (new MailMessage)
->line('You are receiving this email because we received a password reset request for your account.')
->action('Reset Password', route('customer.reset-password.create', $this->token))
->line('If you did not request a password reset, no further action is required.');
}
}

View File

@ -3,6 +3,11 @@
namespace Webkul\Customer\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Blade;
use Webkul\Admin\Providers\EventServiceProvider;
// use Webkul\Admin\Providers\ComposerServiceProvider;
class CustomerServiceProvider extends ServiceProvider
{
@ -14,6 +19,10 @@ class CustomerServiceProvider extends ServiceProvider
__DIR__ . '/../../publishable/assets' => public_path('vendor/webkul/customer/assets'),
], 'public');
$router->aliasMiddleware('customer', RedirectIfNotCustomer::class);
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'customer');
}

View File

@ -0,0 +1,5 @@
$sign-up-text-color: #5e5e5e;
$login-text: #3a3a3a;
$background-color: #ffffff;
$border-color: #ffe8e8e8;
$forgot-password-color: #0031f0;

View File

@ -0,0 +1,66 @@
@import "mixins";
@import "variables";
.content {
padding-top: 15%;
padding-bottom: 15%;
.sign-up-text {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 18px;
color: $sign-up-text-color;
letter-spacing: -0.29px;
text-align: center;
}
.login-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-left: 25px;
padding-right: 25px;
.login-text {
font-size: 24px;
font-weight: bold;
color: $login-text;
letter-spacing: -0.23px;
margin-top: 5%;
margin-bottom: 3%;
}
.control-group {
margin-bottom: 15px !important;
.control {
width: 100% !important;
}
}
.forgot-password-link {
font-size: 17px;
color: $forgot-password-color;
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.signup-confirm {
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.btn-primary {
width: 100%;
text-transform: uppercase;
border-radius: 0px;
height: 45px;
margin-bottom: 4%;
}
}
}

View File

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<title>@yield('page_title')</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/shop/assets/css/shop.css') }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/ui/assets/css/ui.css') }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/customer/assets/css/customer.css') }}">
@yield('head')
@yield('css')
</head>
<body>
<div id="app">
@include('shop::layouts.header')
<div class="main-container-wrapper">
<div class="content-container">
@yield('content-wrapper')
</div>
</div>
@include('shop::layouts.footer')
</div>
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }];
@elseif($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@endif
window.serverErrors = [];
@if (count($errors))
window.serverErrors = @json($errors->getMessages());
@endif
</script>
<script type="text/javascript" src="{{ asset('vendor/webkul/shop/assets/js/shop.js') }}"></script>
<script type="text/javascript" src="{{ asset('vendor/webkul/ui/assets/js/ui.js') }}"></script>
@yield('javascript')
</body>
</html>

View File

@ -0,0 +1,27 @@
@extends('customer::layouts.master')
@section('content-wrapper')
<div class="content">
<div class="sign-up-text">
Don't have account - <a href="{{ route('customer.register') }}">Sign Up</a>
</div>
<form>
<div class="login-form">
<div class="login-text">Sign In</div>
<div class="control-group">
<label for="email">E-Mail</label>
<input type="text" class="control" name="email">
</div>
<div class="control-group">
<label for="email">Password</label>
<input type="password" class="control" name="email">
</div>
<div class="forgot-password-link">
<a href="">Forgot Password?</a>
</div>
<input class="btn btn-primary btn-lg" type="submit" value="sign in">
</div>
</form>
</div>
@endsection

View File

@ -0,0 +1,44 @@
@extends('customer::layouts.master')
@section('content-wrapper')
<div class="content">
<div class="sign-up-text">
Already have an account - <a href="{{ route('customer.login') }}">Sign In</a>
</div>
<form>
<div class="login-form">
<div class="login-text">Sign Up</div>
<div class="control-group">
<label for="email">First Name</label>
<input type="text" class="control" name="email">
</div>
<div class="control-group">
<label for="email">Last Name</label>
<input type="text" class="control" name="email">
</div>
<div class="control-group">
<label for="email">Email</label>
<input type="email" class="control" name="email">
</div>
<div class="control-group">
<label for="email">Password</label>
<input type="password" class="control" name="email">
</div>
<div class="control-group">
<label for="email">Confirm Password</label>
<input type="password" class="control" name="email">
</div>
<div class="signup-confirm">
<span class="checkbox">
<input type="checkbox" id="checkbox2" name="checkbox[]">
<label class="checkbox-view" for="checkbox2"></label>
<span>Agree <a href="">Terms</a> & <a href="">Conditions</a> by using this website.</span>
</span>
</div>
<input class="btn btn-primary btn-lg" type="submit" value="sign in">
</div>
</form>
</div>
@endsection

View File

@ -6,18 +6,13 @@ var publicPath = "../../../public/vendor/webkul/customer/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();
mix.js(
[
__dirname + "/src/Resources/assets/js/app.js"
// __dirname + "/src/Resources/assets/js/dropdown.js"
],
"js/ui.js"
)
// .copy(__dirname + "/src/Resources/assets/images", publicPath + "/images")
.sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/customer.css")
.options({
processCssUrls: false
});
mix.sass(
__dirname + "/src/Resources/assets/sass/app.scss",
"css/customer.css"
).options({
processCssUrls: false
});
if (mix.inProduction()) {
mix.version();

View File

@ -1,9 +1,13 @@
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,500");
@import "mixins";
@import "variables";
body {
margin: 0;
padding: 0;
font-family: "Montserrat", sans-serif;
font-weight: 500;
font-size: 14px;
}
.header {
@ -18,7 +22,6 @@ body {
width: 100%;
margin-left: auto;
margin-right: auto;
// border: 1px solid indigo;
align-items: center;
justify-content: space-between;
@ -49,15 +52,9 @@ body {
border-right: none;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
input.search-field::-moz-placeholder {
font-family: "montserrat", sans-serif;
padding-left: 10px;
}
input.search-field::-webkit-input-placeholder {
font-family: "montserrat", sans-serif;
padding-left: 10px;
padding-left: 12px;
font-family: "Montserrat", sans-serif;
font-size: 14px;
}
.q-c {
@ -92,17 +89,18 @@ body {
li.account-dropdown {
display: flex;
flex-direction: row;
margin-right: 10px;
margin-right: 14px;
.icon-account {
.account-icon {
margin: 0;
padding-right: 5px;
padding-right: 8px;
height: 24px;
width: 24px;
}
.account {
padding-top: 3px;
padding-right: 5px;
margin-left: 8px;
}
.icon.arrow-down-icon {
margin-top: 10px;
@ -116,13 +114,13 @@ body {
li.product-dropdown {
display: flex;
flex-direction: row;
margin-left: 10px;
margin-left: 14px;
.icon-cart {
.cart-icon {
margin: 0;
height: 24px;
width: 24px;
margin-right: 9px;
margin-right: 8px;
}
.cart {
padding-top: 3px;
@ -397,6 +395,7 @@ body {
.btn-primary {
background-color: $subscribe-btn-color;
margin-top: 8px;
border-radius: 0px;
text-align: center;
}
@ -1173,14 +1172,3 @@ body {
}
}
}
// @media all and (max-width: 960px) {
// }
// @media all and (max-width: 768px) {
// }
// @media all and (max-width: 480px) {
// }

View File

@ -23,7 +23,7 @@
</ul>
<ul class="account-dropdown-container">
<li class="account-dropdown">
<span class="icon icon-account"></span>
<span class="icon account-icon"></span>
<span class="account">Account</span>
<span class="icon arrow-down-icon"></span>
</li>
@ -31,7 +31,7 @@
<ul class="product-dropdown-container">
<li class="product-dropdown">
<span class="icon icon-cart"></span>
<span class="icon cart-icon"></span>
<span class="cart"><span class="cart-count">5</span>Products</span>
<span class="icon arrow-down-icon"></span>
</li>

View File

@ -8,7 +8,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/shop/assets/css/shop.css') }}">
<link rel="stylesheet" href="{{ asset('vendor/webkul/ui/assets/css/ui.css') }}"> @yield('head') @yield('css')
<link rel="stylesheet" href="{{ asset('vendor/webkul/ui/assets/css/ui.css') }}">
@yield('head')
@yield('css')
</head>

View File

@ -122,6 +122,18 @@
height: 24px;
}
.account-icon {
background-image: url("../images/icon-account.svg");
width: 24px;
height: 24px;
}
.cart-icon {
background-image: url("../images/icon-cart.svg");
width: 24px;
height: 24px;
}
.active {
.dashboard-icon {
background-image: url("../images/Icon-Dashboard-Active.svg");

View File

@ -14,7 +14,7 @@ mix.js(
],
"js/ui.js"
)
// .copy(__dirname + "/src/Resources/assets/images", publicPath + "/images")
.copy(__dirname + "/src/Resources/assets/images", publicPath + "/images")
.sass(__dirname + "/src/Resources/assets/sass/app.scss", "css/ui.css")
.options({
processCssUrls: false

View File

@ -25,4 +25,4 @@ class AdminResetPassword extends ResetPassword
->action('Reset Password', route('admin.reset-password.create', $this->token))
->line('If you did not request a password reset, no further action is required.');
}
}
}

View File

@ -0,0 +1,71 @@
.content {
padding-top: 15%;
padding-bottom: 15%;
}
.content .sign-up-text {
margin-bottom: 2%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-size: 18px;
color: #5e5e5e;
letter-spacing: -0.29px;
text-align: center;
}
.content .login-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-left: 25px;
padding-right: 25px;
}
.content .login-form .login-text {
font-size: 24px;
font-weight: bold;
color: #3a3a3a;
letter-spacing: -0.23px;
margin-top: 5%;
margin-bottom: 3%;
}
.content .login-form .control-group {
margin-bottom: 15px !important;
}
.content .login-form .control-group .control {
width: 100% !important;
}
.content .login-form .forgot-password-link {
font-size: 17px;
color: #0031f0;
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.content .login-form .signup-confirm {
letter-spacing: -0.11px;
margin-bottom: 5%;
}
.content .login-form .btn-primary {
width: 100%;
text-transform: uppercase;
border-radius: 0px;
height: 45px;
margin-bottom: 4%;
}

View File

@ -0,0 +1,81 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
(function webpackMissingModule() { throw new Error("Cannot find module \"/home/users/prashant.singh/www/html/bagisto/packages/Webkul/Customer/src/Resources/assets/js/app.js\""); }());
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ })
/******/ ]);

View File

@ -0,0 +1,4 @@
{
"/js/ui.js": "/js/ui.js",
"/css/customer.css": "/css/customer.css"
}

View File

@ -1,6 +1,9 @@
body {
@import url(https://fonts.googleapis.com/css?family=Montserrat:400,500);body {
margin: 0;
padding: 0;
font-family: "Montserrat", sans-serif;
font-weight: 500;
font-size: 14px;
}
.header {
@ -70,16 +73,9 @@ body {
border-right: none;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
.header .header-top div.left-content ul.search-container li.search-group input.search-field::-moz-placeholder {
font-family: "montserrat", sans-serif;
padding-left: 10px;
}
.header .header-top div.left-content ul.search-container li.search-group input.search-field::-webkit-input-placeholder {
font-family: "montserrat", sans-serif;
padding-left: 10px;
padding-left: 12px;
font-family: "Montserrat", sans-serif;
font-size: 14px;
}
.header .header-top div.left-content ul.search-container li.search-group .q-c {
@ -128,12 +124,12 @@ body {
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
margin-right: 10px;
margin-right: 14px;
}
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .icon-account {
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .account-icon {
margin: 0;
padding-right: 5px;
padding-right: 8px;
height: 24px;
width: 24px;
}
@ -141,6 +137,7 @@ body {
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .account {
padding-top: 3px;
padding-right: 5px;
margin-left: 8px;
}
.header .header-top div.right-content ul.account-dropdown-container li.account-dropdown .icon.arrow-down-icon {
@ -159,14 +156,14 @@ body {
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
margin-left: 10px;
margin-left: 14px;
}
.header .header-top div.right-content ul.product-dropdown-container li.product-dropdown .icon-cart {
.header .header-top div.right-content ul.product-dropdown-container li.product-dropdown .cart-icon {
margin: 0;
height: 24px;
width: 24px;
margin-right: 9px;
margin-right: 8px;
}
.header .header-top div.right-content ul.product-dropdown-container li.product-dropdown .cart {
@ -488,6 +485,7 @@ body {
.footer .footer-content .footer-list-container .list-container .form-container .control-group .btn-primary {
background-color: black;
margin-top: 8px;
border-radius: 0px;
text-align: center;
}

View File

@ -154,7 +154,6 @@ $(document).ready(function () {
mounted: function mounted() {
this.addServerErrors();
this.addFlashMessages();
this.responsiveHeader();
},
methods: {

View File

@ -123,6 +123,18 @@
height: 24px;
}
.account-icon {
background-image: url("../images/icon-account.svg");
width: 24px;
height: 24px;
}
.cart-icon {
background-image: url("../images/icon-cart.svg");
width: 24px;
height: 24px;
}
.active .dashboard-icon {
background-image: url("../images/Icon-Dashboard-Active.svg");
}