Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deep Dey
LaMartin-Webomagic
Commits
37d6a4b1
Commit
37d6a4b1
authored
Jul 02, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: polish the ui-functionality and api integration for export features
parent
90614abe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
65 deletions
+118
-65
lamartinDashboard/dashboard.html
lamartinDashboard/dashboard.html
+22
-2
lamartinDashboard/js/dashboard.js
lamartinDashboard/js/dashboard.js
+96
-17
lamartinFrontend/datepickerForm.html
lamartinFrontend/datepickerForm.html
+0
-46
No files found.
lamartinDashboard/dashboard.html
View file @
37d6a4b1
...
...
@@ -54,7 +54,7 @@
</div>
<div
class=
"book-appointment-box"
>
<button
id=
"bookAppointmentBtn"
class=
"btn btn-primary btn-sm"
>
Schedule Appointment
</button>
<button
class=
"btn btn-success btn-sm"
>
Download Admission Data
</button>
<button
id=
"download-admission-data-btn"
class=
"btn btn-success btn-sm"
>
Download Admission Data
</button>
</div>
</div>
...
...
@@ -100,13 +100,33 @@
<label
for=
"appointmentTime"
>
Time
</label>
<input
type=
"time"
class=
"form-control"
id=
"appointmentTime"
required
/>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
Book
</button>
<div
class=
"modal-footer p-0 pt-2 border-top-0"
>
<button
type=
"submit"
class=
"btn btn-primary submit-btn"
>
Schedule
</button>
<button
class=
"btn btn-primary loading-btn"
type=
"button"
disabled
>
<span
class=
"spinner-border spinner-border-sm"
role=
"status"
aria-hidden=
"true"
></span>
Loading...
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div
class=
"modal"
tabindex=
"-1"
role=
"dialog"
id=
"messageModal"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
></h5>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body"
></div>
</div>
</div>
</div>
<script
src=
"https://code.jquery.com/jquery-3.6.0.min.js"
></script>
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
></script>
<script
src=
"js/constant.js"
></script>
...
...
lamartinDashboard/js/dashboard.js
View file @
37d6a4b1
...
...
@@ -20,7 +20,12 @@ $(document).ready(function () {
student
.
id
+
'
"></td>
'
;
outputHtml
+=
'
<td>
'
+
student
.
fullName
+
'
</td>
'
;
outputHtml
+=
'
<td>
'
+
(
student
.
interactionDate
||
''
)
+
'
'
+
(
student
.
interactionTime
||
''
)
+
'
</td>
'
;
outputHtml
+=
'
<td>
'
+
(
student
.
interactionDate
||
''
)
+
'
'
+
(
student
.
interactionTime
||
''
)
+
'
</td>
'
;
outputHtml
+=
'
<td>
'
+
student
.
fatherName
+
'
</td>
'
;
outputHtml
+=
'
<td>
'
+
student
.
motherName
+
'
</td>
'
;
outputHtml
+=
'
</tr>
'
;
...
...
@@ -82,6 +87,17 @@ $(document).ready(function () {
});
}
function
formatAMPM
(
date
)
{
var
hours
=
date
.
getHours
();
var
minutes
=
date
.
getMinutes
();
var
ampm
=
hours
>=
12
?
'
PM
'
:
'
AM
'
;
hours
=
hours
%
12
;
hours
=
hours
?
hours
:
12
;
// the hour '0' should be '12'
minutes
=
minutes
<
10
?
'
0
'
+
minutes
:
minutes
;
var
strTime
=
hours
+
'
:
'
+
minutes
+
'
'
+
ampm
;
return
strTime
;
}
// Apply filters button click event
$
(
'
#applyFilters
'
).
click
(
function
()
{
var
schoolFilter
=
$
(
'
#schoolFilter
'
).
val
();
...
...
@@ -98,14 +114,14 @@ $(document).ready(function () {
getAdmissionData
(
null
,
null
,
null
,
null
);
});
// Select all checkbox click event
$
(
'
#selectAll
'
).
click
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
.student-checkbox
'
).
prop
(
'
checked
'
,
true
);
}
else
{
$
(
'
.student-checkbox
'
).
prop
(
'
checked
'
,
false
);
}
});
// Select all checkbox click event
$
(
'
#selectAll
'
).
click
(
function
()
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
$
(
'
.student-checkbox
'
).
prop
(
'
checked
'
,
true
);
}
else
{
$
(
'
.student-checkbox
'
).
prop
(
'
checked
'
,
false
);
}
});
// Book appointment button click event
$
(
'
#bookAppointmentBtn
'
).
click
(
function
()
{
...
...
@@ -113,23 +129,86 @@ $(document).ready(function () {
$
(
'
.student-checkbox:checked
'
).
each
(
function
()
{
checkedValues
.
push
(
$
(
this
).
data
(
'
id
'
));
});
console
.
log
(
checkedValues
);
$
(
'
#studentIdForAppointment
'
).
val
(
checkedValues
.
toString
());
$
(
'
#appointmentModal
'
).
modal
(
'
show
'
);
$
(
'
.loading-btn
'
).
hide
();
});
// Appointment form submission event
$
(
'
#appointmentForm
'
).
submit
(
function
(
event
)
{
event
.
preventDefault
();
var
studentId
=
$
(
'
#studentIdForAppointment
'
).
val
();
var
formIds
=
$
(
'
#studentIdForAppointment
'
).
val
();
var
appointmentDate
=
$
(
'
#appointmentDate
'
).
val
();
var
appointmentTime
=
$
(
'
#appointmentTime
'
).
val
();
console
.
log
(
'
Booking Appointment for Student ID:
'
,
studentId
);
console
.
log
(
'
Appointment Date:
'
,
appointmentDate
);
console
.
log
(
'
Appointment Time:
'
,
appointmentTime
);
// Perform further actions here like sending data to the backend
$
(
'
#appointmentModal
'
).
modal
(
'
hide
'
);
alert
(
'
Appointment booked successfully for Student ID:
'
+
studentId
);
var
selectedDateTime
=
new
Date
(
appointmentDate
+
'
T
'
+
appointmentTime
);
if
(
!
formIds
)
{
$
(
'
#appointmentModal
'
).
modal
(
'
hide
'
);
$
(
'
#messageModal .modal-title
'
).
text
(
'
Error
'
);
$
(
'
#messageModal .modal-body
'
).
text
(
'
Please select at least one form to schedule an appointment.
'
);
$
(
'
#messageModal
'
).
modal
(
'
show
'
);
return
;
}
$
(
'
.submit-btn
'
).
hide
();
$
(
'
.loading-btn
'
).
show
();
$
.
ajax
({
url
:
BASE_URL_LAMARTIN
+
'
/admission-form/set-interview
'
,
type
:
'
GET
'
,
contentType
:
'
application/json
'
,
dataType
:
'
json
'
,
headers
:
{
apikey
:
loginData
.
apiKey
,
},
data
:
{
formIds
:
formIds
,
interactionDate
:
appointmentDate
,
interactionTime
:
formatAMPM
(
selectedDateTime
),
},
success
:
function
(
response
)
{
window
.
location
.
reload
();
},
error
:
function
(
error
)
{
if
(
error
.
responseJSON
&&
error
.
responseJSON
.
message
)
{
$
(
'
#messageModal .modal-body
'
).
text
(
error
.
responseJSON
.
message
);
}
else
{
$
(
'
#messageModal .modal-body
'
).
text
(
'
An unexpected error occurred. Please try again.
'
);
}
$
(
'
#appointmentModal
'
).
modal
(
'
hide
'
);
$
(
'
#messageModal .modal-title
'
).
text
(
'
Error
'
);
$
(
'
#messageModal
'
).
modal
(
'
show
'
);
},
});
});
$
(
'
#download-admission-data-btn
'
).
click
(
function
()
{
var
checkedValues
=
[];
$
(
'
.student-checkbox:checked
'
).
each
(
function
()
{
checkedValues
.
push
(
$
(
this
).
data
(
'
id
'
));
});
window
.
open
(
BASE_URL_LAMARTIN
+
`/admission-form/download-form?apikey=
${
loginData
.
apiKey
}
&formIds=
${
checkedValues
.
toString
()}
`
,
'
_blank
'
)
.
focus
();
});
});
lamartinFrontend/datepickerForm.html
deleted
100644 → 0
View file @
90614abe
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Datetime Picker
</title>
<script
src=
"https://code.jquery.com/jquery-3.6.0.min.js"
></script>
</head>
<body>
<input
type=
"date"
id=
"datePicker"
>
<input
type=
"time"
id=
"timePicker"
>
<button
id=
"logDatetime"
>
Log Datetime
</button>
<div
id=
"result"
></div>
<script>
function
formatAMPM
(
date
)
{
var
hours
=
date
.
getHours
();
var
minutes
=
date
.
getMinutes
();
var
ampm
=
hours
>=
12
?
'
PM
'
:
'
AM
'
;
hours
=
hours
%
12
;
hours
=
hours
?
hours
:
12
;
// the hour '0' should be '12'
minutes
=
minutes
<
10
?
'
0
'
+
minutes
:
minutes
;
var
strTime
=
hours
+
'
:
'
+
minutes
+
'
'
+
ampm
;
return
strTime
;
}
$
(
document
).
ready
(
function
()
{
$
(
'
#logDatetime
'
).
click
(
function
()
{
var
date
=
$
(
'
#datePicker
'
).
val
();
var
time
=
$
(
'
#timePicker
'
).
val
();
if
(
!
date
||
!
time
)
{
alert
(
'
Please select both date and time.
'
);
return
;
}
var
selectedDateTime
=
new
Date
(
date
+
'
T
'
+
time
);
var
formattedDateTime
=
date
+
'
T
'
+
formatAMPM
(
selectedDateTime
);
//TODO: send date and formatAMPM(selectedDateTime) to the backend
$
(
'
#result
'
).
text
(
formatAMPM
(
selectedDateTime
));
console
.
log
(
formattedDateTime
);
});
});
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment