diff --git a/app.py b/app.py index 554a392..da639b8 100644 --- a/app.py +++ b/app.py @@ -150,12 +150,16 @@ def logout(): @admin_required def upload_content(): if request.method == 'POST': - target_type = request.form['target_type'] - target_id = int(request.form['target_id']) + target_type = request.form.get('target_type') + target_id = request.form.get('target_id') files = request.files.getlist('files') duration = int(request.form['duration']) - return_url = request.form['return_url'] - media_type = request.form['media_type'] + return_url = request.form.get('return_url') + media_type = request.form.get('media_type') + + if not target_type or not target_id: + flash('Please select a target type and target ID.', 'danger') + return redirect(url_for('upload_content')) for file in files: filename = secure_filename(file.filename) @@ -202,14 +206,27 @@ def upload_content(): # Remove the original PDF file after processing os.remove(file_path) + # Handle video files + elif media_type == 'video': + # Add the video file to the playlist + if target_type == 'group': + group = Group.query.get_or_404(target_id) + for player in group.players: + new_content = Content(file_name=filename, duration=duration, player_id=player.id) + db.session.add(new_content) + elif target_type == 'player': + new_content = Content(file_name=filename, duration=duration, player_id=target_id) + db.session.add(new_content) + db.session.commit() return redirect(return_url) + # Handle GET request target_type = request.args.get('target_type') target_id = request.args.get('target_id') return_url = request.args.get('return_url', url_for('dashboard')) - players = [{'id': player.id, 'username': player.username} for player in Player.query.filter(~Player.groups.any()).all()] + players = [{'id': player.id, 'username': player.username} for player in Player.query.all()] groups = [{'id': group.id, 'name': group.name} for group in Group.query.all()] return render_template('upload_content.html', target_type=target_type, target_id=target_id, players=players, groups=groups, return_url=return_url) diff --git a/instance/dashboard.db b/instance/dashboard.db index 89d5bf1..fd222a1 100644 Binary files a/instance/dashboard.db and b/instance/dashboard.db differ diff --git a/static/uploads/VID-20250502-WA0066.mp4 b/static/uploads/VID-20250502-WA0066.mp4 new file mode 100644 index 0000000..904b8b3 Binary files /dev/null and b/static/uploads/VID-20250502-WA0066.mp4 differ diff --git a/static/uploads/merged_1.jpg b/static/uploads/merged_1.jpg deleted file mode 100644 index 1a56da3..0000000 Binary files a/static/uploads/merged_1.jpg and /dev/null differ diff --git a/static/uploads/merged_2.jpg b/static/uploads/merged_2.jpg deleted file mode 100644 index 915fc85..0000000 Binary files a/static/uploads/merged_2.jpg and /dev/null differ diff --git a/static/uploads/merged_3.jpg b/static/uploads/merged_3.jpg deleted file mode 100644 index b8be422..0000000 Binary files a/static/uploads/merged_3.jpg and /dev/null differ diff --git a/static/uploads/welcome_Prodrive_4.png b/static/uploads/welcome_Prodrive_4.png deleted file mode 100644 index 45bc8eb..0000000 Binary files a/static/uploads/welcome_Prodrive_4.png and /dev/null differ diff --git a/templates/add_player.html b/templates/add_player.html index 6cc91d5..d688465 100644 --- a/templates/add_player.html +++ b/templates/add_player.html @@ -1,6 +1,8 @@ - + + + Add Player

Add Player

-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - +
+ + Back to Dashboard
-
- - -
- - Back to Dashboard
diff --git a/templates/admin.html b/templates/admin.html index 8e03b88..c2b25c3 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -1,6 +1,8 @@ - + + + Admin Panel @@ -46,6 +64,7 @@

Admin Panel

+

Manage Users

@@ -112,33 +131,26 @@
+
-

Upload Personalization Photos for the App

+

Upload Personalization Photos

-
+
{% if logo_exists %} Current Logo {% endif %} -
-
-
-
-
-
+
{% if login_picture_exists %} Current Login Picture {% endif %} -
-
-
@@ -166,7 +178,7 @@
- +

Clean Unused Files

@@ -193,7 +205,7 @@ popup.style.display = 'block'; setTimeout(() => { popup.style.display = 'none'; - }, 5000); // Increased time to 5 seconds + }, 5000); } diff --git a/templates/create_group.html b/templates/create_group.html index e93fa5e..5ed5568 100644 --- a/templates/create_group.html +++ b/templates/create_group.html @@ -1,6 +1,8 @@ - + + + Create Group

Create Group

-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - +
+ + Back to Dashboard
- - Back to Dashboard
diff --git a/templates/dashboard.html b/templates/dashboard.html index 8552cc1..2325cdb 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -18,6 +18,22 @@ max-height: 100px; margin-right: 20px; } + @media (max-width: 768px) { + .logo { + max-height: 50px; + margin-right: 10px; + } + h1 { + font-size: 1.5rem; + } + .btn { + font-size: 0.9rem; + padding: 0.5rem 1rem; + } + .card { + margin-bottom: 1rem; + } + } @@ -35,8 +51,8 @@
-
- + +

Players

@@ -68,8 +84,10 @@ {% endif %}
+
- + +

Group of Players

@@ -97,8 +115,10 @@
+
- + +

Content Upload

@@ -111,7 +131,7 @@ {% if current_user.role == 'admin' %} -
+

App Settings

diff --git a/templates/edit_group.html b/templates/edit_group.html index d619850..850c435 100644 --- a/templates/edit_group.html +++ b/templates/edit_group.html @@ -1,15 +1,61 @@ -
-
- - + + + + + + Edit Group + + + + +
+

Edit Group

+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + Back to Dashboard +
+
-
- - -
- - \ No newline at end of file + + + \ No newline at end of file diff --git a/templates/edit_player.html b/templates/edit_player.html index c5ec83b..56ed80b 100644 --- a/templates/edit_player.html +++ b/templates/edit_player.html @@ -1,6 +1,8 @@ - + + + Edit Player

Edit Player

-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - + -
- - -
- - Back to Player Page - Back to Dashboard
diff --git a/templates/login.html b/templates/login.html index fb844f2..558c0c5 100644 --- a/templates/login.html +++ b/templates/login.html @@ -1,34 +1,53 @@ - + + + Login - +
-
-
+
+
{% if login_picture_exists %} {% endif %}
-
+

Login

- +
- +
diff --git a/templates/manage_group.html b/templates/manage_group.html index a2c4925..35dbc47 100644 --- a/templates/manage_group.html +++ b/templates/manage_group.html @@ -5,6 +5,31 @@ Manage Group +
diff --git a/templates/player_page.html b/templates/player_page.html index 78c8ab2..77670b0 100644 --- a/templates/player_page.html +++ b/templates/player_page.html @@ -1,6 +1,8 @@ - + + + Player Schedule @@ -62,20 +76,27 @@ {% if content %}
    {% for media in content %} -
  • -
    -

    Media Name: {{ media.file_name }}

    -
    -
    -
    - seconds - +
  • +
    + +
    +

    Media Name: {{ media.file_name }}

    - - -
    - -
    + + +
    +
    +
    + seconds + +
    + +
    +
    + +
    +
    +
  • {% endfor %}
diff --git a/templates/register.html b/templates/register.html index f4d1d17..c9ff94b 100644 --- a/templates/register.html +++ b/templates/register.html @@ -1,6 +1,8 @@ - + + + Register

Register

-
- - +
+
+
+ + +
+
+
+
+ + +
+
-
- - +
+ + Back to Login
-
diff --git a/templates/upload_content.html b/templates/upload_content.html index 8e75487..4d4a438 100644 --- a/templates/upload_content.html +++ b/templates/upload_content.html @@ -1,6 +1,8 @@ - + + + Upload Content @@ -45,75 +59,90 @@
-
- - - {% if target_type %} - - {% endif %} -
-
- - - {% if target_id %} - - {% endif %} -
-
- - -
-
- - -
-
- - -
- -
- Back - Back to Dashboard -
- - -