Files
orderPRO/public/assets/js/modules/jquery-alerts.js
Jacek Pyziak b67542d159 feat: Implement user authentication and database migration system
- Refactored AuthService to use UserRepository for user authentication.
- Added .env file for environment configuration.
- Created migration system with Migrator and ConnectionFactory classes.
- Added database migration files for creating users table.
- Implemented settings controller for managing database migrations.
- Developed user repository for user data handling.
- Created users controller for user management interface.
- Added frontend standards and migration documentation.
- Introduced reusable UI components and jQuery alerts module.
2026-02-21 17:51:34 +01:00

73 lines
1.5 KiB
JavaScript

"use strict";
(function (factory) {
if (typeof module === "object" && module.exports) {
module.exports = factory;
return;
}
if (typeof window.jQuery !== "undefined") {
factory(window.jQuery);
}
})(function ($) {
if (!$ || !$.fn) {
return;
}
const DEFAULTS = {
type: "info",
dismissible: true,
timeout: 0,
classPrefix: "jq-alert",
};
function removeAlert($el) {
$el.removeClass("is-visible");
window.setTimeout(function () {
$el.remove();
}, 180);
}
$.fn.orderProAlert = function (options) {
const settings = $.extend({}, DEFAULTS, options);
return this.each(function () {
const $host = $(this);
const $alert = $("<div>", {
class: settings.classPrefix + " " + settings.classPrefix + "--" + settings.type + " is-visible",
role: "alert",
});
const $content = $("<div>", {
class: settings.classPrefix + "__content",
text: String(settings.message || ""),
});
$alert.append($content);
if (settings.dismissible) {
const $close = $("<button>", {
class: settings.classPrefix + "__close",
type: "button",
"aria-label": "Close alert",
text: "x",
});
$close.on("click", function () {
removeAlert($alert);
});
$alert.append($close);
}
$host.append($alert);
if (settings.timeout > 0) {
window.setTimeout(function () {
removeAlert($alert);
}, settings.timeout);
}
});
};
});