mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 13:24:24 +00:00
Compare commits
105 Commits
dev-V1
...
old-webpac
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d379bbe62 | |||
| f9fb42e90b | |||
| e9681e57cf | |||
| a5aae2c54f | |||
| e57c13341b | |||
| c810f439ba | |||
| fc030bd56e | |||
| a06a3ade22 | |||
| 5ae2be0541 | |||
| 39eefd6b0c | |||
| 0f8633ede4 | |||
| f1f36b135c | |||
| a22305f814 | |||
|
|
89008df6cc | ||
| c05bd545b4 | |||
| aed1ca4712 | |||
| 2d5308b140 | |||
| f97d8ab0ec | |||
| ea547fa6ef | |||
| 644891c5af | |||
|
|
dee06e4eef | ||
| 8fe3a9a003 | |||
|
|
30c1b0fa2e | ||
|
|
ee4ecd4aa8 | ||
|
|
9098e509e8 | ||
| b98fc4f37f | |||
| e3df40067c | |||
| 2412674cb8 | |||
| a47bf22050 | |||
| 6c3434c05c | |||
| 5ecd2d3f17 | |||
| 4bbe9fbec9 | |||
| 4729384fc8 | |||
| 2d6911b324 | |||
| 1b794e0742 | |||
| 00a7aaa08f | |||
| b6fb8ef294 | |||
| 15c33ce2c5 | |||
|
|
f56b00c641 | ||
|
|
4bb78c3991 | ||
| f517786655 | |||
| 62b5b33b88 | |||
| 7140b78786 | |||
| 879c5374ca | |||
| abe181db87 | |||
| 49d785f2d7 | |||
| 8fcd65c153 | |||
| 516dd1b690 | |||
| 5cad71ef79 | |||
|
|
b1b7ea994b | ||
| 5c88280fd2 | |||
|
|
3da6119955 | ||
| e324c52a81 | |||
| b4083c369d | |||
| 7de7546371 | |||
| 84567f14d4 | |||
| da48045280 | |||
| 6e527795d5 | |||
| 1f4bbe691f | |||
| 48a5f99293 | |||
| c2a7a11aaf | |||
| beb837cc8d | |||
|
|
ad5ebf798f | ||
| a246b89bfa | |||
| 19807f729c | |||
|
|
1f6fd6859a | ||
| 2ff4f4a09c | |||
| 7edd663f4f | |||
| eec30d8ed4 | |||
|
|
c7bc810e18 | ||
| ab9b232433 | |||
| 64452abf6c | |||
|
|
99ff1abc5d | ||
|
|
ac5c71559a | ||
|
|
58ae853d71 | ||
|
|
736521834d | ||
|
|
5030532712 | ||
|
|
bf97068357 | ||
|
|
f19b9a472e | ||
|
|
f78a7c7dd6 | ||
|
|
1d7832a945 | ||
|
|
767d9a3d7a | ||
|
|
02af46d0f2 | ||
|
|
0e402bfba0 | ||
|
|
95b83d95bd | ||
|
|
66e4e448e5 | ||
|
|
c829bdcdb1 | ||
|
|
c89438854c | ||
|
|
c04ccd802b | ||
|
|
55023dd46d | ||
| 5e406e99d6 | |||
| 8d751026b6 | |||
| 13924e3abb | |||
| 7a81b94438 | |||
| 9fcdef4aac | |||
| a70c4cb1eb | |||
| c4abf91aeb | |||
| 5b8f1c03f7 | |||
| ed63af624d | |||
| 8b8172d9f8 | |||
| f7e121708b | |||
| c9e3648a0f | |||
| d72ba805b9 | |||
| 5eccbb336a | |||
|
|
408739caad |
@@ -1,24 +1,24 @@
|
||||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@5.1.0
|
||||
node: circleci/node@5.1.0
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
executor: node/default
|
||||
steps:
|
||||
- checkout
|
||||
- node/install-packages:
|
||||
pkg-manager: npm
|
||||
- run:
|
||||
command: npm run build
|
||||
name: Build app
|
||||
- run:
|
||||
command: npm run test
|
||||
name: Run tests
|
||||
- run:
|
||||
command: npm run build-website
|
||||
name: Build documentation
|
||||
- persist_to_workspace:
|
||||
root: ~/project
|
||||
paths:
|
||||
- .
|
||||
build_and_test:
|
||||
executor: node/default
|
||||
steps:
|
||||
- checkout
|
||||
- node/install-packages:
|
||||
pkg-manager: npm
|
||||
- run:
|
||||
command: npm run build
|
||||
name: Build app
|
||||
- run:
|
||||
command: npm run test
|
||||
name: Run tests
|
||||
- run:
|
||||
command: npm run build-website
|
||||
name: Build documentation
|
||||
- persist_to_workspace:
|
||||
root: ~/project
|
||||
paths:
|
||||
- .
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* myevent - .eslintrc.js
|
||||
* libreevent - .eslintrc.js
|
||||
*
|
||||
* Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# myevent - .gitignore
|
||||
# libreevent - .gitignore
|
||||
#
|
||||
# Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License
|
||||
# https://janishutz.com, development@janishutz.com
|
||||
@@ -12,3 +12,6 @@
|
||||
|
||||
# ignore node_modules (can be rebuilt with npm i --> shrinks repo size)
|
||||
node_modules
|
||||
|
||||
# ignore dist folder (this repo only contains source code!)
|
||||
/dist
|
||||
674
LICENSE
Normal file
674
LICENSE
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
64
README.md
64
README.md
@@ -1,10 +1,70 @@
|
||||
# myevent
|
||||
<div id="title" align="center">
|
||||
<img src="./assets/logo.png" width="300">
|
||||
<h1>libreevent</h1>
|
||||
</div>
|
||||
|
||||
<div id="badges" align="center">
|
||||
<img alt="Project License" src="https://img.shields.io/github/license/simplePCBuilding/libreevent.svg">
|
||||
<img alt="GitHub Repo size" src="https://img.shields.io/github/repo-size/simplePCBuilding/libreevent.svg">
|
||||
<img alt="Project code lines count" src="https://img.shields.io/tokei/lines/github/simplePCBuilding/libreevent">
|
||||
<img alt="GitHub Repo issues" src="https://img.shields.io/github/issues-pr-raw/simplePCBuilding/libreevent">
|
||||
<img alt="Top Languages" src="https://img.shields.io/github/languages/top/simplePCBuilding/libreevent">
|
||||
<img alt="GitHub Repo filecount" src="https://img.shields.io/github/directory-file-count/simplePCBuilding/libreevent.svg">
|
||||
<br>
|
||||
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/simplePCBuilding/libreevent">
|
||||
<img alt="GitHub watchers" src="https://img.shields.io/github/watchers/simplePCBuilding/libreevent">
|
||||
<img alt="GitHub forks" src="https://img.shields.io/github/forks/simplePCBuilding/libreevent">
|
||||
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/simplePCBuilding/libreevent">
|
||||
<br>
|
||||
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/simplePCBuilding/libreevent/total?label=Downloads (total)">
|
||||
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/downloads/simplePCBuilding/libreevent/latest/total?label=Downloads (latest)">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/release/simplePCBuilding/libreevent.svg">
|
||||
<img alt="App Version" src="https://img.shields.io/github/package-json/v/simplePCBuilding/libreevent.svg?label=Development Version">
|
||||
</div>
|
||||
|
||||
A fully featured, fully free and open source event management solution you can host yourself, to manage your event and sell tickets. All you need is a webserver that can run node.js!
|
||||
|
||||
Visit our [website](https://myevent.janishutz.com)
|
||||
Visit our [website](https://libreevent.janishutz.com)
|
||||
|
||||
# System requirements
|
||||
- node.js V16.0+
|
||||
- npm
|
||||
- (OPTIONAL) MySQL
|
||||
- any CPU from the last 10 years
|
||||
- Any operating system that can run node.js
|
||||
|
||||
# Download
|
||||
You may download this project using the GitHub releases page or the direct links on the [libreevent website](https://libreevent.janishutz.com/download) as this only downloads the ready-to-distribute version, not the development version.
|
||||
Alternatively, you may download the project directly from GitHub (by cloning it or downloading the code) but you'll have to compile and package the project [manually](https://libreevent.janishutz.com/docs/contributing/packaging).
|
||||
|
||||
# Contributing
|
||||
If you want to contribute to this project, please read more [here](https://libreevent.janishutz.com/docs/contributing). Until the end of October 2023, no contributions can be accepted into master.
|
||||
|
||||
# Supporting the project
|
||||
If you like this project and it helped you save money, please consider donating to help fund the continuous development. If you are a company, please contact me [here](https://libreevent.janishutz.com/docs/sponsoring) if you want to sponsor the project and become an official partner.
|
||||
|
||||
# Repository structure
|
||||
- [assets/](/assets/): contains the logo (as png and GIMP file), also iOS and Android marketing materials, just global assets (images / videos)
|
||||
- [src/](/src/): contains all of the source code of the project:
|
||||
- [src/apps](/src/apps/): contains the source code of the iOS and Android app.
|
||||
- [src/server](/src/server/): contains the source code for the node.js application that runs on the server side.
|
||||
- [src/webapp](/src/webapp/): contains the source code for the frontend, contains lots of vue files.
|
||||
- [website/](/website/): contains all of the website files:
|
||||
- [website/dist/](/website/dist/): contains all the ready to distribute website files
|
||||
- [website/src/](/website/src/): contains all of the source files (markdown format) for the website. These files are converted into HTML by the build script.
|
||||
- [package.js](/package.js): collects all of the files of the project and copies them into the [dist/](/dist/) folder. It also minifies the files in the process to reduce package size.
|
||||
- [.eslintrc.js](/.eslintrc.js): ESlint config, the linter used for the project
|
||||
- [.gitignore](/.gitignore): ignored files, currently is node_modules & log files.
|
||||
|
||||
You may notice some additional folders appearing after running
|
||||
```
|
||||
npm run package
|
||||
```
|
||||
This is to shrink the repository size. Distribution ready files can be found in the releases or on our [website](https://libreevent.janishutz.com/download).
|
||||
|
||||
## This project is currently NOT ready to be used!
|
||||
Development of this project is currently ongoing and no stable version is available yet.
|
||||
|
||||
|
||||
## ROADMAP
|
||||
The goal is to get this tool fully functioning by the End of September 2023.
|
||||
BIN
assets/logo.png
BIN
assets/logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 57 KiB |
BIN
assets/logo.xcf
BIN
assets/logo.xcf
Binary file not shown.
8
package.js
Normal file
8
package.js
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
* libreevent - package.js
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
24
package.json
Normal file
24
package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "libreevent",
|
||||
"version": "1.0.0",
|
||||
"description": "A free and open source event management solution",
|
||||
"main": "/dist/app.js",
|
||||
"scripts": {
|
||||
"test": "npm run test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/simplePCBuilding/libreevent.git"
|
||||
},
|
||||
"keywords": [
|
||||
"eventmanager",
|
||||
"events",
|
||||
"tickets"
|
||||
],
|
||||
"author": "Janis Hutz",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/simplePCBuilding/libreevent/issues"
|
||||
},
|
||||
"homepage": "https://libreevent.janishutz.com"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* myevent - pwdmanager.js
|
||||
* libreevent - pwdmanager.js
|
||||
*
|
||||
* Created by Janis Hutz 03/26/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* myevent - routes.js (admin)
|
||||
* libreevent - routes.js (admin)
|
||||
*
|
||||
* Created by Janis Hutz 03/11/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
@@ -7,93 +7,39 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const path = require( 'path' );
|
||||
const pwdmanager = require( './pwdmanager.js' );
|
||||
const fs = require( 'fs' );
|
||||
|
||||
module.exports = ( app, settings ) => {
|
||||
/*
|
||||
Static routes for files like login screen, css, js and assets. Js and assets require login
|
||||
Admin login route that checks the password
|
||||
*/
|
||||
app.get( '/admin/login', ( request, response ) => {
|
||||
if ( request.session.loggedIn ) {
|
||||
response.redirect( '/admin' );
|
||||
} else {
|
||||
response.sendFile( path.join( __dirname + '/ui/login.html' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
app.get( '/admin/loginLangPack', ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/js/loginLangPack.js' ) );
|
||||
} );
|
||||
|
||||
app.get( '/admin/js/:file', ( request, response ) => {
|
||||
if ( request.session.loggedIn ) {
|
||||
response.sendFile( path.join( __dirname + '/ui/js/' + request.params.file ) );
|
||||
}
|
||||
} );
|
||||
|
||||
app.get( '/admin/css/:file', ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/css/' + request.params.file ) );
|
||||
} );
|
||||
|
||||
/*
|
||||
Admin login route that checks the password and, if enabled in settings, redirects to 2fa page or directly to admin panel
|
||||
*/
|
||||
app.post( '/admin/auth', ( request, response ) => {
|
||||
pwdmanager.checkpassword( request.body.mail, request.body.pwd ).then( data => {
|
||||
if ( data ) {
|
||||
if ( settings.twoFA ) {
|
||||
response.sendFile( path.join( __dirname + '../admin/ui/2fa.html' ) );
|
||||
response.send( '2fa' );
|
||||
} else {
|
||||
request.session.loggedIn = true;
|
||||
response.redirect( '/admin' );
|
||||
request.session.loggedInAdmin = true;
|
||||
response.send( 'ok' );
|
||||
}
|
||||
} else {
|
||||
response.send( 'Password wrong' );
|
||||
response.send( 'pwErr' );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
app.get( '/test/login', ( request, response ) => {
|
||||
request.session.loggedInAdmin = true;
|
||||
response.send( 'Logged in' );
|
||||
} );
|
||||
|
||||
app.get( '/admin/logout', ( request, response ) => {
|
||||
request.session.loggedIn = false;
|
||||
request.session.loggedInAdmin = false;
|
||||
response.send( 'logged out' );
|
||||
} );
|
||||
|
||||
/*
|
||||
main admin panel access route. Will serve an html file
|
||||
that uses vue.js in its SPA form to make the admin panel
|
||||
more responsive. Same technology is also used in the purchasing
|
||||
system itself.
|
||||
*/
|
||||
app.get( '/admin', ( request, response ) => {
|
||||
if ( request.session.loggedIn ) {
|
||||
if ( settings[ 'init' ] ) {
|
||||
response.sendFile( path.join( __dirname + '/ui/panel.html' ) );
|
||||
} else {
|
||||
response.sendFile( path.join( __dirname + '/ui/welcome.html' ) );
|
||||
}
|
||||
} else {
|
||||
response.redirect( '/admin/login' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
/*
|
||||
Send admin panel modules to UI as UI uses Vue.js Router
|
||||
*/
|
||||
app.get( '/admin/panel/modules', ( request, response ) => {
|
||||
let panelModules = { 'home': fs.readFileSync( path.join( __dirname + '/ui/panel/home.html' ) ).toString() };
|
||||
if ( request.session.loggedIn ) {
|
||||
response.send( panelModules );
|
||||
}
|
||||
} );
|
||||
|
||||
app.get( '/admin/setup', ( request, response ) => {
|
||||
if ( request.session.loggedIn ) {
|
||||
response.sendFile( path.join( __dirname + '/ui/setup.html' ) );
|
||||
} else {
|
||||
response.redirect( '/admin/login' );
|
||||
}
|
||||
app.get( '/api/getAuth', ( request, response ) => {
|
||||
response.send( { 'admin': request.session.loggedInAdmin ? true : false, 'user': request.session.loggedInUser ? true : false } );
|
||||
} );
|
||||
};
|
||||
@@ -1,101 +0,0 @@
|
||||
:root, :root.light {
|
||||
--background-color: rgb(202, 223, 255);
|
||||
--secondary-background: white;
|
||||
--primary-color: black;
|
||||
--primary-inverse: white;
|
||||
--secondary-color: blue;
|
||||
--secondary-hover: darkblue;
|
||||
}
|
||||
|
||||
:root.dark {
|
||||
--background-color: rgb(42, 44, 56);
|
||||
--secondary-background: rgb(19, 20, 32);
|
||||
--primary-color: white;
|
||||
--primary-inverse: black;
|
||||
--secondary-color: rgb(94, 94, 226);
|
||||
--secondary-hover: rgb(155, 155, 255);
|
||||
}
|
||||
|
||||
@media ( prefers-color-scheme: dark ) {
|
||||
:root {
|
||||
--background-color: rgb(42, 44, 56);
|
||||
--secondary-background: rgb(19, 20, 32);
|
||||
--primary-color: white;
|
||||
--secondary-color: rgb(94, 94, 226);
|
||||
--secondary-hover: rgb(155, 155, 255);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
font-family: sans-serif;
|
||||
font-size: calc(12pt + 0.35vw);
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-app {
|
||||
border-radius: 50px;
|
||||
margin-top: 2%;
|
||||
background-color: var(--secondary-background);
|
||||
color: var(--primary-color);
|
||||
width: 60%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.form {
|
||||
width: 80%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 4%;
|
||||
margin-bottom: 4%;
|
||||
}
|
||||
|
||||
.button {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background-color: var(--secondary-color);
|
||||
padding: 15px;
|
||||
border-radius: 30px;
|
||||
transition: 1s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
transition: ease-in-out 0.2s;
|
||||
color: var(--primary-inverse);
|
||||
background-color: var(--secondary-hover);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.input {
|
||||
padding: 1%;
|
||||
width: 80%;
|
||||
margin-bottom: 3%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: end;
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
.selector {
|
||||
background-color: lightblue;
|
||||
border-radius: 20px;
|
||||
padding: 0.5%;
|
||||
border-style: solid;
|
||||
border-color: blue;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
.setup-app {
|
||||
border-radius: 50px;
|
||||
margin-top: 2%;
|
||||
background-color: var(--secondary-background);
|
||||
color: var(--primary-color);
|
||||
height: 85vh;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.setup-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.explanation {
|
||||
padding-left: 5%;
|
||||
padding-right: 5%;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
:root, :root.light {
|
||||
--background-color: rgb(202, 223, 255);
|
||||
--secondary-background: white;
|
||||
--primary-color: black;
|
||||
--primary-inverse: white;
|
||||
--secondary-color: blue;
|
||||
--secondary-hover: darkblue;
|
||||
}
|
||||
|
||||
:root.dark {
|
||||
--background-color: rgb(42, 44, 56);
|
||||
--secondary-background: rgb(19, 20, 32);
|
||||
--primary-color: white;
|
||||
--primary-inverse: black;
|
||||
--secondary-color: rgb(94, 94, 226);
|
||||
--secondary-hover: rgb(155, 155, 255);
|
||||
}
|
||||
|
||||
@media ( prefers-color-scheme: dark ) {
|
||||
:root {
|
||||
--background-color: rgb(42, 44, 56);
|
||||
--secondary-background: rgb(19, 20, 32);
|
||||
--primary-color: white;
|
||||
--secondary-color: rgb(94, 94, 226);
|
||||
--secondary-hover: rgb(155, 155, 255);
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
font-family: sans-serif;
|
||||
font-size: calc(12pt + 0.35vw);
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background-color: var(--secondary-color);
|
||||
padding: 15px;
|
||||
border-radius: 30px;
|
||||
transition: 1s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
transition: ease-in-out 0.2s;
|
||||
color: var(--primary-inverse);
|
||||
background-color: var(--secondary-hover);
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.input {
|
||||
padding: 1%;
|
||||
width: 80%;
|
||||
margin-bottom: 3%;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.selector {
|
||||
background-color: lightblue;
|
||||
border-radius: 20px;
|
||||
padding: 0.5%;
|
||||
border-style: solid;
|
||||
border-color: blue;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
fetch( '/admin/panel/modules' ).then( res => {
|
||||
res.json().then( data => {
|
||||
const Home = { template: data[ 'home' ] };
|
||||
const About = { template: '<div>About</div>' };
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: Home },
|
||||
{ path: '/about', component: About }
|
||||
];
|
||||
|
||||
const router = VueRouter.createRouter( {
|
||||
history: VueRouter.createWebHashHistory(),
|
||||
routes,
|
||||
} );
|
||||
|
||||
const app = Vue.createApp( {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
$route ( to, from ) {
|
||||
console.log( 'changing route' );
|
||||
}
|
||||
},
|
||||
} );
|
||||
|
||||
app.use( router );
|
||||
|
||||
app.mount( '#app' );
|
||||
} );
|
||||
} );
|
||||
@@ -1,32 +0,0 @@
|
||||
let themeSelector2 = document.getElementById( 'theme' );
|
||||
let languageSelector = document.getElementById( 'lang' );
|
||||
let mailLabel = document.getElementById( 'mailLabel' );
|
||||
let pwdLabel = document.getElementById( 'pwdLabel' );
|
||||
let login = document.getElementById( 'login' );
|
||||
|
||||
languageSelector.value = sessionStorage.getItem( 'lang' );
|
||||
|
||||
function langUpdate () {
|
||||
if ( sessionStorage.getItem( 'lang' ) === 'de' ) {
|
||||
themeSelector2.options[0].innerHTML = 'Automatisch';
|
||||
themeSelector2.options[1].innerHTML = 'Hellmodus';
|
||||
themeSelector2.options[2].innerHTML = 'Dunkelmodus';
|
||||
mailLabel.innerHTML = 'Email - Adresse';
|
||||
pwdLabel.innerHTML = 'Passwort';
|
||||
login.value = 'Anmelden';
|
||||
} else {
|
||||
themeSelector2.options[0].innerHTML = 'System theme';
|
||||
themeSelector2.options[1].innerHTML = 'Light';
|
||||
themeSelector2.options[2].innerHTML = 'Dark';
|
||||
mailLabel.innerHTML = 'Email address';
|
||||
pwdLabel.innerHTML = 'Password';
|
||||
login.value = 'Log in';
|
||||
}
|
||||
}
|
||||
|
||||
function changeLang () {
|
||||
sessionStorage.setItem( 'lang', languageSelector.value );
|
||||
langUpdate();
|
||||
}
|
||||
|
||||
langUpdate();
|
||||
@@ -1,77 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login :: myevent - admin panel</title>
|
||||
<link rel="stylesheet" href="/admin/css/loginstyle.css">
|
||||
<script defer src="/admin/loginLangPack"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="top-bar">
|
||||
<select name="lang" id="lang" class="selector" onchange="changeLang();">
|
||||
<option value="en">English</option>
|
||||
<option value="de">Deutsch</option>
|
||||
</select>
|
||||
<select name="theme" id="theme" class="selector" onchange="toggleTheme();">
|
||||
<option value="system">System theme</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<a href="https://myevent.janishutz.com"><img src="/assets/logo.png" alt="myevent-logo" style="height: 35vh;"></a>
|
||||
<div class="login-app">
|
||||
<h1>Login</h1>
|
||||
<footer>myevent - admin panel</footer>
|
||||
<form action="/admin/auth" method="post" class="form">
|
||||
<label for="mail" id="mailLabel">Email address</label><br>
|
||||
<input type="email" id="mail" name="mail" required class="input"><br>
|
||||
<label for="pwd" id="pwdLabel">Password</label><br>
|
||||
<input type="password" id="pwd" name="pwd" required class="input"><br>
|
||||
<input type="submit" value="Log in" class="button" id="login">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script>
|
||||
let themeSelector = document.getElementById( 'theme' );
|
||||
|
||||
if ( sessionStorage.getItem( 'theme' ) ) {
|
||||
themeSelector.value = sessionStorage.getItem( 'theme' );
|
||||
}
|
||||
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
};
|
||||
|
||||
setTimeout( activate, 500 );
|
||||
|
||||
function activate () {
|
||||
$( 'body' ).css( 'transition', '0.5s' );
|
||||
}
|
||||
|
||||
function toggleTheme () {
|
||||
sessionStorage.setItem( 'theme', themeSelector.value );
|
||||
if ( themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else if ( themeSelector.value === 'light' ) {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
} else if ( themeSelector.value === 'system' ) {
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,77 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/admin/css/style.css">
|
||||
|
||||
<title>Admin panel :: myevent</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top">
|
||||
<select name="lang" id="lang" class="selector" onchange="changeLang();">
|
||||
<option value="en">English</option>
|
||||
<option value="de">Deutsch</option>
|
||||
</select>
|
||||
<select name="theme" id="theme" class="selector" onchange="toggleTheme();">
|
||||
<option value="system">System theme</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="app">
|
||||
<div id="nav">
|
||||
<router-link to="/">Home</router-link>
|
||||
<router-link to="/about">About</router-link>
|
||||
</div>
|
||||
<div id="content">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Load vue.js and app -->
|
||||
<script src="https://unpkg.com/vue@3"></script>
|
||||
<script src="https://unpkg.com/vue-router@4"></script>
|
||||
<script src="/admin/js/index.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script>
|
||||
let themeSelector = document.getElementById( 'theme' );
|
||||
|
||||
if ( sessionStorage.getItem( 'theme' ) ) {
|
||||
themeSelector.value = sessionStorage.getItem( 'theme' );
|
||||
}
|
||||
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
};
|
||||
|
||||
setTimeout( activate, 500 );
|
||||
|
||||
function activate () {
|
||||
$( 'body' ).css( 'transition', '0.5s' );
|
||||
}
|
||||
|
||||
function toggleTheme () {
|
||||
sessionStorage.setItem( 'theme', themeSelector.value );
|
||||
if ( themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else if ( themeSelector.value === 'light' ) {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
} else if ( themeSelector.value === 'system' ) {
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +0,0 @@
|
||||
<div>
|
||||
Hello World!
|
||||
</div>
|
||||
@@ -1,152 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Setup :: myevent - admin panel</title>
|
||||
<link rel="stylesheet" href="/admin/css/loginstyle.css">
|
||||
<link rel="stylesheet" href="/admin/css/setupstyle.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="top-bar">
|
||||
<select name="lang" id="lang" class="selector" onchange="changeLang();">
|
||||
<option value="en">English</option>
|
||||
<option value="de">Deutsch</option>
|
||||
</select>
|
||||
<select name="theme" id="theme" class="selector" onchange="toggleTheme()">
|
||||
<option value="system">System theme</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="dark">Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="setup-app">
|
||||
<!-- TODO: In docs note that user has to set up the mail account via config file. -->
|
||||
<!-- Root account setup -->
|
||||
<div class="setup-page" id="1">
|
||||
<h1>Setup</h1>
|
||||
<p class="explanation">Now, let's create an admin account! Please choose a secure password, as this user has the highest amounts of privileges.</p>
|
||||
<form class="form" style="margin-bottom: 0;">
|
||||
<label for="mail">Email address *</label><br>
|
||||
<input type="email" id="mail" name="mail" required class="input"><br>
|
||||
<label for="pwd1">Password *</label><br>
|
||||
<input type="password" id="pwd1" name="pwd1" required class="input"><br>
|
||||
<label for="pwd2">Repeat password *</label><br>
|
||||
<input type="password" id="pwd2" name="pwd2" required class="input"><br>
|
||||
</form>
|
||||
<button class="button" style="margin-bottom: 3%;">Continue</button>
|
||||
</div>
|
||||
|
||||
<!-- Company name & offered language(s) & choice if homepage or not -->
|
||||
<div class="setup-page" id="2">
|
||||
<h1>Setup</h1>
|
||||
<p class="explanation">Next off, we need to know your organisation's name, the language(s) you want to offer and you need to select if a simple homepage should be generated from templates for you. You may choose the template in the next step.</p>
|
||||
<form class="form" style="margin-bottom: 0;">
|
||||
<label for="name">Organisation name *</label><br>
|
||||
<input type="text" id="name" name="name" required class="input"><br>
|
||||
<p>Languages * (one required, if none selected, uses English only)</p>
|
||||
<div style="margin-bottom: 1%;">
|
||||
<label for="lang-en">English</label>
|
||||
<input type="checkbox" id="lang-en" name="lang-en">
|
||||
</div>
|
||||
<div style="margin-bottom: 3%;">
|
||||
<label for="lang-de">German</label>
|
||||
<input type="checkbox" id="lang-de" name="lang-de">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 3%;">
|
||||
<label for="homepage">Homepage?</label>
|
||||
<input type="checkbox" id="homepage" name="homepage">
|
||||
</div>
|
||||
</form>
|
||||
<button class="button" style="margin-bottom: 3%;">Continue</button>
|
||||
</div>
|
||||
|
||||
<!-- Setup of homepage (if activated previously) -->
|
||||
<div class="setup-page" id="3">
|
||||
<h1>Setup</h1>
|
||||
<p class="explanation">Since you have activated the homepage on the previous step, let's set it up now. Please choose from a template which you can find <a href="https://myevent.janishutz.com/docs/homepage/templates">here</a></p>
|
||||
<form class="form" style="margin-bottom: 0;">
|
||||
<label for="template">Choose homepage template</label><br>
|
||||
<select name="template" id="template" style="margin-bottom: 3%;">
|
||||
<option value="1">Template 1</option>
|
||||
<option value="2">Template 2</option>
|
||||
<option value="3">Template 3</option>
|
||||
<option value="4">Template 4</option>
|
||||
</select>
|
||||
<label for="pwd1">Promotional text *</label><br>
|
||||
<textarea name="" id="" rows="10" class="input" minlength="100" placeholder="Your promotional text"></textarea>
|
||||
</form>
|
||||
<button class="button" style="margin-bottom: 1.5%; margin-top: 2%;">Preview</button>
|
||||
<button class="button" style="margin-bottom: 3%;">Continue</button>
|
||||
</div>
|
||||
|
||||
<!-- Payment options (one required) -->
|
||||
<div class="setup-page" id="3">
|
||||
<h1>Setup</h1>
|
||||
<p class="explanation">Now, please choose a payment option. When entering the admin panel for the first time after completing the setup, you'll be prompted to enter tokens which you can find in the payment provider's dashboard. You there may also add more payment options that are provided by plugins. Please refer to the <a href="https://myevent.janishutz.com/docs/payments">docs</a> to see advantages and disadvantages of each payment provider.</p>
|
||||
<form class="form" style="margin-bottom: 0;">
|
||||
<label for="name">Organisation name *</label><br>
|
||||
<input type="text" id="name" name="name" required class="input"><br>
|
||||
<p>Languages * (one required, if none selected, uses English only)</p>
|
||||
<div style="margin-bottom: 1%;">
|
||||
<label for="lang-en">English</label>
|
||||
<input type="checkbox" id="lang-en" name="lang-en">
|
||||
</div>
|
||||
<div style="margin-bottom: 3%;">
|
||||
<label for="lang-de">German</label>
|
||||
<input type="checkbox" id="lang-de" name="lang-de">
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 3%;">
|
||||
<label for="homepage">Homepage?</label>
|
||||
<input type="checkbox" id="homepage" name="homepage">
|
||||
</div>
|
||||
</form>
|
||||
<button class="button" style="margin-bottom: 1.5%; margin-top: 2%;">Preview</button>
|
||||
<button class="button" style="margin-bottom: 3%;">Continue</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script>
|
||||
let themeSelector = document.getElementById( 'theme' );
|
||||
|
||||
if ( sessionStorage.getItem( 'theme' ) ) {
|
||||
themeSelector.value = sessionStorage.getItem( 'theme' );
|
||||
}
|
||||
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
};
|
||||
|
||||
setTimeout( activate, 500 );
|
||||
|
||||
function activate () {
|
||||
$( 'body' ).css( 'transition', '0.5s' );
|
||||
}
|
||||
|
||||
function toggleTheme () {
|
||||
sessionStorage.setItem( 'theme', themeSelector.value );
|
||||
if ( themeSelector.value === 'dark' ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else if ( themeSelector.value === 'light' ) {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
} else if ( themeSelector.value === 'system' ) {
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,36 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Welcome :: myevent - admin panel</title>
|
||||
<link rel="stylesheet" href="/admin/css/loginstyle.css">
|
||||
<style>
|
||||
.myevent-logo-welcome {
|
||||
height: 50vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1>Welcome to myevent!</h1>
|
||||
<a href="https://myevent.janishutz.com"><img src="/assets/logo.png" alt="myevent-logo" class="myevent-logo-welcome"></a>
|
||||
<p>myevent, the new way to sell your tickets online!</p>
|
||||
<p>Let's get started setting up your event!</p>
|
||||
<p id="warranty">Note: As a project licensed under the GNU General Public License Version 3.0-or-later (GPL 3.0+), this software comes with ABSOLUTELY NO WARRANTY TO THE EXTENT PERMITTED BY APPLICABLE LAW</p>
|
||||
<p>It is strongly advised to read through our <a href="https://myevent.janishutz.com/docs/setup/">setup guide</a> whilst doing the setup, as it contains vital information and shows you additional options which you can configure in the configuration file.</p>
|
||||
<a href="/admin/setup">Getting Started!</a>
|
||||
</div>
|
||||
|
||||
<!--Script for dark mode-->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script>
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || sessionStorage.getItem( 'theme' ) === 'dark' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* myevent - app.js
|
||||
* libreevent - app.js
|
||||
*
|
||||
* Created by Janis Hutz 02/26/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
@@ -11,20 +11,15 @@ const express = require( 'express' );
|
||||
let app = express();
|
||||
const path = require( 'path' );
|
||||
const expressSession = require( 'express-session' );
|
||||
const fs = require( 'fs' );
|
||||
const bodyParser = require( 'body-parser' );
|
||||
const cookieParser = require( 'cookie-parser' );
|
||||
const favicon = require( 'serve-favicon' );
|
||||
const http = require( 'http' );
|
||||
const serveStatic = require( 'serve-static' );
|
||||
const fs = require( 'fs' );
|
||||
|
||||
// const env = process.env.PROD || false;
|
||||
|
||||
const root = process.env.ROOT || '/order';
|
||||
|
||||
const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config.json' ) ) );
|
||||
|
||||
|
||||
// initialise express with middlewares
|
||||
app.use( expressSession( {
|
||||
secret: 'gaoevgoawefgo083tq2rfvöfaf0p8',
|
||||
@@ -35,43 +30,15 @@ app.use( expressSession( {
|
||||
app.use( bodyParser.urlencoded( { extended: false } ) );
|
||||
app.use( bodyParser.json() );
|
||||
app.use( cookieParser() );
|
||||
app.use( favicon( path.join( __dirname + '/ui/assets/logo.png' ) ) );
|
||||
app.use( serveStatic( __dirname + '/admin/ui/modules' ) );
|
||||
// app.use( favicon( path.join( __dirname + '/ui/assets/logo.png' ) ) );
|
||||
app.use( express.static( '../webapp/dist' ) );
|
||||
|
||||
|
||||
require( './admin/routes.js' )( app, settings ); // admin route
|
||||
|
||||
if ( settings[ 'init' ] ) {
|
||||
if ( root !== '/' ) {
|
||||
app.get( '/', ( request, response ) => {
|
||||
let lang = request.query.lang || 'en';
|
||||
response.sendFile( path.join( __dirname + '/ui/html/' + lang + '/index.html' ) );
|
||||
} );
|
||||
}
|
||||
} else {
|
||||
app.get( '/', ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/html/index.html' ) );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
// Assets route for logo, etc
|
||||
app.get( '/assets/:file', ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/assets/' + request.params.file ) );
|
||||
} );
|
||||
|
||||
|
||||
|
||||
// CSS route for all user-facing CSS files
|
||||
app.get( '/css/:file', ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/css/' + request.params.file ) );
|
||||
} );
|
||||
|
||||
|
||||
|
||||
// create 404 handler
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
app.use( ( request, response, next ) => {
|
||||
response.sendFile( path.join( __dirname + '/ui/html/en/errorResponses/404.html' ) );
|
||||
app.use( ( request, response ) => {
|
||||
response.sendFile( path.join( __dirname + '/../webapp/dist/index.html' ) );
|
||||
} );
|
||||
|
||||
const PORT = process.env.PORT || 8080;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* myevent - db.js
|
||||
* libreevent - db.js
|
||||
*
|
||||
* Created by Janis Hutz 03/26/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
|
||||
172
src/server/package-lock.json
generated
172
src/server/package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "myevent",
|
||||
"name": "libreevent",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "myevent",
|
||||
"name": "libreevent",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
@@ -53,9 +53,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
|
||||
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
@@ -85,9 +85,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz",
|
||||
"integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
@@ -95,21 +95,27 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.17",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz",
|
||||
"integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==",
|
||||
"version": "0.3.18",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz",
|
||||
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@mapbox/node-pre-gyp": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz",
|
||||
@@ -481,9 +487,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/entities": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
|
||||
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
@@ -816,14 +822,14 @@
|
||||
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ=="
|
||||
},
|
||||
"node_modules/html-minifier-terser": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.1.0.tgz",
|
||||
"integrity": "sha512-BvPO2S7Ip0Q5qt+Y8j/27Vclj6uHC6av0TMoDn7/bJPhMWHI2UtR2e/zEgJn3/qYAmxumrGp9q4UHurL6mtW9Q==",
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz",
|
||||
"integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"camel-case": "^4.1.2",
|
||||
"clean-css": "5.2.0",
|
||||
"commander": "^9.4.1",
|
||||
"clean-css": "~5.3.2",
|
||||
"commander": "^10.0.0",
|
||||
"entities": "^4.4.0",
|
||||
"param-case": "^3.0.4",
|
||||
"relateurl": "^0.2.7",
|
||||
@@ -836,16 +842,13 @@
|
||||
"node": "^14.13.1 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/html-minifier-terser/node_modules/clean-css": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz",
|
||||
"integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==",
|
||||
"node_modules/html-minifier-terser/node_modules/commander": {
|
||||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
|
||||
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"source-map": "~0.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.0"
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
@@ -1066,9 +1069,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.4.tgz",
|
||||
"integrity": "sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==",
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
|
||||
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@@ -1359,9 +1362,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz",
|
||||
"integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
@@ -1432,9 +1435,9 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
|
||||
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
@@ -1637,9 +1640,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.16.5",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.16.5.tgz",
|
||||
"integrity": "sha512-qcwfg4+RZa3YvlFh0qjifnzBHjKGNbtDo9yivMqMFDy9Q6FSaQWSB/j1xKhsoUFJIqDOM3TsN6D5xbrMrFcHbg==",
|
||||
"version": "5.17.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz",
|
||||
"integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
@@ -1796,9 +1799,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
|
||||
"integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/set-array": "^1.0.1",
|
||||
@@ -1819,9 +1822,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/source-map": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz",
|
||||
"integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/gen-mapping": "^0.3.0",
|
||||
@@ -1829,19 +1832,27 @@
|
||||
}
|
||||
},
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"version": "1.4.15",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
|
||||
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
|
||||
"dev": true
|
||||
},
|
||||
"@jridgewell/trace-mapping": {
|
||||
"version": "0.3.17",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz",
|
||||
"integrity": "sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==",
|
||||
"version": "0.3.18",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz",
|
||||
"integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/resolve-uri": "3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "1.4.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": {
|
||||
"version": "1.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||
"integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@mapbox/node-pre-gyp": {
|
||||
@@ -2133,9 +2144,9 @@
|
||||
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="
|
||||
},
|
||||
"entities": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
|
||||
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dev": true
|
||||
},
|
||||
"escape-html": {
|
||||
@@ -2406,28 +2417,25 @@
|
||||
"integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ=="
|
||||
},
|
||||
"html-minifier-terser": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.1.0.tgz",
|
||||
"integrity": "sha512-BvPO2S7Ip0Q5qt+Y8j/27Vclj6uHC6av0TMoDn7/bJPhMWHI2UtR2e/zEgJn3/qYAmxumrGp9q4UHurL6mtW9Q==",
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz",
|
||||
"integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"camel-case": "^4.1.2",
|
||||
"clean-css": "5.2.0",
|
||||
"commander": "^9.4.1",
|
||||
"clean-css": "~5.3.2",
|
||||
"commander": "^10.0.0",
|
||||
"entities": "^4.4.0",
|
||||
"param-case": "^3.0.4",
|
||||
"relateurl": "^0.2.7",
|
||||
"terser": "^5.15.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"clean-css": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.2.0.tgz",
|
||||
"integrity": "sha512-2639sWGa43EMmG7fn8mdVuBSs6HuWaSor+ZPoFWzenBc6oN+td8YhTfghWXZ25G1NiiSvz8bOFBS7PdSbTiqEA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-map": "~0.6.0"
|
||||
}
|
||||
"commander": {
|
||||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
|
||||
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2591,9 +2599,9 @@
|
||||
}
|
||||
},
|
||||
"minipass": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.4.tgz",
|
||||
"integrity": "sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ=="
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
|
||||
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ=="
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "2.1.2",
|
||||
@@ -2800,9 +2808,9 @@
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz",
|
||||
"integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
@@ -2844,9 +2852,9 @@
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "7.3.8",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
|
||||
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
|
||||
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
|
||||
"requires": {
|
||||
"lru-cache": "^6.0.0"
|
||||
}
|
||||
@@ -3019,9 +3027,9 @@
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.16.5",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.16.5.tgz",
|
||||
"integrity": "sha512-qcwfg4+RZa3YvlFh0qjifnzBHjKGNbtDo9yivMqMFDy9Q6FSaQWSB/j1xKhsoUFJIqDOM3TsN6D5xbrMrFcHbg==",
|
||||
"version": "5.17.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz",
|
||||
"integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "myevent",
|
||||
"name": "libreevent",
|
||||
"version": "1.0.0",
|
||||
"description": "Free & Open source event management solution",
|
||||
"main": "app.js",
|
||||
@@ -54,7 +54,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/simplePCBuilding/myevent.git"
|
||||
"url": "git+https://github.com/simplePCBuilding/libreevent.git"
|
||||
},
|
||||
"keywords": [
|
||||
"event",
|
||||
@@ -64,7 +64,7 @@
|
||||
"author": "Janis Hutz",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"bugs": {
|
||||
"url": "https://github.com/simplePCBuilding/myevent/issues"
|
||||
"url": "https://github.com/simplePCBuilding/libreevent/issues"
|
||||
},
|
||||
"homepage": "https://myevent.janishutz.com"
|
||||
"homepage": "https://libreevent.janishutz.com"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* myevent - errorstyle.css
|
||||
*
|
||||
* Created by Janis Hutz 03/11/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
html {
|
||||
height: 98%;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: lightgray;
|
||||
font-family: monospace;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code {
|
||||
font-size: 20vw;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 1.5vw;
|
||||
}
|
||||
|
||||
.button {
|
||||
text-decoration: none;
|
||||
background-color: gray;
|
||||
font-style: italic;
|
||||
font-size: 1vw;
|
||||
color: white;
|
||||
padding: 20px;
|
||||
border-radius: 30px;
|
||||
transition: 1s;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
transition: ease-in-out 0.2s;
|
||||
background-color: black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>403 - Forbidden</title>
|
||||
<link rel="stylesheet" href="/css/errorstyle.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 class="code">403</h1>
|
||||
<h2 class="message">You are currently not allowed to visit this page!</h2>
|
||||
<a href="/" class="button">Back to the homepage</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>404 - Not found</title>
|
||||
<link rel="stylesheet" href="/css/errorstyle.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 class="code">404</h1>
|
||||
<h2 class="message">The page you are looking for was not found on the server!</h2>
|
||||
<a href="/" class="button">Back to the homepage</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>500 - Internal Server Error</title>
|
||||
<link rel="stylesheet" href="/css/errorstyle.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<h1 class="code">500</h1>
|
||||
<h2 class="message">The server encountered a problem whilst processing your request!</h2>
|
||||
<a href="/" class="button">Back to the homepage</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,91 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>myevent</title>
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- We are using inline styling to simplify the removal of this page -->
|
||||
<style>
|
||||
body {
|
||||
background-color: rgb(202, 223, 255);
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.content, .lang {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin: 2%;
|
||||
height: 50vh;
|
||||
}
|
||||
|
||||
.lang {
|
||||
display: none;
|
||||
background-color: white;
|
||||
padding: 2%;
|
||||
margin: 3%;
|
||||
margin-bottom: 0;
|
||||
border-radius: 50px;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.button {
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background-color: blue;
|
||||
padding: 30px;
|
||||
border-radius: 30px;
|
||||
transition: 1s;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
transition: ease-in-out 0.2s;
|
||||
background-color: darkblue;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.presented {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<img src="/assets/logo.png" alt="myevent-logo" class="logo">
|
||||
<div class="lang presented" id="en">
|
||||
<h1>Welcome to myevent!</h1>
|
||||
<!-- <p>Thank you for installing and using myevent! Let's get started by setting it up! First plan of action is to log in to the admin panel where you can replace this page here with your own landing page!</p> -->
|
||||
<a href="/admin/login" class="button" onclick="sessionStorage.setItem( 'lang', 'en' )">To the admin panel</a>
|
||||
</div>
|
||||
<div class="lang" id="de">
|
||||
<h1>Willkommen zu myevent!</h1>
|
||||
<!-- <p>Vielen Dank für die Installation und Nutzung von myevent! Beginnen wir mit dem Aufsetzen! Der erste Schritt ist, sich ins Admin-Panel einzuloggen um die Seite hier mit deiner eigenen Seite zu ersetzen!</p> -->
|
||||
<a href="/admin/login" class="button" onclick="sessionStorage.setItem( 'lang', 'de' )">Zum Admin-Panel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
let lang = [ 'en', 'de' ];
|
||||
let pos = 0;
|
||||
function switchPresented () {
|
||||
console.log( 'updating' );
|
||||
$( `#${ lang[ pos ] }` ).removeClass( 'presented' );
|
||||
if ( pos + 2 > lang.length ) {
|
||||
pos = 0;
|
||||
} else {
|
||||
pos += 1;
|
||||
}
|
||||
$( `#${ lang[ pos ] }` ).addClass( 'presented' );
|
||||
}
|
||||
|
||||
setInterval( switchPresented, 5000 );
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
4
src/webapp/.browserslistrc
Normal file
4
src/webapp/.browserslistrc
Normal file
@@ -0,0 +1,4 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
not ie 11
|
||||
23
src/webapp/.gitignore
vendored
Normal file
23
src/webapp/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
19
src/webapp/README.md
Normal file
19
src/webapp/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# libreevent
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
5
src/webapp/babel.config.js
Normal file
5
src/webapp/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
};
|
||||
19
src/webapp/jsconfig.json
Normal file
19
src/webapp/jsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
||||
14
src/webapp/notes.md
Normal file
14
src/webapp/notes.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Account view:
|
||||
- set page title based on settings
|
||||
|
||||
- make pricing groups changeable in UI (event categories)
|
||||
|
||||
- Fix text field overflow (text too big for box)
|
||||
- Other optimisation for seat plan editor
|
||||
|
||||
- Implement Permission system
|
||||
|
||||
|
||||
|
||||
|
||||
- add webpack to project website to decrease file size
|
||||
18450
src/webapp/package-lock.json
generated
Normal file
18450
src/webapp/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
src/webapp/package.json
Normal file
23
src/webapp/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "libreevent",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pdfme/generator": "^1.2.3",
|
||||
"@pdfme/ui": "^1.2.3",
|
||||
"core-js": "^3.8.3",
|
||||
"pinia": "^2.0.34",
|
||||
"vue": "^3.2.13",
|
||||
"vue-router": "^4.0.3",
|
||||
"vue3-draggable-resizable": "^1.6.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-router": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0"
|
||||
}
|
||||
}
|
||||
1
src/webapp/public/coloris.min.css
vendored
Normal file
1
src/webapp/public/coloris.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
src/webapp/public/coloris.min.js
vendored
Normal file
6
src/webapp/public/coloris.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
src/webapp/public/favicon.ico
Normal file
BIN
src/webapp/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
24
src/webapp/public/iecrasher.html
Normal file
24
src/webapp/public/iecrasher.html
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
<html><head>
|
||||
<style type="text/css">
|
||||
#a {
|
||||
margin:0 10px 10px;
|
||||
}
|
||||
|
||||
#b {
|
||||
width:100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
<title>IE Crasher</title>
|
||||
</head>
|
||||
<body>
|
||||
<table><tr><td>
|
||||
<div id="a">
|
||||
<form id="b">
|
||||
<input type="text" name="test"/>
|
||||
</div>
|
||||
</td><td width="1"></td></tr></table>
|
||||
</body></html>
|
||||
|
||||
28
src/webapp/public/index.html
Normal file
28
src/webapp/public/index.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>
|
||||
<%= htmlWebpackPlugin.options.title %>
|
||||
</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
|
||||
<script defer src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="/coloris.min.css">
|
||||
<script defer src="/coloris.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
||||
Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
191
src/webapp/src/App.vue
Normal file
191
src/webapp/src/App.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<!--
|
||||
* libreevent - App.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<nav>
|
||||
<router-link to="/">Home</router-link> |
|
||||
<router-link to="/tickets">Tickets</router-link> |
|
||||
<router-link to="/cart">Cart</router-link> |
|
||||
<router-link to="/account">Account</router-link> |
|
||||
<button @click="changeTheme();" v-html="theme" id="themeSelector"></button>
|
||||
</nav>
|
||||
<router-view v-slot="{ Component, route }">
|
||||
<transition :name="route.meta.transition || 'fade'" mode="out-in">
|
||||
<component :is="Component" />
|
||||
</transition>
|
||||
</router-view>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
:root, :root.light {
|
||||
--primary-color: #2c3e50;
|
||||
--accent-background: rgb(30, 30, 82);
|
||||
--secondary-color: white;
|
||||
--background-color: white;
|
||||
--popup-color: rgb(224, 224, 224);
|
||||
--accent-color: #42b983;
|
||||
--hover-color: rgb(165, 165, 165);
|
||||
--accent-background-hover: rgb(124, 140, 236);
|
||||
--overlay-color: rgba(0, 0, 0, 0.7);
|
||||
--inactive-color: rgb(100, 100, 100);
|
||||
--highlight-backdrop: rgb(143, 134, 192);
|
||||
--hint-color: rgb(174, 210, 221);
|
||||
--PI: 3.14159265358979;
|
||||
}
|
||||
|
||||
:root.dark {
|
||||
--primary-color: white;
|
||||
--accent-background: rgb(56, 56, 112);
|
||||
--secondary-color: white;
|
||||
--background-color: rgb(32, 32, 32);
|
||||
--popup-color: rgb(58, 58, 58);
|
||||
--accent-color: #42b983;
|
||||
--hover-color: rgb(83, 83, 83);
|
||||
--accent-background-hover: #4380a8;
|
||||
--overlay-color: rgba(104, 104, 104, 0.575);
|
||||
--inactive-color: rgb(190, 190, 190);
|
||||
--highlight-backdrop: rgb(85, 63, 207);
|
||||
--hint-color: rgb(88, 91, 110);
|
||||
}
|
||||
|
||||
@media ( prefers-color-scheme: dark ) {
|
||||
:root {
|
||||
--primary-color: white;
|
||||
--accent-background: rgb(56, 56, 112);
|
||||
--secondary-color: white;
|
||||
--background-color: rgb(32, 32, 32);
|
||||
--popup-color: rgb(58, 58, 58);
|
||||
--accent-color: #42b983;
|
||||
--hover-color: rgb(83, 83, 83);
|
||||
--accent-background-hover: #4380a8;
|
||||
--overlay-color: rgba(104, 104, 104, 0.575);
|
||||
--inactive-color: rgb(190, 190, 190);
|
||||
--highlight-backdrop: rgb(85, 63, 207);
|
||||
--hint-color: rgb(88, 91, 110);
|
||||
}
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: var( --highlight-backdrop );
|
||||
color: var( --secondary-color );
|
||||
}
|
||||
|
||||
#themeSelector {
|
||||
background-color: rgba( 0, 0, 0, 0 );
|
||||
color: var( --primary-color );
|
||||
font-size: 130%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#app {
|
||||
transition: 0.5s;
|
||||
background-color: var( --background-color );
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: var( --primary-color );
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
nav a {
|
||||
font-weight: bold;
|
||||
color: var( --primary-color );
|
||||
}
|
||||
|
||||
nav a.router-link-exact-active {
|
||||
color: #42b983;
|
||||
}
|
||||
|
||||
.scale-enter-active,
|
||||
.scale-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
|
||||
.scale-enter-from,
|
||||
.scale-leave-to {
|
||||
opacity: 0;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.4s ease;
|
||||
}
|
||||
|
||||
.fade-enter-from,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.material-symbols-outlined {
|
||||
font-variation-settings:
|
||||
'FILL' 0,
|
||||
'wght' 400,
|
||||
'GRAD' 0,
|
||||
'opsz' 48
|
||||
}
|
||||
|
||||
.clr-open {
|
||||
border: black solid 1px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'app',
|
||||
data () {
|
||||
return {
|
||||
theme: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeTheme () {
|
||||
if ( this.theme === '☼' ) {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
localStorage.setItem( 'theme', '☽' );
|
||||
this.theme = '☽';
|
||||
} else if ( this.theme === '☽' ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
localStorage.setItem( 'theme', '☼' );
|
||||
this.theme = '☼';
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.theme = localStorage.getItem( 'theme' ) ? localStorage.getItem( 'theme' ) : '';
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || this.theme === '☼' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
this.theme = '☼';
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
this.theme = '☽';
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
BIN
src/webapp/src/assets/logo.png
Normal file
BIN
src/webapp/src/assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
35
src/webapp/src/components/initial.vue
Normal file
35
src/webapp/src/components/initial.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<img alt="Vue logo" src="../assets/logo.png">
|
||||
<div>
|
||||
<h1>Welcome to libreǝvent!</h1>
|
||||
<p>Let's start the setup by entering the setup key below! You may define a setup key in the config file of libreevent. See <a href="https://libreevent.janishutz.com/docs/setup/setup" target="_blank">here</a> for more instructions</p>
|
||||
<form>
|
||||
<label for="key">Your setup key</label><br>
|
||||
<input type="text" v-model="formData[ 'key' ]" required name="key" id="key">
|
||||
</form>
|
||||
<button @click="setup();" class="button">Start setup</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setup () {
|
||||
this.$router.push( '/setup' );
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
img {
|
||||
width: 20%;
|
||||
}
|
||||
</style>
|
||||
317
src/webapp/src/components/noseatplan.vue
Normal file
317
src/webapp/src/components/noseatplan.vue
Normal file
@@ -0,0 +1,317 @@
|
||||
<template>
|
||||
<div class="seatingWrapper">
|
||||
<div class="sidebar">
|
||||
<h2>{{ eventInfo.name }}</h2>
|
||||
<h3>{{ eventInfo.date }}</h3>
|
||||
<h3>{{ eventInfo.location }}</h3>
|
||||
<h3>Selected tickets</h3>
|
||||
<table class="price-table" v-for="event in selectedSeats">
|
||||
<tr v-if="Object.keys( event.selectedSeats ).length">
|
||||
<h4>{{ event.name }}</h4>
|
||||
</tr>
|
||||
<tr v-for="ticket in event.selectedSeats">
|
||||
<td>{{ ticket.name }} ({{ ticket.ageGroup }})</td>
|
||||
<td>{{ eventInfo[ 'currency' ] }} {{ ticket[ 'price' ] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Total: {{ eventInfo[ 'currency' ] }} {{ total }}</h3>
|
||||
<router-link to="/cart">To cart</router-link>
|
||||
</div>
|
||||
<div class="noseatplan">
|
||||
<h3>Available tickets</h3>
|
||||
<div class="wrapper">
|
||||
<div v-for="ticket in tickets">
|
||||
{{ eventInfo[ 'categories' ][ ticket.category ][ 'name' ] }}<br>
|
||||
<div v-for="ticketOption in eventInfo[ 'ageGroups' ]" class="ticket">
|
||||
<div>
|
||||
{{ ticketOption.name }} <div style="display: inline" v-if="ticketOption.age">({{ ticketOption.age }})</div> {{ eventInfo.currency }} {{ eventInfo[ 'categories' ][ ticket.category ][ 'price' ][ ticketOption.id ] }} <span class="material-symbols-outlined">add</span> Selected <span class="material-symbols-outlined">remove</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'noseatplan',
|
||||
props: {
|
||||
ticketID: String
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
tickets: { 'ticket1': { 'name': 'Ticket 1', 'id': 'ticket1', 'category': 1 }, 'ticket2': { 'name': 'Ticket 2', 'id': 'ticket2', 'category': 2 } },
|
||||
eventInfo: { 'name': 'TestEvent', 'location': 'TestLocation', 'date': 'TestDate', 'RoomName': 'TestRoom', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99 years' }, '2':{ 'id': 2, 'name': 'Adult', 'age': null } }, 'ageGroupCount':2, 'stage': true },
|
||||
selectedSeats: {},
|
||||
pricingCurrentlySelected: {},
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadPreviouslySelected () {
|
||||
/*
|
||||
This function is called whenever the data on the webpage is to be reloaded
|
||||
*/
|
||||
|
||||
// load data from cart and set up cart if not available
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : { 'name': this.eventInfo.name, 'date': this.eventInfo.date, 'location': this.eventInfo.location, 'currency': this.eventInfo.currency };
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let showError = false
|
||||
for ( let i in data ) {
|
||||
if ( this.seating[ data[ i ][ 'row' ] ][ 'content' ][ data[ i ][ 'seat' ] ][ 'available' ] ) {
|
||||
this.seating[ data[ i ][ 'row' ] ][ 'content' ][ data[ i ][ 'seat' ] ][ 'selected' ] = true;
|
||||
} else {
|
||||
showError = true;
|
||||
delete data[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( showError ) {
|
||||
// TODO: Show popup that no more tickets in a category are available
|
||||
}
|
||||
|
||||
|
||||
// check if no ticket selected and prevent writing if no ticket
|
||||
// selected to not show too many events
|
||||
let isEmpty = sessionStorage.getItem( 'selectedTicket' ) ? false : true;
|
||||
|
||||
if ( !isEmpty ) {
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
}
|
||||
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
},
|
||||
sumUp () {
|
||||
// This function calculates the total price of the tickets for this event.
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
|
||||
let price = 0;
|
||||
for ( let i in cart ) {
|
||||
for ( let entry in cart[ i ][ 'selectedSeats' ] ) {
|
||||
price += parseInt( cart[ i ][ 'selectedSeats' ][ entry ][ 'price' ] );
|
||||
}
|
||||
}
|
||||
|
||||
let back = {};
|
||||
|
||||
back[ 'total' ] = price;
|
||||
back[ 'currency' ] = this.eventInfo.currency;
|
||||
|
||||
this.total = price;
|
||||
|
||||
|
||||
// check if no ticket selected and prevent writing if no ticket
|
||||
// selected to not show too many events
|
||||
let isEmpty = sessionStorage.getItem( 'selectedTicket' ) ? false : true;
|
||||
|
||||
if ( !isEmpty ) {
|
||||
sessionStorage.setItem( 'backend', JSON.stringify( back ) );
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
}
|
||||
},
|
||||
selectSeat( placeID, rowID ) {
|
||||
/*
|
||||
This function allows the user to select a seat and deselect it, if it has previously
|
||||
been selected.
|
||||
*/
|
||||
sessionStorage.setItem( 'tempStorage', JSON.stringify( { 1:[ placeID, rowID ] } ) );
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : {};
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let isDeleting = false;
|
||||
|
||||
for ( let i in data ) {
|
||||
if ( data[ i ][ 'seat' ] == placeID && data[ i ][ 'row' ] == rowID ) {
|
||||
delete data[ i ];
|
||||
isDeleting = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.seating[ rowID ][ 'content' ][ placeID ][ 'selected' ] = !isDeleting;
|
||||
|
||||
if ( isDeleting ) {
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
} else {
|
||||
if ( this.eventInfo.ageGroupCount > 1 ) {
|
||||
$( '#overlay' ).show( 200 );
|
||||
} else {
|
||||
this.storeSeat( '1' );
|
||||
}
|
||||
}
|
||||
|
||||
this.pricingCurrentlySelected = this.eventInfo[ 'categories' ][ this.seating[ rowID ][ 'content' ][ placeID ][ 'category' ] ][ 'price' ];
|
||||
},
|
||||
closePopup () {
|
||||
// This function closes the popup and sets the seat to not selected
|
||||
$( '#overlay' ).hide( 200 );
|
||||
let seat = JSON.parse( sessionStorage.getItem( 'tempStorage' ) );
|
||||
this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ][ 'selected' ] = false;
|
||||
},
|
||||
storeSeat( ticketOption ) {
|
||||
/*
|
||||
This function stores a ticket into the event's selected seat sessionStorage.
|
||||
*/
|
||||
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : { 'name': this.eventInfo.name, 'date': this.eventInfo.date, 'location': this.eventInfo.location, 'currency': this.eventInfo.currency };
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let seat = JSON.parse( sessionStorage.getItem( 'tempStorage' ) );
|
||||
|
||||
let ticket = this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ];
|
||||
let ticketData = { 'name': ticket[ 'name' ], 'categoryID': ticketOption, 'category': this.eventInfo[ 'categories' ][ ticket[ 'category' ] ], 'price': this.eventInfo[ 'categories' ][ this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ][ 'category' ] ][ 'price' ][ ticketOption ], 'row':seat[ 1 ][ 1 ], 'seat':seat[ 1 ][ 0 ], 'ageGroup': this.eventInfo[ 'ageGroups' ][ ticketOption ][ 'name' ] };
|
||||
data[ String( seat[ 1 ][ 1 ] ) + String( seat[ 1 ][ 0 ] ) ] = ticketData;
|
||||
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
|
||||
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
$( '#overlay' ).hide( 200 );
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.loadPreviouslySelected();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.seatingWrapper {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar';
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
grid-area: sidebar;
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.noseatplan {
|
||||
grid-area: main;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: justify;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
width: 30%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: justify;
|
||||
justify-content: justify;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.ticket {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var( --overlay-color );
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.popup {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
background-color: var( --background-color );
|
||||
height: 60%;
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.popup-content-wrapper {
|
||||
display: flex;
|
||||
height: 90%;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.close-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.close-button {
|
||||
cursor: pointer;
|
||||
margin-right: 3vh;
|
||||
margin-top: 3vh;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
border-radius: 20px;
|
||||
border-style: none;
|
||||
padding: 10px 40px;
|
||||
transition: 0.6s;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: var( --accent-background-hover );
|
||||
transition: 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.price-table {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
208
src/webapp/src/components/notifications/notifications.vue
Normal file
208
src/webapp/src/components/notifications/notifications.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div id="notifications" @click="handleNotifications();">
|
||||
<div class="message-box" :class="location">
|
||||
<div class="message-container" :class="messageType">
|
||||
<span class="material-symbols-outlined types hide" v-if="messageType == 'hide'">question_mark</span>
|
||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'ok'" style="background-color: green;">done</span>
|
||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'error'" style="background-color: red;">close</span>
|
||||
<span class="material-symbols-outlined types progress-spinner" v-else-if="messageType == 'progress'" style="background-color: blue;">progress_activity</span>
|
||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'info'" style="background-color: lightblue;">info</span>
|
||||
<span class="material-symbols-outlined types" v-else-if="messageType == 'warning'" style="background-color: orangered;">warning</span>
|
||||
<p class="message">{{ message }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'notifications',
|
||||
props: {
|
||||
location: {
|
||||
type: String,
|
||||
'default': 'topleft',
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
notifications: {},
|
||||
queue: [],
|
||||
message: '',
|
||||
messageType: 'hide',
|
||||
notificationDisplayTime: 0,
|
||||
notificationPriority: 'normal',
|
||||
currentlyDisplayedNotificationID: 0,
|
||||
currentID: { 'critical': 0, 'medium': 1000, 'low': 100000 },
|
||||
displayTimeCurrentNotification: 0,
|
||||
notificationScheduler: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createNotification( message, showDuration, messageType, priority ) {
|
||||
/*
|
||||
Takes a notification options array that contains: message, showDuration (in seconds), messageType (ok, error, progress, info) and priority (low, normal, critical).
|
||||
Returns a notification ID which can be used to cancel the notification. The component will throttle notifications and display
|
||||
one at a time and prioritize messages with higher priority. Use vue refs to access these methods.
|
||||
*/
|
||||
let id = 0;
|
||||
|
||||
if ( priority === 'critical' ) {
|
||||
this.currentID[ 'critical' ] += 1;
|
||||
id = this.currentID[ 'critical' ];
|
||||
} else if ( priority === 'normal' ) {
|
||||
this.currentID[ 'medium' ] += 1;
|
||||
id = this.currentID[ 'medium' ];
|
||||
} else if ( priority === 'low' ) {
|
||||
this.currentID[ 'low' ] += 1;
|
||||
id = this.currentID[ 'low' ];
|
||||
}
|
||||
this.notifications[ id ] = { 'message': message, 'showDuration': showDuration, 'messageType': messageType, 'priority': priority, 'id': id };
|
||||
this.queue.push( id );
|
||||
console.log( 'scheduled notification: ' + id + ' (' + message + ')' );
|
||||
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
|
||||
this.handleNotifications();
|
||||
}
|
||||
return id;
|
||||
},
|
||||
cancelNotification ( id ) {
|
||||
/*
|
||||
This method deletes a notification and, in case the notification is being displayed, hides it.
|
||||
*/
|
||||
try {
|
||||
delete notifications[ id ];
|
||||
delete this.queue[ this.queue.findIndex( id ) ];
|
||||
} catch ( error ) {
|
||||
console.log( 'notification to be deleted is nonexistent or currently being displayed' );
|
||||
}
|
||||
if ( this.currentlyDisplayedNotificationID == id ) {
|
||||
this.handleNotifications();
|
||||
}
|
||||
},
|
||||
handleNotifications () {
|
||||
/*
|
||||
This methods should NOT be called in any other component than this one!
|
||||
*/
|
||||
this.displayTimeCurrentNotification = 0;
|
||||
this.notificationDisplayTime = 0;
|
||||
this.message = '';
|
||||
this.queue.sort();
|
||||
if ( this.queue.length > 0 ) {
|
||||
this.message = this.notifications[ this.queue[ 0 ] ][ 'message' ];
|
||||
this.messageType = this.notifications[ this.queue[ 0 ] ][ 'messageType' ];
|
||||
this.priority = this.notifications[ this.queue[ 0 ] ][ 'priority' ];
|
||||
this.currentlyDisplayedNotificationID = this.notifications[ this.queue[ 0 ] ][ 'id' ];
|
||||
this.notificationDisplayTime = this.notifications[ this.queue[ 0 ] ][ 'showDuration' ];
|
||||
this.queue.reverse();
|
||||
this.queue.pop();
|
||||
} else {
|
||||
this.messageType = 'hide';
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.notificationScheduler = setInterval( () => {
|
||||
if ( this.displayTimeCurrentNotification >= this.notificationDisplayTime ) {
|
||||
this.handleNotifications();
|
||||
} else {
|
||||
this.displayTimeCurrentNotification += 0.5;
|
||||
}
|
||||
}, 500 );
|
||||
},
|
||||
unmounted ( ) {
|
||||
clearInterval( this.notificationScheduler );
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.message-box {
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
color: white;
|
||||
height: 10vh;
|
||||
width: 15vw;
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
.topleft {
|
||||
top: 3vh;
|
||||
left: 0.5vw;
|
||||
}
|
||||
|
||||
.topright {
|
||||
top: 3vh;
|
||||
right: 0.5vw;
|
||||
}
|
||||
|
||||
.bottomright {
|
||||
bottom: 3vh;
|
||||
right: 0.5vw;
|
||||
}
|
||||
|
||||
.bottomleft {
|
||||
top: 3vh;
|
||||
right: 0.5vw;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
opacity: 1;
|
||||
transition: all 0.5s;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.types {
|
||||
color: white;
|
||||
border-radius: 100%;
|
||||
margin-right: auto;
|
||||
margin-left: 5%;
|
||||
padding: 1.5%;
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.message {
|
||||
margin-right: 5%;
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
.ok {
|
||||
background-color: rgb(1, 71, 1);
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: rgb(114, 1, 1);
|
||||
}
|
||||
|
||||
.info {
|
||||
background-color: rgb(44, 112, 151);
|
||||
}
|
||||
|
||||
.warning {
|
||||
background-color: orange;
|
||||
}
|
||||
|
||||
.hide {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.progress {
|
||||
background-color: rgb(0, 0, 99);
|
||||
}
|
||||
|
||||
.progress-spinner {
|
||||
animation: spin 2s infinite linear;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate( 0deg );
|
||||
}
|
||||
to {
|
||||
transform: rotate( 720deg );
|
||||
}
|
||||
}
|
||||
</style>
|
||||
180
src/webapp/src/components/notifications/popups.vue
Normal file
180
src/webapp/src/components/notifications/popups.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div id="popup-backdrop">
|
||||
<div class="popup-container">
|
||||
<div class="popup" :class="size">
|
||||
<div class="close-wrapper"><span class="material-symbols-outlined close-button" @click="closePopup( 'cancel' );" title="Close this popup">close</span></div>
|
||||
<div class="message-container">
|
||||
<div v-if="contentType === 'string'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<div style="width: 100%; margin-top: 3%;">
|
||||
<button @click="closePopup( 'ok' )" title="Close popup">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'html'" v-html="data.message" class="options"></div>
|
||||
<div v-else-if="contentType === 'settings'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<settings v-model:settings="data.options"></settings>
|
||||
<div style="width: 100%; margin-top: 3%;">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes">Save</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'confirm'" class="confirm options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<div style="width: 100%; margin-top: 3%;">
|
||||
<button @click="closePopup( 'ok' )" title="Confirm operation">Ok</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel operation">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'dropdown'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<select id="select" v-model="data.selected">
|
||||
<option v-for="selectOption in data.options" :value="selectOption.value">{{ selectOption.displayName }}</option>
|
||||
</select>
|
||||
<div style="width: 100%; margin-top: 3%;">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes">Save</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Options to be passed in: html, settings (for settings component), strings, confirm, dropdowns, selection -->
|
||||
|
||||
<script>
|
||||
import settings from '@/components/settings/settings.vue';
|
||||
export default {
|
||||
name: 'popups',
|
||||
components: {
|
||||
settings,
|
||||
},
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
'default': 'normal',
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
contentType: 'dropdown',
|
||||
data: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closePopup( message ) {
|
||||
$( '#popup-backdrop' ).fadeOut( 300 );
|
||||
if ( message ) {
|
||||
this.$emit( 'status', message );
|
||||
this.$emit( 'data', this.data );
|
||||
}
|
||||
},
|
||||
openPopup ( message, options, dataType, selected ) {
|
||||
let data = { 'message': message ? message : 'No message defined on method call!!', 'options': options ? options : { '1': { 'value': 'undefined', 'displayName': 'No options specified in call' } }, 'selected': selected ? selected : '' };
|
||||
this.data = data;
|
||||
this.contentType = dataType ? dataType : 'string';
|
||||
$( '#popup-backdrop' ).fadeIn( 300 );
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#popup-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: var( --overlay-color );
|
||||
display: none;
|
||||
}
|
||||
|
||||
.popup-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.close-wrapper {
|
||||
width: 100%;
|
||||
height: 5%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
margin-right: 1vw;
|
||||
margin-top: 2vw;
|
||||
font-size: 200%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.popup {
|
||||
border: none;
|
||||
border-radius: 20px;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
.small {
|
||||
width: 40%;
|
||||
height: 40%;
|
||||
}
|
||||
|
||||
.normal {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.big {
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
.bigger {
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
}
|
||||
|
||||
.huge {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
height: 90%;
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.options {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: visible;
|
||||
min-height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.options button {
|
||||
padding: 1% 2%;
|
||||
display: inline-block;
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.options button:hover {
|
||||
background-color: var( --accent-background-hover );
|
||||
}
|
||||
</style>
|
||||
379
src/webapp/src/components/seatplan.vue
Normal file
379
src/webapp/src/components/seatplan.vue
Normal file
@@ -0,0 +1,379 @@
|
||||
<template>
|
||||
<div class="seatingWrapper">
|
||||
<div class="sidebar">
|
||||
<h2>{{ eventInfo.name }}</h2>
|
||||
<h3>{{ eventInfo.date }}</h3>
|
||||
<h3>{{ eventInfo.location }}</h3>
|
||||
<h3>Selected tickets</h3>
|
||||
<table class="price-table" v-for="event in selectedSeats">
|
||||
<tr v-if="Object.keys( event.selectedSeats ).length">
|
||||
<h4>{{ event.name }}</h4>
|
||||
</tr>
|
||||
<tr v-for="ticket in event.selectedSeats">
|
||||
<td>{{ ticket.name }} ({{ ticket.ageGroup }})</td>
|
||||
<td>{{ eventInfo[ 'currency' ] }} {{ ticket[ 'price' ] }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Total: {{ eventInfo[ 'currency' ] }} {{ total }}</h3>
|
||||
<router-link to="/cart">To cart</router-link>
|
||||
</div>
|
||||
<div class="seatingPlan">
|
||||
<h3>Seating plan</h3>
|
||||
<p>{{ eventInfo.RoomName }}</p>
|
||||
<p class="stage" v-if="eventInfo.stage">Stage</p>
|
||||
<div class="seating">
|
||||
<table>
|
||||
<tr v-for="row in seating">
|
||||
<td>
|
||||
{{ row.name }}
|
||||
</td>
|
||||
<td v-for="place in row.content">
|
||||
<div :class="place.category" class="active" v-if="place.available" @click="selectSeat( place.id, row.id )">
|
||||
<div v-if="place.selected" :title="row.name + ', ' + place.name + ' is currently selected, click to deselect'">
|
||||
<span class="material-symbols-outlined">done</span>
|
||||
</div>
|
||||
<div v-else :title="row.name + ', ' + place.name + ' is not currently selected, click to select'">
|
||||
<span class="material-symbols-outlined">living</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="occupied">
|
||||
<span class="material-symbols-outlined">close</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overlay" id="overlay">
|
||||
<div class="popup">
|
||||
<div class="popup-content">
|
||||
<div class="close-container">
|
||||
<span class="material-symbols-outlined close-button" @click="closePopup()">close</span>
|
||||
</div>
|
||||
<div class="popup-content-wrapper">
|
||||
<h3>Choose a ticket option</h3>
|
||||
<ul v-for="group in eventInfo.ageGroups">
|
||||
<li @click="storeSeat( group.id )" class="option">{{ group.name }} <i v-if="group.age">(0 - 15.99 years)</i> - {{ eventInfo.currency }} {{ pricingCurrentlySelected[ group.id ] }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overlay" id="placeNotAvailable">
|
||||
<div class="popup">
|
||||
<div class="popup-content">
|
||||
<div class="close-container">
|
||||
<span class="material-symbols-outlined close-button" @click="closePlaceNotAvailablePopup()">close</span>
|
||||
</div>
|
||||
<div class="popup-content-wrapper">
|
||||
<h3>One or more seat(s) you have previously selected is/are no longer available!</h3>
|
||||
<p>Please select another one!</p>
|
||||
<button class="button" @click="closePlaceNotAvailablePopup()">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'seatplan',
|
||||
props: {
|
||||
ticketID: String
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seating: { 'r1': { 'name': 'Row 1', 'id': 'r1', 'content':{ 'S1':{ 'name': 'Seat 1', 'id': 'S1', 'available': true, 'selected': false, 'category':'1' } } }, 'r2': { 'name': 'Row 2', 'id': 'r2', 'content':{ 'S1':{ 'name': 'S1', 'id': 'S1', 'available': true, 'selected': false, 'category':'2' } } } },
|
||||
eventInfo: { 'name': 'TestEvent2', 'location': 'TestLocation2', 'date': 'TestDate2', 'RoomName': 'TestRoom2', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult', 'age': null } }, 'ageGroupCount': 2, 'stage': true, 'maxTickets': 2 },
|
||||
selectedSeats: {},
|
||||
pricingCurrentlySelected: {},
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadPreviouslySelected () {
|
||||
/*
|
||||
This function is called whenever the data on the webpage is to be reloaded
|
||||
*/
|
||||
|
||||
// load data from cart and set up cart if not available
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : { 'name': this.eventInfo.name, 'date': this.eventInfo.date, 'location': this.eventInfo.location, 'currency': this.eventInfo.currency };
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let showError = false
|
||||
for ( let i in data ) {
|
||||
if ( this.seating[ data[ i ][ 'row' ] ][ 'content' ][ data[ i ][ 'seat' ] ][ 'available' ] ) {
|
||||
this.seating[ data[ i ][ 'row' ] ][ 'content' ][ data[ i ][ 'seat' ] ][ 'selected' ] = true;
|
||||
} else {
|
||||
showError = true;
|
||||
delete data[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( showError ) {
|
||||
setTimeout( function () {
|
||||
$( '#placeNotAvailable' ).show( 200 );
|
||||
console.log( 'showing error message' );
|
||||
}, 500 );
|
||||
}
|
||||
|
||||
// check if no ticket selected and prevent writing if no ticket
|
||||
// selected to not show too many events
|
||||
let isEmpty = sessionStorage.getItem( 'selectedTicket' ) ? false : true;
|
||||
|
||||
if ( !isEmpty ) {
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
}
|
||||
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
},
|
||||
sumUp () {
|
||||
// This function calculates the total price of the tickets for this event.
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
|
||||
let price = 0;
|
||||
for ( let i in cart ) {
|
||||
for ( let entry in cart[ i ][ 'selectedSeats' ] ) {
|
||||
price += parseInt( cart[ i ][ 'selectedSeats' ][ entry ][ 'price' ] );
|
||||
}
|
||||
}
|
||||
|
||||
let back = {};
|
||||
|
||||
back[ 'total' ] = price;
|
||||
back[ 'currency' ] = this.eventInfo.currency;
|
||||
|
||||
this.total = price;
|
||||
|
||||
|
||||
// check if no ticket selected and prevent writing if no ticket
|
||||
// selected to not show too many events
|
||||
let isEmpty = sessionStorage.getItem( 'selectedTicket' ) ? false : true;
|
||||
|
||||
if ( !isEmpty ) {
|
||||
sessionStorage.setItem( 'backend', JSON.stringify( back ) );
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
}
|
||||
},
|
||||
closePlaceNotAvailablePopup () {
|
||||
$( '#placeNotAvailable' ).hide( 300 );
|
||||
},
|
||||
selectSeat( placeID, rowID ) {
|
||||
/*
|
||||
This function allows the user to select a seat and deselect it, if it has previously
|
||||
been selected.
|
||||
*/
|
||||
sessionStorage.setItem( 'tempStorage', JSON.stringify( { 1:[ placeID, rowID ] } ) );
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : {};
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let isDeleting = false;
|
||||
|
||||
for ( let i in data ) {
|
||||
if ( data[ i ][ 'seat' ] == placeID && data[ i ][ 'row' ] == rowID ) {
|
||||
delete data[ i ];
|
||||
isDeleting = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.seating[ rowID ][ 'content' ][ placeID ][ 'selected' ] = !isDeleting;
|
||||
|
||||
if ( isDeleting ) {
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
} else {
|
||||
if ( this.eventInfo.ageGroupCount > 1 ) {
|
||||
$( '#overlay' ).show( 200 );
|
||||
} else {
|
||||
this.storeSeat( '1' );
|
||||
}
|
||||
}
|
||||
|
||||
this.pricingCurrentlySelected = this.eventInfo[ 'categories' ][ this.seating[ rowID ][ 'content' ][ placeID ][ 'category' ] ][ 'price' ];
|
||||
},
|
||||
closePopup () {
|
||||
// This function closes the popup and sets the seat to not selected
|
||||
$( '#overlay' ).hide( 200 );
|
||||
let seat = JSON.parse( sessionStorage.getItem( 'tempStorage' ) );
|
||||
this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ][ 'selected' ] = false;
|
||||
},
|
||||
storeSeat( ticketOption ) {
|
||||
/*
|
||||
This function stores a ticket into the event's selected seat sessionStorage.
|
||||
*/
|
||||
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
cart[ this.ticketID ?? 'default' ] = cart[ this.ticketID ?? 'default' ] ? cart[ this.ticketID ?? 'default' ] : { 'name': this.eventInfo.name, 'date': this.eventInfo.date, 'location': this.eventInfo.location, 'currency': this.eventInfo.currency };
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let data = cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] ? cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] : {};
|
||||
|
||||
let seat = JSON.parse( sessionStorage.getItem( 'tempStorage' ) );
|
||||
|
||||
let ticket = this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ];
|
||||
let ticketData = { 'name': ticket[ 'name' ], 'categoryID': ticketOption, 'category': this.eventInfo[ 'categories' ][ ticket[ 'category' ] ], 'price': this.eventInfo[ 'categories' ][ this.seating[ seat[ 1 ][ 1 ] ][ 'content' ][ seat[ 1 ][ 0 ] ][ 'category' ] ][ 'price' ][ ticketOption ], 'row':seat[ 1 ][ 1 ], 'seat':seat[ 1 ][ 0 ], 'ageGroup': this.eventInfo[ 'ageGroups' ][ ticketOption ][ 'name' ] };
|
||||
data[ String( seat[ 1 ][ 1 ] ) + String( seat[ 1 ][ 0 ] ) ] = ticketData;
|
||||
|
||||
cart[ this.ticketID ?? 'default' ][ 'selectedSeats' ] = data;
|
||||
|
||||
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
$( '#overlay' ).hide( 200 );
|
||||
this.selectedSeats = cart;
|
||||
this.sumUp();
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.loadPreviouslySelected();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.seatingWrapper {
|
||||
display: grid;
|
||||
grid-template-areas:
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar'
|
||||
'main main main sidebar';
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
grid-area: sidebar;
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.seatingPlan {
|
||||
grid-area: main;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: justify;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.active {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.occupied {
|
||||
background-color: var( --hover-color );
|
||||
padding: 0.4%;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var( --overlay-color );
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.popup {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.popup-content {
|
||||
background-color: var( --background-color );
|
||||
height: 60%;
|
||||
width: 50%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.popup-content-wrapper {
|
||||
display: flex;
|
||||
height: 90%;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.close-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.close-button {
|
||||
cursor: pointer;
|
||||
margin-right: 3vh;
|
||||
margin-top: 3vh;
|
||||
}
|
||||
|
||||
.option {
|
||||
list-style: none;
|
||||
padding: 7px 15px;
|
||||
border-radius: 10px;
|
||||
border-color: var( --primary-color );
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
margin: 3px 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.stage {
|
||||
border-color: var( --primary-color );
|
||||
border-style: solid;
|
||||
width: 80%;
|
||||
height: 7%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
font-weight: bold;
|
||||
font-size: 110%;
|
||||
border-radius: 20px;
|
||||
border-style: none;
|
||||
padding: 10px 40px;
|
||||
transition: 0.6s;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: var( --accent-background-hover );
|
||||
transition: 0.3s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.price-table {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
337
src/webapp/src/components/seatplan/editor/properties.vue
Normal file
337
src/webapp/src/components/seatplan/editor/properties.vue
Normal file
@@ -0,0 +1,337 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="properties">
|
||||
<h2>Properties</h2>
|
||||
<h3>General settings</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Zoom Factor:</td>
|
||||
<td>
|
||||
{{ Math.round( zoomFactor * 1000 ) / 1000 }}x
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Row naming scheme</td>
|
||||
<td>
|
||||
<select v-model="generalSettings[ 'namingScheme' ]">
|
||||
<option value="numeric">Numeric</option>
|
||||
<option value="alphabetic">Alphabetic</option>
|
||||
<option value="roman">Roman numerals</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Component settings</h3>
|
||||
<table v-if="active">
|
||||
|
||||
<!-- H/W/Y/X for rendering -->
|
||||
|
||||
<tr>
|
||||
<td>Position X:</td>
|
||||
<td>
|
||||
<input type="number" min="20" v-model="internal[ active ].x" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Position Y:</td>
|
||||
<td>
|
||||
<input type="number" min="20" v-model="internal[ active ].y" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Width:</td>
|
||||
<td>
|
||||
<input type="number" min="20" v-model="internal[ active ].w" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Height:</td>
|
||||
<td>
|
||||
<input type="number" min="20" v-model="internal[ active ].h" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Starting row for row counting and rendering -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'seat'">
|
||||
<td>Starting row:</td>
|
||||
<td>
|
||||
<input type="number" min="1" max="20" v-model="internal[ active ].startingRow" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- ORIGIN of component for rendering -->
|
||||
|
||||
<tr>
|
||||
<td>Origin:</td>
|
||||
<td>
|
||||
<input type="number" min="1" max="4" v-model="internal[ active ].origin" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- TEXT Settings -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'text'">
|
||||
<td>Text:</td>
|
||||
<td>
|
||||
<input type="text" v-model="internal[ active ].text.text" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr v-if="internal[ active ].type == 'text'">
|
||||
<td>Text Size:</td>
|
||||
<td>
|
||||
<input type="number" min="1" max="100" v-model="internal[ active ].text.textSize" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr v-if="internal[ active ].type == 'text'">
|
||||
<td>Text colour:</td>
|
||||
<td>
|
||||
<input type="text" data-coloris v-model="internal[ active ].text.colour" onkeydown="return false;">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- CATEGORY -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'seat' || internal[ active ].type == 'stand'">
|
||||
<td>Category:</td>
|
||||
<td>
|
||||
<select v-model="internal[ active ].seatCountingStartingPoint" @change="resubmit()">
|
||||
<option v-for="category in categories" :value="category.value">{{ category.name }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- SECTOR -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'seat' || internal[ active ].type == 'stand'">
|
||||
<td>Sector:</td>
|
||||
<td>
|
||||
<input type="text" min="1" max="4" v-model="internal[ active ].sector" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- TICKET COUNT -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'stand'">
|
||||
<td>Ticket count:</td>
|
||||
<td>
|
||||
<input type="number" min="1" max="4" v-model="internal[ active ].ticketCount" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- SEAT NUMBERING for seats -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'seat'">
|
||||
<td>Component number:
|
||||
<div class="info-container" @mouseenter="showInfo( 'componentNumber' )" @mouseleave="hideInfo( 'componentNumber' )">
|
||||
<span class="material-symbols-outlined info-icon">info</span>
|
||||
<div class="info-box" id="componentNumber">
|
||||
<div class="info-box-container">
|
||||
<div>
|
||||
With this you can change what the order of the components is which is used to determine the seat numbering. Read more <a href="https://libreevent.janishutz.com/docs/admin-panel/seatplan-editor#component-number-property">here</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" min="1" max="4" v-model="internal[ active ].seatNumberingPosition" @change="resubmit()">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- SEAT NUMBERING direction -->
|
||||
|
||||
<tr v-if="internal[ active ].type == 'seat'">
|
||||
<td>Numbering direction:</td>
|
||||
<td>
|
||||
<select min="20" v-model="internal[ active ].numberingDirection" @change="resubmit()">
|
||||
<option value="left">Left to right</option>
|
||||
<option value="right">Right to left</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Component type selector -->
|
||||
|
||||
<tr>
|
||||
<td>Type:</td>
|
||||
<td>
|
||||
<select min="20" v-model="internal[ active ].type" @change="resubmit()">
|
||||
<option value="seat">Seat</option>
|
||||
<option value="stand">Stand</option>
|
||||
<option value="stage">Stage</option>
|
||||
<option value="text">Text</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- SHAPE of component if not a text element -->
|
||||
|
||||
<tr v-if="internal[ active ].type != 'text'">
|
||||
<td>Shape:</td>
|
||||
<td>
|
||||
<select min="20" v-model="internal[ active ].shape" @change="resubmit()">
|
||||
<option value="rectangular">Rectangular</option>
|
||||
<option value="trapezoid">Trapezoid</option>
|
||||
<option value="circular">Circular</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div v-else class="no-select">
|
||||
<b>No component selected</b><br>
|
||||
Please select one to view details here.
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'propertiesSeatplan',
|
||||
props: {
|
||||
draggables: {
|
||||
type: Object,
|
||||
"default": {}
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
generalSettings: {
|
||||
type: Object,
|
||||
"default": {},
|
||||
},
|
||||
zoomFactor: {
|
||||
type: Number,
|
||||
"default": 1
|
||||
},
|
||||
active: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
historyPos: {
|
||||
type: Number,
|
||||
"default": 0,
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
internal: {},
|
||||
categories: { '1':{} },
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// TODO: Load categories from server
|
||||
loadInternal () {
|
||||
for ( let value in this.draggables ) {
|
||||
this.internal[ value ] = {};
|
||||
for ( let info in this.draggables[ value ] ) {
|
||||
if ( info === 'w' || info === 'h' || info === 'x' || info === 'y' ) {
|
||||
this.internal[ value ][ info ] = Math.round( ( this.draggables[ value ][ info ] / this.scaleFactor ) * 1000 ) / 1000;
|
||||
} else {
|
||||
this.internal[ value ][ info ] = this.draggables[ value ][ info ];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
resubmit () {
|
||||
let ret = {};
|
||||
for ( let value in this.internal ) {
|
||||
ret[ value ] = {};
|
||||
for ( let info in this.internal[ value ] ) {
|
||||
if ( info === 'w' || info === 'h' || info === 'x' || info === 'y' ) {
|
||||
ret[ value ][ info ] = this.internal[ value ][ info ] * this.scaleFactor;
|
||||
} else {
|
||||
ret[ value ][ info ] = this.internal[ value ][ info ];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit( 'updated', ret );
|
||||
},
|
||||
showInfo ( box ) {
|
||||
$( '#' + box ).stop();
|
||||
$( '#' + box ).fadeIn( 300 );
|
||||
},
|
||||
hideInfo ( box ) {
|
||||
$( '#' + box ).stop();
|
||||
$( '#' + box ).fadeOut( 300 );
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
draggables ( value ) {
|
||||
this.loadInternal();
|
||||
},
|
||||
active ( value ) {
|
||||
this.loadInternal();
|
||||
},
|
||||
scaleFactor ( value ) {
|
||||
this.loadInternal();
|
||||
},
|
||||
historyPos ( value ) {
|
||||
this.loadInternal();
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.loadInternal();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.info-container {
|
||||
display: inline;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
font-size: 100%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
color: var( --primary-color );
|
||||
text-align: center;
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
width: 20vw;
|
||||
height: 20vh;
|
||||
background-color: var( --hint-color );
|
||||
border-radius: 20px;
|
||||
top: 125%;
|
||||
right: -9.3vw;
|
||||
}
|
||||
|
||||
.info-box::before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
bottom: 100%; /* At the bottom of the tooltip */
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 10px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent var( --hint-color ) transparent;
|
||||
}
|
||||
|
||||
.info-box-container {
|
||||
display: flex;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
padding: 10%;
|
||||
padding-top: 5%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
</style>
|
||||
397
src/webapp/src/components/seatplan/editor/window.vue
Normal file
397
src/webapp/src/components/seatplan/editor/window.vue
Normal file
@@ -0,0 +1,397 @@
|
||||
<!--
|
||||
* libreevent - window.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="window">
|
||||
<!-- TODO: Add additional div with v-if to check if a location has been selected and warn if not so. -->
|
||||
<properties class="properties" v-model:draggables="draggables" @updated="handleUpdate" :scale-factor="scaleFactor" :active="active" :history-pos="historyPos" :zoom-factor="zoomFactor" v-model:general-settings="generalSettings"></properties>
|
||||
<div class="parent" id="parent">
|
||||
<div class="content-parent">
|
||||
<Vue3DraggableResizable v-for="draggable in draggables" :initW="draggable.w" :initH="draggable.h" v-model:x="draggable.x" v-model:y="draggable.y" v-model:w="draggable.w" v-model:h="draggable.h"
|
||||
v-model:active="draggable.active" v-model:draggable="draggable.draggable" :resizable="draggable.resizable" :parent="true" @activated="activateComponent( draggable.id );"
|
||||
@drag-end="saveHistory();" @resize-end="saveHistory();" @contextmenu="( e ) => { e.preventDefault(); }" class="draggable-box">
|
||||
<circularSeatplanComponent v-if="draggable.shape == 'circular' && draggable.type == 'seat'" :scale-factor="scaleFactor" :w="draggable.w" :h="draggable.h" :origin="draggable.origin" :starting-row="draggable.startingRow" :id="draggable.id" @seatingInfo="( info ) => { handleSeatCountInfo( info ); }"></circularSeatplanComponent>
|
||||
<trapezoidSeatplanComponent v-else-if="draggable.shape == 'trapezoid' && draggable.type == 'seat'" :scale-factor="scaleFactor" :w="draggable.w" :h="draggable.h" :origin="draggable.origin" :starting-row="draggable.startingRow" :id="draggable.id" @seatingInfo="( info ) => { handleSeatCountInfo( info ); }"></trapezoidSeatplanComponent>
|
||||
<rectangularSeatplanComponent v-else-if="draggable.shape == 'rectangular' && draggable.type == 'seat'" :scale-factor="scaleFactor" :w="draggable.w" :h="draggable.h" :origin="draggable.origin" :id="draggable.id" @seatingInfo="( info ) => { handleSeatCountInfo( info ); }"></rectangularSeatplanComponent>
|
||||
<stagesSeatplanComponent v-else-if="draggable.type == 'stage'" :origin="draggable.origin" :shape="draggable.shape"></stagesSeatplanComponent>
|
||||
<standingSeatplanComponent v-else-if="draggable.type == 'stand'" :origin="draggable.origin" :shape="draggable.shape"></standingSeatplanComponent>
|
||||
<textFieldSeatplanComponent v-else-if="draggable.type == 'text'" :text="draggable.text.text" :text-size="draggable.text.textSize" :colour="draggable.text.colour" :origin="draggable.origin" :scale-factor="scaleFactor"></textFieldSeatplanComponent>
|
||||
</Vue3DraggableResizable>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<button title="Go back to location settings" @click="this.$router.push( '/admin/locations' )"><span class="material-symbols-outlined">arrow_back</span></button>
|
||||
<button title="Undo [Ctrl + Z]" v-if="available.undo" @click="historyOp( 'undo' )"><span class="material-symbols-outlined">undo</span></button>
|
||||
<button title="Undo (unavailable)" v-else disabled><span class="material-symbols-outlined">undo</span></button>
|
||||
<button title="Redo [Ctrl + Y]" v-if="available.redo" @click="historyOp( 'redo' )"><span class="material-symbols-outlined">redo</span></button>
|
||||
<button title="Redo (unavailable)" v-else disabled><span class="material-symbols-outlined">redo</span></button>
|
||||
<button title="Zoom in [+]" @click="zoom( 0.2 )"><span class="material-symbols-outlined">zoom_in</span></button>
|
||||
<button title="Reset zoom [=]" @click="zoom( 1 );"><span class="material-symbols-outlined">center_focus_strong</span></button>
|
||||
<button title="Zoom out [-]" @click="zoom( -0.2 )"><span class="material-symbols-outlined">zoom_out</span></button>
|
||||
<button title="Add component [Ctrl + I]" @click="addNewElement()"><span class="material-symbols-outlined">add</span></button>
|
||||
<button title="Remove selected component [Delete]" @click="deleteSelected()"><span class="material-symbols-outlined">delete</span></button>
|
||||
<button title="Save this seatplan as a draft [Ctrl + S]" @click="saveDraft()"><span class="material-symbols-outlined">save</span></button>
|
||||
<button title="Deploy this seatplan (save it for use)" @click="deploy()"><span class="material-symbols-outlined">system_update_alt</span></button>
|
||||
</div>
|
||||
<notifications ref="notification" location="topleft"></notifications>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue3DraggableResizable from 'vue3-draggable-resizable';
|
||||
import properties from '@/components/seatplan/editor/properties.vue';
|
||||
import circularSeatplanComponent from '@/components/seatplan/seatplanComponents/seats/circular.vue';
|
||||
import rectangularSeatplanComponent from '@/components/seatplan/seatplanComponents/seats/rectangular.vue';
|
||||
import trapezoidSeatplanComponent from '@/components/seatplan/seatplanComponents/seats/trapezoid.vue';
|
||||
import stagesSeatplanComponent from '@/components/seatplan/seatplanComponents/stages.vue';
|
||||
import standingSeatplanComponent from '@/components/seatplan/seatplanComponents/standing.vue';
|
||||
import textFieldSeatplanComponent from '@/components/seatplan/seatplanComponents/textField.vue';
|
||||
import notifications from '@/components/notifications/notifications.vue';
|
||||
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css';
|
||||
|
||||
export default {
|
||||
'name': 'window',
|
||||
components: {
|
||||
Vue3DraggableResizable,
|
||||
properties,
|
||||
circularSeatplanComponent,
|
||||
rectangularSeatplanComponent,
|
||||
trapezoidSeatplanComponent,
|
||||
stagesSeatplanComponent,
|
||||
standingSeatplanComponent,
|
||||
textFieldSeatplanComponent,
|
||||
notifications,
|
||||
},
|
||||
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' } },
|
||||
available: { 'redo': false, 'undo': false },
|
||||
scaleFactor: 1,
|
||||
sizePoll: null,
|
||||
prevSize: { 'h': window.innerHeight, 'w': window.innerWidth },
|
||||
zoomFactor: 1,
|
||||
historyPos: 0,
|
||||
generalSettings: { 'namingScheme': 'numeric' },
|
||||
seatCountInfo: { 'data': {}, 'count': 0 },
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/*
|
||||
Coords are from top left corner of box.
|
||||
The below function is executed as the init hook (created hook)
|
||||
of vue.js, so whenever this particular page is loaded.
|
||||
It loads previous data (if available) and starts the event listeners
|
||||
for keyevents (like delete) and also check if the user uses a desktop
|
||||
browser that meets all the requirements for being able to use the editor
|
||||
reliably according to testing done.
|
||||
*/
|
||||
runHook () {
|
||||
let self = this;
|
||||
this.zoomFactor = sessionStorage.getItem( 'zoom' ) ? parseFloat( sessionStorage.getItem( 'zoom' ) ) : 1;
|
||||
|
||||
/*
|
||||
Keybinds:
|
||||
- Delete: delete selected object
|
||||
- Ctrl + S: Save
|
||||
- Ctrl + Z: Undo
|
||||
- Ctrl + Y: Redo
|
||||
*/
|
||||
document.onkeydown = function ( event ) {
|
||||
if ( event.key === 'Delete' ) {
|
||||
event.preventDefault();
|
||||
self.deleteSelected();
|
||||
} else if ( event.ctrlKey && event.key === 's' ) {
|
||||
event.preventDefault();
|
||||
self.saveDraft();
|
||||
} else if ( ( event.ctrlKey && event.key === 'y' ) ) {
|
||||
event.preventDefault();
|
||||
self.historyOp( 'redo' );
|
||||
} else if ( event.ctrlKey && event.key === 'z' ) {
|
||||
event.preventDefault();
|
||||
self.historyOp( 'undo' );
|
||||
} else if ( event.ctrlKey && event.key === 'i' ) {
|
||||
event.preventDefault();
|
||||
self.addNewElement();
|
||||
} else if ( event.key === '+' ) {
|
||||
self.zoom( 0.2 );
|
||||
} else if ( event.key === '-' ) {
|
||||
self.zoom( -0.2 );
|
||||
} else if ( event.key === '=' ) {
|
||||
self.zoom( 1 );
|
||||
}
|
||||
};
|
||||
|
||||
this.loadSeatplan();
|
||||
|
||||
if ( !sessionStorage.getItem( 'seatplan-history' ) ) {
|
||||
sessionStorage.setItem( 'seatplan-history', JSON.stringify( { '1': this.scaleDown( this.draggables ) } ) );
|
||||
}
|
||||
|
||||
let history = sessionStorage.getItem( 'seatplan-history' ) ? JSON.parse( sessionStorage.getItem( 'seatplan-history' ) ) : {};
|
||||
let count = parseInt( Object.keys( history ).length );
|
||||
|
||||
if ( count > parseInt( sessionStorage.getItem( 'historyPos' ) ) ) {
|
||||
this.available.redo = true;
|
||||
}
|
||||
|
||||
if ( parseInt( sessionStorage.getItem( 'historyPos' ) ) > 0 ) {
|
||||
this.available.undo = true;
|
||||
}
|
||||
|
||||
let supportedBrowser = [];
|
||||
this.save();
|
||||
// TODO: Add warning for untested browsers & suboptimal window sizes!
|
||||
},
|
||||
eventHandler ( e ) {
|
||||
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
|
||||
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
|
||||
this.loadSeatplan();
|
||||
}
|
||||
},
|
||||
loadSeatplan () {
|
||||
/*
|
||||
Calculate scale factor (this adds support for differently sized screens)
|
||||
900px is the "default" height
|
||||
*/
|
||||
|
||||
let height = $( document ).height() * 0.8;
|
||||
this.scaleFactor = ( height / 900 ) * this.zoomFactor;
|
||||
/*
|
||||
Load seatplan
|
||||
*/
|
||||
// TODO: load from server
|
||||
if ( sessionStorage.getItem( 'seatplan' ) ) {
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) );
|
||||
}
|
||||
|
||||
|
||||
for ( let element in this.draggables ) {
|
||||
if ( this.draggables[ element ].active ) {
|
||||
this.draggables[ element ].active = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
scaleDown ( valueArray ) {
|
||||
const allowedAttributes = [ 'w', 'h', 'x', 'y' ]
|
||||
let returnArray = {};
|
||||
for ( let entry in valueArray ) {
|
||||
returnArray[ entry ] = {};
|
||||
for ( let attributes in valueArray[ entry ] ) {
|
||||
if ( allowedAttributes.includes( attributes ) ) {
|
||||
returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] / this.scaleFactor ) * 1000 ) / 1000;
|
||||
} else {
|
||||
returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ];
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnArray;
|
||||
},
|
||||
scaleUp ( valueArray ) {
|
||||
const allowedAttributes = [ 'w', 'h', 'x', 'y' ]
|
||||
let returnArray = {};
|
||||
for ( let entry in valueArray ) {
|
||||
returnArray[ entry ] = {};
|
||||
for ( let attributes in valueArray[ entry ] ) {
|
||||
if ( allowedAttributes.includes( attributes ) ) {
|
||||
returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] * this.scaleFactor ) * 1000 ) / 1000;
|
||||
} else {
|
||||
returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ];
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnArray;
|
||||
},
|
||||
activateComponent ( id ) {
|
||||
this.active = id;
|
||||
},
|
||||
saveHistory () {
|
||||
let history = sessionStorage.getItem( 'seatplan-history' ) ? JSON.parse( sessionStorage.getItem( 'seatplan-history' ) ) : {};
|
||||
let count = parseInt( Object.keys( history ).length + 1 );
|
||||
this.historyPos = count;
|
||||
if ( count - 1 > parseInt( sessionStorage.getItem( 'historyPos' ) ) ) {
|
||||
for ( let i = parseInt( sessionStorage.getItem( 'historyPos' ) ) + 1; i < count; i++ ) {
|
||||
delete history[ i ];
|
||||
this.available.redo = false;
|
||||
}
|
||||
}
|
||||
|
||||
count = parseInt( Object.keys( history ).length + 1 );
|
||||
sessionStorage.setItem( 'historyPos', count );
|
||||
history[ count ] = this.scaleDown( this.draggables );
|
||||
sessionStorage.setItem( 'seatplan-history', JSON.stringify( history ) );
|
||||
|
||||
if ( parseInt( sessionStorage.getItem( 'historyPos' ) ) > 1 ) {
|
||||
this.available.undo = true;
|
||||
}
|
||||
|
||||
this.save();
|
||||
},
|
||||
historyOp ( action ) {
|
||||
if ( action === 'undo' ) {
|
||||
if ( parseInt( sessionStorage.getItem( 'historyPos' ) ) > 1 ) {
|
||||
sessionStorage.setItem( 'historyPos', parseInt( sessionStorage.getItem( 'historyPos' ) ) - 1 );
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan-history' ) )[ sessionStorage.getItem( 'historyPos' ) ] );
|
||||
this.available.redo = true;
|
||||
if ( parseInt( sessionStorage.getItem( 'historyPos' ) ) < 2 ) {
|
||||
this.available.undo = false;
|
||||
}
|
||||
} else {
|
||||
this.available.undo = false;
|
||||
}
|
||||
} else if ( action === 'redo' ) {
|
||||
if ( parseInt( Object.keys( JSON.parse( sessionStorage.getItem( 'seatplan-history' ) ) ).length ) > parseInt( sessionStorage.getItem( 'historyPos' ) ) ) {
|
||||
sessionStorage.setItem( 'historyPos', parseInt( sessionStorage.getItem( 'historyPos' ) ) + 1 );
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan-history' ) )[ sessionStorage.getItem( 'historyPos' ) ] );
|
||||
this.available.undo = true;
|
||||
if ( parseInt( Object.keys( JSON.parse( sessionStorage.getItem( 'seatplan-history' ) ) ).length ) < parseInt( sessionStorage.getItem( 'historyPos' ) ) + 1 ) {
|
||||
this.available.redo = false;
|
||||
}
|
||||
} else {
|
||||
this.available.redo = false;
|
||||
}
|
||||
}
|
||||
this.historyPos = sessionStorage.getItem( 'historyPos' );
|
||||
},
|
||||
save () {
|
||||
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
|
||||
},
|
||||
saveDraft () {
|
||||
// TODO: Save seat count and seat config to server as well
|
||||
let progressNotification = this.$refs.notification.createNotification( 'Saving as draft', 5, 'progress', 'normal' );
|
||||
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
|
||||
this.$refs.notification.createNotification( 'Saved as draft', 5, 'ok', 'normal' );
|
||||
// TODO: Save to server and add warning if no component has a seat start point if any component is a seat component
|
||||
},
|
||||
deploy () {
|
||||
// TODO: Save to server
|
||||
this.$refs.notification.createNotification( 'Deploying...', 5, 'progress', 'normal' );
|
||||
this.$refs.notification.createNotification( 'Deployed successfully', 5, 'ok', 'normal' );
|
||||
},
|
||||
addNewElement () {
|
||||
// TODO: Check that this algorithm actually works in practice. If not, replace with one that
|
||||
// searches for the first available ID or uses a var to determine ID.
|
||||
this.draggables[ Object.keys( this.draggables ).length + 1 ] = { 'x': 100, 'y':100, 'h': 100, 'w': 250, 'active': false, 'draggable': true, 'resizable': true, 'id': Object.keys( this.draggables ).length + 1, 'origin': 1, 'shape':'rectangular', 'type': 'seat', 'startingRow': 1, 'seatNumberingPosition': Object.keys( this.draggables ).length + 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' }, 'ticketCount': 1, 'numberingDirection': 'left' };
|
||||
this.saveHistory();
|
||||
document.getElementById( 'parent' ).scrollTop = 0;
|
||||
document.getElementById( 'parent' ).scrollLeft = 0;
|
||||
this.$refs.notification.createNotification( 'New component added successfully', 5, 'ok', 'normal' );
|
||||
},
|
||||
deleteSelected () {
|
||||
if ( this.active ) {
|
||||
this.draggables[ this.active ].active = true;
|
||||
if ( confirm( 'Do you really want to delete the selected item?' ) ) {
|
||||
delete this.draggables[ this.active ];
|
||||
this.saveHistory();
|
||||
this.active = 0;
|
||||
this.$refs.notification.createNotification( 'Successfully deleted component', 5, 'ok', 'normal' );
|
||||
}
|
||||
} else {
|
||||
this.$refs.notification.createNotification( 'Please select a seat first!', 5, 'error', 'normal' );
|
||||
}
|
||||
},
|
||||
handleUpdate ( value ) {
|
||||
this.draggables = value;
|
||||
this.selectedObject = value;
|
||||
this.saveHistory();
|
||||
},
|
||||
zoom ( scale ) {
|
||||
if ( scale == 1 ) {
|
||||
this.zoomFactor = 1;
|
||||
sessionStorage.setItem( 'zoom', this.zoomFactor );
|
||||
this.loadSeatplan();
|
||||
} else {
|
||||
if ( ( this.zoomFactor < 0.3 && scale < 0 ) || ( this.zoomFactor > 2.9 && scale > 0 ) ) {
|
||||
if ( this.zoomFactor < 0.3 ) {
|
||||
this.$refs.notification.createNotification( 'Minimum zoom factor reached', 5, 'warning', 'normal' );
|
||||
} else {
|
||||
this.$refs.notification.createNotification( 'Maximum zoom factor reached', 5, 'warning', 'normal' );
|
||||
}
|
||||
} else {
|
||||
this.zoomFactor += scale;
|
||||
}
|
||||
sessionStorage.setItem( 'zoom', this.zoomFactor );
|
||||
this.loadSeatplan();
|
||||
}
|
||||
},
|
||||
handleSeatCountInfo ( info ) {
|
||||
this.seatCountInfo[ 'data' ][ info.id ] = info.data;
|
||||
},
|
||||
getSeatCount () {
|
||||
this.seatCountInfo[ 'count' ] = document.getElementsByClassName( 'seats' ).length;
|
||||
},
|
||||
},
|
||||
created () {
|
||||
this.runHook();
|
||||
this.sizePoll = setInterval( this.eventHandler, 250 );
|
||||
},
|
||||
unmounted() {
|
||||
clearInterval( this.sizePoll );
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.parent {
|
||||
height: 90vh;
|
||||
aspect-ratio: 16 / 9;
|
||||
top: 7.5vh;
|
||||
left: 3vw;
|
||||
position: absolute;
|
||||
border: black 1px solid;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.draggable-box {
|
||||
cursor: all-scroll;
|
||||
}
|
||||
|
||||
.properties {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 1;
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
width: 20vw;
|
||||
height: 90vh;
|
||||
top: 7.5vh;
|
||||
right: 0.5vw;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.content-parent {
|
||||
aspect-ratio: 16 / 9;
|
||||
height: 400%;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
top: 7.5vh;
|
||||
left: 0.5vw;
|
||||
height: 90vh;
|
||||
}
|
||||
.toolbar button {
|
||||
margin-top: 10%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toolbar button:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,119 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="circularSeatplan">
|
||||
<div v-for="row in seats">
|
||||
<span class="material-symbols-outlined seats" v-for="seat in row" :style="seat.style">living</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'circularSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
startingRow: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
"default": 1
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.round( this.w / this.scaleFactor );
|
||||
let h = Math.round( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
let count = Math.min( Math.floor( w / size ), Math.floor( h / size ) );
|
||||
this.seats = {};
|
||||
let details = { 'data': {}, 'id': this.id };
|
||||
for ( let row = this.startingRow; row < count; row++ ) {
|
||||
let nn = row * ( Math.PI / 2 );
|
||||
details.data[ row ] = Math.floor( nn );
|
||||
let r = row * size;
|
||||
this.seats[ row ] = {};
|
||||
for ( let n = 0; n < nn; n++ ) {
|
||||
let phi = n * size / ( row * size );
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi }rad` };
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - phi }rad` };
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi + Math.PI }rad` };
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI - phi }rad` };
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit( 'seatingInfo', details );
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="rectangularSeatplan">
|
||||
<div v-for="row in seats" class="rows">
|
||||
<span class="material-symbols-outlined seats" v-for="seat in row" :style="seat.style">living</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'rectangularSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
"default": 1
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.floor( this.w / this.scaleFactor );
|
||||
let h = Math.floor( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
this.seats = {};
|
||||
let details = { 'data': { '0': Math.floor( w / size ) }, 'id': this.id };
|
||||
for ( let row = 0; row < Math.floor( h / size ); row++ ) {
|
||||
this.seats[ row ] = {};
|
||||
for ( let n = 0; n < Math.floor( w / size ); n++ ) {
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ row * size * this.scaleFactor }px; left: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;` };
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ row * size * this.scaleFactor }px; right: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;` };
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ row * size * this.scaleFactor }px; right: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;` };
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ row * size * this.scaleFactor }px; left: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;` };
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit( 'seatingInfo', details );
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="trapezoidSeatplan">
|
||||
<div v-for="row in seats">
|
||||
<span class="material-symbols-outlined seats" v-for="seat in row" :style="seat.style">living</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'trapezoidSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
startingRow: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
"default": 1
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.round( this.w / this.scaleFactor );
|
||||
let h = Math.round( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
let side = Math.min( w, h ) + 20;
|
||||
let heightTriangle = Math.floor( Math.sqrt( side ** 2 - ( Math.sqrt( side ** 2 * 2 ) / 2 ) ) )
|
||||
let sideOffset = size / Math.sqrt( 2 );
|
||||
let count = Math.floor( heightTriangle / ( sideOffset * 2 ) );
|
||||
const angle = Math.PI / 4;
|
||||
this.seats = {};
|
||||
let details = { 'data': {}, 'id': this.id };
|
||||
for ( let row = this.startingRow; row < count; row++ ) {
|
||||
let nn = 2 + ( row - 1 ) * 2;
|
||||
this.seats[ row ] = {};
|
||||
details.data[ row ] = Math.floor( nn );
|
||||
for ( let n = 0; n < nn; n++ ) {
|
||||
let side = n * sideOffset;
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle }rad` };
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; bottom: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - angle }rad` };
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle + Math.PI }rad` };
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ] = { 'style': `font-size: ${this.scaleFactor * 200}%; top: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI - angle }rad` };
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit( 'seatingInfo', details );
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
110
src/webapp/src/components/seatplan/seatplanComponents/stages.vue
Normal file
110
src/webapp/src/components/seatplan/seatplanComponents/stages.vue
Normal file
@@ -0,0 +1,110 @@
|
||||
<!--
|
||||
* libreevent - stages.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="stages" class="stages">
|
||||
<div id="rectangular" v-if="shape == 'rectangular'" class="stages" :style="style"></div>
|
||||
<div id="trapezoid" v-else-if="shape == 'trapezoid'" class="stages"><div id="trapezoid-ingredient" :style="trapezoidStyle"><div id="trapezoid-line"></div></div></div>
|
||||
<div id="circular" v-else-if="shape == 'circular'" class="stages"><div id="circular-ingredient" :style="circularStyle"></div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stages {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#rectangular {
|
||||
border-color: black;
|
||||
border-width: 2px;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular, #trapezoid {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#trapezoid-ingredient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
height: 200%;
|
||||
width: 200%;
|
||||
position: relative;
|
||||
bottom: 50%;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
#trapezoid-line {
|
||||
border: black solid 1px;
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular-ingredient {
|
||||
border: solid black 2px;
|
||||
border-radius: 100%;
|
||||
height: 199%;
|
||||
width: 199%;
|
||||
position: relative;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'stagesSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
"default": "rectangular",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'border-style: none none solid none',
|
||||
circularStyle: 'top: 0; left 100%;',
|
||||
trapezoidStyle: 'rotate: 45deg',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateOrigin () {
|
||||
if ( this.origin === 1 ) {
|
||||
this.style = 'border-style: none none solid none';
|
||||
this.circularStyle = 'top: 0; right: 100%;';
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.style = 'border-style: none solid none none';
|
||||
this.circularStyle = 'top: 0; right: 0;';
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.style = 'border-style: solid none none none';
|
||||
this.circularStyle = 'top: -100%; right: 0;';
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.style = 'border-style: none none none solid';
|
||||
this.circularStyle = 'top: -100%; right: 100%;';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateOrigin();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateOrigin();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<!--
|
||||
* libreevent - standing.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="stages" class="stages">
|
||||
<div id="rectangular" v-if="shape == 'rectangular'" class="stages" :style="style"></div>
|
||||
<div id="trapezoid" v-else-if="shape == 'trapezoid'" class="stages"><div id="trapezoid-ingredient" :style="trapezoidStyle"><div id="trapezoid-line"></div></div></div>
|
||||
<div id="circular" v-else-if="shape == 'circular'" class="stages"><div id="circular-ingredient" :style="circularStyle"></div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stages {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#rectangular {
|
||||
border-color: black;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
#circular, #trapezoid {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#trapezoid-ingredient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200%;
|
||||
width: 200%;
|
||||
position: relative;
|
||||
bottom: 50%;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
#trapezoid-line {
|
||||
border: black solid 1px;
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular-ingredient {
|
||||
border: solid black 2px;
|
||||
border-radius: 100%;
|
||||
height: 199%;
|
||||
width: 199%;
|
||||
position: relative;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'stagesSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
"default": "rectangular",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'border-style: none none solid none',
|
||||
circularStyle: 'top: 0; left 100%;',
|
||||
trapezoidStyle: 'rotate: 45deg',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateOrigin () {
|
||||
if ( this.origin === 1 ) {
|
||||
this.style = 'border-style: none none solid none';
|
||||
this.circularStyle = 'top: 0; right: 100%;';
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.style = 'border-style: none solid none none';
|
||||
this.circularStyle = 'top: 0; right: 0;';
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.style = 'border-style: solid none none none';
|
||||
this.circularStyle = 'top: -100%; right: 0;';
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.style = 'border-style: none none none solid';
|
||||
this.circularStyle = 'top: -100%; right: 100%;';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateOrigin();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateOrigin();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<!--
|
||||
* libreevent - textField.vue
|
||||
*
|
||||
* Created by Janis Hutz 07/01/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="textFields">
|
||||
<p :style="style">{{ text }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'textFieldSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
"default": "Untitled",
|
||||
},
|
||||
textSize: {
|
||||
type: Number,
|
||||
"default": 20,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
colour: {
|
||||
type: String,
|
||||
"default": '#000000',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'font-size: 20pt; rotate: 0deg; color: #000000',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateStyle () {
|
||||
this.style = `font-size: ${ this.scaleFactor * this.textSize }pt; rotate: ${ 90 * this.origin - 90 }deg; color: ${this.colour}`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
scaleFactor ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
colour ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
textSize ( value ) {
|
||||
this.updateStyle();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateStyle();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,128 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="circularSeatplan">
|
||||
<div v-for="row in seats">
|
||||
<div class="seats" v-for="seat in row" :style="seat.style" :id="seat.id">
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" @click="selectSeat( seat.row, seat.seat )" v-if="seat.status == 'av'"
|
||||
:title="seat.displayName + ', Available'">living</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'nav'"
|
||||
:title="seat.displayName + ', Unavailable'">close</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'sel'"
|
||||
:title="seat.displayName + ', Selected'">done</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'circularSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
startingRow: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
"default": { 'sector': 'A', 'sectorCount': 1, 'unavailableSeats': { 'secAr0s0': true } }
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.round( this.w / this.scaleFactor );
|
||||
let h = Math.round( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
let count = Math.min( Math.floor( w / size ), Math.floor( h / size ) );
|
||||
this.seats = {};
|
||||
for ( let row = this.startingRow; row < count; row++ ) {
|
||||
let nn = row * ( Math.PI / 2 );
|
||||
let r = row * size;
|
||||
this.seats[ row ] = {};
|
||||
for ( let n = 0; n < nn; n++ ) {
|
||||
this.seats[ row ][ n ] = { 'style': '', 'id': 'sec' + this.data.sector + 'r' + row + 's' + n, 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + ( row + 1 ) + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n };
|
||||
let phi = n * size / ( row * size );
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi }rad`;
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - phi }rad`;
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; right: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ phi + Math.PI }rad`;
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ r * Math.cos( phi ) * this.scaleFactor }px; left: ${ r * Math.sin( phi ) * this.scaleFactor }px; rotate: ${ Math.PI - phi }rad`;
|
||||
}
|
||||
this.seats[ row ][ n ][ 'scaling' ] = `font-size: ${this.scaleFactor * 200}%; `;
|
||||
}
|
||||
}
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
},
|
||||
selectSeat ( row, seat ) {
|
||||
console.log( row + ' ' + seat );
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="rectangularSeatplan">
|
||||
<div v-for="row in seats" class="rows">
|
||||
<div class="seats" v-for="seat in row" :style="seat.style" :id="seat.id">
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" @click="selectSeat( seat.row, seat.seat )" v-if="seat.status == 'av'"
|
||||
:title="seat.displayName + ', Available'">living</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'nav'"
|
||||
:title="seat.displayName + ', Unavailable'">disabled_by_default</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'sel'"
|
||||
:title="seat.displayName + ', Selected'" @click="deselectSeat( seat.row, seat.seat )">check_box</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'rectangularSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
"default": { 'sector': 'A', 'sectorCount': 1, 'unavailableSeats': { 'secAr0s0': true } }
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.floor( this.w / this.scaleFactor );
|
||||
let h = Math.floor( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
this.seats = {};
|
||||
for ( let row = 0; row < Math.floor( h / size ); row++ ) {
|
||||
this.seats[ row ] = {};
|
||||
for ( let n = 0; n < Math.floor( w / size ); n++ ) {
|
||||
this.seats[ row ][ n ] = { 'style': '', 'id': 'sec' + this.data.sector + 'r' + row + 's' + n, 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + ( row + 1 ) + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n };
|
||||
// TODO: apply style of category
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ row * size * this.scaleFactor }px; left: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;`;
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ row * size * this.scaleFactor }px; right: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;`;
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ row * size * this.scaleFactor }px; right: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;`;
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ row * size * this.scaleFactor }px; left: ${ n * size * this.scaleFactor }px; rotate: ${ this.origin / 4 - 0.25 }turn;`;
|
||||
}
|
||||
this.seats[ row ][ n ][ 'scaling' ] = `font-size: ${this.scaleFactor * 200}%; `;
|
||||
if ( this.data.unavailableSeats ) {
|
||||
if ( this.data.unavailableSeats[ this.seats[ row ][ n ][ 'id' ] ] ) {
|
||||
this.seats[ row ][ n ][ 'status' ] = 'nav';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
},
|
||||
selectSeat ( row, seat ) {
|
||||
this.$emit( 'seatSelected', this.seats[ row ][ seat ] );
|
||||
},
|
||||
deselectSeat( row, seat ) {
|
||||
this.$emit( 'seatDeselected', this.seats[ row ][ seat ] );
|
||||
this.seats[ seatObject[ 'row' ] ][ seatObject[ 'seat' ] ][ 'status' ] = 'av';
|
||||
// TODO: Make server call to deselect ticket
|
||||
},
|
||||
validateSeatSelection( seatObject, selectedTicketOption ) {
|
||||
this.seats[ seatObject[ 'row' ] ][ seatObject[ 'seat' ] ][ 'status' ] = 'sel';
|
||||
this.seats[ seatObject[ 'row' ] ][ seatObject[ 'seat' ] ][ 'ticketOption' ] = selectedTicketOption;
|
||||
// TODO: Make server call to reserve ticket
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<!--
|
||||
* libreevent - properties.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="trapezoidSeatplan">
|
||||
<div v-for="row in seats">
|
||||
<div class="seats" v-for="seat in row" :style="seat.style" :id="seat.id">
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" @click="selectSeat( seat.row, seat.seat )" v-if="seat.status == 'av'"
|
||||
:title="seat.displayName + ', Available'">living</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'nav'"
|
||||
:title="seat.displayName + ', Unavailable'">close</span>
|
||||
<span class="material-symbols-outlined" :style="seat.scaling" v-else-if="seat.status == 'sel'"
|
||||
:title="seat.displayName + ', Selected'">done</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.seats {
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'trapezoidSeatplanComponent',
|
||||
props: {
|
||||
h: {
|
||||
type: Number,
|
||||
"default": 100,
|
||||
},
|
||||
w: {
|
||||
type: Number,
|
||||
"default": 200,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
startingRow: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
"default": { 'sector': 'A', 'sectorCount': 1, 'unavailableSeats': { 'secAr0s0': true } }
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
seats: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateChairs () {
|
||||
// Size of seat at scale 1 is 32px
|
||||
// w & h are normalised
|
||||
let w = Math.round( this.w / this.scaleFactor );
|
||||
let h = Math.round( this.h / this.scaleFactor );
|
||||
const size = 33;
|
||||
let side = Math.min( w, h ) + 20;
|
||||
let heightTriangle = Math.floor( Math.sqrt( side ** 2 - ( Math.sqrt( side ** 2 * 2 ) / 2 ) ) )
|
||||
let sideOffset = size / Math.sqrt( 2 );
|
||||
let count = Math.floor( heightTriangle / ( sideOffset * 2 ) );
|
||||
const angle = Math.PI / 4;
|
||||
this.seats = {};
|
||||
for ( let row = this.startingRow; row < count; row++ ) {
|
||||
let nn = 2 + ( row - 1 ) * 2;
|
||||
this.seats[ row ] = {};
|
||||
for ( let n = 0; n < nn; n++ ) {
|
||||
this.seats[ row ][ n ] = { 'style': '', 'id': 'sec' + this.data.sector + 'r' + row + 's' + n, 'displayName': ( this.data.sectorCount > 1 ? 'Sector ' + this.data.sector + ', ' : '' ) + 'Row ' + ( row + 1 ) + ', Seat ' + ( n + 1 ), 'status': 'av', 'row': row, 'seat': n };
|
||||
let side = n * sideOffset;
|
||||
if ( this.origin === 1 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle }rad`;
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `bottom: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI * 2 - angle }rad`;
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; right: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ angle + Math.PI }rad`;
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.seats[ row ][ n ][ 'style' ] = `top: ${ ( side + 5 ) * this.scaleFactor }px; left: ${ ( row * sideOffset * 2 - side ) * this.scaleFactor }px; rotate: ${ Math.PI - angle }rad`;
|
||||
}
|
||||
this.seats[ row ][ n ][ 'scaling' ] = `font-size: ${this.scaleFactor * 200}%; `;
|
||||
}
|
||||
}
|
||||
},
|
||||
setScaleFactor () {
|
||||
for ( let row in this.seats ) {
|
||||
for ( let seat in this.seats[ row ] ) {
|
||||
let styles = this.seats[ row ][ seat ].style.substring( this.seats[ row ][ seat ].style.indexOf( ';' ) + 1 );
|
||||
this.seats[ row ][ seat ].style = `font-size: ${this.scaleFactor * 200}%;` + styles;
|
||||
}
|
||||
}
|
||||
},
|
||||
selectSeat ( row, seat ) {
|
||||
console.log( row + ' ' + seat );
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
scaleFactor() {
|
||||
this.setScaleFactor();
|
||||
},
|
||||
h() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
w() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
origin() {
|
||||
this.calculateChairs();
|
||||
},
|
||||
startingRow() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.calculateChairs();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<!--
|
||||
* libreevent - stages.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="stages" class="stages">
|
||||
<div id="rectangular" v-if="shape == 'rectangular'" class="stages" :style="style"></div>
|
||||
<div id="trapezoid" v-else-if="shape == 'trapezoid'" class="stages"><div id="trapezoid-ingredient" :style="trapezoidStyle"><div id="trapezoid-line"></div></div></div>
|
||||
<div id="circular" v-else-if="shape == 'circular'" class="stages"><div id="circular-ingredient" :style="circularStyle"></div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stages {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#rectangular {
|
||||
border-color: black;
|
||||
border-width: 2px;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular, #trapezoid {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#trapezoid-ingredient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
height: 200%;
|
||||
width: 200%;
|
||||
position: relative;
|
||||
bottom: 50%;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
#trapezoid-line {
|
||||
border: black solid 1px;
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular-ingredient {
|
||||
border: solid black 2px;
|
||||
border-radius: 100%;
|
||||
height: 199%;
|
||||
width: 199%;
|
||||
position: relative;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'stagesSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
"default": "rectangular",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'border-style: none none solid none',
|
||||
circularStyle: 'top: 0; left 100%;',
|
||||
trapezoidStyle: 'rotate: 45deg',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateOrigin () {
|
||||
if ( this.origin === 1 ) {
|
||||
this.style = 'border-style: none none solid none';
|
||||
this.circularStyle = 'top: 0; right: 100%;';
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.style = 'border-style: none solid none none';
|
||||
this.circularStyle = 'top: 0; right: 0;';
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.style = 'border-style: solid none none none';
|
||||
this.circularStyle = 'top: -100%; right: 0;';
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.style = 'border-style: none none none solid';
|
||||
this.circularStyle = 'top: -100%; right: 100%;';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateOrigin();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateOrigin();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<!--
|
||||
* libreevent - standing.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="stages" class="stages">
|
||||
<div id="rectangular" v-if="shape == 'rectangular'" class="stages" :style="style"></div>
|
||||
<div id="trapezoid" v-else-if="shape == 'trapezoid'" class="stages"><div id="trapezoid-ingredient" :style="trapezoidStyle"><div id="trapezoid-line"></div></div></div>
|
||||
<div id="circular" v-else-if="shape == 'circular'" class="stages"><div id="circular-ingredient" :style="circularStyle"></div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stages {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#rectangular {
|
||||
border-color: black;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
#circular, #trapezoid {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#trapezoid-ingredient {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200%;
|
||||
width: 200%;
|
||||
position: relative;
|
||||
bottom: 50%;
|
||||
right: 50%;
|
||||
}
|
||||
|
||||
#trapezoid-line {
|
||||
border: black solid 1px;
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
display: block;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
|
||||
#circular-ingredient {
|
||||
border: solid black 2px;
|
||||
border-radius: 100%;
|
||||
height: 199%;
|
||||
width: 199%;
|
||||
position: relative;
|
||||
background-color: var( --popup-color );
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'stagesSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
shape: {
|
||||
type: String,
|
||||
"default": "rectangular",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'border-style: none none solid none',
|
||||
circularStyle: 'top: 0; left 100%;',
|
||||
trapezoidStyle: 'rotate: 45deg',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateOrigin () {
|
||||
if ( this.origin === 1 ) {
|
||||
this.style = 'border-style: none none solid none';
|
||||
this.circularStyle = 'top: 0; right: 100%;';
|
||||
} else if ( this.origin === 2 ) {
|
||||
this.style = 'border-style: none solid none none';
|
||||
this.circularStyle = 'top: 0; right: 0;';
|
||||
} else if ( this.origin === 3 ) {
|
||||
this.style = 'border-style: solid none none none';
|
||||
this.circularStyle = 'top: -100%; right: 0;';
|
||||
} else if ( this.origin === 4 ) {
|
||||
this.style = 'border-style: none none none solid';
|
||||
this.circularStyle = 'top: -100%; right: 100%;';
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateOrigin();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateOrigin();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<!--
|
||||
* libreevent - textField.vue
|
||||
*
|
||||
* Created by Janis Hutz 07/01/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="textFields">
|
||||
<p :style="style">{{ text }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'textFieldSeatplanComponent',
|
||||
props: {
|
||||
origin: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
"default": "Untitled",
|
||||
},
|
||||
textSize: {
|
||||
type: Number,
|
||||
"default": 20,
|
||||
},
|
||||
scaleFactor: {
|
||||
type: Number,
|
||||
"default": 1,
|
||||
},
|
||||
colour: {
|
||||
type: String,
|
||||
"default": '#000000',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
style: 'font-size: 20pt; rotate: 0deg; color: #000000',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateStyle () {
|
||||
this.style = `font-size: ${ this.scaleFactor * this.textSize }pt; rotate: ${ 90 * this.origin - 90 }deg; color: ${this.colour}`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
origin ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
scaleFactor ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
colour ( value ) {
|
||||
this.updateStyle();
|
||||
},
|
||||
textSize ( value ) {
|
||||
this.updateStyle();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.updateStyle();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
9
src/webapp/src/components/seatplan/userApp/sidebar.vue
Normal file
9
src/webapp/src/components/seatplan/userApp/sidebar.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
* libreevent - sidebar.vue
|
||||
*
|
||||
* Created by Janis Hutz 07/03/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
312
src/webapp/src/components/seatplan/userApp/userWindow.vue
Normal file
312
src/webapp/src/components/seatplan/userApp/userWindow.vue
Normal file
@@ -0,0 +1,312 @@
|
||||
<!--
|
||||
* libreevent - window.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div id="window">
|
||||
<h2>Seat plan: {{ event.name }}</h2>
|
||||
<div class="parent" id="parent" @wheel="( e ) => { handleScroll( e ); }" @mousemove="( e ) => { handleDrag( e ); }" @mousedown="( e ) => { setOffset( e ); }">
|
||||
<div class="content-parent">
|
||||
<Vue3DraggableResizable v-for="draggable in draggables" :initW="draggable.w" :initH="draggable.h" :x="draggable.x" :y="draggable.y" :w="draggable.w" :h="draggable.h"
|
||||
:active="false" :draggable="false" :resizable="false" :parent="true" class="draggable-box">
|
||||
|
||||
<circularSeatplanComponent v-if="draggable.shape == 'circular' && draggable.type == 'seat'" :scale-factor="scaleFactor"
|
||||
:w="draggable.w" :h="draggable.h" :origin="draggable.origin" :starting-row="draggable.startingRow"
|
||||
@seatSelected="( seat ) => { seatSelected( seat ) }"></circularSeatplanComponent>
|
||||
|
||||
<trapezoidSeatplanComponent v-else-if="draggable.shape == 'trapezoid' && draggable.type == 'seat'" :scale-factor="scaleFactor"
|
||||
:w="draggable.w" :h="draggable.h" :origin="draggable.origin" :starting-row="draggable.startingRow"
|
||||
@seatSelected="( seat ) => { seatSelected( seat ) }"></trapezoidSeatplanComponent>
|
||||
|
||||
<rectangularSeatplanComponent v-else-if="draggable.shape == 'rectangular' && draggable.type == 'seat'" :scale-factor="scaleFactor"
|
||||
:w="draggable.w" :h="draggable.h" :origin="draggable.origin"
|
||||
@seatSelected="( seat ) => { seatSelected( seat ) }" @seatDeselected="( seat ) => { seatDeselected( seat ) }"></rectangularSeatplanComponent>
|
||||
|
||||
<stagesSeatplanComponent v-else-if="draggable.type == 'stage'" :origin="draggable.origin" :shape="draggable.shape"></stagesSeatplanComponent>
|
||||
<standingSeatplanComponent v-else-if="draggable.type == 'stand'" :origin="draggable.origin" :shape="draggable.shape"></standingSeatplanComponent>
|
||||
<textFieldSeatplanComponent v-else-if="draggable.type == 'text'" :text="draggable.text.text" :text-size="draggable.text.textSize" :colour="draggable.text.colour" :origin="draggable.origin" :scale-factor="scaleFactor"></textFieldSeatplanComponent>
|
||||
</Vue3DraggableResizable>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<button title="Zoom in [+]" @click="zoom( 0.2 )"><span class="material-symbols-outlined">zoom_in</span></button>
|
||||
<button title="Reset zoom [=]" @click="zoom( 1 );"><span class="material-symbols-outlined">center_focus_strong</span></button>
|
||||
<button title="Zoom out [-]" @click="zoom( -0.2 )"><span class="material-symbols-outlined">zoom_out</span></button>
|
||||
</div>
|
||||
<notifications ref="notification" location="topleft"></notifications>
|
||||
<popups ref="popups" size="big"></popups>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue3DraggableResizable from 'vue3-draggable-resizable';
|
||||
import circularSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/seats/circular.vue';
|
||||
import rectangularSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/seats/rectangular.vue';
|
||||
import trapezoidSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/seats/trapezoid.vue';
|
||||
import stagesSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/stages.vue';
|
||||
import standingSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/standing.vue';
|
||||
import textFieldSeatplanComponent from '@/components/seatplan/userApp/seatplanComponents/textField.vue';
|
||||
import notifications from '@/components/notifications/notifications.vue';
|
||||
import popups from '@/components/notifications/popups.vue';
|
||||
import 'vue3-draggable-resizable/dist/Vue3DraggableResizable.css';
|
||||
|
||||
export default {
|
||||
'name': 'window',
|
||||
components: {
|
||||
Vue3DraggableResizable,
|
||||
circularSeatplanComponent,
|
||||
rectangularSeatplanComponent,
|
||||
trapezoidSeatplanComponent,
|
||||
stagesSeatplanComponent,
|
||||
standingSeatplanComponent,
|
||||
textFieldSeatplanComponent,
|
||||
notifications,
|
||||
popups,
|
||||
},
|
||||
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, 'seatCountingStartingPoint': 1, 'sector': 'A', 'text': { 'text': 'TestText', 'textSize': 20, 'colour': '#20FFFF' } }, 'ticketCount': 1 },
|
||||
event: { 'name': 'TestEvent2', 'location': 'TestLocation2', 'date': '2023-07-15', 'RoomName': 'TestRoom2', 'currency': 'CHF', 'categories': { '1': { 'price': { '1':25, '2':35 }, 'bg': 'black', 'fg': 'white', 'name': 'Category 1' }, '2': { 'price': { '1':15, '2':20 }, 'bg': 'green', 'fg': 'white', 'name': 'Category 2' } }, 'ageGroups': { '1':{ 'id': 1, 'name':'Child', 'age':'0 - 15.99' }, '2':{ 'id': 2, 'name': 'Adult', 'age': null } }, 'ageGroupCount': 2, 'maxTickets': 2 },
|
||||
available: { 'redo': false, 'undo': false },
|
||||
scaleFactor: 1,
|
||||
sizePoll: null,
|
||||
prevSize: { 'h': window.innerHeight, 'w': window.innerWidth },
|
||||
zoomFactor: 1,
|
||||
standardDeviation: { 'currentTop': 0, 'currentLeft': 0 },
|
||||
movePos: { 'top': 0, 'left': 0, 'isMoving': false, 'isSet': false },
|
||||
generalSettings: { 'namingScheme': 'numeric' },
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/*
|
||||
Coords are from top left corner of box.
|
||||
The below function is executed as the init hook (created hook)
|
||||
of vue.js, so whenever this particular page is loaded.
|
||||
It loads previous data (if available) and starts the event listeners
|
||||
for keyevents (like delete) and also check if the user uses a desktop
|
||||
browser that meets all the requirements for being able to use the editor
|
||||
reliably according to testing done.
|
||||
*/
|
||||
runHook () {
|
||||
let self = this;
|
||||
this.zoomFactor = sessionStorage.getItem( 'zoom' ) ? parseFloat( sessionStorage.getItem( 'zoom' ) ) : 1;
|
||||
|
||||
/*
|
||||
Keybinds:
|
||||
- Delete: delete selected object
|
||||
- Ctrl + S: Save
|
||||
- Ctrl + Z: Undo
|
||||
- Ctrl + Y: Redo
|
||||
*/
|
||||
document.onkeydown = function ( event ) {
|
||||
if ( event.key === '+' ) {
|
||||
self.zoom( 0.2 );
|
||||
} else if ( event.key === '-' ) {
|
||||
self.zoom( -0.2 );
|
||||
} else if ( event.key === '=' ) {
|
||||
self.zoom( 1 );
|
||||
}
|
||||
};
|
||||
|
||||
this.loadSeatplan();
|
||||
sessionStorage.setItem( 'seatplan', JSON.stringify( this.scaleDown( this.draggables ) ) );
|
||||
// TODO: remove scaleDown function again once backend is up
|
||||
// TODO: Optimise for odd screen sizes and aspect ratios
|
||||
},
|
||||
eventHandler ( e ) {
|
||||
if ( this.prevSize.h != window.innerHeight || this.prevSize.w != window.innerWidth ) {
|
||||
this.prevSize = { 'h': window.innerHeight, 'w': window.innerWidth };
|
||||
this.loadSeatplan();
|
||||
}
|
||||
},
|
||||
handleScroll ( e ) {
|
||||
e.preventDefault();
|
||||
if ( e.deltaY > 0 ) {
|
||||
this.zoom( 0.2 );
|
||||
} else {
|
||||
this.zoom( -0.2 );
|
||||
}
|
||||
},
|
||||
setOffset( e ) {
|
||||
this.standardDeviation.currentLeft = e.clientX;
|
||||
this.standardDeviation.currentTop = e.clientY;
|
||||
},
|
||||
handleDrag ( e ) {
|
||||
if ( e.buttons === 1 ) {
|
||||
let parent = document.getElementById( 'parent' );
|
||||
if ( !this.movePos.isSet ) {
|
||||
this.movePos.left = parent.scrollWidth - parent.scrollLeft;
|
||||
this.movePos.top = parent.scrollHeight - parent.scrollTop;
|
||||
this.movePos.isSet = true;
|
||||
}
|
||||
this.movePos.isMoving = true;
|
||||
e.preventDefault();
|
||||
let valueTop = parent.scrollHeight - ( e.clientY - this.standardDeviation.currentTop + this.movePos.top );
|
||||
let valueLeft = parent.scrollWidth - ( e.clientX - this.standardDeviation.currentLeft + this.movePos.left );
|
||||
parent.scrollTop = valueTop > 0 ? valueTop : 0;
|
||||
parent.scrollLeft = valueLeft > 0 ? valueLeft : 0;
|
||||
} else {
|
||||
if ( this.movePos.isMoving ) {
|
||||
let parent = document.getElementById( 'parent' );
|
||||
this.movePos.left = parent.scrollWidth - parent.scrollLeft;
|
||||
this.movePos.top = parent.scrollHeight - parent.scrollTop;
|
||||
this.movePos.isMoving = false;
|
||||
}
|
||||
};
|
||||
},
|
||||
scaleDown ( valueArray ) {
|
||||
const allowedAttributes = [ 'w', 'h', 'x', 'y' ]
|
||||
let returnArray = {};
|
||||
for ( let entry in valueArray ) {
|
||||
returnArray[ entry ] = {};
|
||||
for ( let attributes in valueArray[ entry ] ) {
|
||||
if ( allowedAttributes.includes( attributes ) ) {
|
||||
returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] / this.scaleFactor ) * 1000 ) / 1000;
|
||||
} else {
|
||||
returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ];
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnArray;
|
||||
},
|
||||
loadSeatplan () {
|
||||
/*
|
||||
Calculate scale factor (this adds support for differently sized screens)
|
||||
900px is the "default" height
|
||||
*/
|
||||
|
||||
let height = $( document ).height() * 0.8;
|
||||
this.scaleFactor = ( height / 900 ) * this.zoomFactor;
|
||||
/*
|
||||
Load seatplan
|
||||
*/
|
||||
// TODO: load from server
|
||||
if ( sessionStorage.getItem( 'seatplan' ) ) {
|
||||
this.draggables = this.scaleUp( JSON.parse( sessionStorage.getItem( 'seatplan' ) ) );
|
||||
}
|
||||
|
||||
for ( let element in this.draggables ) {
|
||||
if ( this.draggables[ element ].active ) {
|
||||
this.draggables[ element ].active = false;
|
||||
}
|
||||
}
|
||||
// Check if all seats are available
|
||||
// TODO: delay call
|
||||
let allSeatsAvailable = false;
|
||||
let self = this;
|
||||
setTimeout( () => {
|
||||
if ( !allSeatsAvailable ) {
|
||||
self.$refs.popups.openPopup( 'We are sorry to tell you that since the last time the seat plan was refreshed, one or more of the seats you have selected has/have been taken.', {}, 'string' );
|
||||
}
|
||||
}, 500 );
|
||||
},
|
||||
scaleUp ( valueArray ) {
|
||||
const allowedAttributes = [ 'w', 'h', 'x', 'y' ];
|
||||
let returnArray = {};
|
||||
for ( let entry in valueArray ) {
|
||||
returnArray[ entry ] = {};
|
||||
for ( let attributes in valueArray[ entry ] ) {
|
||||
if ( allowedAttributes.includes( attributes ) ) {
|
||||
returnArray[ entry ][ attributes ] = Math.round( ( valueArray[ entry ][ attributes ] * this.scaleFactor ) * 1000 ) / 1000;
|
||||
} else {
|
||||
returnArray[ entry ][ attributes ] = valueArray[ entry ][ attributes ];
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnArray;
|
||||
},
|
||||
zoom ( scale ) {
|
||||
if ( scale == 1 ) {
|
||||
this.zoomFactor = 1;
|
||||
sessionStorage.setItem( 'zoom', this.zoomFactor );
|
||||
this.loadSeatplan();
|
||||
} else {
|
||||
if ( ( this.zoomFactor < 0.3 && scale < 0 ) || ( this.zoomFactor > 2.9 && scale > 0 ) ) {
|
||||
|
||||
} else {
|
||||
this.zoomFactor += scale;
|
||||
}
|
||||
sessionStorage.setItem( 'zoom', this.zoomFactor );
|
||||
this.loadSeatplan();
|
||||
}
|
||||
},
|
||||
seatSelected ( seat ) {
|
||||
console.log( seat );
|
||||
this.$refs.popups.openPopup( 'Please choose a ticket option', seat.option, 'dropdown' );
|
||||
// Make call to server to reserve ticket.
|
||||
},
|
||||
seatDeselected ( seat ) {
|
||||
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.runHook();
|
||||
this.sizePoll = setInterval( this.eventHandler, 250 );
|
||||
},
|
||||
unmounted() {
|
||||
clearInterval( this.sizePoll );
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.parent {
|
||||
height: 80vh;
|
||||
aspect-ratio: 16 / 9;
|
||||
-webkit-aspect-ratio: 16 / 9;
|
||||
top: 17vh;
|
||||
left: 10vw;
|
||||
position: absolute;
|
||||
border: black 1px solid;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.draggable-box {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.properties {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 1;
|
||||
background-color: var( --accent-background );
|
||||
color: var( --secondary-color );
|
||||
width: 20vw;
|
||||
height: 90vh;
|
||||
top: 7.5vh;
|
||||
right: 0.5vw;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.content-parent {
|
||||
aspect-ratio: 16 / 9;
|
||||
height: 400%;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top: 17vh;
|
||||
left: 10.5vw;
|
||||
}
|
||||
.toolbar button {
|
||||
margin-top: 10%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.toolbar button:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
</style>
|
||||
95
src/webapp/src/components/settings/rightClickMenu.vue
Normal file
95
src/webapp/src/components/settings/rightClickMenu.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<!--
|
||||
* libreevent - rightClickMenu.vue
|
||||
*
|
||||
* Created by Janis Hutz 07/02/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="right-click-menu" id="right-click-menu">
|
||||
<ul>
|
||||
<li v-for="option in options" @click="executeCommand( option.command )"><span class="material-symbols-outlined right-click-symbols">{{ option.symbol }}</span>{{ option.display }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="right-click-menu-disable" @click="closeRightClickMenu()" id="right-click-menu-disable"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'rightClickMenu',
|
||||
data() {
|
||||
return {
|
||||
options: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openRightClickMenu( event, options ) {
|
||||
$( '#right-click-menu' ).show( 100 );
|
||||
|
||||
// Get cursor position
|
||||
$( '#right-click-menu' ).css( 'top', event.clientY + 'px' );
|
||||
$( '#right-click-menu' ).css( 'left', event.clientX + 'px' );
|
||||
this.options = options;
|
||||
$( '#right-click-menu-disable' ).show();
|
||||
},
|
||||
closeRightClickMenu() {
|
||||
$( '#right-click-menu' ).hide( 100 );
|
||||
$( '#right-click-menu-disable' ).hide();
|
||||
},
|
||||
executeCommand ( command ) {
|
||||
this.closeRightClickMenu();
|
||||
this.$emit( 'command', command );
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Right click menu */
|
||||
|
||||
.right-click-symbols {
|
||||
margin-right: 2%;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
.right-click-menu {
|
||||
text-align: justify;
|
||||
display: none;
|
||||
z-index: 10;
|
||||
width: 10vw;
|
||||
position: fixed;
|
||||
background-color: var( --overlay-color );
|
||||
color: var( --secondary-color );
|
||||
padding: 0.5%;
|
||||
}
|
||||
|
||||
.right-click-menu ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.right-click-menu ul li {
|
||||
cursor: pointer;
|
||||
width: 90%;
|
||||
padding: 5% 5%;
|
||||
}
|
||||
|
||||
.right-click-menu ul li:hover {
|
||||
background-color: var( --hover-color );
|
||||
}
|
||||
|
||||
.right-click-menu-disable {
|
||||
position: fixed;
|
||||
display: none;
|
||||
opacity: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
</style>
|
||||
195
src/webapp/src/components/settings/settings.vue
Normal file
195
src/webapp/src/components/settings/settings.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<!--
|
||||
* libreevent - settings.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="settings-wrapper">
|
||||
<table class="settings-toggles">
|
||||
<tr class="settings-option" v-for="setting in settings">
|
||||
<td class="info-wrapper">
|
||||
{{ setting.display }}
|
||||
<div class="info-container" @mouseenter="showInfo( setting.id )" @mouseleave="hideInfo( setting.id )">
|
||||
<span class="material-symbols-outlined info-icon">info</span>
|
||||
<div class="info-box" :id="setting.id">
|
||||
<div class="info-box-container" v-html="setting.tooltip">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td v-if="setting.type == 'toggle'">
|
||||
<label class="switch">
|
||||
<input type="checkbox" v-model="setting.value">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'select'">
|
||||
<select v-model="setting.value">
|
||||
<option v-for="option in setting.restrictions" :value="option.value">{{ option.displayName }}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'number'">
|
||||
<input type="number" v-model="setting.value" :min="setting.restrictions.min" :max="setting.restrictions.max">
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'text'">
|
||||
<input type="text" v-model="setting.value">
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'textbox'">
|
||||
<textarea v-model="setting.value"></textarea>
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'date'">
|
||||
<input type="date" v-model="setting.value">
|
||||
</td>
|
||||
<td v-else-if="setting.type == 'link'">
|
||||
<router-link :to="setting.restrictions.to">{{ setting.restrictions.displayName }}</router-link>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
settings: Object,
|
||||
},
|
||||
methods: {
|
||||
showInfo ( box ) {
|
||||
$( '#' + box ).stop();
|
||||
$( '#' + box ).fadeIn( 300 );
|
||||
},
|
||||
hideInfo ( box ) {
|
||||
$( '#' + box ).stop();
|
||||
$( '#' + box ).fadeOut( 300 );
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.settings-wrapper {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
text-align: justify;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.settings-toggles {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.info-wrapper {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.info-container {
|
||||
display: inline;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
font-size: 100%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.info-box {
|
||||
text-align: center;
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
width: 20vw;
|
||||
height: 20vh;
|
||||
background-color: var( --hint-color );
|
||||
border-radius: 20px;
|
||||
top: 125%;
|
||||
right: -9.3vw;
|
||||
}
|
||||
|
||||
.info-box::before {
|
||||
content: " ";
|
||||
position: absolute;
|
||||
bottom: 100%; /* At the bottom of the tooltip */
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 10px;
|
||||
border-style: solid;
|
||||
border-color: transparent transparent var( --hint-color ) transparent;
|
||||
}
|
||||
|
||||
.info-box-container {
|
||||
display: flex;
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
padding: 10%;
|
||||
padding-top: 5%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_switch */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
38
src/webapp/src/main.js
Normal file
38
src/webapp/src/main.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* libreevent - main.js
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import { createPinia } from 'pinia';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
|
||||
let app = createApp( App );
|
||||
|
||||
app.use( createPinia() );
|
||||
|
||||
let userStore = useUserStore();
|
||||
|
||||
let prod = false;
|
||||
|
||||
if ( prod ) {
|
||||
fetch( '/api/getAuth' ).then( res => {
|
||||
res.json().then( data => {
|
||||
userStore.setUserAuth( data.user );
|
||||
userStore.setAdminAuth( data.admin );
|
||||
|
||||
app.use( router );
|
||||
app.mount( '#app' );
|
||||
} );
|
||||
} );
|
||||
} else {
|
||||
// userStore.setUserAuth( true );
|
||||
app.use( router );
|
||||
app.mount( '#app' );
|
||||
}
|
||||
93
src/webapp/src/router/adminRoutes.js
Normal file
93
src/webapp/src/router/adminRoutes.js
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* libreevent - adminRoutes.js
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
export default {
|
||||
path: '/admin',
|
||||
name: 'admin',
|
||||
component: () => import( '../views/admin/AdminView.vue' ),
|
||||
meta: {
|
||||
title: 'Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'adminHome',
|
||||
component: () => import( '../views/admin/HomeView.vue' ),
|
||||
meta: {
|
||||
title: 'Home :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'locations',
|
||||
name: 'adminLocations',
|
||||
component: () => import( '../views/admin/LocationsView.vue' ),
|
||||
meta: {
|
||||
title: 'Accounts :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
permissions: 'root'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'pages',
|
||||
name: 'adminPages',
|
||||
component: () => import( '../views/admin/PagesView.vue' ),
|
||||
meta: {
|
||||
title: 'Pages :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'events',
|
||||
name: 'adminEvents',
|
||||
component: () => import( '../views/admin/EventsView.vue' ),
|
||||
meta: {
|
||||
title: 'Events :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'plugins',
|
||||
name: 'adminPlugins',
|
||||
component: () => import( '../views/admin/PluginsView.vue' ),
|
||||
meta: {
|
||||
title: 'Plugins :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
name: 'adminSettings',
|
||||
component: () => import( '../views/admin/SettingsView.vue' ),
|
||||
meta: {
|
||||
title: 'Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'events/view',
|
||||
name: 'eventDetails',
|
||||
component: () => import( '../views/admin/events/EventsDetailsView.vue' ),
|
||||
meta: {
|
||||
title: 'Event details :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'events/analytics',
|
||||
name: 'eventAnalytics',
|
||||
component: () => import( '../views/admin/events/AnalyticsView.vue' ),
|
||||
meta: {
|
||||
title: 'Event analytics :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
73
src/webapp/src/router/index.js
Normal file
73
src/webapp/src/router/index.js
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* libreevent - index.js
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
/*
|
||||
This is the Vue.js router file. All valid routes get imported from other files to
|
||||
improve code legibility. Only router logic and importing logic is defined here.
|
||||
*/
|
||||
|
||||
const routes = mainRoutes;
|
||||
|
||||
routes.push( adminRoutes );
|
||||
|
||||
const router = createRouter( {
|
||||
history: createWebHistory( process.env.BASE_URL ),
|
||||
routes,
|
||||
} );
|
||||
|
||||
|
||||
router.afterEach( ( to, from ) => {
|
||||
document.title = to.meta.title ? to.meta.title : 'libreevent';
|
||||
} );
|
||||
|
||||
let UserAccountPages = [ 'account' ];
|
||||
|
||||
let authRequired = false;
|
||||
|
||||
router.beforeEach( ( to, from ) => {
|
||||
let userStore = useUserStore();
|
||||
let backendStore = useBackendStore();
|
||||
backendStore.loadVisitedSetupPages();
|
||||
let isUserAuthenticated = userStore.getUserAuthenticated;
|
||||
let isAdminAuthenticated = userStore.getAdminAuthenticated;
|
||||
|
||||
if ( to.meta.adminAuthRequired && !isAdminAuthenticated ) {
|
||||
return { name: 'adminLogin' };
|
||||
} else if ( to.name === 'adminLogin' && isAdminAuthenticated ) {
|
||||
return { name: 'adminHome' };
|
||||
} else if ( UserAccountPages.includes( to.name ) && !isUserAuthenticated ) {
|
||||
return { name: 'login' };
|
||||
} else if ( isUserAuthenticated && to.name === 'login' ) {
|
||||
return { name: 'account' };
|
||||
} else if ( !isUserAuthenticated && to.name === 'pay' ) {
|
||||
return { name: 'purchase' };
|
||||
} else if ( to.name.substring( 0, 5 ) === 'setup' && !backendStore.getVisitedSetupPages[ to.name.substring( 5 ).toLowerCase() ] && to.name.substring( 5 ).toLowerCase() !== 'start' && to.name.substring( 5 ).toLowerCase() !== 'root' ) {
|
||||
return { name: 'setupStart' };
|
||||
}
|
||||
} );
|
||||
|
||||
let doSetup = true;
|
||||
|
||||
if ( doSetup ) {
|
||||
import( '@/router/setupRoutes' ).then( data => {
|
||||
router.addRoute( data.default );
|
||||
setTimeout( function () {
|
||||
router.replace( window.location.pathname );
|
||||
}, 200 );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
export default router;
|
||||
139
src/webapp/src/router/mainRoutes.js
Normal file
139
src/webapp/src/router/mainRoutes.js
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* libreevent - mainRoutes.js
|
||||
*
|
||||
* Created by Janis Hutz 05/12/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import HomeView from '../views/HomeView.vue';
|
||||
|
||||
/*
|
||||
This file contains all the routes for all pages accessible to a normal
|
||||
user. It also includes some pages that require sign in.
|
||||
*/
|
||||
|
||||
|
||||
export default [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomeView,
|
||||
meta: {
|
||||
title: 'Home - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tickets',
|
||||
name: 'tickets',
|
||||
component: () => import( '../views/OrderView.vue' ),
|
||||
meta: {
|
||||
title: 'Order ticket - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import( '../views/LoginView.vue' ),
|
||||
meta: {
|
||||
title: 'Login - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/admin/login',
|
||||
name: 'adminLogin',
|
||||
component: () => import( '../views/AdminLoginView.vue' ),
|
||||
meta: {
|
||||
title: 'Login :: Admin - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/signup',
|
||||
name: 'signup',
|
||||
component: () => import( '../views/SignupView.vue' ),
|
||||
meta: {
|
||||
title: 'Signup - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/account',
|
||||
name: 'account',
|
||||
component: () => import( '../views/AccountView.vue' ),
|
||||
meta: {
|
||||
title: 'Account - libreevent'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tickets/details',
|
||||
name: 'ticketDetails',
|
||||
component: () => import( '../views/TicketsDetailsView.vue' ),
|
||||
meta: {
|
||||
title: 'Details - libreevent',
|
||||
transition: 'scale'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/tickets/order',
|
||||
name: 'ticketOrder',
|
||||
component: () => import( '../views/TicketsOrderingView.vue' ),
|
||||
meta: {
|
||||
title: 'Order ticket - libreevent',
|
||||
transition: 'scale'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/cart',
|
||||
name: 'cart',
|
||||
component: () => import( '../views/CartView.vue' ),
|
||||
meta: {
|
||||
title: 'Cart - libreevent',
|
||||
transition: 'scale'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/purchase',
|
||||
name: 'purchase',
|
||||
component: () => import( '@/views/PurchaseView.vue' ),
|
||||
meta: {
|
||||
title: 'Purchase - libreevent',
|
||||
transition: 'scale'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/pay',
|
||||
name: 'pay',
|
||||
component: () => import( '@/views/PaymentView.vue' ),
|
||||
meta: {
|
||||
title: 'Pay - libreevent',
|
||||
transition: 'scale',
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'NotFound',
|
||||
component: () => import( '@/views/404.vue' ),
|
||||
meta: {
|
||||
title: '404 - Page not found :: libreevent',
|
||||
transition: 'scale',
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/admin/seatplan',
|
||||
name: 'adminSeatplanEditor',
|
||||
component: () => import( '@/views/admin/events/EditorView.vue' ),
|
||||
meta: {
|
||||
title: 'Seatplan Editor :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/admin/ticketEditor',
|
||||
name: 'adminTicketEditor',
|
||||
component: () => import( '@/views/admin/events/TicketEditorView.vue' ),
|
||||
meta: {
|
||||
title: 'Ticket Editor :: Admin - libreevent',
|
||||
adminAuthRequired: true,
|
||||
}
|
||||
},
|
||||
]
|
||||
83
src/webapp/src/router/setupRoutes.js
Normal file
83
src/webapp/src/router/setupRoutes.js
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* libreevent - setupRoutes.js
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
export default {
|
||||
path: '/setup',
|
||||
name: 'setup',
|
||||
component: () => import( '../views/SetupView.vue' ),
|
||||
meta: {
|
||||
title: 'Login :: Admin - libreevent',
|
||||
setupAuthRequired: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'setupStart',
|
||||
component: () => import( '../views/setup/SetupStartView.vue' ),
|
||||
meta: {
|
||||
title: 'Start :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'root',
|
||||
name: 'setupRoot',
|
||||
component: () => import( '../views/setup/SetupRootView.vue' ),
|
||||
meta: {
|
||||
title: 'Root account :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'page',
|
||||
name: 'setupPage',
|
||||
component: () => import( '../views/setup/SetupPageView.vue' ),
|
||||
meta: {
|
||||
title: 'Landing page :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'payments',
|
||||
name: 'setupPayments',
|
||||
component: () => import( '../views/setup/SetupPaymentsView.vue' ),
|
||||
meta: {
|
||||
title: 'Payments :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'events',
|
||||
name: 'setupEvents',
|
||||
component: () => import( '../views/setup/SetupEventsView.vue' ),
|
||||
meta: {
|
||||
title: 'Events :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'tos',
|
||||
name: 'setupTOS',
|
||||
component: () => import( '../views/setup/SetupTOSView.vue' ),
|
||||
meta: {
|
||||
title: 'TOS (Optional) :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'complete',
|
||||
name: 'setupComplete',
|
||||
component: () => import( '../views/setup/SetupCompleteView.vue' ),
|
||||
meta: {
|
||||
title: 'Setup complete :: Setup - libreevent',
|
||||
setupAuthRequired: true,
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
28
src/webapp/src/stores/backendStore.js
Normal file
28
src/webapp/src/stores/backendStore.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* libreevent - backendStore.js
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useBackendStore = defineStore ( 'backend', {
|
||||
state: () => ( { 'visitedSetupPages': {}, 'guestPurchase': false, 'guestPurchaseAllowed': true } ),
|
||||
getters: {
|
||||
getVisitedSetupPages: ( state ) => state.visitedSetupPages,
|
||||
getIsGuestPurchase: ( state ) => state.guestPurchase,
|
||||
getIsGuestPurchaseAllowed: ( state ) => state.guestPurchaseAllowed,
|
||||
},
|
||||
actions: {
|
||||
addVisitedSetupPages ( page, data ) {
|
||||
this.visitedSetupPages[ page ] = data;
|
||||
sessionStorage.setItem( 'visitedSetupPages', JSON.stringify( this.visitedSetupPages ) );
|
||||
},
|
||||
loadVisitedSetupPages () {
|
||||
this.visitedSetupPages = sessionStorage.getItem( 'visitedSetupPages' ) ? JSON.parse( sessionStorage.getItem( 'visitedSetupPages' ) ) : {};
|
||||
}
|
||||
}
|
||||
} );
|
||||
26
src/webapp/src/stores/userStore.js
Normal file
26
src/webapp/src/stores/userStore.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* libreevent - userStore.js
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useUserStore = defineStore ( 'user', {
|
||||
state: () => ( { 'isUserAuth': true, 'isAdminAuth': true, 'userData': {} } ),
|
||||
getters: {
|
||||
getUserAuthenticated: ( state ) => state.isUserAuth,
|
||||
getAdminAuthenticated: ( state ) => state.isAdminAuth,
|
||||
},
|
||||
actions: {
|
||||
setUserAuth ( auth ) {
|
||||
this.isUserAuth = auth;
|
||||
},
|
||||
setAdminAuth ( auth ) {
|
||||
this.isAdminAuth = auth;
|
||||
}
|
||||
}
|
||||
} );
|
||||
48
src/webapp/src/views/404.vue
Normal file
48
src/webapp/src/views/404.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<!--
|
||||
* libreevent - 404.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="notFound">
|
||||
<h1 class="code">404</h1>
|
||||
<h2 class="message">The page you are looking for was not found on the server!</h2>
|
||||
<router-link to="/">Return to home page</router-link>
|
||||
<a href="https://libreevent.janishutz.com/docs/errors#404" target="_blank">More information on this error</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.notFound {
|
||||
font-family: monospace;
|
||||
color: var( --primary-color );
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.code {
|
||||
font-size: 2500%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.small {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: initial;
|
||||
}
|
||||
</style>
|
||||
12
src/webapp/src/views/AccountView.vue
Normal file
12
src/webapp/src/views/AccountView.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>Account</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style>
|
||||
nav {
|
||||
display: initial;
|
||||
}
|
||||
</style>
|
||||
75
src/webapp/src/views/AdminLoginView.vue
Normal file
75
src/webapp/src/views/AdminLoginView.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<!--
|
||||
* libreevent - AdminLoginView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="login-app">
|
||||
<h1>Log into your admin account</h1>
|
||||
<form>
|
||||
<label for="mail">Email address</label><br>
|
||||
<input type="email" v-model="formData[ 'mail' ]" name="mail" id="mail" required><br><br>
|
||||
<label for="password">Password</label><br>
|
||||
<input type="text" v-model="formData[ 'password' ]" name="password" id="password" required>
|
||||
</form>
|
||||
<button @click="login();" class="button">Log in</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
formData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login () {
|
||||
this.$router.push( '/admin' );
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.login {
|
||||
background-color: green;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.login-app {
|
||||
background-color: var( --background-color );
|
||||
min-height: fit-content;
|
||||
min-height: fit-content;
|
||||
padding: 5% 20%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 5px 10px;
|
||||
margin-top: 2%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
nav {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
158
src/webapp/src/views/CartView.vue
Normal file
158
src/webapp/src/views/CartView.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<!--
|
||||
* libreevent - CartView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="cart">
|
||||
<h1>Cart</h1>
|
||||
<div v-if="cartNotEmpty" class="cart-list">
|
||||
<h3>Your tickets</h3>
|
||||
<ul v-for="event in tickets" class="cart-list">
|
||||
<li>{{ event.name }}
|
||||
<ul v-for="ticket in event.selectedSeats">
|
||||
<li>{{ ticket.name }} ({{ ticket.category.name }}, {{ ticket.ageGroup }}) {{ event.currency }} {{ ticket.price }} <span class="material-symbols-outlined deleteButton" @click="deleteEntry( ticket.name, event.name )" title="Delete ticket">delete</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tool-wrapper">
|
||||
<h4>Total: {{ backend.currency }} {{ backend.total }}</h4>
|
||||
<router-link to="/purchase">Purchase now</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
Cart is empty. Please add tickets <router-link to="/tickets">here</router-link>
|
||||
<div class="empty-cart-wrapper">
|
||||
<span class="material-symbols-outlined empty-cart">remove_shopping_cart</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.cart {
|
||||
text-align: justify;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-cart-wrapper {
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.empty-cart {
|
||||
display: block;
|
||||
font-size: 20rem;
|
||||
}
|
||||
|
||||
.cart-list {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.tool-wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.deleteButton {
|
||||
cursor: pointer;
|
||||
font-size: 110%;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tickets: {},
|
||||
backend: {},
|
||||
cartNotEmpty: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadCart () {
|
||||
this.cartNotEmpty = false;
|
||||
let tickets = JSON.parse( sessionStorage.getItem( 'cart' ) );
|
||||
|
||||
for ( let event in tickets ) {
|
||||
if ( Object.keys( tickets[ event ][ 'selectedSeats' ] ).length ) {
|
||||
this.cartNotEmpty = true;
|
||||
};
|
||||
}
|
||||
|
||||
this.tickets = tickets;
|
||||
this.backend = JSON.parse( sessionStorage.getItem( 'backend' ) );
|
||||
},
|
||||
deleteEntry( id, eventName ) {
|
||||
if ( confirm( 'Do you really want to delete this ticket?' ) ) {
|
||||
let tickets = JSON.parse( sessionStorage.getItem( 'cart' ) );
|
||||
for ( let event in tickets ) {
|
||||
let ev = tickets[ event ];
|
||||
if ( ev.name == eventName ) {
|
||||
for ( let ticket in ev[ 'selectedSeats' ] ) {
|
||||
if ( ev[ 'selectedSeats' ][ ticket ].name ) {
|
||||
delete tickets[ event ][ 'selectedSeats' ][ ticket ];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( tickets ) );
|
||||
this.sumUp();
|
||||
this.loadCart();
|
||||
};
|
||||
},
|
||||
sumUp () {
|
||||
// This function calculates the total price of the tickets for this event.
|
||||
let cart = sessionStorage.getItem( 'cart' ) ? JSON.parse( sessionStorage.getItem( 'cart' ) ) : {};
|
||||
|
||||
let price = 0;
|
||||
for ( let i in cart ) {
|
||||
for ( let entry in cart[ i ][ 'selectedSeats' ] ) {
|
||||
price += parseInt( cart[ i ][ 'selectedSeats' ][ entry ][ 'price' ] );
|
||||
}
|
||||
}
|
||||
|
||||
let back = {};
|
||||
|
||||
back[ 'total' ] = price;
|
||||
back[ 'currency' ] = this.backend.currency;
|
||||
|
||||
sessionStorage.setItem( 'backend', JSON.stringify( back ) );
|
||||
|
||||
this.total = price;
|
||||
|
||||
sessionStorage.setItem( 'cart', JSON.stringify( cart ) );
|
||||
},
|
||||
},
|
||||
created () {
|
||||
this.loadCart();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
nav {
|
||||
display: initial;
|
||||
}
|
||||
</style>
|
||||
8
src/webapp/src/views/GuestPurchaseView.vue
Normal file
8
src/webapp/src/views/GuestPurchaseView.vue
Normal file
@@ -0,0 +1,8 @@
|
||||
<!--
|
||||
* libreevent - GuestPurchaseView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
32
src/webapp/src/views/HomeView.vue
Normal file
32
src/webapp/src/views/HomeView.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
* libreevent - HomeView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<initial></initial>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import initial from '@/components/initial.vue';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
formData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setup () {
|
||||
|
||||
}
|
||||
},
|
||||
components: {
|
||||
initial
|
||||
}
|
||||
};
|
||||
</script>
|
||||
84
src/webapp/src/views/LoginView.vue
Normal file
84
src/webapp/src/views/LoginView.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<!--
|
||||
* libreevent - LoginView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="login-app">
|
||||
<h1>Log in</h1>
|
||||
<form>
|
||||
<label for="mail">Email</label><br>
|
||||
<input type="email" v-model="formData[ 'mail' ]" name="mail" id="mail" required><br><br>
|
||||
<label for="password">Password</label><br>
|
||||
<input type="password" v-model="formData[ 'password' ]" name="password" id="password" required>
|
||||
</form>
|
||||
<button @click="login();" class="button">Log in</button>
|
||||
<router-link to="/signup" class="button">Sign up instead</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import { mapStores } from 'pinia';
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
formData: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapStores( useUserStore )
|
||||
},
|
||||
methods: {
|
||||
login () {
|
||||
this.userStore.setUserAuth( true );
|
||||
this.$router.push( sessionStorage.getItem( 'redirect' ) ? sessionStorage.getItem( 'redirect' ) : '/account' );
|
||||
sessionStorage.removeItem( 'redirect' );
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
/* TODO: Update colour to image */
|
||||
.login {
|
||||
background-color: green;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
|
||||
.login-app {
|
||||
background-color: var( --background-color );
|
||||
min-height: fit-content;
|
||||
min-height: fit-content;
|
||||
padding: 5% 20%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 5px 10px;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: initial;
|
||||
}
|
||||
</style>
|
||||
109
src/webapp/src/views/OrderView.vue
Normal file
109
src/webapp/src/views/OrderView.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<!--
|
||||
* libreevent - OrderView.vue
|
||||
*
|
||||
* Created by Janis Hutz 05/14/2023, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="order">
|
||||
<h1>Order tickets</h1>
|
||||
<div class="order-app" v-if="events">
|
||||
<ul>
|
||||
<li v-for="event in events">
|
||||
<router-link to="/tickets/details" class="ticket" @click="setActiveTicket( event.eventID );">
|
||||
<div class="ticket-name">
|
||||
<h3>{{ event.name }}</h3>
|
||||
<p>{{ event.description }}</p>
|
||||
</div>
|
||||
<div class="ticket-info">
|
||||
<p>Free seats: {{ event.freeSeats }} / {{ event.maxSeats }}</p>
|
||||
<p>{{ event.location }}, {{ event.date }}</p>
|
||||
<h4>Starting at {{ event.currency }} {{ event.startingPrice }}</h4>
|
||||
</div>
|
||||
<img :src="require( '@/assets/' + event.logo )" alt="event logo" class="ticket-logo">
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="order-app" v-else>
|
||||
No future events are available!
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.order-app {
|
||||
text-align: justify;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.ticket {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
color: var( --primary-color );
|
||||
border-color: var( --primary-color );
|
||||
border-width: 1px;
|
||||
height: fit-content;
|
||||
border-style: solid;
|
||||
padding: 10px;
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.ticket:hover {
|
||||
background-color: var( --hover-color );
|
||||
transition: 0.4s;
|
||||
}
|
||||
|
||||
.ticket-logo {
|
||||
height: 20vh;
|
||||
width: auto;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.ticket-name {
|
||||
margin-right: auto;
|
||||
max-width: 35%;
|
||||
}
|
||||
|
||||
.ticket-info {
|
||||
margin-left: auto;
|
||||
margin-right: auto
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'OrderView',
|
||||
methods: {
|
||||
setActiveTicket ( id ) {
|
||||
sessionStorage.setItem( 'selectedTicket', id );
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
events: { 'test':{ 'name': 'TestEvent', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'TestDate', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test', 'currency': 'CHF', 'logo': 'logo.png' }, 'test2':{ 'name': 'TestEvent2', 'description': 'This is a description for the TestEvent to test multiline support and proper positioning of the Fields', 'freeSeats': 2, 'maxSeats': 2, 'date':'TestDate', 'startingPrice':15, 'location': 'TestLocation', 'eventID': 'test2', 'currency': 'CHF', 'logo': 'logo.png' } }
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
nav {
|
||||
display: initial;
|
||||
}
|
||||
</style>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user