Commit cc0cd69e authored by Kevin Yumang's avatar Kevin Yumang

SERV-2286 - toastr changed to PNotify package. named Notifications added. WIP

parent 5d95f38f
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
@Limitless::SideNavMenuItem(['url' => '?page=Element.LoremIpsum', 'target' => '_self', 'icon' => 'icon-bubble-lines3', 'title' => 'Lorem Ipsum']) @Limitless::SideNavMenuItem(['url' => '?page=Element.LoremIpsum', 'target' => '_self', 'icon' => 'icon-bubble-lines3', 'title' => 'Lorem Ipsum'])
@Limitless::SideNavMenuItem(['url' => '?page=Looper', 'target' => '_self', 'icon' => 'icon-loop3', 'title' => 'Looper']) @Limitless::SideNavMenuItem(['url' => '?page=Looper', 'target' => '_self', 'icon' => 'icon-loop3', 'title' => 'Looper'])
@Limitless::SideNavMenuItem(['url' => '?page=Modal', 'target' => '_self', 'icon' => 'icon-stack', 'title' => 'Modal']) @Limitless::SideNavMenuItem(['url' => '?page=Modal', 'target' => '_self', 'icon' => 'icon-stack', 'title' => 'Modal'])
@Limitless::SideNavMenuItem(['url' => '?page=Notification', 'target' => '_self', 'icon' => 'icon-popout', 'title' => 'Notification'])
@Limitless::SideNavMenuItem(['url' => '?page=Element.RandomSelect', 'target' => '_self', 'icon' => 'icon-shuffle', 'title' => 'Random Select']) @Limitless::SideNavMenuItem(['url' => '?page=Element.RandomSelect', 'target' => '_self', 'icon' => 'icon-shuffle', 'title' => 'Random Select'])
@Limitless::SideNavMenuItem(['url' => '?page=Videoplayer', 'target' => '_self', 'icon' => 'icon-video-camera2', 'title' => 'Video Player']) @Limitless::SideNavMenuItem(['url' => '?page=Videoplayer', 'target' => '_self', 'icon' => 'icon-video-camera2', 'title' => 'Video Player'])
......
function getDefaultIcon(type, icon) {
if(!icon) {
icon = 'icon-warning22';
switch (type) {
case 'success':
icon = 'icon-checkmark3';
break;
case 'error':
icon = 'icon-blocked';
break;
case 'warning':
icon = 'icon-warning22';
break;
case 'info':
icon = 'icon-info22';
break;
}
}
return icon;
}
function getType(type) {
switch (type) {
case 'success':
case 'error':
case 'info':
break;
case 'error':
case 'warning':
type = 'success';
break;
}
return type;
}
$(document).ready(function() {
if (typeof PNotify == 'undefined') {
console.warn('Warning - pnotify.min.js is not loaded.');
return;
}
let elementObjects = $('.LimitlessNotification');
elementObjects.each(function() {
let obj = $(this);
let title = obj.attr('data-title');
let msg = obj.attr('data-message');
let type = obj.attr('data-type');
let icon = obj.attr('data-icon');
setTimeout(function() {
new PNotify({
title: title,
text: msg,
icon: getDefaultIcon(type, icon),
type: getType(type)
});
},1);
});
// TRANSFER SAMPLES ON RESOURCES
$('#notify_success').on('click', function () {
new PNotify({
title: 'Success!',
text: 'This is a Success!',
icon: 'icon-checkmark3',
type: 'success'
});
});
$('#notify_error').on('click', function () {
new PNotify({
title: 'Error!',
text: 'This is an Error!',
icon: 'icon-blocked',
type: 'error'
});
});
$('#notify_warning').on('click', function () {
new PNotify({
title: 'Warning!',
text: 'This is a Warning!',
icon: 'icon-warning22',
type: ''
});
});
$('#notify_info').on('click', function () {
new PNotify({
title: 'Info!',
text: 'This is an Info!',
icon: 'icon-info22',
type: 'info'
});
});
})
\ No newline at end of file
<?php
/*
|------------------------------------------------------------------------------------------------
| Information
|------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: Kevin Almond Roe Yumang <kevin.yumang@itmax.email>
| Update: 2022-06-30 02:31:57
|
*/
namespace Ceetrox\Sidekick\Views\Limitless\Notification;
/*
|------------------------------------------------------------------------------------------------
| Dependencies
|------------------------------------------------------------------------------------------------
*/
use View;
/*
|------------------------------------------------------------------------------------------------
| Class "Config"
|------------------------------------------------------------------------------------------------
*/
class Config
{
public $methodAllocation = [
'Limitless::Notify' => 'notify',
];
public $assetAllocation;
public function __construct()
{
$this->assetAllocation = [
'Limitless::Notify' => [
'Attachments/notification.init.js',
secure_url('/ceetrox/sidekick/resource/public/Webdesigns/design-limitless/Template/global_assets/js/plugins/notifications/pnotify.min.js'),
]
];
}
/*
|--------------------------------------------------------------------------------------------
| Method "notify"
|--------------------------------------------------------------------------------------------
*/
public function notify($parameters)
{
return View('Limitless::Notification.Notification')
->withTitle($parameters['title'] ?? '')
->withMessage($parameters['message'] ?? 'No Message')
->withType($parameters['type'] ?? 'success')
->withIcon($parameters['icon'] ?? null);
}
}
{{-- Layout Reference --}}
@extends('Limitless::Help.Layout.Master')
@section('Limitless::Content')
@Limitless::CardStart(['title' => "Description", 'icon' => 'icon-info22'])
@Limitless::Notify(['type' => 'info', 'title' => 'PNotify', 'message' => 'Popup notifications using PNotify!'])
<button type="button" class="btn btn-light" id="notify_success">Success</button>
<button type="button" class="btn btn-light" id="notify_error">Error</button>
<button type="button" class="btn btn-light" id="notify_warning">Warning</button>
<button type="button" class="btn btn-light" id="notify_info">Info</button>
<button type="button" class="btn btn-light" id="notify_confirm">Confirm</button>
@Limitless::CardStop
@stop
\ No newline at end of file
<div
class="LimitlessNotification"
data-type="{{ $type }}"
data-icon="{{ $icon }}"
data-title="{{ $title }}"
data-message="{{ $message }}"
hidden
>
</div>
\ No newline at end of file
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