From 72a7a0dfc81c7d1969f299eb40cfb3d8b17dc69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Gr=C3=B8n=C3=A5s?= <44143748+sondregronas@users.noreply.github.com> Date: Mon, 21 Aug 2023 13:22:23 +0200 Subject: [PATCH] Update alerts.html --- BookingSystem/templates/templates/alerts.html | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/BookingSystem/templates/templates/alerts.html b/BookingSystem/templates/templates/alerts.html index 65d65e9..f53e846 100644 --- a/BookingSystem/templates/templates/alerts.html +++ b/BookingSystem/templates/templates/alerts.html @@ -60,17 +60,14 @@ }); function customAlert(header, msg, type, fullscreen = false) { - let icon; - let color; + const typeMapping = { + success: {icon: 'fa fa-check-circle', color: 'green'}, + warning: {icon: 'fa fa-exclamation-circle', color: 'orange'}, + error: {icon: 'fa fa-times-circle', color: 'red'}, + default: {icon: 'fa fa-info-circle', color: 'blue'} + } + let {icon, color} = typeMapping[type] || typeMapping.default; if (fullscreen) { - const typeMapping = { - success: {icon: 'fa fa-check-circle', type: 'green',}, - warning: {icon: 'fa fa-exclamation-circle', type: 'orange',}, - error: {icon: 'fa fa-times-circle', type: 'red',}, - default: {icon: 'fa fa-info-circle', type: 'blue',} - } - icon = typeMapping[type].icon || typeMapping.default.icon; - color = typeMapping[type].type || typeMapping.default.type; $.alert({ title: header, content: msg,