From 8dbbe65a09a61d5850009f1807ae26946547bd53 Mon Sep 17 00:00:00 2001 From: libexi01 Date: Fri, 5 Jul 2024 23:57:32 +0530 Subject: [PATCH] 1 --- .gitignore | 2 + README.MD | 3 + app.db | Bin 0 -> 12288 bytes databases/config_databases_sqlite.v | 8 +++ src/faculty_controller.v | 39 +++++++++++ src/faculty_entities.v | 13 ++++ src/faculty_htmx.v | 1 + src/faculty_service.v | 44 ++++++++++++ src/faculty_view.v | 33 +++++++++ src/index.html | 21 ++++++ src/main.v | 40 +++++++++++ src/principle_controller.v | 0 src/principle_service.v | 0 src/principle_view.v | 0 src/students_entities.v | 11 +++ src/students_service.v | 0 src/students_view.v | 9 +++ src/templates/faculty/admin.html | 27 ++++++++ src/templates/faculty/attendance.html | 36 ++++++++++ src/templates/faculty/login.html | 24 +++++++ src/templates/faculty/schedule.html | 25 +++++++ src/templates/faculty/signup.html | 29 ++++++++ src/templates/header_component.html | 15 ++++ src/templates/products.css | 11 +++ src/templates/products.html | 94 ++++++++++++++++++++++++++ src/templates/student/student.js | 6 ++ src/templates/student/view.html | 23 +++++++ src/templates/style.css | 33 +++++++++ v.mod | 7 ++ 29 files changed, 554 insertions(+) create mode 100644 .gitignore create mode 100644 README.MD create mode 100644 app.db create mode 100644 databases/config_databases_sqlite.v create mode 100644 src/faculty_controller.v create mode 100644 src/faculty_entities.v create mode 100644 src/faculty_htmx.v create mode 100644 src/faculty_service.v create mode 100644 src/faculty_view.v create mode 100644 src/index.html create mode 100644 src/main.v create mode 100644 src/principle_controller.v create mode 100644 src/principle_service.v create mode 100644 src/principle_view.v create mode 100644 src/students_entities.v create mode 100644 src/students_service.v create mode 100644 src/students_view.v create mode 100644 src/templates/faculty/admin.html create mode 100644 src/templates/faculty/attendance.html create mode 100644 src/templates/faculty/login.html create mode 100644 src/templates/faculty/schedule.html create mode 100644 src/templates/faculty/signup.html create mode 100644 src/templates/header_component.html create mode 100644 src/templates/products.css create mode 100644 src/templates/products.html create mode 100644 src/templates/student/student.js create mode 100644 src/templates/student/view.html create mode 100644 src/templates/style.css create mode 100644 v.mod diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..22c82cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +src/.DS_Store \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..58197da --- /dev/null +++ b/README.MD @@ -0,0 +1,3 @@ +# Welland Gouldsmith School Management System + +This is the repository for my Welland Gouldsmith School Management System project made using the V Programming language, SQLite3 and HTMX \ No newline at end of file diff --git a/app.db b/app.db new file mode 100644 index 0000000000000000000000000000000000000000..e3d29a8f689d7acf547ab783d58c5c6d280721bf GIT binary patch literal 12288 zcmWFz^vNtqRY=P(%1ta$FlG>7U}R))P*7lCU|?ckU|?oI07eD|1{MUD0mMh*Vr4Qh z=;iI=<^RFJ#CM5-?-Kt>tg1!@M?+vV1V%$(Gz3ONU^E0qLtr!nMnhmU1V%$(Gz3ON zfaDNpEMa69mzHL1wl7Ic%1KR2OfJnSsf1EY&Oxq@A+8D`j!r(V3JFlr1O<(R%#;KL zPrndXch?{VKmQN~zfd0^9fgFn%%b9wyu{qp1ceaSh!A9{oJ3qQskw=nIhYy}lao`6 zi{o=r%TjZ&T2_!)TwI=Cl!Bo(Ajs3#F(^{O+cgsGQcWF&P(RPWP*;rvh+UeRx=d{1 zj?#<_nRzLx6~%=)nI)<5iKQj^V17K*qw$7N2B=@p0Sa1P1_lO3{*w%&J#$cKjN;J{ z7!85Z5Eu=C(GVC7fzc2c4S~@R7!85Z5Eu=C(GVEqAz;eL&Y&o6%^{nfUz}f%X=rI_ zR+O5TT!i2{q$L(- + + + + + School Management System + @css '/templates/style.css' + + +
+

Welcome to Welland Gouldsmith Management System

+
+
+
+

Choose an option:

+ Check Attendance (Student) + Faculty Login +
+
+ + diff --git a/src/main.v b/src/main.v new file mode 100644 index 0000000..7bd65a3 --- /dev/null +++ b/src/main.v @@ -0,0 +1,40 @@ +module main + +import vweb +import databases +import os + +const ( + port = 8082 +) + +struct App { + vweb.Context +} + +pub fn (app App) before_request() { + println('[web] before_request: ${app.req.method} ${app.req.url}') +} + +fn main() { + mut db := databases.create_db_connection() or { panic(err) } + + sql db { + create table Faculty + // create table Product + } or { panic('error on create table: ${err}') } + + db.close() or { panic(err) } + + mut app := &App{} + app.serve_static('/favicon.ico', 'src/assets/favicon.ico') + // makes all static files available. + app.mount_static_folder_at(os.resource_abs_path('.'), '/') + + vweb.run(app, port) +} + +pub fn (mut app App) index() vweb.Result { + + return $vweb.html() +} diff --git a/src/principle_controller.v b/src/principle_controller.v new file mode 100644 index 0000000..e69de29 diff --git a/src/principle_service.v b/src/principle_service.v new file mode 100644 index 0000000..e69de29 diff --git a/src/principle_view.v b/src/principle_view.v new file mode 100644 index 0000000..e69de29 diff --git a/src/students_entities.v b/src/students_entities.v new file mode 100644 index 0000000..858900b --- /dev/null +++ b/src/students_entities.v @@ -0,0 +1,11 @@ +module main + +@[table: 'students'] +pub struct Student { +mut: + id int @[primary; sql: serial] + firstname string @[sql_type: 'TEXT'] + lastname string @[sql_type: 'TEXT'] + email string @[sql_type: 'TEXT'; unique] + password string @[sql_type: 'TEXT'] +} diff --git a/src/students_service.v b/src/students_service.v new file mode 100644 index 0000000..e69de29 diff --git a/src/students_view.v b/src/students_view.v new file mode 100644 index 0000000..e3e5b4f --- /dev/null +++ b/src/students_view.v @@ -0,0 +1,9 @@ +module main + +import vweb + +@['/student'; get] +pub fn (mut app App) student_view() vweb.Result { + + return $vweb.html() +} \ No newline at end of file diff --git a/src/templates/faculty/admin.html b/src/templates/faculty/admin.html new file mode 100644 index 0000000..ceec8de --- /dev/null +++ b/src/templates/faculty/admin.html @@ -0,0 +1,27 @@ + + + + + + Faculty Admin + @css '/templates/style.css' + + +
+

Faculty Admin Panel

+
+
+
+

Welcome, [Faculty Name]!

+ +
+
+ + diff --git a/src/templates/faculty/attendance.html b/src/templates/faculty/attendance.html new file mode 100644 index 0000000..8b935b4 --- /dev/null +++ b/src/templates/faculty/attendance.html @@ -0,0 +1,36 @@ + + + + + + Take Attendance + @css '/templates/style.css' + + +
+

Faculty Admin Panel

+
+
+
+

Take Attendance (Select Class)

+
+ + +
+

+ + Back to Admin Panel +
+
+ + diff --git a/src/templates/faculty/login.html b/src/templates/faculty/login.html new file mode 100644 index 0000000..6994c09 --- /dev/null +++ b/src/templates/faculty/login.html @@ -0,0 +1,24 @@ + + + + + + Faculty Login + @css '/templates/style.css' + + +
+

Faculty Login

+
+
+ +
+ + diff --git a/src/templates/faculty/schedule.html b/src/templates/faculty/schedule.html new file mode 100644 index 0000000..d04c249 --- /dev/null +++ b/src/templates/faculty/schedule.html @@ -0,0 +1,25 @@ + + + + + + View Class Schedule + @css '/templates/style.css' + + +
+

Faculty Admin Panel

+
+
+
+

Your Class Schedule

+

**Day** | **Time** | **Course** | **Location**

+

----- | -------- | -------- | --------

+

Monday | 9:00 AM - 10:00 AM | Math | Room 201

+

Tuesday | 10:30 AM - 12:00 PM | English | Room 305

+

Wednesday | 1:00 PM - 2:00 PM | Science | Lab 102

+ Back to Admin Panel +
+
+ + diff --git a/src/templates/faculty/signup.html b/src/templates/faculty/signup.html new file mode 100644 index 0000000..acdd2e4 --- /dev/null +++ b/src/templates/faculty/signup.html @@ -0,0 +1,29 @@ + + + + + + Faculty Login + @css '/templates/style.css' + + +
+

Faculty Login

+
+
+ +
+ + diff --git a/src/templates/header_component.html b/src/templates/header_component.html new file mode 100644 index 0000000..60f1a88 --- /dev/null +++ b/src/templates/header_component.html @@ -0,0 +1,15 @@ + diff --git a/src/templates/products.css b/src/templates/products.css new file mode 100644 index 0000000..d83d2d1 --- /dev/null +++ b/src/templates/products.css @@ -0,0 +1,11 @@ +h1.title { + font-family: Arial, Helvetica, sans-serif; + color: #3b7bbf; +} + +div.products-table { + border: 1px solid; + max-width: 720px; + padding: 10px; + margin: 10px; +} \ No newline at end of file diff --git a/src/templates/products.html b/src/templates/products.html new file mode 100644 index 0000000..959c3ee --- /dev/null +++ b/src/templates/products.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + Login + @css 'src/templates/products.css' + + +
@include 'header_component.html'
+

Hi, ${user.username}! you are online

+ +
+
+
+ + +
+
+ +
+
+ +
+ +
+ + + + + + + + + + + @for product in user.products + + + + + + @end + +
IDNameCreated date
${product.id}${product.name}${product.created_at}
+
+ + \ No newline at end of file diff --git a/src/templates/student/student.js b/src/templates/student/student.js new file mode 100644 index 0000000..5ca8c3e --- /dev/null +++ b/src/templates/student/student.js @@ -0,0 +1,6 @@ +function checkAttendance() { + // Simulate attendance check (replace with actual logic) + const studentId = document.getElementById('student_id').value; + const attendanceMessage = document.getElementById('attendance_message'); + attendanceMessage.textContent = `Attendance data for student ID ${studentId} is not available in this demo.`; +} \ No newline at end of file diff --git a/src/templates/student/view.html b/src/templates/student/view.html new file mode 100644 index 0000000..61238ed --- /dev/null +++ b/src/templates/student/view.html @@ -0,0 +1,23 @@ + + + + + + Student Attendance + @css '/templates/style.css' + + +
+

Check Attendance

+
+
+
+

Enter your Student ID:

+ + +

+
+
+ @js '/templates/student/attendance.js' + + diff --git a/src/templates/style.css b/src/templates/style.css new file mode 100644 index 0000000..09c0987 --- /dev/null +++ b/src/templates/style.css @@ -0,0 +1,33 @@ +body { + font-family: sans-serif; + margin: 0; + padding: 20px; +} + +header { + text-align: center; +} + +main { + display: flex; + justify-content: center; + align-items: center; + min-height: calc(100vh - 120px); /* Subtract header and footer height */ +} + +.options { + text-align: center; +} + +.options a { + display: block; + margin-bottom: 10px; + padding: 10px 20px; + border: 1px solid #ddd; + text-decoration: none; + color: #000; +} + +.options a:hover { + background-color: #eee; +} diff --git a/v.mod b/v.mod new file mode 100644 index 0000000..a6c67b9 --- /dev/null +++ b/v.mod @@ -0,0 +1,7 @@ +Module { + name: 'v4' + description: 'School Management System' + version: '0.0.0' + license: 'MIT' + dependencies: [] +}