103 Commits
Author SHA1 Message Date
sankalp 67a788143f fix(dependabot): fix indentation and schema rules 2025-04-22 06:06:07 +05:45
sankalp 829d002d60 refactor(dependabot): changes interval 2025-04-22 05:10:54 +05:45
sankalp 21305c1fc5 fix(config): validation logic 2025-04-22 05:05:20 +05:45
sankalp 9be8764716 fix(signals): course tracking fix 2025-04-22 04:57:13 +05:45
sankalp 7715c6b72a fix(fake data generator): course tracking fix 2025-04-22 04:56:09 +05:45
sankalp d69511806a docs(readme):update 2025-04-22 04:48:42 +05:45
sankalp 5b03a4b307 signals(fix): huge errors 2025-04-22 04:48:16 +05:45
sankalp a7ce06325c signals(fix): error on course tracking 2025-04-22 04:40:53 +05:45
sankalp b6eacf720b models(update): remove meeting field from student 2025-04-22 04:32:17 +05:45
sankalp 000e2a6d9d signals: add signal to create HOD group 2025-04-22 04:29:13 +05:45
sankalp fc37c6b163 docs(readme):update 2025-04-22 03:57:55 +05:45
sankalp deaba4bed8 huge updates 2025-04-22 03:47:56 +05:45
sankalp a9a5f1bc10 huge updates 2025-04-22 03:47:31 +05:45
sankalp 9b721e10d4 Update README 2025-04-20 18:03:33 +05:45
sankalp 76a3423580 Update README 2025-04-20 17:55:36 +05:45
sankalp 5cfe342288 Update README 2025-04-20 17:50:17 +05:45
sankalp 5842fb9890 huge update 2025-04-20 17:48:44 +05:45
sankalp a5d938b3b0 huge update 2025-04-20 17:46:30 +05:45
sankalp dbc0a7d695 fix leak 2025-04-04 09:42:42 +05:45
Sankalp Tharu 8d180aa751 Update requirements.txt 2025-04-04 09:37:20 +05:45
Sankalp Tharu 2acd08136e Merge pull request #21 from S4NKALP/dependabot/pip/protobuf-6.30.2
fix(deps): bump protobuf from 5.29.4 to 6.30.2
2025-04-04 09:23:06 +05:45
dependabot[bot] d68b04de45 fix(deps): bump protobuf from 5.29.4 to 6.30.2
Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 5.29.4 to 6.30.2.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v5.29.4...v6.30.2)

---
updated-dependencies:
- dependency-name: protobuf
  dependency-version: 6.30.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-03 23:04:23 +00:00
sankalp c7b0e1d91f update 2025-04-03 23:28:55 +05:45
Sankalp Tharu 33b4941c5b Merge pull request #20 from S4NKALP/dev
update
2025-04-03 17:04:31 +05:45
sankalp 64d28e4435 update 2025-04-03 17:03:53 +05:45
Sankalp Tharu bc44c6ae0c Merge pull request #19 from S4NKALP/dev
update
2025-04-03 17:01:46 +05:45
sankalp b86bd04641 update 2025-04-03 17:01:15 +05:45
Sankalp Tharu 870911c086 Merge pull request #18 from S4NKALP/dev
update
2025-04-03 17:00:05 +05:45
sankalp a88c086652 update 2025-04-03 16:59:30 +05:45
Sankalp Tharu fbb50172dc Merge pull request #17 from S4NKALP/dev
update
2025-04-03 16:58:04 +05:45
sankalp a329f16c73 update 2025-04-03 16:57:26 +05:45
Sankalp Tharu 1b06e0f6bc Merge pull request #16 from S4NKALP/dev
Dev
2025-04-03 16:42:17 +05:45
Sankalp Tharu c0002cf039 Merge branch 'main' into dev 2025-04-03 16:41:59 +05:45
Sankalp Tharu 3b3ac3b718 Update requirements.txt 2025-04-03 16:38:56 +05:45
sankalp 22a49522be update 2025-04-03 16:37:58 +05:45
sankalp 6f142d8aff update gitignore 2025-04-03 16:35:14 +05:45
sankalp e729cd615c huge updates 2025-04-03 16:30:28 +05:45
sankalp 2c62f212cf update gitignore 2025-03-29 09:30:52 +05:45
sankalp beae06e57c update readme 2025-03-29 09:18:15 +05:45
sankalp 94ad0cadf2 delete migrations 2025-03-29 09:16:49 +05:45
sankalp 17e7ed0818 huge updates i donot track what updates i have made 2025-03-29 03:24:16 +05:45
sankalp 84dd5d0b2f huge updates i donot track what updates i have made 2025-03-29 03:22:47 +05:45
Sankalp Tharu 97c532a8aa Merge pull request #14 from S4NKALP/dependabot/pip/pytz-2025.2
fix(deps): bump pytz from 2025.1 to 2025.2
2025-03-29 01:51:32 +05:45
dependabot[bot] 52a8a604e4 fix(deps): bump pytz from 2025.1 to 2025.2
Bumps [pytz](https://github.com/stub42/pytz) from 2025.1 to 2025.2.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2025.1...release_2025.2)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-28 20:06:03 +00:00
Sankalp Tharu ba49bdb5d2 Merge pull request #15 from S4NKALP/dependabot/pip/setuptools-78.1.0
fix(deps): bump setuptools from 78.0.2 to 78.1.0
2025-03-29 01:50:01 +05:45
dependabot[bot] c140c78a74 fix(deps): bump setuptools from 78.0.2 to 78.1.0
Bumps [setuptools](https://github.com/pypa/setuptools) from 78.0.2 to 78.1.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v78.0.2...v78.1.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-26 22:28:45 +00:00
sankalp d02b470ca0 updates 2025-03-26 02:05:14 +05:45
sankalp defd0c59ee updates 2025-03-26 02:00:34 +05:45
sankalp eee09e2e47 updates 2025-03-26 01:59:23 +05:45
sankalp 0868e7d9fb updates 2025-03-26 00:19:16 +05:45
sankalp d4696b8fee updates 2025-03-26 00:17:10 +05:45
Sankalp Tharu b791a2992e Merge pull request #13 from S4NKALP/dependabot/pip/setuptools-78.0.2
fix(deps): bump setuptools from 77.0.3 to 78.0.2
2025-03-25 10:34:19 +05:45
dependabot[bot] 223791f7c6 fix(deps): bump setuptools from 77.0.3 to 78.0.2
Bumps [setuptools](https://github.com/pypa/setuptools) from 77.0.3 to 78.0.2.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v77.0.3...v78.0.2)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 00:47:18 +00:00
Sankalp Tharu 6fd8bc0370 Merge pull request #12 from S4NKALP/dependabot/pip/setuptools-77.0.3
fix(deps): bump setuptools from 77.0.1 to 77.0.3
2025-03-21 11:46:32 +05:45
dependabot[bot] 177facc79d fix(deps): bump setuptools from 77.0.1 to 77.0.3
Bumps [setuptools](https://github.com/pypa/setuptools) from 77.0.1 to 77.0.3.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v77.0.1...v77.0.3)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-20 22:35:39 +00:00
Sankalp Tharu 3461de9c7d Merge pull request #11 from S4NKALP/dependabot/pip/setuptools-77.0.1
fix(deps): bump setuptools from 76.1.0 to 77.0.1
2025-03-20 13:45:45 +05:45
dependabot[bot] a61b5837e6 fix(deps): bump setuptools from 76.1.0 to 77.0.1
Bumps [setuptools](https://github.com/pypa/setuptools) from 76.1.0 to 77.0.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v76.1.0...v77.0.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-19 22:59:30 +00:00
Sankalp Tharu a1b55662be Merge pull request #10 from S4NKALP/dependabot/pip/setuptools-76.1.0
fix(deps): bump setuptools from 76.0.0 to 76.1.0
2025-03-19 13:09:35 +05:45
dependabot[bot] f8af777ee7 fix(deps): bump setuptools from 76.0.0 to 76.1.0
Bumps [setuptools](https://github.com/pypa/setuptools) from 76.0.0 to 76.1.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v76.0.0...v76.1.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 22:51:13 +00:00
Sankalp Tharu aae0ce08c9 Merge pull request #9 from S4NKALP/dependabot/pip/setuptools-76.0.0
fix(deps): bump setuptools from 75.8.2 to 76.0.0
2025-03-11 21:41:06 +05:45
dependabot[bot] 47f1bb9bc4 fix(deps): bump setuptools from 75.8.2 to 76.0.0
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.8.2 to 76.0.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.8.2...v76.0.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 23:06:52 +00:00
Sankalp Tharu e7d48feef4 Merge pull request #8 from S4NKALP/dependabot/pip/django-5.1.7
fix(deps): bump django from 5.1.6 to 5.1.7
2025-03-07 10:02:41 +05:45
dependabot[bot] e0d9f7a20e fix(deps): bump django from 5.1.6 to 5.1.7
Bumps [django](https://github.com/django/django) from 5.1.6 to 5.1.7.
- [Commits](https://github.com/django/django/compare/5.1.6...5.1.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 22:24:30 +00:00
Sankalp Tharu a9fe0a819a Merge pull request #7 from S4NKALP/dependabot/pip/setuptools-75.8.2
fix(deps): bump setuptools from 75.8.1 to 75.8.2
2025-02-27 09:13:51 +05:45
dependabot[bot] 1b4c3e8321 fix(deps): bump setuptools from 75.8.1 to 75.8.2
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.8.1 to 75.8.2.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.8.1...v75.8.2)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-26 22:41:37 +00:00
Sankalp Tharu 42306e548d Update requirements.txt 2025-02-26 15:48:09 +05:45
Sankalp Tharu 13d5ab5258 Merge pull request #6 from S4NKALP/dev
Dev
2025-02-26 15:46:04 +05:45
Sankalp Tharu 01046fdcee Merge pull request #5 from S4NKALP/dependabot/pip/setuptools-75.8.1
fix(deps): bump setuptools from 75.8.0 to 75.8.1
2025-02-26 11:31:26 +05:45
dependabot[bot] 7edfc96a7c fix(deps): bump setuptools from 75.8.0 to 75.8.1
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.8.0 to 75.8.1.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.8.0...v75.8.1)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 22:59:29 +00:00
Sankalp Tharu 07e50974b9 Merge pull request #4 from S4NKALP/dependabot/pip/django-5.1.6
fix(deps): bump django from 5.1.5 to 5.1.6
2025-02-06 08:30:05 +05:45
dependabot[bot] 584495d0f7 fix(deps): bump django from 5.1.5 to 5.1.6
Bumps [django](https://github.com/django/django) from 5.1.5 to 5.1.6.
- [Commits](https://github.com/django/django/compare/5.1.5...5.1.6)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-05 22:37:47 +00:00
Sankalp Tharu d46f55b409 Merge pull request #3 from S4NKALP/dependabot/pip/pytz-2025.1
fix(deps): bump pytz from 2024.2 to 2025.1
2025-02-01 19:46:44 +05:45
dependabot[bot] b3c9826d25 fix(deps): bump pytz from 2024.2 to 2025.1
Bumps [pytz](https://github.com/stub42/pytz) from 2024.2 to 2025.1.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](https://github.com/stub42/pytz/compare/release_2024.2...release_2025.1)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-31 22:14:56 +00:00
Sankalp Tharu 6aa9a8b78d Merge pull request #2 from S4NKALP/dependabot/pip/setuptools-75.8.0
fix(deps): bump setuptools from 75.7.0 to 75.8.0
2025-01-28 12:27:40 +05:45
dependabot[bot] f3a4f77f3c fix(deps): bump setuptools from 75.7.0 to 75.8.0
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.7.0 to 75.8.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.7.0...v75.8.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-28 06:36:11 +00:00
sankalp 10d6702610 Add Dependabot configuration for Django project 2025-01-28 12:20:18 +05:45
Sankalp Tharu 2bae4b2802 Merge pull request #1 from S4NKALP/dependabot/pip/django-5.1.5
Bump django from 5.1.4 to 5.1.5
2025-01-28 12:15:13 +05:45
dependabot[bot] 1cb86bd9e8 Bump django from 5.1.4 to 5.1.5
Bumps [django](https://github.com/django/django) from 5.1.4 to 5.1.5.
- [Commits](https://github.com/django/django/compare/5.1.4...5.1.5)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-28 06:28:23 +00:00
sankalp c74c50aa68 huh new thing 2025-01-19 14:44:28 +05:45
sankalp dc55dad9b9 huh new thing 2025-01-17 09:10:45 +05:45
sankalp 92c80eec2f lol i dont know what i am doing 2025-01-16 13:18:00 +05:45
sankalp fccc95ed06 lol 2025-01-16 13:16:44 +05:45
sankalp dd41b5ff78 fix 2025-01-10 14:10:39 +05:45
sankalp 1e79deb319 update 2025-01-10 14:09:32 +05:45
sankalp 29680072a0 update 2025-01-08 21:15:45 +05:45
sankalp aaf2a1b2f6 update 2025-01-07 23:30:30 +05:45
sankalp 34effb453a fix readme 2025-01-07 17:01:14 +05:45
sankalp c70c35e780 fix readme 2025-01-07 17:00:06 +05:45
sankalp 67d6473f97 fix readme 2025-01-07 16:51:44 +05:45
sankalp 86d63b342a fix readme 2025-01-07 16:50:46 +05:45
sankalp 1e101f29e1 update 2025-01-07 16:48:11 +05:45
sankalp 1f73c3dc47 update 2025-01-07 16:35:54 +05:45
sankalp 5579eb84fc update 2025-01-06 23:10:04 +05:45
sankalp 5cbe886c76 update 2025-01-06 22:41:10 +05:45
sankalp eebc2b8230 fix 2025-01-06 20:40:18 +05:45
sankalp fb5449bedd fix 2025-01-06 20:36:31 +05:45
sankalp 5668f1ce6e fix 2025-01-06 20:34:50 +05:45
Sankalp Tharu 23735b234d Create django.yml 2025-01-06 20:33:29 +05:45
sankalp 0cf38e198a fix 2025-01-06 20:32:08 +05:45
sankalp cba46bbda2 initial commit 2025-01-06 20:31:03 +05:45
sankalp b79c121f72 initial commit 2025-01-06 20:30:30 +05:45
sankalp 54039a4fce logo added 2024-12-14 16:06:22 +05:45
Sankalp Tharu 8ef6db21fa Initial commit 2024-12-14 11:54:24 +05:45
21 changed files with 2773 additions and 2735 deletions

No files matched your search

+27
View File
@@ -1,17 +1,25 @@
# Django Settings
# Required: Secret key for Django's cryptographic signing
DJANGO_SECRET_KEY=your-secret-key-here
# Optional: Enable debug mode (True/False)
DJANGO_DEBUG=True
# Optional: Comma-separated list of allowed hosts
DJANGO_ALLOWED_HOSTS=*
# Database Configuration
# Optional: Database engine (default: django.db.backends.sqlite3)
DB_ENGINE=django.db.backends.sqlite3
# Optional: Database name (default: db.sqlite3)
DB_NAME=db.sqlite3
# Optional: Database timeout in seconds (default: 20)
DB_TIMEOUT=20
# Optional: Database host (required for non-SQLite databases)
DB_HOST=
# Optional: Database port (required for non-SQLite databases)
DB_PORT=
# Optional: Database user (required for non-SQLite databases)
DB_USER=
# Optional: Database password (required for non-SQLite databases)
DB_PASSWORD=
# Cache Configuration
@@ -19,38 +27,57 @@ DB_PASSWORD=
USE_REDIS_CACHE=True
# Optional: Redis URL (default: redis://localhost:6379/1)
REDIS_URL=redis://localhost:6379/1
# Optional: Cache timeout in seconds (default: 300)
CACHE_TIMEOUT=300
# Optional: Cache key prefix (default: sms)
CACHE_KEY_PREFIX=sms
# Optional: Maximum number of cache connections (default: 1000)
CACHE_MAX_CONNECTIONS=1000
# Email Configuration
# Optional: Email backend (default: django.core.mail.backends.console.EmailBackend)
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
# Optional: Default from email address
DEFAULT_FROM_EMAIL=noreply@studentmanagementsystem.com
# Optional: Email host (required for SMTP backend)
EMAIL_HOST=
# Optional: Email port (required for SMTP backend)
EMAIL_PORT=
# Optional: Email username (required for SMTP backend)
EMAIL_USERNAME=
# Optional: Email password (required for SMTP backend)
EMAIL_PASSWORD=
# Optional: Use TLS for email (True/False)
EMAIL_USE_TLS=True
# Firebase Configuration
# Required: Firebase API key
FIREBASE_API_KEY=your_firebase_api_key_here
# Required: Firebase auth domain
FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com
# Required: Firebase project ID
FIREBASE_PROJECT_ID=your_project_id
# Required: Firebase storage bucket
FIREBASE_STORAGE_BUCKET=your_project_id.firebasestorage.app
# Required: Firebase messaging sender ID
FIREBASE_MESSAGING_SENDER_ID=your_sender_id
# Required: Firebase app ID
FIREBASE_APP_ID=your_app_id
# Required: Firebase measurement ID
FIREBASE_MEASUREMENT_ID=your_measurement_id
# SMS Configuration
# Required: SMS API key
SMS_API_KEY=your_sms_api_key_here
# Optional: SMS sender ID (default: SMSSYS)
SMS_SENDER_ID=SMSSYS
# Gunicorn Configuration
# Optional: Number of worker processes (default: 4)
GUNICORN_WORKERS=4
# Optional: Number of threads per worker (default: 2)
GUNICORN_THREADS=2
# Optional: Worker timeout in seconds (default: 30)
GUNICORN_TIMEOUT=30
# Optional: Keep-alive timeout in seconds (default: 2)
GUNICORN_KEEPALIVE=2
+3 -5
View File
@@ -64,6 +64,7 @@ db.sqlite3
db.sqlite3-journal
*/migrations/*.py
*/migrations/*
!*/migrations/__init__.py
# Flask stuff:
instance/
@@ -156,10 +157,10 @@ dump.rdb
*.DS_Store
# Firebase configuration
firebase-key.json
firebase-config.json
firebase.json
static/js/firebase-config.js
static/firebase-messaging-sw.js
firebase-key.json
# Environment files
.env
@@ -174,6 +175,3 @@ local_settings.py
*_key.json
*_credentials.json
*_secret.json
firebase-key.json
student-management-syste-2e040-firebase-adminsdk-fbsvc-6335c3d2f9.json
+21 -675
View File
@@ -1,675 +1,21 @@
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>.
MIT License
Copyright (c) 2025 Sankalp Tharu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+769 -276
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -699,11 +699,11 @@ def edit_course_tracking(request):
# Update tracking fields
start_date = request.POST.get("start_date")
if start_date:
tracking.start_date = datetime.strptime(start_date, "%Y-%m-%d").date()
tracking.start_date = start_date
expected_end_date = request.POST.get("expected_end_date")
if expected_end_date:
tracking.expected_end_date = datetime.strptime(expected_end_date, "%Y-%m-%d").date()
tracking.expected_end_date = expected_end_date
current_period = request.POST.get("current_period")
if current_period:
-15
View File
@@ -15,14 +15,6 @@ class MultiModelBackend(ModelBackend):
if username is None or password is None:
return None
# Try authenticating as superuser/admin first
try:
user = User.objects.get(email=username)
if user.check_password(password):
return user
except User.DoesNotExist:
pass
# Try authenticating as Staff by phone first
staff = Staff.objects.filter(phone=username).first()
if staff:
@@ -60,13 +52,6 @@ class MultiModelBackend(ModelBackend):
"""
Retrieve a user instance using their ID.
"""
# Try to get superuser/admin first
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
pass
# Try other user types
for model in [Staff, Student, Parent]:
try:
return model.objects.get(pk=user_id)
+4 -32
View File
@@ -1,7 +1,5 @@
from django.http import HttpResponse, HttpResponseServerError
from django.http import HttpResponse
from django.template.loader import render_to_string
import re
from django.middleware.csrf import CsrfViewMiddleware
class HTTP505Middleware:
@@ -13,13 +11,9 @@ class HTTP505Middleware:
self.get_response = get_response
def __call__(self, request):
# Simple check for HTTP version
http_version = request.META.get("SERVER_PROTOCOL", "")
if http_version and http_version.startswith("HTTP/") and http_version > "HTTP/2.0":
# This is a simplistic check - in reality, you'd want to handle this more gracefully
return HttpResponseServerError("HTTP Version Not Supported", content_type="text/plain")
return self.get_response(request)
# Process the request and get the response
response = self.get_response(request)
return response
def process_exception(self, request, exception):
# Check if exception is related to HTTP version
@@ -33,25 +27,3 @@ class HTTP505Middleware:
response_content = render_to_string("505.html", context, request)
return HttpResponse(response_content, status=505)
return None
class CSRFExemptMiddleware(CsrfViewMiddleware):
"""
Middleware to exempt specific URLs from CSRF protection.
"""
def __init__(self, get_response):
self.get_response = get_response
self.exempt_urls = [
re.compile(r'^/saveFCMToken/$'),
]
super().__init__(get_response)
def process_view(self, request, callback, callback_args, callback_kwargs):
# Check if the path matches any of the exempt URLs
path = request.path_info
if any(url.match(path) for url in self.exempt_urls):
return None # Skip CSRF validation
# Otherwise, continue with regular CSRF validation
return super().process_view(request, callback, callback_args, callback_kwargs)
+161 -136
View File
@@ -126,12 +126,14 @@ class Course(models.Model):
verbose_name = "Course"
verbose_name_plural = "Courses"
indexes = [
models.Index(fields=['name']),
models.Index(fields=['code']),
models.Index(fields=['is_active']),
models.Index(fields=['duration_type']),
models.Index(fields=['name', 'is_active']), # For active course lookups
models.Index(fields=['code', 'is_active']), # For active course lookups by code
models.Index(fields=["name"]),
models.Index(fields=["code"]),
models.Index(fields=["is_active"]),
models.Index(fields=["duration_type"]),
# For active course lookups
models.Index(fields=["name", "is_active"]),
# For active course lookups by code
models.Index(fields=["code", "is_active"]),
]
def cleanup_orphaned_data(self):
@@ -140,10 +142,10 @@ class Course(models.Model):
"""
# Clean up subjects using the correct reverse relationship
Subject.objects.filter(course=self).delete()
# Clean up course tracking records
self.student_trackings.all().delete()
# Clean up routine records
self.routines.all().delete()
@@ -222,11 +224,13 @@ class Subject(models.Model):
unique_together = ["name", "course", "period_or_year"]
ordering = ["course", "period_or_year", "name"]
indexes = [
models.Index(fields=['course']),
models.Index(fields=['period_or_year']),
models.Index(fields=['name']),
models.Index(fields=['course', 'period_or_year']), # For course period subjects
models.Index(fields=['name', 'course']), # For subject lookups
models.Index(fields=["course"]),
models.Index(fields=["period_or_year"]),
models.Index(fields=["name"]),
# For course period subjects
models.Index(fields=["course", "period_or_year"]),
# For subject lookups
models.Index(fields=["name", "course"]),
]
def cleanup_orphaned_data(self):
@@ -235,10 +239,10 @@ class Subject(models.Model):
"""
# Clean up subject files
self.subjectfile_set.all().delete()
# Clean up routine records
self.routines.all().delete()
# Clean up attendance records
self.attendance_records.all().delete()
@@ -402,12 +406,12 @@ class Student(AbstractUser):
with transaction.atomic():
# Validate data before saving
self.full_clean()
# Call the original save method
super().save(*args, **kwargs)
# Update related records in the same transaction
if hasattr(self, 'course_trackings'):
if hasattr(self, "course_trackings"):
for tracking in self.course_trackings.all():
tracking.update_completion_percentage()
except ValidationError as e:
@@ -419,13 +423,13 @@ class Student(AbstractUser):
"""Validate student data before saving"""
if self.phone and not self.phone.isdigit():
raise ValidationError("Phone number must contain only digits")
if self.email and '@' not in self.email:
if self.email and "@" not in self.email:
raise ValidationError("Invalid email format")
if self.birth_date and self.birth_date > date.today():
raise ValidationError("Birth date cannot be in the future")
if self.joining_date and self.joining_date > date.today():
raise ValidationError("Joining date cannot be in the future")
@@ -435,13 +439,13 @@ class Student(AbstractUser):
"""
# Clean up attendance records
self.attendance_records.all().delete()
# Clean up course tracking
self.course_trackings.all().delete()
# Clean up leave records
self.leave_requests.all().delete()
# Clean up meeting records
self.meetings.clear()
@@ -463,26 +467,26 @@ class Student(AbstractUser):
Get FCM tokens for notifications
"""
tokens = set()
# Get student's token
if self.fcm_token:
tokens.add(self.fcm_token)
# Get parent's token
if self.parent and self.parent.fcm_token:
tokens.add(self.parent.fcm_token)
return tokens
class Meta:
verbose_name = "Student"
verbose_name_plural = "Students"
indexes = [
models.Index(fields=['phone']),
models.Index(fields=['status']),
models.Index(fields=['course']),
models.Index(fields=['current_period']),
models.Index(fields=['joining_date']),
models.Index(fields=["phone"]),
models.Index(fields=["status"]),
models.Index(fields=["course"]),
models.Index(fields=["current_period"]),
models.Index(fields=["joining_date"]),
]
@@ -545,7 +549,9 @@ class Staff(AbstractUser):
help_text="Course for which this staff member is HOD",
)
courses_taught = models.ManyToManyField(Course, related_name="teachers", blank=True)
meetings = models.ManyToManyField("TeacherParentMeeting", related_name="staff_members", blank=True)
meetings = models.ManyToManyField(
"TeacherParentMeeting", related_name="staff_members", blank=True
)
USERNAME_FIELD = "phone"
REQUIRED_FIELDS = ["name"]
@@ -605,13 +611,13 @@ class Staff(AbstractUser):
"""Validate staff data before saving"""
if self.phone and not self.phone.isdigit():
raise ValidationError("Phone number must contain only digits")
if self.email and '@' not in self.email:
if self.email and "@" not in self.email:
raise ValidationError("Invalid email format")
if self.birth_date and self.birth_date > date.today():
raise ValidationError("Birth date cannot be in the future")
if self.joining_date and self.joining_date > date.today():
raise ValidationError("Joining date cannot be in the future")
@@ -621,10 +627,10 @@ class Staff(AbstractUser):
"""
# Clean up attendance records
self.attendance_records.all().delete()
# Clean up course assignments
self.courses_taught.clear()
# Clean up meeting records
self.meetings.clear()
@@ -646,25 +652,27 @@ class Staff(AbstractUser):
Get FCM tokens for notifications
"""
tokens = set()
# Get staff's token
if self.fcm_token:
tokens.add(self.fcm_token)
return tokens
class Meta:
verbose_name = "Staff"
verbose_name_plural = "Staffs"
indexes = [
models.Index(fields=['phone']),
models.Index(fields=['designation']),
models.Index(fields=['is_active']),
models.Index(fields=['course']),
models.Index(fields=["phone"]),
models.Index(fields=["designation"]),
models.Index(fields=["is_active"]),
models.Index(fields=["course"]),
# Add these composite indexes
models.Index(fields=['designation', 'is_active']), # For active staff by role
models.Index(fields=['course', 'is_active']), # For course staff
models.Index(fields=['phone', 'is_active']), # For active staff lookups
# For active staff by role
models.Index(fields=["designation", "is_active"]),
models.Index(fields=["course", "is_active"]), # For course staff
# For active staff lookups
models.Index(fields=["phone", "is_active"]),
]
@@ -695,14 +703,15 @@ class Routine(models.Model):
"period_or_year",
]
indexes = [
models.Index(fields=['course']),
models.Index(fields=['subject']),
models.Index(fields=['teacher']),
models.Index(fields=['is_active']),
models.Index(fields=['period_or_year']),
models.Index(fields=['course', 'period_or_year']), # For course routines
models.Index(fields=['teacher', 'is_active']), # For teacher schedules
models.Index(fields=['subject', 'is_active']), # For subject schedules
models.Index(fields=["course"]),
models.Index(fields=["subject"]),
models.Index(fields=["teacher"]),
models.Index(fields=["is_active"]),
models.Index(fields=["period_or_year"]),
# For course routines
models.Index(fields=["course", "period_or_year"]),
models.Index(fields=["teacher", "is_active"]), # For teacher schedules
models.Index(fields=["subject", "is_active"]), # For subject schedules
]
@@ -736,14 +745,17 @@ class Attendance(models.Model):
verbose_name = "Attendance"
verbose_name_plural = "Attendances"
indexes = [
models.Index(fields=['date']),
models.Index(fields=['routine']),
models.Index(fields=['teacher']),
models.Index(fields=['class_status']),
models.Index(fields=["date"]),
models.Index(fields=["routine"]),
models.Index(fields=["teacher"]),
models.Index(fields=["class_status"]),
# Add these composite indexes
models.Index(fields=['date', 'routine']), # For date-based routine lookups
models.Index(fields=['teacher', 'date']), # For teacher attendance history
models.Index(fields=['routine', 'class_status']), # For class status filtering
# For date-based routine lookups
models.Index(fields=["date", "routine"]),
# For teacher attendance history
models.Index(fields=["teacher", "date"]),
# For class status filtering
models.Index(fields=["routine", "class_status"]),
]
@@ -769,13 +781,15 @@ class AttendanceRecord(models.Model):
class Meta:
indexes = [
models.Index(fields=['attendance']),
models.Index(fields=['student']),
models.Index(fields=['student_attend']),
models.Index(fields=["attendance"]),
models.Index(fields=["student"]),
models.Index(fields=["student_attend"]),
# Add these composite indexes
models.Index(fields=['student', 'student_attend']), # For attendance filtering
models.Index(fields=['attendance', 'student']), # For attendance lookups
models.Index(fields=['attendance', 'student_attend']), # For attendance status
# For attendance filtering
models.Index(fields=["student", "student_attend"]),
models.Index(fields=["attendance", "student"]), # For attendance lookups
# For attendance status
models.Index(fields=["attendance", "student_attend"]),
]
@@ -840,13 +854,14 @@ class StudentLeave(models.Model):
verbose_name_plural = "Student Leaves"
ordering = ["-created_at"]
indexes = [
models.Index(fields=['student']),
models.Index(fields=['status']),
models.Index(fields=['start_date']),
models.Index(fields=['end_date']),
models.Index(fields=['student', 'status']), # For student leave status
models.Index(fields=['start_date', 'end_date']), # For date range queries
models.Index(fields=['status', 'start_date']), # For pending leaves
models.Index(fields=["student"]),
models.Index(fields=["status"]),
models.Index(fields=["start_date"]),
models.Index(fields=["end_date"]),
# For student leave status
models.Index(fields=["student", "status"]),
models.Index(fields=["start_date", "end_date"]), # For date range queries
models.Index(fields=["status", "start_date"]), # For pending leaves
]
@@ -1057,16 +1072,16 @@ class CourseTracking(models.Model):
"""Validate course tracking data"""
if self.enrollment_date and self.enrollment_date > date.today():
raise ValidationError("Enrollment date cannot be in the future")
if self.start_date and self.start_date > date.today():
raise ValidationError("Start date cannot be in the future")
if self.expected_end_date and self.expected_end_date < self.start_date:
raise ValidationError("Expected end date cannot be before start date")
if self.actual_end_date and self.actual_end_date < self.start_date:
raise ValidationError("Actual end date cannot be before start date")
if self.completion_percentage < 0 or self.completion_percentage > 100:
raise ValidationError("Completion percentage must be between 0 and 100")
@@ -1083,39 +1098,40 @@ class CourseTracking(models.Model):
# Get completed subjects from SubjectProgress
completed_subjects = SubjectProgress.objects.filter(
student=self.student,
subject__course=self.course,
status="Completed"
student=self.student, subject__course=self.course, status="Completed"
).count()
# Get attendance percentage for active subjects
attended_classes = AttendanceRecord.objects.filter(
student=self.student,
attendance__routine__subject__course=self.course,
student_attend=True
student_attend=True,
).count()
total_classes = AttendanceRecord.objects.filter(
student=self.student,
attendance__routine__subject__course=self.course
student=self.student, attendance__routine__subject__course=self.course
).count()
# Calculate weighted completion percentage
subject_weight = 0.7 # 70% weight to subject completion
attendance_weight = 0.3 # 30% weight to attendance
subject_percentage = (completed_subjects / total_subjects) * 100 if total_subjects > 0 else 0
attendance_percentage = (attended_classes / total_classes) * 100 if total_classes > 0 else 0
subject_percentage = (
(completed_subjects / total_subjects) * 100 if total_subjects > 0 else 0
)
attendance_percentage = (
(attended_classes / total_classes) * 100 if total_classes > 0 else 0
)
# Calculate final percentage
completion_percentage = int(
(subject_percentage * subject_weight) +
(attendance_percentage * attendance_weight)
(subject_percentage * subject_weight)
+ (attendance_percentage * attendance_weight)
)
# Ensure percentage is between 0 and 100
completion_percentage = max(0, min(100, completion_percentage))
# Update progress status based on completion
if completion_percentage >= 100:
self.progress_status = "Completed"
@@ -1192,13 +1208,13 @@ class CourseTracking(models.Model):
try:
self.clean()
# Update completion percentage without triggering save again
if not hasattr(self, '_updating_completion'):
if not hasattr(self, "_updating_completion"):
self._updating_completion = True
try:
self.completion_percentage = self.update_completion_percentage()
finally:
delattr(self, '_updating_completion')
delattr(self, "_updating_completion")
super().save(*args, **kwargs)
except Exception as e:
print(f"Error saving course tracking for {self.student.name}: {str(e)}")
@@ -1273,17 +1289,17 @@ class CourseTracking(models.Model):
unique_together = ["student", "course"]
ordering = ["-created_at"]
indexes = [
models.Index(fields=['student']),
models.Index(fields=['course']),
models.Index(fields=['progress_status']),
models.Index(fields=['current_period']),
models.Index(fields=['enrollment_date']),
models.Index(fields=['student', 'progress_status']),
models.Index(fields=['course', 'progress_status']),
models.Index(fields=['student', 'course', 'progress_status']),
models.Index(fields=['completion_percentage']),
models.Index(fields=['start_date', 'expected_end_date']),
models.Index(fields=['current_period', 'progress_status']),
models.Index(fields=["student"]),
models.Index(fields=["course"]),
models.Index(fields=["progress_status"]),
models.Index(fields=["current_period"]),
models.Index(fields=["enrollment_date"]),
models.Index(fields=["student", "progress_status"]),
models.Index(fields=["course", "progress_status"]),
models.Index(fields=["student", "course", "progress_status"]),
models.Index(fields=["completion_percentage"]),
models.Index(fields=["start_date", "expected_end_date"]),
models.Index(fields=["current_period", "progress_status"]),
]
@@ -1326,12 +1342,13 @@ class ResetToken(models.Model):
class OTPAttempt(models.Model):
"""Model to track OTP attempts for rate limiting"""
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='otp_attempts',
related_name="otp_attempts",
null=True,
blank=True
blank=True,
)
identifier = models.CharField(max_length=255) # phone or email
attempts = models.IntegerField(default=0)
@@ -1341,21 +1358,21 @@ class OTPAttempt(models.Model):
class Meta:
indexes = [
models.Index(fields=['identifier']),
models.Index(fields=['is_locked']),
models.Index(fields=['lock_until']),
models.Index(fields=["identifier"]),
models.Index(fields=["is_locked"]),
models.Index(fields=["lock_until"]),
]
def increment_attempts(self):
"""Increment attempt count and handle locking"""
self.attempts += 1
self.last_attempt = timezone.now()
# Lock after 3 failed attempts for 15 minutes
if self.attempts >= 3:
self.is_locked = True
self.lock_until = timezone.now() + timedelta(minutes=15)
self.save()
def reset_attempts(self):
@@ -1369,11 +1386,11 @@ class OTPAttempt(models.Model):
"""Check if the user is currently locked out"""
if not self.is_locked:
return False
if self.lock_until and timezone.now() > self.lock_until:
self.reset_attempts()
return False
return True
@@ -1458,22 +1475,23 @@ class Parent(AbstractUser):
"""
# Clean up meeting records
self.meetings.all().delete()
# Clean up feedback records
self.feedbacks.all().delete()
self.institute_feedbacks.all().delete()
# Clean up notification tokens
self.fcm_token = None
self.save(update_fields=['fcm_token'])
self.save(update_fields=["fcm_token"])
class Meta:
verbose_name = "Parent"
verbose_name_plural = "Parents"
indexes = [
models.Index(fields=['phone']),
models.Index(fields=['is_active']),
models.Index(fields=['phone', 'is_active']), # For active parent lookups
models.Index(fields=["phone"]),
models.Index(fields=["is_active"]),
# For active parent lookups
models.Index(fields=["phone", "is_active"]),
]
@@ -1507,11 +1525,11 @@ class TeacherParentMeeting(models.Model):
ordering = ["-meeting_date", "-meeting_time"]
unique_together = ["meeting_date", "meeting_time"]
indexes = [
models.Index(fields=['meeting_date']),
models.Index(fields=['status']),
models.Index(fields=['is_online']),
models.Index(fields=['meeting_date', 'status']), # For upcoming meetings
models.Index(fields=['status', 'is_online']), # For online meetings
models.Index(fields=["meeting_date"]),
models.Index(fields=["status"]),
models.Index(fields=["is_online"]),
models.Index(fields=["meeting_date", "status"]), # For upcoming meetings
models.Index(fields=["status", "is_online"]), # For online meetings
]
def __str__(self):
@@ -1568,22 +1586,29 @@ class TeacherParentMeeting(models.Model):
class SubjectProgress(models.Model):
"""Model for tracking student progress in individual subjects"""
student = models.ForeignKey(Student, on_delete=models.CASCADE, related_name='subject_progress')
subject = models.ForeignKey(Subject, on_delete=models.CASCADE, related_name='student_progress')
status = models.CharField(max_length=20, choices=PROGRESS_STATUS_CHOICES, default="Not Started")
student = models.ForeignKey(
Student, on_delete=models.CASCADE, related_name="subject_progress"
)
subject = models.ForeignKey(
Subject, on_delete=models.CASCADE, related_name="student_progress"
)
status = models.CharField(
max_length=20, choices=PROGRESS_STATUS_CHOICES, default="Not Started"
)
completion_percentage = models.IntegerField(default=0)
last_updated = models.DateTimeField(auto_now=True)
notes = models.TextField(blank=True, null=True)
class Meta:
unique_together = ['student', 'subject']
ordering = ['-last_updated']
unique_together = ["student", "subject"]
ordering = ["-last_updated"]
indexes = [
models.Index(fields=['student']),
models.Index(fields=['subject']),
models.Index(fields=['status']),
models.Index(fields=['student', 'subject']),
models.Index(fields=['student', 'status']),
models.Index(fields=["student"]),
models.Index(fields=["subject"]),
models.Index(fields=["status"]),
models.Index(fields=["student", "subject"]),
models.Index(fields=["student", "status"]),
]
def __str__(self):
+2 -1
View File
@@ -505,8 +505,9 @@ def delete_notice(request, notice_id):
return JsonResponse({"success": False, "error": "Invalid request method"})
@require_POST
@login_required
@csrf_exempt
@require_POST
def save_fcm_token(request):
"""Save FCM token to database"""
try:
+72
View File
@@ -0,0 +1,72 @@
annotated-types==0.7.0
asgiref==3.8.1
cachecontrol==0.14.2
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.2
django==5.2
django-cacheops==7.2
django-debug-toolbar==5.1.0
django-jazzmin==3.0.1
django-mathfilters==1.0.0
django-model-utils==5.0.0
django-query-profiler==0.9
django-redis==5.4.0
djangorestframework==3.16.0
dotenv==0.9.9
faker==37.1.0
firebase-admin==6.7.0
funcy==2.0
google-api-core==2.24.2
google-api-python-client==2.167.0
google-auth==2.39.0
google-auth-httplib2==0.2.0
google-cloud-core==2.4.3
google-cloud-firestore==2.20.2
google-cloud-storage==3.1.0
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.70.0
grpcio==1.71.0
grpcio-status==1.71.0
gunicorn==23.0.0
hiredis==3.1.0
httplib2==0.22.0
idna==3.10
isort==6.0.1
mmh3==5.1.0
mo-dots==10.672.25036
mo-future==7.672.25036
mo-imports==7.672.25036
mo-parsing==8.675.25037
mo-sql-parsing==11.675.25037
msgpack==1.1.0
packaging==25.0
pillow==11.2.1
proto-plus==1.26.1
protobuf==5.29.4
pyasn1==0.6.1
pyasn1-modules==0.4.2
pycparser==2.22
pydantic==2.11.3
pydantic-core==2.33.1
pyjwt==2.10.1
pyotp==2.9.0
pyparsing==3.2.3
python-dotenv==1.1.0
python-magic==0.4.27
pytz==2025.2
redis==5.2.1
requests==2.32.3
rsa==4.9.1
setuptools==79.0.0
sqlparse==0.5.3
tenacity==9.1.2
typing-extensions==4.13.2
typing-inspection==0.4.0
tzdata==2025.2
uritemplate==4.1.1
urllib3==2.4.0
whitenoise==6.9.0
+2 -27
View File
@@ -1,37 +1,12 @@
// Function to get CSRF token
function getCSRFToken() {
// Try getting from meta tag
const metaTag = document.querySelector('meta[name="csrf-token"]');
if (metaTag) {
return metaTag.getAttribute('content');
}
// Try getting from form input
const inputField = document.querySelector('input[name="csrfmiddlewaretoken"]');
if (inputField) {
return inputField.value;
}
// Try getting from cookie
const cookies = document.cookie.split(';');
for (let cookie of cookies) {
cookie = cookie.trim();
if (cookie.startsWith('csrftoken=')) {
return decodeURIComponent(cookie.substring('csrftoken='.length));
}
}
console.error('CSRF token not found in meta tag, form input, or cookie');
return null;
const token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
return token;
}
// Function to update leave requests
function updateLeaveRequests() {
const csrfToken = getCSRFToken();
if (!csrfToken) {
console.error('No CSRF token available. Cannot make request.');
return;
}
// Fetch staff leave requests
fetch('/app/get-staff-leaves/', {
+35 -116
View File
@@ -1,82 +1,4 @@
// Get CSRF token from cookie or any other available source
function getCSRFToken() {
// Try getting from cookie
let token = getCookie('csrftoken');
// If not in cookie, try getting from meta tag (Django often puts it there)
if (!token) {
const metaTag = document.querySelector('meta[name="csrf-token"]');
if (metaTag) {
token = metaTag.getAttribute('content');
}
}
// Try getting from a hidden input field with name="csrfmiddlewaretoken"
if (!token) {
const inputField = document.querySelector('input[name="csrfmiddlewaretoken"]');
if (inputField) {
token = inputField.value;
}
}
console.log('CSRF Token found:', token ? 'Yes (length: ' + token.length + ')' : 'No');
return token || '';
}
// CSRF-safe fetch utility function
async function csrfFetch(url, options = {}) {
// Default options
const defaultOptions = {
headers: {
'Content-Type': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
},
credentials: 'include'
};
// Merge provided options with defaults
const mergedOptions = {
...defaultOptions,
...options,
headers: {
...defaultOptions.headers,
...options.headers
}
};
// Add CSRF token if not explicitly provided and it's a mutating request method
const method = mergedOptions.method ? mergedOptions.method.toUpperCase() : 'GET';
const needsCSRF = ['POST', 'PUT', 'PATCH', 'DELETE'].includes(method);
if (needsCSRF && !mergedOptions.headers['X-CSRFToken']) {
const csrfToken = getCSRFToken();
if (csrfToken) {
// Set token in exactly the format Django expects (X-CSRFToken)
// Django is case-sensitive and specifically looks for X-CSRFToken
mergedOptions.headers['X-CSRFToken'] = csrfToken;
} else {
console.warn('No CSRF token available for a mutating request to:', url);
}
}
try {
console.log(`Making ${method} request to ${url} with headers:`, mergedOptions.headers);
const response = await fetch(url, mergedOptions);
if (!response.ok) {
const errorText = await response.text();
console.error('Server response:', response.status, errorText);
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
return response;
} catch (error) {
console.error('Fetch error:', error);
throw error;
}
}
// Original getCookie function
// Get CSRF token from cookie
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
@@ -149,30 +71,43 @@ async function getDeviceToken() {
console.log('Got FCM token:', token);
// Simple approach: send token to server using basic fetch
try {
const response = await fetch('/app/saveFCMToken/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ token: token })
});
if (response.ok) {
console.log('FCM Token saved successfully');
} else {
console.error('Failed to save FCM token:', response.status);
}
return token;
} catch (fetchError) {
console.error('Error saving FCM token:', fetchError);
return token; // Return token even if saving failed
// Get CSRF token
const csrftoken = getCookie('csrftoken');
if (!csrftoken) {
throw new Error('CSRF token not found');
}
// Send the token to your backend for storage
const response = await fetch('/app/saveFCMToken/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrftoken
},
body: JSON.stringify({ token: token })
});
if (!response.ok) {
throw new Error('Failed to save token to server');
}
console.log('FCM Token saved successfully');
return token;
} catch (error) {
console.error('Error in getDeviceToken:', error);
return null;
try {
// Clean up and retry on failure
await messaging.deleteToken().catch(console.error);
const registrations = await navigator.serviceWorker.getRegistrations();
for (let registration of registrations) {
await registration.unregister();
}
await new Promise(resolve => setTimeout(resolve, 1000));
return getDeviceToken();
} catch (retryError) {
console.error('Error during cleanup and retry:', retryError);
throw error;
}
}
}
@@ -222,20 +157,4 @@ messaging.onMessage((payload) => {
});
});
}
});
// Automatically initialize FCM when page loads
document.addEventListener('DOMContentLoaded', () => {
// Wait a moment for the page to fully initialize
setTimeout(() => {
getDeviceToken()
.then(token => {
if (token) {
console.log('FCM initialized successfully with token');
}
})
.catch(error => {
console.error('Failed to initialize FCM:', error);
});
}, 2000);
});
-22
View File
@@ -1,22 +0,0 @@
// Teacher Modals JavaScript
document.addEventListener('DOMContentLoaded', function() {
console.log('Teacher modals initialized');
// Initialize any modals that need to be shown
const modals = document.querySelectorAll('.modal');
modals.forEach(modal => {
if (modal.classList.contains('show')) {
const modalInstance = new bootstrap.Modal(modal);
modalInstance.show();
}
});
// Handle modal close events
document.querySelectorAll('.modal').forEach(modal => {
modal.addEventListener('hidden.bs.modal', function () {
// Clean up any form data or reset states
const forms = modal.querySelectorAll('form');
forms.forEach(form => form.reset());
});
});
});
File diff suppressed because it is too large. Load diff
+57 -54
View File
@@ -2,30 +2,30 @@
<!-- Add Routine Modal -->
<div id="addRoutineModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closeAddRoutineModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 600px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 15px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 18px;">Add Class Routine</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeAddRoutineModal()">&times;</button>
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 600px; background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
<div style="background-color: #6366f1; color: white; padding: 1rem 1.5rem; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 1.125rem; font-weight: 500;">Add Class Routine</h5>
<button style="background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 0.25rem;" onclick="closeAddRoutineModal()">&times;</button>
</div>
<form id="addRoutineForm">
{% csrf_token %}
<div style="padding: 20px;">
<div style="margin-bottom: 15px;">
<label for="periodSelect" style="display: block; margin-bottom: 8px; font-weight: 500;">{% if course.duration_type == 'Semester' %}Semester{% else %}Year{% endif %}</label>
<select id="periodSelect" name="period_select" style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;" required>
<div style="padding: 1.5rem;">
<div style="margin-bottom: 1.5rem;">
<label for="periodSelect" style="display: block; margin-bottom: 0.5rem; font-weight: 500; color: #374151;">{% if course.duration_type == 'Semester' %}Semester{% else %}Year{% endif %}</label>
<select id="periodSelect" name="period_select" style="width: 100%; padding: 0.625rem; border: 1px solid #d1d5db; border-radius: 6px; background-color: white; font-size: 0.875rem;" required>
<option value="">Select {% if course.duration_type == 'Semester' %}Semester{% else %}Year{% endif %}</option>
<!-- Options will be populated dynamically via JavaScript -->
</select>
</div>
<!-- Subject list container - subjects will be added here dynamically -->
<div id="subjectsContainer" style="margin-bottom: 15px; max-height: 400px; overflow-y: auto;"></div>
<div id="subjectsContainer" style="margin-bottom: 1.5rem; max-height: 400px; overflow-y: auto;"></div>
<input type="hidden" id="periodOrYear" name="period_or_year">
</div>
<div style="padding: 15px; border-top: 1px solid #EEEEEE; text-align: right; display: flex; flex-wrap: wrap; justify-content: flex-end;">
<button type="button" style="background-color: #9E9E9E; color: white; border: none; padding: 8px 16px; border-radius: 4px; margin-right: 10px; margin-bottom: 10px; cursor: pointer; font-size: 14px;" onclick="closeAddRoutineModal()">Cancel</button>
<button type="button" style="background-color: #3F51B5; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px; margin-bottom: 10px;" onclick="submitAddRoutineForm()">Save</button>
<div style="padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb; background-color: #f9fafb; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; display: flex; justify-content: flex-end; gap: 0.75rem;">
<button type="button" style="padding: 0.5rem 1rem; border: 1px solid #d1d5db; background-color: white; color: #374151; border-radius: 6px; font-size: 0.875rem; font-weight: 500;" onclick="closeAddRoutineModal()">Cancel</button>
<button type="button" style="padding: 0.5rem 1rem; background-color: #6366f1; color: white; border: none; border-radius: 6px; font-size: 0.875rem; font-weight: 500;" onclick="submitAddRoutineForm()">Save</button>
</div>
</form>
</div>
@@ -63,9 +63,7 @@ function openAddRoutineModal() {
let totalPeriods = 3;
{% if course.total_periods %}
// If we have it from the template, use that
totalPeriods = {{ course.total_periods }};
console.log("Using course periods from template:", totalPeriods);
{% endif %}
// Clear all options
@@ -75,7 +73,6 @@ function openAddRoutineModal() {
periodSelect.innerHTML = `<option value="">Select ${periodLabel}</option>`;
// Add options based on total periods
console.log(`Adding ${totalPeriods} period options`);
for (let i = 1; i <= totalPeriods; i++) {
periodSelect.innerHTML += `<option value="${i}">${periodLabel} ${i}</option>`;
}
@@ -94,7 +91,7 @@ function openAddRoutineModal() {
const periodSubjects = allSubjects.filter(subject => subject.period === selectedPeriod);
if (periodSubjects.length === 0) {
subjectsContainer.innerHTML = '<p style="text-align: center; padding: 10px;">No subjects found for this period.</p>';
subjectsContainer.innerHTML = '<p style="text-align: center; padding: 1rem; color: #6b7280;">No subjects found for this period.</p>';
return;
}
@@ -102,16 +99,19 @@ function openAddRoutineModal() {
periodSubjects.forEach(subject => {
const subjectDiv = document.createElement('div');
subjectDiv.className = 'subject-item';
subjectDiv.style.padding = '15px';
subjectDiv.style.marginBottom = '15px';
subjectDiv.style.border = '1px solid #EEEEEE';
subjectDiv.style.borderRadius = '4px';
subjectDiv.style.padding = '1rem';
subjectDiv.style.marginBottom = '1rem';
subjectDiv.style.border = '1px solid #e5e7eb';
subjectDiv.style.borderRadius = '6px';
subjectDiv.style.backgroundColor = 'white';
// Create subject header
const subjectHeader = document.createElement('h4');
subjectHeader.textContent = subject.name;
subjectHeader.style.margin = '0 0 10px 0';
subjectHeader.style.fontSize = '16px';
subjectHeader.style.margin = '0 0 1rem 0';
subjectHeader.style.fontSize = '0.875rem';
subjectHeader.style.fontWeight = '600';
subjectHeader.style.color = '#374151';
subjectDiv.appendChild(subjectHeader);
// Add hidden input for subject ID
@@ -121,32 +121,33 @@ function openAddRoutineModal() {
subjectIdInput.value = subject.id;
subjectDiv.appendChild(subjectIdInput);
// Create inline form row
const formRow = document.createElement('div');
formRow.style.display = 'flex';
formRow.style.flexWrap = 'wrap';
formRow.style.gap = '10px';
formRow.style.alignItems = 'flex-end';
// Create form grid
const formGrid = document.createElement('div');
formGrid.style.display = 'grid';
formGrid.style.gridTemplateColumns = 'repeat(auto-fit, minmax(150px, 1fr))';
formGrid.style.gap = '1rem';
formGrid.style.alignItems = 'end';
// Create teacher dropdown
const teacherDiv = document.createElement('div');
teacherDiv.style.flex = '2';
teacherDiv.style.minWidth = '180px';
const teacherLabel = document.createElement('label');
teacherLabel.textContent = 'Teacher';
teacherLabel.style.display = 'block';
teacherLabel.style.marginBottom = '5px';
teacherLabel.style.marginBottom = '0.5rem';
teacherLabel.style.fontSize = '0.875rem';
teacherLabel.style.fontWeight = '500';
teacherLabel.style.color = '#374151';
teacherDiv.appendChild(teacherLabel);
const teacherSelect = document.createElement('select');
teacherSelect.name = `teacher_id_${subject.id}`;
teacherSelect.style.width = '100%';
teacherSelect.style.padding = '10px';
teacherSelect.style.border = '1px solid #BDBDBD';
teacherSelect.style.borderRadius = '4px';
teacherSelect.style.boxSizing = 'border-box';
teacherSelect.style.padding = '0.625rem';
teacherSelect.style.border = '1px solid #d1d5db';
teacherSelect.style.borderRadius = '6px';
teacherSelect.style.backgroundColor = 'white';
teacherSelect.style.fontSize = '0.875rem';
teacherSelect.required = true;
// Add default option
@@ -164,60 +165,62 @@ function openAddRoutineModal() {
{% endfor %}
teacherDiv.appendChild(teacherSelect);
formRow.appendChild(teacherDiv);
formGrid.appendChild(teacherDiv);
// Start time
const startTimeDiv = document.createElement('div');
startTimeDiv.style.flex = '1';
startTimeDiv.style.minWidth = '120px';
const startTimeLabel = document.createElement('label');
startTimeLabel.textContent = 'Start Time';
startTimeLabel.style.display = 'block';
startTimeLabel.style.marginBottom = '5px';
startTimeLabel.style.marginBottom = '0.5rem';
startTimeLabel.style.fontSize = '0.875rem';
startTimeLabel.style.fontWeight = '500';
startTimeLabel.style.color = '#374151';
startTimeDiv.appendChild(startTimeLabel);
const startTimeInput = document.createElement('input');
startTimeInput.type = 'time';
startTimeInput.name = `start_time_${subject.id}`;
startTimeInput.style.width = '100%';
startTimeInput.style.padding = '10px';
startTimeInput.style.border = '1px solid #BDBDBD';
startTimeInput.style.borderRadius = '4px';
startTimeInput.style.boxSizing = 'border-box';
startTimeInput.style.padding = '0.625rem';
startTimeInput.style.border = '1px solid #d1d5db';
startTimeInput.style.borderRadius = '6px';
startTimeInput.style.backgroundColor = 'white';
startTimeInput.style.fontSize = '0.875rem';
startTimeInput.required = true;
startTimeDiv.appendChild(startTimeInput);
formRow.appendChild(startTimeDiv);
formGrid.appendChild(startTimeDiv);
// End time
const endTimeDiv = document.createElement('div');
endTimeDiv.style.flex = '1';
endTimeDiv.style.minWidth = '120px';
const endTimeLabel = document.createElement('label');
endTimeLabel.textContent = 'End Time';
endTimeLabel.style.display = 'block';
endTimeLabel.style.marginBottom = '5px';
endTimeLabel.style.marginBottom = '0.5rem';
endTimeLabel.style.fontSize = '0.875rem';
endTimeLabel.style.fontWeight = '500';
endTimeLabel.style.color = '#374151';
endTimeDiv.appendChild(endTimeLabel);
const endTimeInput = document.createElement('input');
endTimeInput.type = 'time';
endTimeInput.name = `end_time_${subject.id}`;
endTimeInput.style.width = '100%';
endTimeInput.style.padding = '10px';
endTimeInput.style.border = '1px solid #BDBDBD';
endTimeInput.style.borderRadius = '4px';
endTimeInput.style.boxSizing = 'border-box';
endTimeInput.style.padding = '0.625rem';
endTimeInput.style.border = '1px solid #d1d5db';
endTimeInput.style.borderRadius = '6px';
endTimeInput.style.backgroundColor = 'white';
endTimeInput.style.fontSize = '0.875rem';
endTimeInput.required = true;
endTimeDiv.appendChild(endTimeInput);
formRow.appendChild(endTimeDiv);
formGrid.appendChild(endTimeDiv);
// Add the form row to the subject div
subjectDiv.appendChild(formRow);
// Add the form grid to the subject div
subjectDiv.appendChild(formGrid);
// Add the subject div to the container
subjectsContainer.appendChild(subjectDiv);
+1 -18
View File
@@ -237,7 +237,7 @@
{% csrf_token %}
<div class="input-group">
<label for="username">Email or Phone Number</label>
<input type="text" name="username" id="username" required autofocus placeholder="Enter email or phone number">
<input type="text" name="username" id="username" required autofocus placeholder="Enter email or phone number" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|[0-9]{10}" title="Please enter a valid email or 10-digit phone number">
</div>
<div class="input-group">
@@ -272,23 +272,6 @@
icon.classList.toggle('fa-eye-slash');
});
});
document.addEventListener('DOMContentLoaded', function() {
const form = document.querySelector('form');
const usernameInput = document.getElementById('username');
form.addEventListener('submit', function(event) {
const value = usernameInput.value.trim();
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
const phonePattern = /^\d{10}$/;
if (!emailPattern.test(value) && !phonePattern.test(value)) {
event.preventDefault();
alert('Please enter a valid email address or a 10-digit phone number.');
usernameInput.focus();
}
});
});
</script>
</body>
</html>
+300 -113
View File
@@ -1,142 +1,329 @@
{% load static %}
<style>
/* Modal Base Styles */
.modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10000;
backdrop-filter: blur(4px);
}
.modal-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 90%;
max-width: 500px;
background-color: white;
border-radius: 12px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
overflow: hidden;
}
.modal-header {
background: linear-gradient(135deg, #0D6EFD 0%, #0B5ED7 100%);
color: white;
padding: 16px 24px;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-title {
margin: 0;
font-size: 18px;
font-weight: 600;
}
.modal-close {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
line-height: 24px;
padding: 0;
opacity: 0.8;
transition: opacity 0.2s ease;
}
.modal-close:hover {
opacity: 1;
}
.modal-body {
padding: 24px;
}
.modal-footer {
padding: 16px 24px;
border-top: 1px solid #E9ECEF;
display: flex;
justify-content: flex-end;
gap: 12px;
}
/* Form Styles */
.form-group {
margin-bottom: 20px;
}
.form-label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #212529;
}
.form-control {
width: 100%;
padding: 10px 12px;
border: 1px solid #DEE2E6;
border-radius: 6px;
box-sizing: border-box;
font-size: 14px;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
border-color: #0D6EFD;
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
outline: none;
}
textarea.form-control {
resize: vertical;
min-height: 80px;
}
/* Button Styles */
.btn {
padding: 8px 16px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border: none;
transition: all 0.2s ease;
}
.btn-primary {
background-color: #0D6EFD;
color: white;
}
.btn-primary:hover {
background-color: #0B5ED7;
}
.btn-secondary {
background-color: #6C757D;
color: white;
}
.btn-secondary:hover {
background-color: #5C636A;
}
/* Profile Picture Styles */
.profile-picture-container {
width: 120px;
height: 120px;
border-radius: 50%;
overflow: hidden;
margin-bottom: 20px;
border: 3px solid #E9ECEF;
}
.profile-picture {
width: 100%;
height: 100%;
object-fit: cover;
}
/* File Input Styles */
.file-input-wrapper {
position: relative;
}
.file-input {
opacity: 0;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.file-input-label {
display: block;
padding: 10px 12px;
background-color: #F8F9FA;
border: 1px dashed #DEE2E6;
border-radius: 6px;
text-align: center;
cursor: pointer;
transition: all 0.2s ease;
}
.file-input-label:hover {
background-color: #E9ECEF;
border-color: #CED4DA;
}
</style>
<!-- Profile Modal -->
<div id="profileModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closeProfileModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 500px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 15px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 18px;">Update Profile Picture</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeProfileModal()">&times;</button>
<div id="profileModal" class="modal-overlay" onclick="if(event.target === this) closeProfileModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Update Profile Picture</h5>
<button class="modal-close" onclick="closeProfileModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% url 'update_profile' %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div class="text-center">
{% if user.image %}
<div class="profile-picture-container mx-auto">
<img src="{{ user.image.url }}" alt="{{ user.name }}" class="profile-picture">
</div>
{% else %}
<div class="profile-picture-container mx-auto">
<img src="{% static 'img/user.png' %}" alt="Default User" class="profile-picture">
</div>
{% endif %}
</div>
<div class="form-group">
<label class="form-label">Select New Profile Picture</label>
<div class="file-input-wrapper">
<label class="file-input-label">
<i class="fas fa-cloud-upload-alt me-2"></i>Choose a file...
<input type="file" name="profile_image" required class="file-input">
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeProfileModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Update Picture</button>
</div>
</form>
</div>
</div>
<div style="padding: 20px;">
<form action="{% url 'update_profile' %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
<div style="text-align: center; margin-bottom: 20px;">
{% if user.image %}
<div class="profile-picture-container profile-lg mx-auto">
<img src="{{ user.image.url }}" alt="{{ user.name }}" class="profile-picture">
</div>
{% else %}
<div class="profile-picture-container profile-lg mx-auto">
<img src="{% static 'img/user.png' %}" alt="Default User" class="profile-picture">
</div>
{% endif %}
</div>
<div style="margin-bottom: 15px;">
<label style="display: block; margin-bottom: 8px; font-weight: 500;">Select New Profile Picture</label>
<input type="file" name="profile_image" required style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;">
</div>
<div style="display: flex; justify-content: space-between;">
<button type="button" onclick="closeProfileModal()" style="background-color: #9E9E9E; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer;">Cancel</button>
<button type="submit" style="background-color: #3F51B5; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer;">Update Picture</button>
</div>
</form>
</div>
</div>
</div>
<!-- Password Change Modal -->
<div id="passwordModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closePasswordModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 500px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 15px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 18px;">Change Password</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closePasswordModal()">&times;</button>
<div id="passwordModal" class="modal-overlay" onclick="if(event.target === this) closePasswordModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Change Password</h5>
<button class="modal-close" onclick="closePasswordModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% url 'change_password' %}" method="post">
{% csrf_token %}
<div class="form-group">
<label class="form-label" for="current_password">Current Password</label>
<input type="password" id="current_password" name="current_password" required class="form-control">
</div>
<div class="form-group">
<label class="form-label" for="new_password">New Password</label>
<input type="password" id="new_password" name="new_password" required class="form-control">
</div>
<div class="form-group">
<label class="form-label" for="confirm_password">Confirm New Password</label>
<input type="password" id="confirm_password" name="confirm_password" required class="form-control">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closePasswordModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Change Password</button>
</div>
</form>
</div>
</div>
<div style="padding: 20px;">
<form action="{% url 'change_password' %}" method="post">
{% csrf_token %}
<div style="margin-bottom: 15px;">
<label for="current_password" style="display: block; margin-bottom: 8px; font-weight: 500;">Current Password</label>
<input type="password" id="current_password" name="current_password" required style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;">
</div>
<div style="margin-bottom: 15px;">
<label for="new_password" style="display: block; margin-bottom: 8px; font-weight: 500;">New Password</label>
<input type="password" id="new_password" name="new_password" required style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;">
</div>
<div style="margin-bottom: 15px;">
<label for="confirm_password" style="display: block; margin-bottom: 8px; font-weight: 500;">Confirm New Password</label>
<input type="password" id="confirm_password" name="confirm_password" required style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;">
</div>
<button type="submit" style="background-color: #3F51B5; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; width: 100%;">Change Password</button>
</form>
</div>
</div>
</div>
<!-- Leave Request Modal -->
<div id="customLeaveModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closeLeaveModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 500px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 15px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 18px;">Request Leave</h5>
<button id="closeCustomModal" style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeLeaveModal()">&times;</button>
<div id="customLeaveModal" class="modal-overlay" onclick="if(event.target === this) closeLeaveModal();">
<div class="modal-container">
<div class="modal-header">
<h5 class="modal-title">Request Leave</h5>
<button class="modal-close" onclick="closeLeaveModal()">&times;</button>
</div>
<div class="modal-body">
<form action="{% if user.is_teacher %}{% url 'request_staff_leave' %}{% else %}{% url 'request_leave' %}{% endif %}" method="post">
{% csrf_token %}
<div class="form-group">
<label class="form-label" for="startDate">Start Date</label>
<input type="date" id="startDate" name="start_date" class="form-control" required>
</div>
<div class="form-group">
<label class="form-label" for="endDate">End Date</label>
<input type="date" id="endDate" name="end_date" class="form-control" required>
</div>
<div class="form-group">
<label class="form-label" for="customLeaveMessage">Reason</label>
<textarea id="customLeaveMessage" name="message" rows="3" class="form-control" required></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeLeaveModal()">Cancel</button>
<button type="submit" class="btn btn-primary">Submit Request</button>
</div>
</form>
</div>
</div>
<form action="{% if user.is_teacher %}{% url 'request_staff_leave' %}{% else %}{% url 'request_leave' %}{% endif %}" method="post">
{% csrf_token %}
<div style="padding: 20px;">
<div style="margin-bottom: 15px;">
<label for="startDate" style="display: block; margin-bottom: 8px; font-weight: 500;">Start Date</label>
<input type="date" id="startDate" name="start_date" style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;" required>
</div>
<div style="margin-bottom: 15px;">
<label for="endDate" style="display: block; margin-bottom: 8px; font-weight: 500;">End Date</label>
<input type="date" id="endDate" name="end_date" style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;" required>
</div>
<div style="margin-bottom: 15px;">
<label for="customLeaveMessage" style="display: block; margin-bottom: 8px; font-weight: 500;">Reason</label>
<textarea id="customLeaveMessage" name="message" rows="3" style="width: 100%; padding: 10px; border: 1px solid #BDBDBD; border-radius: 4px; box-sizing: border-box;" required></textarea>
</div>
</div>
<div style="padding: 15px; border-top: 1px solid #EEEEEE; text-align: right; display: flex; flex-wrap: wrap; justify-content: flex-end;">
<button type="button" id="cancelCustomModal" style="background-color: #9E9E9E; color: white; border: none; padding: 8px 16px; border-radius: 4px; margin-right: 10px; margin-bottom: 10px; cursor: pointer; font-size: 14px;" onclick="closeLeaveModal()">Cancel</button>
<button type="submit" style="background-color: #3F51B5; color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 14px; margin-bottom: 10px;">Submit Request</button>
</div>
</form>
</div>
</div>
<!-- Confirmation Modal -->
<div id="confirmationModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closeConfirmationModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 400px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 12px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 1;">
<h5 style="margin: 0; font-size: 18px;">Confirm Deletion</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeConfirmationModal()">&times;</button>
<div id="confirmationModal" class="modal-overlay" onclick="if(event.target === this) closeConfirmationModal();">
<div class="modal-container" style="max-width: 400px;">
<div class="modal-header">
<h5 class="modal-title">Confirm Deletion</h5>
<button class="modal-close" onclick="closeConfirmationModal()">&times;</button>
</div>
<div class="modal-body">
<p class="mb-0">Are you sure you want to delete this file? This action cannot be undone.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="closeConfirmationModal()">Cancel</button>
<button type="button" class="btn btn-primary" id="confirmDeleteBtn">Delete</button>
</div>
</div>
<div style="padding: 15px;">
<p style="margin: 0 0 15px 0;">Are you sure you want to delete this file? This action cannot be undone.</p>
</div>
<div style="padding: 12px; border-top: 1px solid #EEEEEE; text-align: right; position: sticky; bottom: 0; background-color: white; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;">
<button type="button" style="background-color: #9E9E9E; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; margin-right: 8px;" onclick="closeConfirmationModal()">Cancel</button>
<button type="button" style="background-color: #3F51B5; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px;" id="confirmDeleteBtn">Delete</button>
</div>
</div>
</div>
<!-- Message Modal -->
<div id="messageModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10001;" onclick="if(event.target === this) closeMessageModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 400px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 12px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 id="messageModalTitle" style="margin: 0; font-size: 18px;">Message</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeMessageModal()">&times;</button>
<div id="messageModal" class="modal-overlay" onclick="if(event.target === this) closeMessageModal();">
<div class="modal-container" style="max-width: 400px;">
<div class="modal-header">
<h5 class="modal-title" id="messageModalTitle">Message</h5>
<button class="modal-close" onclick="closeMessageModal()">&times;</button>
</div>
<div class="modal-body">
<p class="mb-0" id="messageModalContent"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="closeMessageModal()">OK</button>
</div>
</div>
<div style="padding: 15px;">
<p id="messageModalContent" style="margin: 0 0 15px 0;"></p>
</div>
<div style="padding: 12px; border-top: 1px solid #EEEEEE; text-align: right;">
<button type="button" style="background-color: #3F51B5; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px;" onclick="closeMessageModal()">OK</button>
</div>
</div>
</div>
<script>
// Utility function for displaying message modals
function showMessageModal(title, message) {
document.getElementById('messageModalTitle').textContent = title;
document.getElementById('messageModalContent').textContent = message;
document.getElementById('messageModal').style.display = 'block';
document.body.style.overflow = 'hidden';
document.getElementById('messageModalTitle').textContent = title;
document.getElementById('messageModalContent').textContent = message;
document.getElementById('messageModal').style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeMessageModal() {
document.getElementById('messageModal').style.display = 'none';
document.body.style.overflow = '';
document.getElementById('messageModal').style.display = 'none';
document.body.style.overflow = '';
}
</script>
+132 -155
View File
@@ -16,8 +16,8 @@
<!-- Summary Cards -->
<div class="row mb-4">
<div class="col-md-6 col-lg-3 mb-3">
<div class="summary-card h-100">
<div class="card-header">
<div class="card summary-card h-100">
<div class="card-header bg-white">
<h5 class="card-title mb-0"><i class="fas fa-users me-2"></i> Students</h5>
</div>
<div class="card-body d-flex flex-column">
@@ -28,11 +28,11 @@
<div class="text-center">
<div class="d-flex justify-content-around">
<div>
<h4 class="fw-bold mb-0">{{ present_students }}</h4>
<h4 class="fw-bold mb-0 text-success">{{ present_students }}</h4>
<p class="text-muted">Present Today</p>
</div>
<div>
<h4 class="fw-bold mb-0">{{ absent_students }}</h4>
<h4 class="fw-bold mb-0 text-danger">{{ absent_students }}</h4>
<p class="text-muted">Absent Today</p>
</div>
</div>
@@ -42,8 +42,8 @@
</div>
<div class="col-md-6 col-lg-3 mb-3">
<div class="summary-card h-100">
<div class="card-header">
<div class="card summary-card h-100">
<div class="card-header bg-white">
<h5 class="card-title mb-0"><i class="fas fa-chalkboard me-2"></i> Today's Classes</h5>
</div>
<div class="card-body d-flex flex-column">
@@ -76,8 +76,8 @@
</div>
<div class="col-md-6 col-lg-3 mb-3">
<div class="summary-card h-100">
<div class="card-header">
<div class="card summary-card h-100">
<div class="card-header bg-white">
<h5 class="card-title mb-0"><i class="fas fa-star me-2"></i> Feedback Rating</h5>
</div>
<div class="card-body text-center">
@@ -85,9 +85,9 @@
<div class="rating-stars mb-3">
{% for i in "12345"|make_list %}
{% if forloop.counter <= avg_rating_rounded %}
<i class="fas fa-star"></i>
<i class="fas fa-star text-warning"></i>
{% else %}
<i class="far fa-star"></i>
<i class="far fa-star text-warning"></i>
{% endif %}
{% endfor %}
</div>
@@ -97,24 +97,24 @@
</div>
<div class="col-md-6 col-lg-3 mb-3">
<div class="summary-card h-100">
<div class="card-header">
<div class="card summary-card h-100">
<div class="card-header bg-white">
<h5 class="card-title mb-0"><i class="fas fa-calendar-minus me-2"></i> Leave Status</h5>
</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-3">
<p class="mb-0">Pending</p>
<span class="badge leave-pending">{{ pending_leaves }}</span>
<span class="badge bg-warning">{{ pending_leaves }}</span>
</div>
<div class="d-flex justify-content-between mb-3">
<p class="mb-0">Approved</p>
<span class="badge leave-approved">{{ approved_leaves }}</span>
<span class="badge bg-success">{{ approved_leaves }}</span>
</div>
<div class="d-flex justify-content-between mb-3">
<p class="mb-0">Rejected</p>
<span class="badge leave-rejected">{{ rejected_leaves }}</span>
<span class="badge bg-danger">{{ rejected_leaves }}</span>
</div>
<button type="button" class="btn btn-sm btn-outline-primary w-100 mt-2" id="requestLeaveBtn" onclick="openLeaveModal()">
<button type="button" class="btn btn-primary w-100 mt-2" id="requestLeaveBtn" onclick="openLeaveModal()">
<i class="fas fa-plus-circle me-2"></i> Request Leave
</button>
</div>
@@ -125,64 +125,66 @@
<!-- Today's Classes -->
<div class="row mb-4">
<div class="col-12">
<div class="content-card">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0"><i class="fas fa-chalkboard-teacher me-2"></i> Today's Classes</h5>
<div class="card content-card">
<div class="card-header bg-white">
<div class="d-flex justify-content-between align-items-center">
<h5 class="mb-0"><i class="fas fa-chalkboard-teacher me-2"></i> Today's Classes</h5>
</div>
</div>
{% if today_routines %}
<!-- Display a single table with all routines -->
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Subject</th>
<th>Code</th>
<th>Course</th>
<th class="d-none d-md-table-cell">Period/Year</th>
<th>Time</th>
<th class="d-none d-sm-table-cell">Attendance</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for routine in today_routines %}
<div class="card-body">
{% if today_routines %}
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<td>{{ routine.name }}</td>
<td>{{ routine.subject.code|default:"-" }}</td>
<td>{{ routine.course_name }}</td>
<td class="d-none d-md-table-cell">{{ routine.period_or_year }}</td>
<td>{{ routine.start_time|time:"h:i A" }} - {{ routine.end_time|time:"h:i A" }}</td>
<td class="d-none d-sm-table-cell">{{ routine.attendance_count }}/{{ routine.total_students }}</td>
<td>
{% if routine.is_completed %}
<span class="status-badge completed">Completed</span>
{% elif routine.is_ongoing %}
<span class="status-badge ongoing">In Progress</span>
{% else %}
<span class="status-badge upcoming">Upcoming</span>
{% endif %}
</td>
<td>
{% if routine.has_attendance %}
<span class="status-badge completed">Recorded</span>
{% else %}
<button type="button" class="btn btn-sm btn-primary" onclick="openAttendanceModal('{{ routine.id }}')">
<i class="fas fa-clipboard-check"></i> <span class="d-none d-sm-inline">Attendance</span>
</button>
{% endif %}
</td>
<th>Subject</th>
<th>Code</th>
<th>Course</th>
<th class="d-none d-md-table-cell">Period/Year</th>
<th>Time</th>
<th class="d-none d-sm-table-cell">Attendance</th>
<th>Status</th>
<th>Action</th>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> No classes scheduled for today.
</div>
{% endif %}
</thead>
<tbody>
{% for routine in today_routines %}
<tr>
<td>{{ routine.name }}</td>
<td>{{ routine.subject.code|default:"-" }}</td>
<td>{{ routine.course_name }}</td>
<td class="d-none d-md-table-cell">{{ routine.period_or_year }}</td>
<td>{{ routine.start_time|time:"h:i A" }} - {{ routine.end_time|time:"h:i A" }}</td>
<td class="d-none d-sm-table-cell">{{ routine.attendance_count }}/{{ routine.total_students }}</td>
<td>
{% if routine.is_completed %}
<span class="badge bg-success">Completed</span>
{% elif routine.is_ongoing %}
<span class="badge bg-primary">In Progress</span>
{% else %}
<span class="badge bg-info">Upcoming</span>
{% endif %}
</td>
<td>
{% if routine.has_attendance %}
<span class="badge bg-success">Recorded</span>
{% else %}
<button type="button" class="btn btn-primary btn-sm" onclick="openAttendanceModal('{{ routine.id }}')">
<i class="fas fa-clipboard-check"></i> <span class="d-none d-sm-inline">Attendance</span>
</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> No classes scheduled for today.
</div>
{% endif %}
</div>
</div>
</div>
</div>
@@ -191,107 +193,82 @@
<div class="row">
<!-- Recent Feedback -->
<div class="col-lg-6 mb-4">
<div class="content-card h-100">
<div class="d-flex justify-content-between align-items-center mb-4">
<h5 class="mb-0"><i class="fas fa-comment-dots me-2"></i> Recent Feedback</h5>
<div class="rating-summary">
<div class="rating-stats">
<div class="rating-number">
{{ avg_rating|floatformat:1 }}<span class="text-muted">/5.0</span>
</div>
<div class="rating-stars mb-2">
{% for i in "12345"|make_list %}
{% if forloop.counter <= avg_rating_rounded %}
<i class="fas fa-star"></i>
{% else %}
<i class="far fa-star"></i>
{% endif %}
{% endfor %}
</div>
<div class="rating-count text-muted">
Based on {{ recent_feedback.count }} feedbacks
<div class="card content-card h-100">
<div class="card-header bg-white">
<div class="d-flex justify-content-between align-items-center">
<h5 class="mb-0"><i class="fas fa-comment-dots me-2"></i> Recent Feedback</h5>
<div class="rating-summary">
<div class="rating-stats">
<div class="rating-number">
{{ avg_rating|floatformat:1 }}<span class="text-muted">/5.0</span>
</div>
</div>
</div>
</div>
</div>
{% if recent_feedback %}
<div class="feedback-list">
{% for feedback in recent_feedback %}
<div class="feedback-card">
<div class="feedback-header">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<div class="student-avatar me-3">
{% if feedback.student.image %}
<img src="{{ feedback.student.image.url }}" alt="{{ feedback.student.name }}" class="rounded-circle">
{% else %}
<i class="fas fa-user-circle"></i>
{% endif %}
</div>
<div>
<h6 class="mb-0">{{ feedback.student.name }}</h6>
<small class="text-muted">
{{ feedback.student.course.name }} -
{% if feedback.student.course.duration_type == 'Semester' %}
Semester {{ feedback.student.current_period }}
{% else %}
Year {{ feedback.student.current_period }}
{% endif %}
</small>
<br>
<small class="text-muted">{{ feedback.created_at|timesince }} ago</small>
</div>
<div class="card-body">
{% if recent_feedback %}
<div class="feedback-list">
{% for feedback in recent_feedback %}
<div class="feedback-item mb-3">
<div class="d-flex justify-content-between align-items-start">
<div class="student-info">
<h6 class="mb-1">{{ feedback.student.name }}</h6>
<p class="text-muted mb-2">{{ feedback.comment|truncatechars:100 }}</p>
</div>
<div class="rating-stars">
<div class="rating">
{% for i in "12345"|make_list %}
{% if forloop.counter <= feedback.rating %}
<i class="fas fa-star"></i>
<i class="fas fa-star text-warning"></i>
{% else %}
<i class="far fa-star"></i>
<i class="far fa-star text-warning"></i>
{% endif %}
{% endfor %}
</div>
</div>
<small class="text-muted">{{ feedback.created_at|date:"M d, Y" }}</small>
</div>
<div class="feedback-body">
<div class="feedback-message">
<p>{{ feedback.feedback_text }}</p>
</div>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<i class="fas fa-comments"></i>
<p>No recent feedback yet.</p>
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> No feedback received yet.
</div>
{% endif %}
</div>
</div>
</div>
<!-- Notices -->
<div class="col-lg-6 mb-4 notice-section">
<div class="content-card">
<h5 class="mb-3"><i class="fas fa-bullhorn me-2"></i> Recent Notices</h5>
{% if notices %}
<div class="list-group">
{% for notice in notices %}
<div class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between flex-wrap">
<h6 class="mb-1">{{ notice.title }}</h6>
<small class="text-muted">{{ notice.created_at|timesince }} ago</small>
<!-- Recent Notices -->
<div class="col-lg-6 mb-4">
<div class="card content-card h-100">
<div class="card-header bg-white">
<div class="d-flex justify-content-between align-items-center">
<h5 class="mb-0"><i class="fas fa-bullhorn me-2"></i> Recent Notices</h5>
</div>
</div>
<div class="card-body">
{% if recent_notices %}
<div class="notice-list">
{% for notice in recent_notices %}
<div class="notice-item mb-3">
<div class="d-flex justify-content-between align-items-start">
<div>
<h6 class="mb-1">{{ notice.title }}</h6>
<p class="text-muted mb-2">{{ notice.content|truncatechars:100 }}</p>
</div>
<span class="badge bg-{{ notice.priority }}">{{ notice.get_priority_display }}</span>
</div>
<small class="text-muted">{{ notice.created_at|date:"M d, Y" }}</small>
</div>
<p class="mb-1">{{ notice.message }}</p>
</div>
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> No recent notices.
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i> No notices available.
</div>
{% endif %}
</div>
</div>
</div>
</div>
+94 -54
View File
@@ -1,61 +1,101 @@
<!-- Attendance Modal -->
<div id="attendanceModal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.5); z-index: 10000;" onclick="if(event.target === this) closeAttendanceModal();">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 800px; background-color: white; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<div style="background-color: #3F51B5; color: white; padding: 15px; border-top-left-radius: 8px; border-top-right-radius: 8px; display: flex; justify-content: space-between; align-items: center;">
<h5 style="margin: 0; font-size: 18px;">Take Attendance</h5>
<button style="background: none; border: none; color: white; font-size: 24px; cursor: pointer; line-height: 24px;" onclick="closeAttendanceModal()">&times;</button>
</div>
<div style="padding: 20px; max-height: 80vh; overflow-y: auto;">
<form method="post" action="/app/save-attendance/" id="quickAttendanceForm">
{% csrf_token %}
<input type="hidden" name="routine_id" id="modalRoutineId">
<input type="hidden" name="date" id="modalDate">
<div class="row mb-3">
<div class="col-md-6">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="modalTeacherAttend" name="teacher_attend">
<label class="form-check-label" for="modalTeacherAttend">Teacher Present</label>
<div class="modal fade" id="attendanceModal" tabindex="-1" aria-labelledby="attendanceModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header bg-primary text-white">
<h5 class="modal-title" id="attendanceModalLabel">
<i class="fas fa-clipboard-check me-2"></i>Take Attendance
</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="attendanceForm">
<input type="hidden" name="routine_id" id="routineId">
<div class="mb-4">
<h6 class="mb-3">Class Information</h6>
<div class="row">
<div class="col-md-6">
<p class="mb-1"><strong>Subject:</strong> <span id="subjectName"></span></p>
<p class="mb-1"><strong>Course:</strong> <span id="courseName"></span></p>
</div>
<div class="col-md-6">
<p class="mb-1"><strong>Time:</strong> <span id="classTime"></span></p>
<p class="mb-1"><strong>Date:</strong> <span id="classDate"></span></p>
</div>
</div>
</div>
<div class="col-md-6">
<select class="form-select" id="modalClassStatus" name="class_status">
<option value="True" selected>Conducted</option>
<option value="False">Not Conducted</option>
</select>
</div>
</div>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th width="5%">#</th>
<th width="40%">Name</th>
<th width="40%">Student ID</th>
<th width="15%">Present</th>
</tr>
</thead>
<tbody id="modalStudentList">
<!-- Students will be loaded here -->
</tbody>
</table>
</div>
<div class="mt-3 d-flex justify-content-between">
<div>
<button type="button" class="btn btn-outline-success me-2" onclick="markAllPresent()">
<i class="fas fa-check-double me-1"></i> Mark All Present
</button>
<button type="button" class="btn btn-outline-danger" onclick="markAllAbsent()">
<i class="fas fa-times-circle me-1"></i> Mark All Absent
</button>
<div class="mb-4">
<h6 class="mb-3">Students List</h6>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Student ID</th>
<th>Name</th>
<th>Status</th>
<th>Remarks</th>
</tr>
</thead>
<tbody id="studentsList">
<!-- Students will be populated here -->
</tbody>
</table>
</div>
</div>
<button type="submit" class="btn btn-primary">
<i class="fas fa-save me-1"></i> Save Attendance
</button>
</div>
</form>
<div class="mb-3">
<label for="remarks" class="form-label">General Remarks</label>
<textarea class="form-control" id="remarks" name="remarks" rows="2" placeholder="Add any general remarks about the class"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
<i class="fas fa-times me-2"></i>Cancel
</button>
<button type="button" class="btn btn-primary" id="saveAttendance">
<i class="fas fa-save me-2"></i>Save Attendance
</button>
</div>
</div>
</div>
</div>
</div>
<style>
#attendanceModal .modal-content {
border: none;
box-shadow: var(--shadow-lg);
}
#attendanceModal .modal-header {
border-bottom: none;
}
#attendanceModal .modal-body {
padding: 1.5rem;
}
#attendanceModal .table th {
background-color: var(--light);
font-weight: 600;
}
#attendanceModal .table td {
vertical-align: middle;
}
#attendanceModal .btn {
padding: 0.5rem 1rem;
font-weight: 500;
}
#attendanceModal .form-control {
border-radius: var(--border-radius-md);
}
#attendanceModal .form-control:focus {
border-color: var(--primary);
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
</style>
-1
View File
@@ -16,4 +16,3 @@
[x] Parent Roles
[ ] Add Screenshots
[ ] Library Management
[ ] Implement Rest API
Generated
+358 -613
View File
File diff suppressed because it is too large. Load diff