Subscription newsletter migration restored and subsctiption newsletter datagrid in admin
This commit is contained in:
parent
fad4bb83f7
commit
5f81a79796
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Admin\DataGrids;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Webkul\Ui\DataGrid\Facades\DataGrid;
|
||||
|
||||
/**
|
||||
* orderDataGrid
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class NewsLetterDataGrid
|
||||
{
|
||||
/**
|
||||
* The Data Grid implementation.
|
||||
*
|
||||
* @var newsletterDataGrid
|
||||
* for orders
|
||||
*/
|
||||
public function newsLetterDataGrid()
|
||||
{
|
||||
|
||||
return DataGrid::make([
|
||||
'name' => 'Subscriberslist',
|
||||
'table' => 'subscribers_list as sublist',
|
||||
'select' => 'sublist.id',
|
||||
'perpage' => 10,
|
||||
'aliased' => false,
|
||||
//True in case of joins else aliasing key required on all cases
|
||||
|
||||
'massoperations' =>[
|
||||
// [
|
||||
// 'route' => route('admin.datagrid.delete'),
|
||||
// 'method' => 'DELETE',
|
||||
// 'label' => 'Delete',
|
||||
// 'type' => 'button',
|
||||
// ],
|
||||
],
|
||||
|
||||
'actions' => [
|
||||
[
|
||||
'type' => 'Delete',
|
||||
'route' => route('admin.datagrid.delete'),
|
||||
'confirm_text' => 'Do you really want to delete this record?',
|
||||
'icon' => 'icon trash-icon',
|
||||
],
|
||||
],
|
||||
|
||||
'join' => [],
|
||||
|
||||
//use aliasing on secodary columns if join is performed
|
||||
'columns' => [
|
||||
[
|
||||
'name' => 'sublist.id',
|
||||
'alias' => 'subid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
'sortable' => true
|
||||
], [
|
||||
'name' => 'sublist.is_subscribed',
|
||||
'alias' => 'issubs',
|
||||
'type' => 'string',
|
||||
'label' => 'Subscribed',
|
||||
'sortable' => true,
|
||||
'wrapper' => function ($value) {
|
||||
if($value == 0)
|
||||
return "False";
|
||||
else
|
||||
return "True";
|
||||
},
|
||||
], [
|
||||
'name' => 'sublist.email',
|
||||
'alias' => 'subsemail',
|
||||
'type' => 'string',
|
||||
'label' => 'Email',
|
||||
'sortable' => true
|
||||
]
|
||||
],
|
||||
|
||||
'filterable' => [
|
||||
[
|
||||
'column' => 'sublist.id',
|
||||
'alias' => 'subid',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'sublist.is_subscribed',
|
||||
'alias' => 'issubs',
|
||||
'type' => 'string',
|
||||
'label' => 'Subscribed',
|
||||
], [
|
||||
'column' => 'sublist.email',
|
||||
'alias' => 'subsemail',
|
||||
'type' => 'string',
|
||||
'label' => 'Email',
|
||||
]
|
||||
],
|
||||
//don't use aliasing in case of searchables
|
||||
|
||||
'searchable' => [
|
||||
[
|
||||
'column' => 'sublist.id',
|
||||
'type' => 'number',
|
||||
'label' => 'ID',
|
||||
], [
|
||||
'column' => 'sublist.is_subscribed',
|
||||
'type' => 'string',
|
||||
'label' => 'Subscribed',
|
||||
], [
|
||||
'column' => 'sublist.email',
|
||||
'type' => 'string',
|
||||
'label' => 'Email',
|
||||
]
|
||||
],
|
||||
|
||||
//list of viable operators that will be used
|
||||
'operators' => [
|
||||
'eq' => "=",
|
||||
'lt' => "<",
|
||||
'gt' => ">",
|
||||
'lte' => "<=",
|
||||
'gte' => ">=",
|
||||
'neqs' => "<>",
|
||||
'neqn' => "!=",
|
||||
'like' => "like",
|
||||
'nlike' => "not like",
|
||||
],
|
||||
// 'css' => []
|
||||
]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->newsLetterDataGrid()->render();
|
||||
}
|
||||
}
|
||||
|
|
@ -96,6 +96,12 @@ class OrderDataGrid
|
|||
'type' => 'string',
|
||||
'label' => 'Order Date',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'or.channel_name',
|
||||
'alias' => 'channelname',
|
||||
'type' => 'string',
|
||||
'label' => 'Channel Name',
|
||||
'sortable' => true,
|
||||
], [
|
||||
'name' => 'or.status',
|
||||
'alias' => 'orstatus',
|
||||
|
|
|
|||
|
|
@ -456,22 +456,29 @@ Route::group(['middleware' => ['web']], function () {
|
|||
Route::put('/account', 'Webkul\User\Http\Controllers\AccountController@update')->name('admin.account.update');
|
||||
|
||||
//API Authorizations
|
||||
Route::get('/api/clients', 'Webkul\Admin\Http\Controllers\AuthorizationController@show')->defaults('_config', [
|
||||
'view' => 'admin::apiauth.client'
|
||||
])->name('admin.index.oauth.client');
|
||||
// Route::get('/api/clients', 'Webkul\Admin\Http\Controllers\AuthorizationController@show')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.client'
|
||||
// ])->name('admin.index.oauth.client');
|
||||
|
||||
//view an OAuth API Client
|
||||
Route::get('/api/clients/view/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@view')->defaults('_config', [
|
||||
'view' => 'admin::apiauth.view'
|
||||
])->name('admin.view.oauth.client');
|
||||
// //view an OAuth API Client
|
||||
// Route::get('/api/clients/view/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@view')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.view'
|
||||
// ])->name('admin.view.oauth.client');
|
||||
|
||||
//edit an OAuth API Client
|
||||
Route::get('/api/clients/delete/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@delete')->defaults('_config', [
|
||||
'view' => 'admin::apiauth.edit'
|
||||
])->name('admin.delete.oauth.client');
|
||||
// //edit an OAuth API Client
|
||||
// Route::get('/api/clients/delete/{id}', 'Webkul\Admin\Http\Controllers\AuthorizationController@delete')->defaults('_config', [
|
||||
// 'view' => 'admin::apiauth.edit'
|
||||
// ])->name('admin.delete.oauth.client');
|
||||
|
||||
|
||||
// Admin Store Front Settings Route
|
||||
Route::get('/subscribers','Webkul\Core\Http\Controllers\SubscriptionController@index')->defaults('_config',[
|
||||
'view' => 'admin::settings.subscribers.index'
|
||||
])->name('admin.subscribers.index');
|
||||
|
||||
//destroy a newsletter subscription item
|
||||
Route::get('subscribers/delete/{id}', 'Webkul\Core\Http\Controllers\SubscriptionController@destroy');
|
||||
|
||||
//slider index
|
||||
Route::get('/slider','Webkul\Shop\Http\Controllers\SliderController@index')->defaults('_config',[
|
||||
'view' => 'admin::settings.sliders.index'
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
'route' => 'admin.account.edit',
|
||||
'sort' => 1,
|
||||
'icon-class' => '',
|
||||
],
|
||||
],
|
||||
// [
|
||||
// 'key' => 'configuration.sales',
|
||||
// 'name' => 'Sales',
|
||||
|
|
@ -121,7 +121,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
// 'route' => 'admin.configuration.sales.general',
|
||||
// 'sort' => 1,
|
||||
// 'icon-class' => '',
|
||||
// ],
|
||||
// ],
|
||||
[
|
||||
'key' => 'settings',
|
||||
'name' => 'Settings',
|
||||
|
|
@ -200,6 +200,12 @@ class EventServiceProvider extends ServiceProvider
|
|||
'route' => 'admin.tax-rates.index',
|
||||
'sort' => 2,
|
||||
'icon-class' => '',
|
||||
], [
|
||||
'key' => 'settings.subscribers',
|
||||
'name' => 'Newsletter Subscription',
|
||||
'route' => 'admin.subscribers.index',
|
||||
'sort' => 9,
|
||||
'icon-class' => '',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -276,11 +282,11 @@ class EventServiceProvider extends ServiceProvider
|
|||
$acl->add('catalog.attributes', 'Attributes', 'admin.catalog.attributes.index', 3);
|
||||
|
||||
$acl->add('catalog.families', 'Families', 'admin.catalog.families.index', 4);
|
||||
|
||||
|
||||
$acl->add('customers', 'Customers', 'admin.customers.index', 4);
|
||||
|
||||
$acl->add('customers.customers', 'Customers', 'admin.customers.index', 1);
|
||||
|
||||
|
||||
$acl->add('customers.groups', 'Groups', 'admin.groups.index', 2);
|
||||
|
||||
$acl->add('customers.reviews', 'Reviews', 'admin.customers.reviews.index', 3);
|
||||
|
|
|
|||
|
|
@ -499,6 +499,10 @@ return [
|
|||
'delete' => 'Tax Rate Deleted Successfully',
|
||||
'atleast-one' => 'Cannot Delete Last Tax Rate'
|
||||
],
|
||||
|
||||
'subscribers' => [
|
||||
'title' => 'Subscribers'
|
||||
]
|
||||
],
|
||||
|
||||
'customers' => [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.subscribers.title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
|
||||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.subscribers.title') }}</h1>
|
||||
</div>
|
||||
|
||||
{{-- <div class="page-action">
|
||||
<a href="{{ route('admin.subscribers.store') }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.subscribers.add-title') }}
|
||||
</a>
|
||||
</div> --}}
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('subscribers','Webkul\Admin\DataGrids\NewsLetterDataGrid')
|
||||
{!! $subscribers->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSubscribersListTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscribers_list', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('email');
|
||||
$table->boolean('is_subscribed')->default(0);
|
||||
$table->string('token')->nullable();
|
||||
$table->integer('channel_id')->unsigned();
|
||||
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('subscribers_list');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Core\Repositories\SubscribersListRepository as Subscribers;
|
||||
/**
|
||||
* Subscription controller
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class SubscriptionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* Subscription repository instance
|
||||
*
|
||||
* @var instanceof SubscribersListRepository
|
||||
*/
|
||||
protected $subscribers;
|
||||
|
||||
public function __construct(Subscribers $subscribers)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->subscribers = $subscribers;
|
||||
|
||||
$this->_config = request('_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->subscribers->delete($id);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -671,12 +671,12 @@ section.slider-block {
|
|||
|
||||
div.slider-control {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
user-select: none;
|
||||
bottom: 2%;
|
||||
right: 2%;
|
||||
|
||||
|
||||
.dark-left-icon {
|
||||
background-color: $background-color;
|
||||
height: 48px;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
@auth('customer')
|
||||
<div class="dropdown-list bottom-right" style="display: none; max-width: 230px;">
|
||||
<div class="dropdown-container">
|
||||
<label>{{ __('shop::app.header.title') }}</label>
|
||||
<label>{{ auth()->guard('customer')->user()->first_name }}</label>
|
||||
<ul>
|
||||
<li><a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a></li>
|
||||
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
<div class="dropdown-list bottom-right" style="display: none;">
|
||||
<div class="dropdown-container">
|
||||
|
||||
<label>{{ __('shop::app.header.title') }}</label>
|
||||
<label>{{ auth()->guard('customer')->user()->first_name }}</label>
|
||||
|
||||
<ul>
|
||||
<li><a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a></li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue