do more cleanup of code using eslint

This commit is contained in:
janis
2023-10-05 13:46:53 +02:00
parent 0352bb9051
commit 5c5462186f
24 changed files with 314 additions and 240 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -187,7 +187,9 @@ export default {
if ( Object.keys( this.cart[ this.event.eventID ][ 'tickets' ] ).length < 1 ) {
try {
delete this.cart[ this.event.eventID ];
} catch {}
} catch {
console.log( 'element nonexistent' );
}
} else {
delete this.cart[ this.event.eventID ][ 'tickets' ][ ticket ];
}
@@ -238,7 +240,7 @@ export default {
}
},
created () {
window.addEventListener( 'visibilitychange', ( e ) => {
window.addEventListener( 'visibilitychange', () => {
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
}, 1 );
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<template>
<div id="notifications" @click="handleNotifications();">
<div class="message-box" :class="[ location, size ]">
@@ -80,7 +81,9 @@ export default {
}
try {
this.queue.splice( this.queue.indexOf( id ), 1 );
} catch {}
} catch {
console.debug( 'queue empty' );
}
if ( this.currentlyDisplayedNotificationID == id ) {
this.handleNotifications();
}

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<template>
<div id="popup-backdrop">
<div class="popup-container">

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - properties.vue
*
@@ -266,16 +267,16 @@ export default {
}
},
watch: {
draggables ( value ) {
draggables () {
this.loadInternal();
},
active ( value ) {
active () {
this.loadInternal();
},
scaleFactor ( value ) {
scaleFactor () {
this.loadInternal();
},
historyPos ( value ) {
historyPos () {
this.loadInternal();
}
},

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - window.vue
*
@@ -74,7 +75,7 @@ export default {
data() {
return {
active: 0,
draggables: { 1: { 'x': 100, 'y': 100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': 1, 'origin': 1, 'shape': 'rectangular', 'type': 'seat', 'startingRow': 1, 'seatNumberingPosition': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'numberingDirection': 'left', 'seatNumberingPosition': 1, 'category': '1' } },
draggables: { 1: { 'x': 100, 'y': 100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': 1, 'origin': 1, 'shape': 'rectangular', 'type': 'seat', 'startingRow': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'numberingDirection': 'left', 'seatNumberingPosition': 1, 'category': '1' } },
available: { 'redo': false, 'undo': false },
scaleFactor: 1,
sizePoll: null,
@@ -206,7 +207,7 @@ export default {
// }
this.save();
},
eventHandler ( e ) {
eventHandler () {
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
this.loadSeatplan();

View File

@@ -102,7 +102,7 @@ export default {
}
},
watch: {
origin ( value ) {
origin () {
this.updateOrigin();
}
},

View File

@@ -49,16 +49,16 @@ export default {
}
},
watch: {
origin ( value ) {
origin () {
this.updateStyle();
},
scaleFactor ( value ) {
scaleFactor () {
this.updateStyle();
},
colour ( value ) {
colour () {
this.updateStyle();
},
textSize ( value ) {
textSize () {
this.updateStyle();
}
},

View File

@@ -102,7 +102,7 @@ export default {
}
},
watch: {
origin ( value ) {
origin () {
this.updateOrigin();
}
},

View File

@@ -108,7 +108,7 @@ export default {
},
},
watch: {
origin ( value ) {
origin () {
this.updateOrigin();
}
},

View File

@@ -49,16 +49,16 @@ export default {
}
},
watch: {
origin ( value ) {
origin () {
this.updateStyle();
},
scaleFactor ( value ) {
scaleFactor () {
this.updateStyle();
},
colour ( value ) {
colour () {
this.updateStyle();
},
textSize ( value ) {
textSize () {
this.updateStyle();
}
},

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - window.vue
*
@@ -173,7 +174,7 @@ export default {
this.seatChecks();
// TODO: FUTURE Trim scroll box to about 200px more than seatplan size
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
window.addEventListener( 'visibilitychange', ( e ) => {
window.addEventListener( 'visibilitychange', () => {
this.seatPlanInit();
}, 1 );
},
@@ -237,7 +238,7 @@ export default {
}
} );
},
eventHandler ( e ) {
eventHandler () {
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
this.loadSeatplan();
@@ -330,7 +331,7 @@ export default {
this.loadSeatplan();
} else {
if ( ( this.zoomFactor < 0.3 && scale < 0 ) || ( this.zoomFactor > 2.9 && scale > 0 ) ) {
console.log( 'maxZoomLevelReached' );
} else {
this.zoomFactor += scale;
}

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - rightClickMenu.vue
*

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - settings.vue
*

View File

@@ -51,7 +51,7 @@ export default {
props: {
'cart': {
type: Object,
default: {},
default: {}
// EXAMPLE: { 'TestEvent2': { 'displayName': 'TestEvent2', 'tickets': { 'secAr1s1': { 'displayName': 'Row 1, Seat 1', 'price': 20 } } } }
},
'width': {

View File

@@ -9,7 +9,6 @@
import { createRouter, createWebHistory } from 'vue-router';
import { useUserStore } from '@/stores/userStore';
import { useBackendStore } from '@/stores/backendStore';
import adminRoutes from '@/router/adminRoutes';
import mainRoutes from '@/router/mainRoutes';
@@ -27,7 +26,7 @@ const router = createRouter( {
routes,
} );
router.afterEach( ( to, from ) => {
router.afterEach( ( to ) => {
let userStore = useUserStore();
document.title = to.meta.title ? to.meta.title + userStore.getPageName : 'libreevent';
} );

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - AdminView.vue
*
@@ -225,7 +226,7 @@ export default {
methods: {
logout () {
if ( confirm( 'Do you really want to log out?' ) ) {
fetch( '/admin/logout' ).then( _ => {
fetch( '/admin/logout' ).then( () => {
this.userStore.setAdminAuth( false );
this.$router.push( '/admin/login' );
} );

View File

@@ -23,7 +23,7 @@
</div>
<!-- <img :src="event.logo" alt="event logo" class="ticket-logo"> -->
</router-link>
<router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else="new Date( event.date ).getTime() > currentDate">
<router-link to="/admin/events/analytics" class="ticket" @click="setActiveTicket( event.eventID );" v-else>
<div class="ticket-name">
<h3>{{ event.name }}</h3>
<p>{{ event.description }}</p>

View File

@@ -200,7 +200,7 @@ export default {
}
},
watch: {
selectedTemplate( value ) {
selectedTemplate() {
this.loadPageSettings();
}
},

View File

@@ -48,7 +48,7 @@ export default {
}
};
source.onopen = e => {
source.onopen = () => {
self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' );
self.$refs.notification.cancelNotification( startNotification );
};

View File

@@ -492,8 +492,7 @@ export default {
'charset': 'utf-8'
}
};
// TODO: fix url
fetch( url, options ).then( res => {
fetch( '/admin/api/undeployEvent', options ).then( res => {
if ( res.status === 200 ) {
this.hasLiveVersion = false;
this.$refs.notification.createNotification( 'Your event is no longer publicly visible!', 5, 'ok', 'normal' );
@@ -510,7 +509,7 @@ export default {
'charset': 'utf-8'
}
};
fetch( url, options ).then( res => {
fetch( '/admin/api/deleteEvent', options ).then( res => {
if ( res.status === 200 ) {
this.$refs.notification.createNotification( 'Your event has been deleted successfully!', 5, 'ok', 'normal' );
setTimeout( () => {
@@ -534,7 +533,7 @@ export default {
} else if ( action === 'undeploy' ) {
this.$refs.popups.openPopup( 'Do you really want to remove this event from the event listings?', {}, 'confirm' );
this.command = 'undeployEvent';
} else if ( type === 'delete' ) {
} else if ( action === 'delete' ) {
this.$refs.popups.openPopup( 'Do you really want to delete this event? This action cannot be undone', {}, 'confirm' );
this.command = 'deleteEvent';
}

View File

@@ -223,7 +223,7 @@ export default {
},
},
created () {
window.addEventListener( 'visibilitychange', ( e ) => {
window.addEventListener( 'visibilitychange', () => {
this.cart = localStorage.getItem( 'cart' ) ? JSON.parse( localStorage.getItem( 'cart' ) ): {};
this.calculateTotal();
}, 1 );

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-undef -->
<!--
* libreevent - GuestPurchaseView.vue
*
@@ -61,7 +62,7 @@ export default {
}
};
source.onopen = e => {
source.onopen = () => {
self.$refs.notification.createNotification( 'Connected to status service', 5, 'ok', 'normal' );
self.$refs.notification.cancelNotification( startNotification );
};