Unverified Commit 6ab7db35 authored by Vipul Basapati's avatar Vipul Basapati Committed by GitHub

Merge pull request #280 from bvipul/develop

Removing Email Templates module
parents aae971c8 76211ca6
<?php
namespace App\Events\Backend\EmailTemplates;
use Illuminate\Queue\SerializesModels;
/**
* Class EmailTemplateDeleted.
*/
class EmailTemplateDeleted
{
use SerializesModels;
/**
* @var
*/
public $emailtemplates;
/**
* @param $emailtemplates
*/
public function __construct($emailtemplates)
{
$this->emailtemplates = $emailtemplates;
}
}
<?php
namespace App\Events\Backend\EmailTemplates;
use Illuminate\Queue\SerializesModels;
/**
* Class EmailTemplateUpdated.
*/
class EmailTemplateUpdated
{
use SerializesModels;
/**
* @var
*/
public $emailtemplates;
/**
* @param $emailtemplates
*/
public function __construct($emailtemplates)
{
$this->emailtemplates = $emailtemplates;
}
}
<?php <?php
use App\Exceptions\GeneralException;
use App\Helpers\uuid; use App\Helpers\uuid;
use App\Http\Utilities\SendEmail;
use App\Models\Notification\Notification; use App\Models\Notification\Notification;
use App\Models\Settings\Setting; use App\Models\Settings\Setting;
use Carbon\Carbon as Carbon; use Carbon\Carbon as Carbon;
...@@ -145,39 +143,26 @@ if (!function_exists('settings')) { ...@@ -145,39 +143,26 @@ if (!function_exists('settings')) {
} }
} }
// Creating Notification
if (!function_exists('createNotification')) { if (!function_exists('createNotification')) {
/** /**
* create new notification. * create new notification.
* *
* @param $message message you want to show in notification * @param $message message you want to show in notification
* @param $userId To Whom You Want To send Notification * @param $userId To Whom You Want To send Notification
* @param $type type of notification (1 - dashboard, 2 - email, 3 - both) (by default 1)
* @param $option associate array [ 'data' => $data, 'email_template_type' => $template_type ]
* *
* @return object * @return object
*/ */
function createNotification($message, $userId, $type = 1, $options = []) function createNotification($message, $userId)
{ {
if ($type == 1 || $type == 3) {
$notification = new Notification(); $notification = new Notification();
return $notification->insert([ return $notification->insert([
'message' => $message, 'message' => $message,
'user_id' => $userId, 'user_id' => $userId,
'type' => $type, 'type' => 1,
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
]); ]);
} }
if ($type == 2 || $type == 3) {
if (!empty($options['data']) && !empty($options['email_template_type'])) {
$mail = new SendEmail();
$emailResult = $mail->sendWithTemplate($options['data'], $options['email_template_type']);
} else {
throw new GeneralException('Invalid input given.option array shold contains data and email_template_type');
}
}
}
} }
if (!function_exists('escapeSlashes')) { if (!function_exists('escapeSlashes')) {
......
...@@ -9,7 +9,6 @@ require __DIR__.'/Access/User.php'; ...@@ -9,7 +9,6 @@ require __DIR__.'/Access/User.php';
require __DIR__.'/Access/Role.php'; require __DIR__.'/Access/Role.php';
require __DIR__.'/Access/Permission.php'; require __DIR__.'/Access/Permission.php';
require __DIR__.'/Page.php'; require __DIR__.'/Page.php';
require __DIR__.'/Email_Template.php';
require __DIR__.'/Setting.php'; require __DIR__.'/Setting.php';
require __DIR__.'/Blog_Category.php'; require __DIR__.'/Blog_Category.php';
require __DIR__.'/Blog_Tag.php'; require __DIR__.'/Blog_Tag.php';
......
<?php
Breadcrumbs::register('admin.emailtemplates.index', function ($breadcrumbs) {
$breadcrumbs->parent('admin.dashboard');
$breadcrumbs->push(trans('menus.backend.emailtemplates.management'), route('admin.emailtemplates.index'));
});
Breadcrumbs::register('admin.emailtemplates.create', function ($breadcrumbs) {
$breadcrumbs->parent('admin.emailtemplates.index');
$breadcrumbs->push(trans('menus.backend.emailtemplates.create'), route('admin.emailtemplates.create'));
});
Breadcrumbs::register('admin.emailtemplates.edit', function ($breadcrumbs, $id) {
$breadcrumbs->parent('admin.emailtemplates.index');
$breadcrumbs->push(trans('menus.backend.emailtemplates.edit'), route('admin.emailtemplates.edit', $id));
});
<?php
namespace App\Http\Controllers\Backend\EmailTemplates;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\EmailTemplates\DeleteEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\EditEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\UpdateEmailTemplatesRequest;
use App\Models\EmailTemplatePlaceholders\EmailTemplatePlaceholder;
use App\Models\EmailTemplates\EmailTemplate;
use App\Models\EmailTemplateTypes\EmailTemplateType;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
/**
* Class EmailTemplatesController.
*/
class EmailTemplatesController extends Controller
{
/**
* @var EmailTemplatesRepository
*/
protected $emailtemplates;
/**
* __construct.
*
* @param \App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository $emailtemplates
*/
public function __construct(EmailTemplatesRepository $emailtemplates)
{
$this->emailtemplates = $emailtemplates;
}
/**
* @param \App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest $request
*
* @return mixed
*/
public function index(ManageEmailTemplatesRequest $request)
{
return view('backend.emailtemplates.index');
}
/**
* @param \App\Models\EmailTemplates\EmailTemplate $emailtemplate
* @param \App\Http\Requests\Backend\EmailTemplates\EditEmailTemplatesRequest $request
*
* @return mixed
*/
public function edit(EmailTemplate $emailtemplate, EditEmailTemplatesRequest
$request)
{
$emailtemplateTypes = EmailTemplateType::getSelectData();
$emailtemplatePlaceholders = EmailTemplatePlaceholder::getSelectData();
return view('backend.emailtemplates.edit')
->withEmailtemplate($emailtemplate)
->withEmailtemplatetypes($emailtemplateTypes)
->withEmailtemplateplaceholders($emailtemplatePlaceholders);
}
/**
* @param \App\Models\EmailTemplates\EmailTemplate $emailtemplate
* @param \App\Http\Requests\Backend\EmailTemplates\UpdateEmailTemplatesRequest $request
*
* @return mixed
*/
public function update(EmailTemplate $emailtemplate, UpdateEmailTemplatesRequest
$request)
{
$this->emailtemplates->update($emailtemplate, $request->except(['_method', '_token', 'placeholder']));
return redirect()->route('admin.emailtemplates.index')
->withFlashSuccess(trans('alerts.backend.emailtemplates.updated'));
}
/**
* @param \App\Models\EmailTemplates\EmailTemplate $emailtemplate
* @param \App\Http\Requests\Backend\EmailTemplates\DeleteEmailTemplatesRequest $request
*
* @return mixed
*/
public function destroy(EmailTemplate $emailtemplate, DeleteEmailTemplatesRequest
$request)
{
$this->emailtemplates->delete($emailtemplate);
return redirect()->route('admin.emailtemplates.index')
->withFlashSuccess(trans('alerts.backend.emailtemplates.deleted'));
}
}
<?php
namespace App\Http\Controllers\Backend\EmailTemplates;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class EmailTemplatesTableController.
*/
class EmailTemplatesTableController extends Controller
{
/**
* @var EmailTemplatesRepository
*/
protected $emailtemplates;
/**
* @param \App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository $emailtemplates
*/
public function __construct(EmailTemplatesRepository $emailtemplates)
{
$this->emailtemplates = $emailtemplates;
}
/**
* @param \App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest $request
*
* @return mixed
*/
public function __invoke(ManageEmailTemplatesRequest $request)
{
return Datatables::of($this->emailtemplates->getForDataTable())
->escapeColumns(['title'])
->addColumn('status', function ($emailtemplates) {
return $emailtemplates->status_label;
})
->addColumn('created_at', function ($emailtemplates) {
return Carbon::parse($emailtemplates->created_at)->toDateString();
})
->addColumn('updated_at', function ($emailtemplates) {
return Carbon::parse($emailtemplates->updated_at)->toDateString();
})
->addColumn('actions', function ($emailtemplates) {
return $emailtemplates->action_buttons;
})
->make(true);
}
}
...@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Auth; ...@@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Auth;
class NotificationController extends Controller class NotificationController extends Controller
{ {
/** /**
* @var EmailTemplateContract * @var \App\Repositories\Backend\Notification\NotificationRepository
*/ */
protected $notification; protected $notification;
......
<?php
namespace App\Http\Requests\Backend\EmailTemplates;
use App\Http\Requests\Request;
/**
* Class DeleteEmailTemplatesRequest.
*/
class DeleteEmailTemplatesRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\EmailTemplates;
use App\Http\Requests\Request;
/**
* Class EditEmailTemplatesRequest.
*/
class EditEmailTemplatesRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('edit-email-template');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\EmailTemplates;
use App\Http\Requests\Request;
/**
* Class ManageEmailTemplatesRequest.
*/
class ManageEmailTemplatesRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('view-email-template');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}
<?php
namespace App\Http\Requests\Backend\EmailTemplates;
use App\Http\Requests\Request;
/**
* Class UpdateEmailTemplatesRequest.
*/
class UpdateEmailTemplatesRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return access()->allow('edit-email-template');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'title' => 'required|max:191',
'type_id' => 'required',
'subject' => 'required|max:191',
'body' => 'required',
];
}
}
<?php
namespace App\Http\Utilities;
use Illuminate\Support\Facades\Mail;
class SendEmail
{
public function sendWithTemplate($data, $typeId)
{
$template = \DB::table('email_templates')->where('type_id', $typeId)->where('status', 1)->orderBy('updated_at', 'DESC')->first();
if (!empty($template)) {
switch ($typeId) {
case '1':
// When user register from frontend
$content = $template->body;
// Replace app name
$content = str_replace('[app_name]', app_name(), $content);
// Replace user firstname
$content = str_replace('[name]', $data['first_name'], $content);
// Replace confirmation link
$url = '<a href='.url('account/confirm/'.$data['confirmation_code']).'>Click Here</a>';
$content = str_replace('[confirmation_link]', $url, $content);
// User email
$data['to'] = $data['email'];
// Subject of mail
$data['subject'] = $template->subject;
break;
case '2':
$content = $template->body;
// Replace app name
$content = str_replace('[app_name]', app_name(), $content);
// Replace user firstname
$content = str_replace('[name]', $data['first_name'], $content);
// Replace user email
$content = str_replace('[email]', $data['email'], $content);
// Replace user password
$content = str_replace('[password]', $data['password'], $content);
$data['to'] = $data['email'];
$data['subject'] = $template->subject;
break;
case '3':
$content = $template->body;
// Replace status in subject
$status = $data->status == 0 ? 'Deactivated' : 'Activated';
$subject = str_replace('[status]', $status, $template->subject);
// Replace status in email body
$content = str_replace('[status]', $status, $content);
// Replace app name
$content = str_replace('[app_name]', app_name(), $content);
$data['to'] = $data['email'];
$data['subject'] = $subject;
break;
case '4':
$content = $template->body;
// Replace status in email body
$content = str_replace('[password]', $data['password'], $content);
// Replace app name
$content = str_replace('[app_name]', app_name(), $content);
$data['to'] = $data['email'];
$data['subject'] = $template->subject;
break;
default:
echo 'Default case';
break;
}
// Send email code
$message = ['data' => $content];
return Mail::send(['html' => 'emails.template'], $message, function ($message) use ($data) {
$message->to($data['to']);
$message->subject($data['subject']);
});
} else {
return false;
}
}
}
<?php
namespace App\Listeners\Backend\EmailTemplates;
/**
* Class EmailTemplateEventListener.
*/
class EmailTemplateEventListener
{
/**
* @var string
*/
private $history_slug = 'EmailTemplate';
/**
* @param $event
*/
public function onUpdated($event)
{
history()->withType($this->history_slug)
->withEntity($event->emailtemplates->id)
->withText('trans("history.backend.emailtemplates.updated") <strong>'.$event->emailtemplates->title.'</strong>')
->withIcon('save')
->withClass('bg-aqua')
->log();
}
/**
* @param $event
*/
public function onDeleted($event)
{
history()->withType($this->history_slug)
->withEntity($event->emailtemplates->id)
->withText('trans("history.backend.emailtemplates.deleted") <strong>'.$event->emailtemplates->title.'</strong>')
->withIcon('trash')
->withClass('bg-maroon')
->log();
}
/**
* Register the listeners for the subscriber.
*
* @param \Illuminate\Events\Dispatcher $events
*/
public function subscribe($events)
{
$events->listen(
\App\Events\Backend\EmailTemplates\EmailTemplateUpdated::class,
'App\Listeners\Backend\EmailTemplates\EmailTemplateEventListener@onUpdated'
);
$events->listen(
\App\Events\Backend\EmailTemplates\EmailTemplateDeleted::class,
'App\Listeners\Backend\EmailTemplates\EmailTemplateEventListener@onDeleted'
);
}
}
<?php <?php
namespace App\Listeners\Backend\CMSPages; namespace App\Listeners\Backend\Pages;
/** /**
* Class CMSPageEventListener. * Class PageEventListener.
*/ */
class CMSPageEventListener class PageEventListener
{ {
/** /**
* @var string * @var string
*/ */
private $history_slug = 'CMSPage'; private $history_slug = 'Page';
/** /**
* @param $event * @param $event
...@@ -18,8 +18,8 @@ class CMSPageEventListener ...@@ -18,8 +18,8 @@ class CMSPageEventListener
public function onCreated($event) public function onCreated($event)
{ {
history()->withType($this->history_slug) history()->withType($this->history_slug)
->withEntity($event->cmspages->id) ->withEntity($event->page->id)
->withText('trans("history.backend.cmspages.created") <strong>'.$event->cmspages->title.'</strong>') ->withText('trans("history.backend.pages.created") <strong>'.$event->page->title.'</strong>')
->withIcon('plus') ->withIcon('plus')
->withClass('bg-green') ->withClass('bg-green')
->log(); ->log();
...@@ -31,8 +31,8 @@ class CMSPageEventListener ...@@ -31,8 +31,8 @@ class CMSPageEventListener
public function onUpdated($event) public function onUpdated($event)
{ {
history()->withType($this->history_slug) history()->withType($this->history_slug)
->withEntity($event->cmspages->id) ->withEntity($event->page->id)
->withText('trans("history.backend.cmspages.updated") <strong>'.$event->cmspages->title.'</strong>') ->withText('trans("history.backend.pages.updated") <strong>'.$event->page->title.'</strong>')
->withIcon('save') ->withIcon('save')
->withClass('bg-aqua') ->withClass('bg-aqua')
->log(); ->log();
...@@ -44,8 +44,8 @@ class CMSPageEventListener ...@@ -44,8 +44,8 @@ class CMSPageEventListener
public function onDeleted($event) public function onDeleted($event)
{ {
history()->withType($this->history_slug) history()->withType($this->history_slug)
->withEntity($event->cmspages->id) ->withEntity($event->page->id)
->withText('trans("history.backend.cmspages.deleted") <strong>'.$event->cmspages->title.'</strong>') ->withText('trans("history.backend.pages.deleted") <strong>'.$event->page->title.'</strong>')
->withIcon('trash') ->withIcon('trash')
->withClass('bg-maroon') ->withClass('bg-maroon')
->log(); ->log();
...@@ -59,18 +59,18 @@ class CMSPageEventListener ...@@ -59,18 +59,18 @@ class CMSPageEventListener
public function subscribe($events) public function subscribe($events)
{ {
$events->listen( $events->listen(
\App\Events\Backend\CMSPages\CMSPageCreated::class, \App\Events\Backend\Pages\PageCreated::class,
'App\Listeners\Backend\CMSPages\CMSPageEventListener@onCreated' 'App\Listeners\Backend\Pages\PageEventListener@onCreated'
); );
$events->listen( $events->listen(
\App\Events\Backend\CMSPages\CMSPageUpdated::class, \App\Events\Backend\Pages\PageUpdated::class,
'App\Listeners\Backend\CMSPages\CMSPageEventListener@onUpdated' 'App\Listeners\Backend\Pages\PageEventListener@onUpdated'
); );
$events->listen( $events->listen(
\App\Events\Backend\CMSPages\CMSPageDeleted::class, \App\Events\Backend\Pages\PageDeleted::class,
'App\Listeners\Backend\CMSPages\CMSPageEventListener@onDeleted' 'App\Listeners\Backend\Pages\PageEventListener@onDeleted'
); );
} }
} }
<?php
namespace App\Models\EmailTemplatePlaceholders;
use App\Models\BaseModel;
class EmailTemplatePlaceholder extends BaseModel
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table;
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->table = config('module.email_templates.placeholders_table');
}
}
<?php
namespace App\Models\EmailTemplateTypes;
use App\Models\BaseModel;
class EmailTemplateType extends BaseModel
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table;
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->table = config('module.email_templates.types_table');
}
}
<?php
namespace App\Models\EmailTemplates;
use App\Models\BaseModel;
use App\Models\EmailTemplates\Traits\Attribute\EmailTemplateAttribute;
use App\Models\ModelTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
class EmailTemplate extends BaseModel
{
use ModelTrait,
SoftDeletes,
EmailTemplateAttribute {
// EmailTemplateAttribute::getEditButtonAttribute insteadof ModelTrait;
}
protected $guarded = ['id'];
/**
* The database table used by the model.
*
* @var string
*/
protected $table;
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->table = config('module.email_templates.table');
}
}
<?php
namespace App\Models\EmailTemplates\Traits\Attribute;
/**
* Class EmailTemplateAttribute.
*/
trait EmailTemplateAttribute
{
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">'.$this->getEditButtonAttribute('edit-email-template', 'admin.emailtemplates.edit').'</div>';
}
/**
* @return string
*/
public function getStatusLabelAttribute()
{
if ($this->isActive()) {
return "<label class='label label-success'>".trans('labels.general.active').'</label>';
}
return "<label class='label label-danger'>".trans('labels.general.inactive').'</label>';
}
/**
* @return bool
*/
public function isActive()
{
return $this->status == 1;
}
}
...@@ -41,8 +41,7 @@ class EventServiceProvider extends ServiceProvider ...@@ -41,8 +41,7 @@ class EventServiceProvider extends ServiceProvider
\App\Listeners\Backend\Access\User\UserEventListener::class, \App\Listeners\Backend\Access\User\UserEventListener::class,
\App\Listeners\Backend\Access\Role\RoleEventListener::class, \App\Listeners\Backend\Access\Role\RoleEventListener::class,
\App\Listeners\Backend\Access\Permission\PermissionEventListener::class, \App\Listeners\Backend\Access\Permission\PermissionEventListener::class,
\App\Listeners\Backend\CMSPages\CMSPageEventListener::class, \App\Listeners\Backend\Pages\PageEventListener::class,
\App\Listeners\Backend\EmailTemplates\EmailTemplateEventListener::class,
\App\Listeners\Backend\BlogCategories\BlogCategoryEventListener::class, \App\Listeners\Backend\BlogCategories\BlogCategoryEventListener::class,
\App\Listeners\Backend\BlogTags\BlogTagEventListener::class, \App\Listeners\Backend\BlogTags\BlogTagEventListener::class,
\App\Listeners\Backend\Blogs\BlogEventListener::class, \App\Listeners\Backend\Blogs\BlogEventListener::class,
......
<?php
namespace App\Repositories\Backend\EmailTemplates;
use App\Events\Backend\EmailTemplates\EmailTemplateDeleted;
use App\Events\Backend\EmailTemplates\EmailTemplateUpdated;
use App\Exceptions\GeneralException;
use App\Models\EmailTemplates\EmailTemplate;
use App\Repositories\BaseRepository;
/**
* Class EmailTemplatesRepository.
*/
class EmailTemplatesRepository extends BaseRepository
{
/**
* Associated Repository Model.
*/
const MODEL = EmailTemplate::class;
/**
* @return mixed
*/
public function getForDataTable()
{
return $this->query()
->select([
config('module.email_templates.table').'.id',
config('module.email_templates.table').'.title',
config('module.email_templates.table').'.subject',
config('module.email_templates.table').'.status',
config('module.email_templates.table').'.created_at',
config('module.email_templates.table').'.updated_at',
]);
}
/**
* @param \App\Models\EmailTemplates\EmailTemplate $emailtemplate
* @param $input
*
* @throws GeneralException
*
* return bool
*/
public function update(EmailTemplate $emailtemplate, array $input)
{
$input['status'] = isset($input['is_active']) ? 1 : 0;
unset($input['is_active']);
$input['updated_by'] = access()->user()->id;
if ($emailtemplate->update($input)) {
event(new EmailTemplateUpdated($emailtemplate));
return true;
}
throw new GeneralException(trans('exceptions.backend.emailtemplates.update_error'));
}
/**
* @param \App\Models\EmailTemplates\EmailTemplate $emailtemplate
*
* @throws GeneralException
*
* @return bool
*/
public function delete(EmailTemplate $emailtemplate)
{
if ($emailtemplate->delete()) {
event(new EmailTemplateDeleted($emailtemplate));
return true;
}
throw new GeneralException(trans('exceptions.backend.emailtemplates.delete_error'));
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplatePlaceholdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_placeholders', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_template_placeholders');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplateTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_template_types', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 191);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_template_types');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEmailTemplatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_templates', function (Blueprint $table) {
$table->increments('id');
$table->integer('type_id')->unsigned()->index();
$table->string('title');
$table->string('subject');
$table->text('body', 65535);
$table->boolean('status')->default(1);
$table->integer('created_by')->unsigned();
$table->integer('updated_by')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_templates');
}
}
...@@ -19,9 +19,6 @@ class DatabaseSeeder extends Seeder ...@@ -19,9 +19,6 @@ class DatabaseSeeder extends Seeder
$this->call(AccessTableSeeder::class); $this->call(AccessTableSeeder::class);
$this->call(HistoryTypeTableSeeder::class); $this->call(HistoryTypeTableSeeder::class);
$this->call(EmailTemplateTypeTableSeeder::class);
$this->call(EmailTemplatePlaceholderTableSeeder::class);
$this->call(EmailTemplateTableSeeder::class);
$this->call(SettingsTableSeeder::class); $this->call(SettingsTableSeeder::class);
$this->call(PagesTableSeeder::class); $this->call(PagesTableSeeder::class);
$this->call(MenuTableSeeder::class); $this->call(MenuTableSeeder::class);
......
<?php
use Carbon\Carbon as Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EmailTemplatePlaceholderTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (env('DB_CONNECTION') == 'mysql') {
DB::table(config('module.email_templates.placeholders_table'))->truncate();
}
$data = [
[
'name' => 'app_name',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'name',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'email',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'password',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'contact-details',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'confirmation_link',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'password_reset_link',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'header_logo',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'footer_logo',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'unscribe_link',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'status',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
];
DB::table(config('module.email_templates.placeholders_table'))->insert($data);
}
}
This diff is collapsed.
<?php
use Carbon\Carbon as Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class EmailTemplateTypeTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
if (env('DB_CONNECTION') == 'mysql') {
DB::table(config('module.email_templates.types_table'))->truncate();
}
$data = [
[
'name' => 'Registration',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'Create User',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'Acivate / Deactivate User',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'name' => 'Change Password',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
];
DB::table(config('module.email_templates.types_table'))->insert($data);
}
}
...@@ -45,30 +45,24 @@ class HistoryTypeTableSeeder extends Seeder ...@@ -45,30 +45,24 @@ class HistoryTypeTableSeeder extends Seeder
], ],
[ [
'id' => 4, 'id' => 4,
'name' => 'CMSPage', 'name' => 'Page',
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
], ],
[ [
'id' => 5, 'id' => 5,
'name' => 'EmailTemplate',
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
],
[
'id' => 6,
'name' => 'BlogTag', 'name' => 'BlogTag',
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
], ],
[ [
'id' => 7, 'id' => 6,
'name' => 'BlogCategory', 'name' => 'BlogCategory',
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
], ],
[ [
'id' => 8, 'id' => 7,
'name' => 'Blog', 'name' => 'Blog',
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
......
...@@ -18,7 +18,7 @@ class MenuTableSeeder extends Seeder ...@@ -18,7 +18,7 @@ class MenuTableSeeder extends Seeder
'id' => 1, 'id' => 1,
'type' => 'backend', 'type' => 'backend',
'name' => 'Backend Sidebar Menu', 'name' => 'Backend Sidebar Menu',
'items' => '[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"view-email-template","icon":"fa-envelope","open_in_new_tab":0,"url_type":"route","url":"admin.emailtemplates.index","name":"Email Templates","id":8,"content":"Email Templates"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogCategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blogTags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]', 'items' => '[{"view_permission_id":"view-access-management","icon":"fa-users","open_in_new_tab":0,"url_type":"route","url":"","name":"Access Management","id":11,"content":"Access Management","children":[{"view_permission_id":"view-user-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.user.index","name":"User Management","id":12,"content":"User Management"},{"view_permission_id":"view-role-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.role.index","name":"Role Management","id":13,"content":"Role Management"},{"view_permission_id":"view-permission-management","open_in_new_tab":0,"url_type":"route","url":"admin.access.permission.index","name":"Permission Management","id":14,"content":"Permission Management"}]},{"view_permission_id":"view-module","icon":"fa-wrench","open_in_new_tab":0,"url_type":"route","url":"admin.modules.index","name":"Module","id":1,"content":"Module"},{"view_permission_id":"view-menu","icon":"fa-bars","open_in_new_tab":0,"url_type":"route","url":"admin.menus.index","name":"Menus","id":3,"content":"Menus"},{"view_permission_id":"view-page","icon":"fa-file-text","open_in_new_tab":0,"url_type":"route","url":"admin.pages.index","name":"Pages","id":2,"content":"Pages"},{"view_permission_id":"edit-settings","icon":"fa-gear","open_in_new_tab":0,"url_type":"route","url":"admin.settings.edit?id=1","name":"Settings","id":9,"content":"Settings"},{"view_permission_id":"view-blog","icon":"fa-commenting","open_in_new_tab":0,"url_type":"route","url":"","name":"Blog Management","id":15,"content":"Blog Management","children":[{"view_permission_id":"view-blog-category","open_in_new_tab":0,"url_type":"route","url":"admin.blogCategories.index","name":"Blog Category Management","id":16,"content":"Blog Category Management"},{"view_permission_id":"view-blog-tag","open_in_new_tab":0,"url_type":"route","url":"admin.blogTags.index","name":"Blog Tag Management","id":17,"content":"Blog Tag Management"},{"view_permission_id":"view-blog","open_in_new_tab":0,"url_type":"route","url":"admin.blogs.index","name":"Blog Management","id":18,"content":"Blog Management"}]},{"view_permission_id":"view-faq","icon":"fa-question-circle","open_in_new_tab":0,"url_type":"route","url":"admin.faqs.index","name":"Faq Management","id":19,"content":"Faq Management"}]',
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
]; ];
......
...@@ -65,13 +65,6 @@ class ModulesTableSeeder extends Seeder ...@@ -65,13 +65,6 @@ class ModulesTableSeeder extends Seeder
'created_by' => 1, 'created_by' => 1,
'created_at' => Carbon::now(), 'created_at' => Carbon::now(),
], ],
[
'name' => trans('labels.backend.emailtemplates.title'),
'url' => 'admin.emailtemplates.index',
'view_permission_id' => 'view-email-template',
'created_by' => 1,
'created_at' => Carbon::now(),
],
[ [
'name' => trans('labels.backend.settings.title'), 'name' => trans('labels.backend.settings.title'),
'url' => 'admin.settings.edit', 'url' => 'admin.settings.edit',
......
...@@ -646,47 +646,6 @@ var Backend = {}; // common variable used in all the files of the backend ...@@ -646,47 +646,6 @@ var Backend = {}; // common variable used in all the files of the backend
} }
}, },
emailTemplate: {
selectors: {
emailtemplateSelection: document.querySelector(".select2")
},
init: function () {
Backend.emailTemplate.addHandlers();
Backend.tinyMCE.init();
},
// ! Backend.emailTemplate.addHandlers
addHandlers: function () {
jQuery(".select2").select2();
// to add placeholder in to active textarea
document.getElementById("addPlaceHolder").onclick = function (event) {
Backend.emailTemplate.addPlaceHolder(event);
};
document.getElementById("showPreview").onclick = function (event) {
Backend.emailTemplate.showPreview(event);
};
},
// ! Backend.emailTemplate.addPlaceHolder
addPlaceHolder: function (event) {
var placeHolder = document.getElementById('placeHolder').value;
if (placeHolder != '') {
tinymce.activeEditor.execCommand('mceInsertContent', false, "[" + jQuery('#placeHolder :selected').text() + "]");
}
},
// ! Backend.emailTemplate.showPreview
showPreview: function (event) {
document.querySelector(".modal-body").innerHTML = tinyMCE.get('txtBody').getContent();
//jQuery( ".modal-body" ).html(tinyMCE.get('txtBody').getContent());
jQuery(".model-wrapper").modal('show');
},
},
/** /**
* Faq * Faq
* *
......
...@@ -61,14 +61,10 @@ return [ ...@@ -61,14 +61,10 @@ return [
'updated' => 'The Blog was successfully updated.', 'updated' => 'The Blog was successfully updated.',
], ],
'emailtemplates' => [
'deleted' => 'The Email Template was successfully deleted.',
'updated' => 'The Email Template was successfully updated.',
],
'settings' => [ 'settings' => [
'updated' => 'The Setting was successfully updated.', 'updated' => 'The Setting was successfully updated.',
], ],
'faqs' => [ 'faqs' => [
'created' => 'The Faq was successfully created.', 'created' => 'The Faq was successfully created.',
'deleted' => 'The Faq was successfully deleted.', 'deleted' => 'The Faq was successfully deleted.',
......
...@@ -81,14 +81,6 @@ return [ ...@@ -81,14 +81,6 @@ return [
'update_error' => 'There was a problem updating this Blog Tag. Please try again.', 'update_error' => 'There was a problem updating this Blog Tag. Please try again.',
], ],
'emailtemplates' => [
'already_exists' => 'That Email Template already exists. Please choose a different name.',
'create_error' => 'There was a problem creating this Email Template. Please try again.',
'delete_error' => 'There was a problem deleting this Email Template. Please try again.',
'not_found' => 'That Email Template does not exist.',
'update_error' => 'There was a problem updating this Email Template. Please try again.',
],
'settings' => [ 'settings' => [
'update_error' => 'There was a problem updating this Settings. Please try again.', 'update_error' => 'There was a problem updating this Settings. Please try again.',
], ],
...@@ -134,9 +126,4 @@ return [ ...@@ -134,9 +126,4 @@ return [
'registration_disabled' => 'Registration is currently closed.', 'registration_disabled' => 'Registration is currently closed.',
], ],
], ],
'api' => [
'cmspage' => [
'not_found' => 'given cms page is not found.',
],
],
]; ];
...@@ -29,9 +29,9 @@ return [ ...@@ -29,9 +29,9 @@ return [
'updated' => 'updated permission', 'updated' => 'updated permission',
], ],
'pages' => [ 'pages' => [
'created' => 'created CMS Page', 'created' => 'created Page',
'deleted' => 'deleted CMS Page', 'deleted' => 'deleted Page',
'updated' => 'updated CMS Page', 'updated' => 'updated Page',
], ],
'blogcategories' => [ 'blogcategories' => [
'created' => 'created Blog Category', 'created' => 'created Blog Category',
...@@ -48,10 +48,6 @@ return [ ...@@ -48,10 +48,6 @@ return [
'deleted' => 'deleted Blog', 'deleted' => 'deleted Blog',
'updated' => 'updated Blog', 'updated' => 'updated Blog',
], ],
'emailtemplates' => [
'deleted' => 'deleted Email Template',
'updated' => 'updated Email Template',
],
'users' => [ 'users' => [
'changed_password' => 'changed password for user', 'changed_password' => 'changed password for user',
'created' => 'created user', 'created' => 'created user',
......
...@@ -177,22 +177,6 @@ return [ ...@@ -177,22 +177,6 @@ return [
], ],
], ],
'emailtemplates' => [
'create' => 'Create Email Template',
'edit' => 'Edit Email Template',
'management' => 'Email Template Management',
'title' => 'Email Templates',
'table' => [
'title' => 'Title',
'subject' => 'Subject',
'status' => 'Status',
'createdat' => 'Created At',
'updatedat' => 'Updated At',
'all' => 'All',
],
],
'settings' => [ 'settings' => [
'edit' => 'Edit Settings', 'edit' => 'Edit Settings',
'management' => 'Settings Management', 'management' => 'Settings Management',
......
...@@ -105,14 +105,6 @@ return [ ...@@ -105,14 +105,6 @@ return [
'main' => 'Faq Pages', 'main' => 'Faq Pages',
], ],
'emailtemplates' => [
'all' => 'All Email Template',
'create' => 'Create Email Template',
'edit' => 'Edit Email Template',
'management' => 'Email Template Management',
'main' => 'Email Template',
],
'settings' => [ 'settings' => [
'all' => 'All Settings', 'all' => 'All Settings',
'create' => 'Create Settings', 'create' => 'Create Settings',
......
...@@ -166,15 +166,6 @@ return [ ...@@ -166,15 +166,6 @@ return [
'is_active' => 'Active', 'is_active' => 'Active',
], ],
'emailtemplates' => [
'title' => 'Title',
'type' => 'Type',
'subject' => 'Subject',
'body' => 'Body',
'placeholder' => 'Placeholder',
'is_active' => 'Active',
],
'blogcategories' => [ 'blogcategories' => [
'title' => 'Blog Category', 'title' => 'Blog Category',
'is_active' => 'Active', 'is_active' => 'Active',
......
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.emailtemplates.management') . ' | ' . trans('labels.backend.emailtemplates.edit'))
@section('page-header')
<h1>
{{ trans('labels.backend.emailtemplates.management') }}
<small>{{ trans('labels.backend.emailtemplates.edit') }}</small>
</h1>
<div class="model-container">
<div class="modal fade model-wrapper" id="myModal" role="dialog">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel"> Email Template </h4>
</div>
<div id="model-body" class="modal-body">
</div>
</div>
</div>
</div>
</div>
@endsection
@section('content')
{{ Form::model($emailtemplate, ['route' => ['admin.emailtemplates.update', $emailtemplate], 'class' => 'form-horizontal', 'role' => 'form', 'method' => 'PATCH', 'id' => 'edit-role']) }}
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.emailtemplates.edit') }}</h3>
</div><!-- /.box-header -->
<div class="box-body">
<div class="form-group">
{{ Form::label('title', trans('validation.attributes.backend.emailtemplates.title'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::text('title', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.emailtemplates.title'), 'required' => 'required']) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('type_id', trans('validation.attributes.backend.emailtemplates.type'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::select('type_id', $emailtemplatetypes, null,['class' => 'form-control select2 box-size', 'placeholder' => trans('validation.attributes.backend.emailtemplates.type'), 'required' => 'required']) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('placeholder', trans('validation.attributes.backend.emailtemplates.placeholder'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
<div class="input-group box-size">
{{ Form::select('placeholder', $emailtemplateplaceholders, null,['class' => 'form-control select2', 'placeholder' => trans('validation.attributes.backend.emailtemplates.placeholder'), 'id' => 'placeHolder', 'style' => 'width:100%']) }}
<span class="input-group-btn">
<button class="btn btn-primary" id="addPlaceHolder" type="button">{{ trans('buttons.general.crud.add') }}</button>
</span>
</div><!-- /input-group -->
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('subject', trans('validation.attributes.backend.emailtemplates.subject'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10">
{{ Form::text('subject', null, ['class' => 'form-control box-size', 'placeholder' => trans('validation.attributes.backend.emailtemplates.subject')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('body', trans('validation.attributes.backend.emailtemplates.body'), ['class' => 'col-lg-2 control-label required']) }}
<div class="col-lg-10 mce-box">
{{ Form::textarea('body', null,['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.emailtemplates.body'), 'id' => 'txtBody']) }}
</div><!--col-lg-3-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('is_active', trans('validation.attributes.backend.emailtemplates.is_active'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
<div class="control-group">
<label class="control control--checkbox">
{{ Form::checkbox('is_active', 1, ($emailtemplate->status == 1) ? true : false ) }}
<div class="control__indicator"></div>
</label>
</div>
</div><!--col-lg-3-->
</div><!--form control-->
<div class="edit-form-btn">
{{ link_to_route('admin.emailtemplates.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-md']) }}
<input type="button" id="showPreview" data-toggle="modal" data-target="#templatePreview" class="btn btn-info btn-md" value="{{ trans('buttons.general.preview') }}" />
{{ Form::submit(trans('buttons.general.crud.update'), ['class' => 'btn btn-primary btn-md']) }}
<div class="clearfix"></div>
</div>
</div><!-- /.box-body -->
</div><!--box-->
{{ Form::close() }}
@endsection
@section("after-scripts")
<script type="text/javascript">
Backend.emailTemplate.init();
</script>
@endsection
\ No newline at end of file
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.emailtemplates.management'))
@section('page-header')
<h1>{{ trans('labels.backend.emailtemplates.management') }}</h1>
@endsection
@section('content')
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.emailtemplates.management') }}</h3>
<div class="box-tools pull-right">
<div class="btn-group">
<button type="button" class="btn btn-warning btn-flat dropdown-toggle" data-toggle="dropdown">Export
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#" id="copyButton"><i class="fa fa-clone"></i> Copy</a></li>
<li><a href="#" id="csvButton"><i class="fa fa-file-text-o"></i> CSV</a></li>
<li><a href="#" id="excelButton"><i class="fa fa-file-excel-o"></i> Excel</a></li>
<li><a href="#" id="pdfButton"><i class="fa fa-file-pdf-o"></i> PDF</a></li>
<li><a href="#" id="printButton"><i class="fa fa-print"></i> Print</a></li>
</ul>
</div>
</div>
</div><!-- /.box-header -->
<div class="box-body">
<div class="table-responsive data-table-wrapper">
<table id="emailtemplates-table" class="table table-condensed table-hover table-bordered">
<thead>
<tr>
<th>{{ trans('labels.backend.emailtemplates.table.title') }}</th>
<th>{{ trans('labels.backend.emailtemplates.table.subject') }}</th>
<th>{{ trans('labels.backend.emailtemplates.table.status') }}</th>
<th>{{ trans('labels.backend.emailtemplates.table.createdat') }}</th>
<th>{{ trans('labels.backend.emailtemplates.table.updatedat') }}</th>
<th>{{ trans('labels.general.actions') }}</th>
</tr>
</thead>
<thead class="transparent-bg">
<tr>
<th>
{!! Form::text('title', null, ["class" => "search-input-text form-control", "data-column" => 0, "placeholder" => trans('labels.backend.emailtemplates.table.title')]) !!}
<a class="reset-data" href="javascript:void(0)" data-column=0><i class="fa fa-times"></i></a>
</th>
<th>
{!! Form::text('subject', null, ["class" => "search-input-text form-control", "data-column" => 1, "placeholder" => trans('labels.backend.emailtemplates.table.subject')]) !!}
<a class="reset-data" href="javascript:void(0)" data-column=1><i class="fa fa-times"></i></a>
</th>
<th>
{!! Form::select('status', [0 => "InActive", 1 => "Active"], null, ["class" => "search-input-select form-control", "data-column" => 2, "placeholder" => trans('labels.backend.emailtemplates.table.all')]) !!}
</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
</div><!--table-responsive-->
</div><!-- /.box-body -->
</div><!--box-->
<!--<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('history.backend.recent_history') }}</h3>
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div><!-- /.box tools -->
</div><!-- /.box-header -->
<div class="box-body">
{{-- {!! history()->renderType('EmailTemplate') !!} --}}
</div><!-- /.box-body -->
</div><!--box box-info-->
@endsection
@section('after-scripts')
{{-- For DataTables --}}
{{ Html::script(mix('js/dataTable.js')) }}
<script>
$(function() {
var dataTable = $('#emailtemplates-table').dataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route("admin.emailtemplates.get") }}',
type: 'post'
},
columns: [
{data: 'title', name: '{{config('module.email_templates.table')}}.title'},
{data: 'subject', name: '{{config('module.email_templates.table')}}.subject'},
{data: 'status', name: '{{config('module.email_templates.table')}}.status'},
{data: 'created_at', name: '{{config('module.email_templates.table')}}.created_at'},
{data: 'updated_at', name: '{{config('module.email_templates.table')}}.updated_at'},
{data: 'actions', name: 'actions', searchable: false, sortable: false}
],
order: [[3, "asc"]],
searchDelay: 500,
dom: 'lBfrtip',
buttons: {
buttons: [
{ extend: 'copy', className: 'copyButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'csv', className: 'csvButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'excel', className: 'excelButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'pdf', className: 'pdfButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }},
{ extend: 'print', className: 'printButton', exportOptions: {columns: [ 0, 1, 2, 3, 4 ] }}
]
}
});
Backend.DataTableSearch.init(dataTable);
});
</script>
@endsection
\ No newline at end of file
<?php //dd(getMenuItems());
?>
<!-- Left side column. contains the logo and sidebar --> <!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar"> <aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less --> <!-- sidebar: style can be found in sidebar.less -->
...@@ -58,14 +56,6 @@ ...@@ -58,14 +56,6 @@
</a> </a>
</li> </li>
@endauth @endauth
@permission('view-email-template')
<li class="{{ active_class(Active::checkUriPattern('admin/emailtemplates*')) }}">
<a href="{{ route('admin.emailtemplates.index') }}">
<i class="fa fa-envelope"></i>
<span>{{ trans('labels.backend.emailtemplates.title') }}</span>
</a>
</li>
@endauth
@permission('edit-settings') @permission('edit-settings')
<li class="{{ active_class(Active::checkUriPattern('admin/settings*')) }}"> <li class="{{ active_class(Active::checkUriPattern('admin/settings*')) }}">
<a href="{{ route('admin.settings.edit', 1 ) }}"> <a href="{{ route('admin.settings.edit', 1 ) }}">
......
<?php
/*
* Email Templates Management
*/
Route::group(['namespace' => 'EmailTemplates'], function () {
Route::resource('emailtemplates', 'EmailTemplatesController', ['except' => ['show', 'create', 'save']]);
//For DataTables
Route::post('emailtemplates/get', 'EmailTemplatesTableController')
->name('emailtemplates.get');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment