/**
* Theme: Minton Admin Template
* Author: Coderthemes
* Module/App: Core js
*/
!function($) {
    "use strict";

    class Notification {
        constructor() { }
        //Simple notification
        notify(style, position, title, text) {
            var icon = 'fa fa-adjust';
            if (style == "error") {
                icon = "fa fa-exclamation";
            } else if (style == "warning") {
                icon = "fa fa-warning";
            } else if (style == "success") {
                icon = "fa fa-check";
            } else if (style == "custom") {
                icon = "zwicon-folder-open";
            } else if (style == "info") {
                icon = "zwicon-sticky-notes";
            } else {
                icon = "zwicon-moon";
            }
            $.notify({
                title: title,
                text: text,
                image: "<i class='" + icon + "'></i>"
            }, {
                style: 'metro',
                className: style,
                globalPosition: position,
                showAnimation: "show",
                showDuration: 0,
                hideDuration: 0,
                autoHide: true,
                clickToHide: true
            });
        }
        //Auto hide notification
        autoHideNotify(style, position, title, text) {
            var icon = "fa fa-adjust";
            if (style == "error") {
                icon = "fa fa-exclamation";
            } else if (style == "warning") {
                icon = "fa fa-warning";
            } else if (style == "success") {
                icon = "fa fa-check";
            } else if (style == "custom") {
                icon = "mdi mdi-album";
            } else if (style == "info") {
                icon = "fa fa-question";
            } else {
                icon = "fa fa-adjust";
            }
            $.notify({
                title: title,
                text: text,
                image: "<i class='" + icon + "'></i>"
            }, {
                style: 'metro',
                className: style,
                globalPosition: position,
                showAnimation: "show",
                showDuration: 0,
                hideDuration: 0,
                autoHideDelay: 5000,
                autoHide: true,
                clickToHide: true
            });
        }
        //Confirmation notification
        confirm(style, position, title) {
            var icon = "fa fa-adjust";
            if (style == "error") {
                icon = "fa fa-exclamation";
            } else if (style == "warning") {
                icon = "fa fa-warning";
            } else if (style == "success") {
                icon = "fa fa-check";
            } else if (style == "custom") {
                icon = "mdi mdi-album";
            } else if (style == "info") {
                icon = "fa fa-question";
            } else {
                icon = "fa fa-adjust";
            }
            $.notify({
                title: title,
                text: 'Are you sure you want to do nothing?<div class="clearfix"></div><br><a class="btn btn-sm btn-white yes">Yes</a> <a class="btn btn-sm btn-danger no">No</a>',
                image: "<i class='" + icon + "'></i>"
            }, {
                style: 'metro',
                className: style,
                globalPosition: position,
                showAnimation: "show",
                showDuration: 0,
                hideDuration: 0,
                autoHide: false,
                clickToHide: false
            });
            //listen for click events from this style
            $(document).on('click', '.notifyjs-metro-base .no', function () {
                //programmatically trigger propogating hide event
                $(this).trigger('notify-hide');
            });
            $(document).on('click', '.notifyjs-metro-base .yes', function () {
                //show button text
                alert($(this).text() + " clicked!");
                //hide notification
                $(this).trigger('notify-hide');
            });
        }
        //init - examples
        init() {
        }
    }

    //init
    $.Notification = new Notification, $.Notification.Constructor = Notification}(window.jQuery);
