mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
messages view
This commit is contained in:
53
httpdocs/assets/js/safekat/components/alerts/alert.js
Normal file
53
httpdocs/assets/js/safekat/components/alerts/alert.js
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
class Alert {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.headingTitle = this.item.find(".alert-heading")
|
||||
this.body = this.item.find(".alert-body")
|
||||
this.icon = this.item.find(".icon-alert")
|
||||
this.iconSuccess = "ti-circle-check"
|
||||
this.iconError = "ti-exclamation-mark"
|
||||
|
||||
|
||||
|
||||
}
|
||||
setIcon(iconClass){
|
||||
this.icon.removeClass(this.iconSuccess)
|
||||
this.icon.removeClass(this.iconError)
|
||||
this.icon.addClass(iconClass)
|
||||
}
|
||||
setAsError() {
|
||||
this.item.removeClass("alert-success")
|
||||
this.item.addClass("alert-danger")
|
||||
this.setIcon(this.iconError)
|
||||
|
||||
}
|
||||
setAsSuccess() {
|
||||
this.item.removeClass("alert-danger")
|
||||
this.item.addClass("alert-success")
|
||||
this.setIcon(this.iconSuccess)
|
||||
}
|
||||
setAsWarning() {
|
||||
this.item.removeClass("alert-success")
|
||||
this.item.addClass("alert-warning")
|
||||
}
|
||||
setAsInfo() {
|
||||
this.item.removeClass("alert-*")
|
||||
this.item.addClass("alert-info")
|
||||
}
|
||||
show() {
|
||||
this.item.removeClass("d-none")
|
||||
}
|
||||
hide() {
|
||||
this.item.addClass("d-none")
|
||||
}
|
||||
setHeadingTitle(title) {
|
||||
this.headingTitle.text(title)
|
||||
}
|
||||
setContent(content) {
|
||||
this.body.append(content)
|
||||
}
|
||||
setErrors() { }
|
||||
}
|
||||
|
||||
export default Alert;
|
||||
Reference in New Issue
Block a user