From 795a0b573619726877eae616637a40761e9540fc Mon Sep 17 00:00:00 2001 From: Latifa Al-Hitmi Date: Sat, 19 Oct 2024 22:48:45 +0300 Subject: [PATCH] fixing syntax and indentation --- public/src/admin/dashboard/bug-logs.js | 112 ++++++++++++------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/public/src/admin/dashboard/bug-logs.js b/public/src/admin/dashboard/bug-logs.js index 82267b680c..5af84ccb95 100644 --- a/public/src/admin/dashboard/bug-logs.js +++ b/public/src/admin/dashboard/bug-logs.js @@ -1,59 +1,59 @@ 'use strict'; define('admin/dashboard/bug-logs', ['jquery', 'api'], ($, api) => { - const BugLogs = {}; - - BugLogs.init = () => { - // Fetch and display bug logs - fetchBugLogs(); - - // Handle bug report submission - $('#submit-bug-report').on('click', submitBugReport); - }; - - function fetchBugLogs() { - api.get('/api/admin/get-bug-log') - .then((data) => { - const bugLogsContainer = $('#bug-logs-container'); - bugLogsContainer.empty(); - - if (data.bugLogs && data.bugLogs.length > 0) { - data.bugLogs.forEach((log) => { - const logElement = $('
').addClass('bug-log'); - logElement.append($('

').text(`User: ${log.user}`)); - logElement.append($('

').text(`Description: ${log.description}`)); - logElement.append($('

').text(`Timestamp: ${log.timestamp}`)); - bugLogsContainer.append(logElement); - }); - } else { - bugLogsContainer.append($('

').text('No bug logs found.')); - } - }) - .catch((err) => { - console.error('Error fetching bug logs:', err); - $('#bug-logs-container').append($('

').text('Error fetching bug logs.')); - }); - } - - function submitBugReport() { - const description = $('#bug-report-description').val().trim(); - - if (!description) { - alert('Description is required'); - return; - } - - api.post('/api/admin/submit-bug-report', { description }) - .then(() => { - alert('Bug report submitted successfully'); - $('#bug-report-description').val(''); - fetchBugLogs(); - }) - .catch((err) => { - console.error('Error submitting bug report:', err); - alert('Error submitting bug report'); - }); - } - - return BugLogs; -}); \ No newline at end of file + const BugLogs = {}; + + BugLogs.init = () => { + // Fetch and display bug logs + fetchBugLogs(); + + // Handle bug report submission + $('#submit-bug-report').on('click', submitBugReport); + }; + + function fetchBugLogs() { + api.get('/api/admin/get-bug-log') + .then((data) => { + const bugLogsContainer = $('#bug-logs-container'); + bugLogsContainer.empty(); + + if (data.bugLogs && data.bugLogs.length > 0) { + data.bugLogs.forEach((log) => { + const logElement = $('

').addClass('bug-log'); + logElement.append($('

').text(`User: ${log.user}`)); + logElement.append($('

').text(`Description: ${log.description}`)); + logElement.append($('

').text(`Timestamp: ${log.timestamp}`)); + bugLogsContainer.append(logElement); + }); + } else { + bugLogsContainer.append($('

').text('No bug logs found.')); + } + }) + .catch((err) => { + console.error('Error fetching bug logs:', err); + $('#bug-logs-container').append($('

').text('Error fetching bug logs.')); + }); + } + + function submitBugReport() { + const description = $('#bug-report-description').val().trim(); + + if (!description) { + alert('Description is required'); + return; + } + + api.post('/api/admin/submit-bug-report', { description }) + .then(() => { + alert('Bug report submitted successfully'); + $('#bug-report-description').val(''); + fetchBugLogs(); + }) + .catch((err) => { + console.error('Error submitting bug report:', err); + alert('Error submitting bug report'); + }); + } + + return BugLogs; +});