Skip to content

Commit b98bba1

Browse files
unknownunknown
authored andcommitted
#5-08-2024
1 parent 9628542 commit b98bba1

10 files changed

Lines changed: 147 additions & 33 deletions

File tree

appsTeacher/groups/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ module.exports = function init(site) {
338338
}
339339
result.date = date;
340340
}
341+
if (_data.type == "validDay" && doc.paymentMethod.name == "lecture") {
342+
343+
doc.studentList = doc.studentList.map((obj) => ({ ...obj, paidType: "notPaid" }));
344+
}
345+
341346
result.studentList = doc.studentList;
342347
response.doc = result;
343348
res.json(response);

appsTeacher/groups/site_files/html/paymentsModal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h2 class="col3 center border-1 bold padding">
3737
<td class="center bold">{{s.month.name##session.lang##}}</td>
3838
<td class="center bold">{{s.price}} ##word.$##</td>
3939
<td class="center bold">
40-
{{s.remain}} ##word.$##
40+
<p>{{s.remain}} ##word.$##</p>
4141
<i-button type="save" ng-show="s.remain > 0" label="##word.Exception##" ng-click="exceptionRemain(s,true)"></i-button>
4242
<i-button type="exit" ng-show="s.exception" title="##word.Cancel Exception##" ng-click="exceptionRemain(s,false)"></i-button>
4343
</td>

appsTeacher/manageUsers/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ module.exports = function init(site) {
477477
where["host"] = site.getHostFilter(req.host);
478478
}
479479
where["id"] = { $ne: 1 };
480-
480+
481481
app.$collection.findMany({ where, select, limit, sort: { id: -1 } }, (err, users, count) => {
482482
res.json({
483483
done: true,

appsTeacher/preparingGroups/site_files/html/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<!DOCTYPE html>
22
<html lang="En" data-ng-app="myApp">
3-
<head x-import="teacher-theme/head-dashboard.html"></head>
3+
<head x-import="teacher-theme/head-dashboard.html">
4+
5+
</head>
46

57
<body class="##session.lang##">
68
<nav

appsTeacher/preparingGroups/site_files/html/modalContent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
></i-list>
1717
</div>
1818

19-
<i-button label="##word.Student Management##" ng-show="item.date" type="list" ng-click="numberAbsencesAttendance()" onclick="site.showModal( '#studentsModal')"></i-button>
19+
<i-button label="##word.Student Management##" ng-show="item.date" type="list" ng-click="numberAbsencesAttendance();getStudentPaid()" onclick="site.showModal( '#studentsModal')"></i-button>
2020

2121

2222
<div class="row" ng-show="item.date">

appsTeacher/preparingGroups/site_files/html/studentsModal.html

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,28 @@
5656
</div>
5757
</div>
5858
<div class="row">
59-
<div class="col5">
60-
<i-button type="search" label="##word.All##" ng-click="$search = ''"></i-button>
61-
<i-button type="search" label="##word.Attendance##" ng-click="$search = 'true'"></i-button>
62-
<i-button type="search" label="##word.Absences##" ng-click="$search = 'false'"></i-button>
59+
<div class="col6">
60+
<i-button type="search" label="##word.All##" ng-click="$search = ''; $search2 = ''"></i-button>
61+
<i-button type="search" label="##word.Attendance##" ng-click="$search2 = 'true'"></i-button>
62+
<i-button type="search" label="##word.Absences##" ng-click="$search2 = 'false'"></i-button>
63+
<i-button type="search" label="##word.Payment Made##" ng-click="$search2 = 'donePaid'"></i-button>
64+
<i-button type="search" label="##word.Payment Not Made##" ng-click="$search2 = 'notPaid'"></i-button>
6365
</div>
6466
<div class="table-responsive col6">
6567
<table class="table hover bold" id="t-students">
6668
<tr>
6769
<th>##word.Number Of Atudents##</th>
6870
<th>##word.Number Of Attendees##</th>
6971
<th>##word.Number Of Absences##</th>
72+
<th ng-show="item.group.paymentMethod.name == 'lecture'">##word.Number Of Payment Made##</th>
73+
<th ng-show="item.group.paymentMethod.name == 'lecture'">##word.Number Of Payment Not Made##</th>
7074
</tr>
7175
<tr>
7276
<td class="center">{{item.studentList.length}}</td>
7377
<td class="center">{{item.attendanceCount}}</td>
7478
<td class="center">{{item.absenceCount}}</td>
79+
<td ng-show="item.group.paymentMethod.name == 'lecture'" class="center">{{item.paidCount}}</td>
80+
<td ng-show="item.group.paymentMethod.name == 'lecture'" class="center">{{item.notPaidCount}}</td>
7581
</tr>
7682
</table>
7783
</div>
@@ -94,8 +100,8 @@
94100
<th>##word.Notes##</th>
95101
<th class="not-print">##word.Actions##</th>
96102
</tr>
97-
<tr ng-repeat="s in item.studentList | filter:$search">
98-
<td class="center">{{s.student.firstName}}</td>
103+
<tr ng-repeat="s in item.studentList | filter:$search | filter:$search2">
104+
<td class="center" ng-class="{'bg-yellow' : s.new === true}">{{s.student.firstName}}</td>
99105
<td class="center userPrint">{{s.student.barcode}}</td>
100106
<td class="center">
101107
<a target="_blank" ng-class="{'change-color-link' : s.clickStudentMoblie}" ng-click="clickMoblie(s,'studentMobile')" href="https://wa.me/{{s.student.mobile}}">
@@ -115,10 +121,9 @@
115121
<p class="text-danger" ng-show="s.attend == false">##word.Absence##</p>
116122
</td>
117123
<td class="center" ng-show="item.group.paymentMethod.name == 'lecture'">
118-
<i-button type="save" ng-show="s.price != item.group.price" label="##word.Paid##" ng-click="studentPAid(s,'paid')"></i-button>
119-
120-
<i-button type="print" ng-show="s.price == item.group.price" label="##word.Print##" ng-click="thermalPrint(s)"></i-button>
121-
<i-button type="close" ng-show="s.price == item.group.price" title="##word.Cancel Paid##" ng-click="studentPAid(s,'unpaid')"></i-button>
124+
<i-button type="save" ng-show="s.paidType == 'notPaid' && s.attend" label="##word.Paid##" ng-click="studentPaid(s,'donePaid');getStudentPaid()"></i-button>
125+
<i-button type="print" ng-show="s.paidType == 'donePaid'" label="##word.Print##" ng-click="thermalPrint(s)"></i-button>
126+
<i-button type="close" ng-show="s.paidType == 'donePaid'" title="##word.Cancel Paid##" ng-click="studentPaid(s,'notPaid');getStudentPaid()"></i-button>
122127
</td>
123128
<td class="center">
124129
<i-control ng-model="s.notes"></i-control>
@@ -127,6 +132,7 @@
127132
<i-button ng-show="!s.attend" label="##word.Attended##" ng-click="setAttendance(s,'attend');numberAbsencesAttendance()"></i-button>
128133
<i-button ng-show="s.attend && !s.departureDate" label="##word.Departure##" ng-click="setAttendance(s,'departure')"></i-button>
129134
<i-button type="close" ng-hide="s.attend == false && s.departureDate" label="##word.Absence##" ng-click="setAttendance(s,'absence');numberAbsencesAttendance()"></i-button>
135+
<i-button type="delete" label="##word.Delete##" ng-show="s.new == true" ng-click="item.studentList.splice($index,1)"></i-button>
130136
</td>
131137
</tr>
132138
</table>

appsTeacher/preparingGroups/site_files/js/index.js

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ app.controller("preparingGroups", function ($scope, $http, $timeout) {
297297
}
298298
);
299299
};
300+
$scope.getStudentPaid = function () {
301+
if ($scope.item.group.paymentMethod && $scope.item.group.paymentMethod.name == "lecture") {
302+
$scope.item.paidCount = $scope.item.studentList.filter((s) => s.paidType == "donePaid").length;
303+
$scope.item.notPaidCount = $scope.item.studentList.filter((s) => s.paidType == "notPaid").length;
304+
}
305+
};
300306

301307
$scope.setAttendance = function (item, type) {
302308
$scope.error = "";
@@ -333,16 +339,63 @@ app.controller("preparingGroups", function ($scope, $http, $timeout) {
333339
$scope.error = "";
334340
$scope.item.attendanceCount = $scope.item.studentList.filter((s) => s.attend).length;
335341
$scope.item.absenceCount = $scope.item.studentList.filter((s) => !s.attend).length;
342+
$scope.$applyAsync();
343+
336344
};
337345

338346
$scope.attendStudent = function (search, ev) {
339347
$scope.error = "";
340348
if (ev.which == 13) {
349+
if ($scope.busyAttend) {
350+
return;
351+
}
352+
$scope.busyAttend = true;
341353
let index = $scope.item.studentList.findIndex((itm) => itm.student.barcode == search);
342-
if (index !== -1 && !$scope.item.studentList[index].attend) {
343-
$scope.item.studentList[index].attendDate = new Date();
344-
$scope.item.studentList[index].attend = true;
345-
$scope.numberAbsencesAttendance();
354+
if (index !== -1) {
355+
if (!$scope.item.studentList[index].attend) {
356+
$scope.item.studentList[index].attendDate = new Date();
357+
$scope.item.studentList[index].attend = true;
358+
$scope.numberAbsencesAttendance();
359+
}
360+
$scope.busyAttend = false;
361+
} else {
362+
$http({
363+
method: "POST",
364+
url: "/api/manageUsers/all",
365+
data: {
366+
where: {
367+
type: "student",
368+
barcode: search,
369+
"educationalLevel.id": $scope.item.educationalLevel.id,
370+
"schoolYear.id": $scope.item.schoolYear.id,
371+
active: true,
372+
},
373+
select: { id: 1, firstName: 1, barcode: 1, mobile: 1, parentMobile: 1 },
374+
},
375+
}).then(
376+
function (response) {
377+
$scope.busyAttend = false;
378+
if (response.data.done && response.data.list.length > 0) {
379+
if (!$scope.item.studentList.some((k) => k.student && k.student.id === response.data.list[0].id)) {
380+
let stu = { student: response.data.list[0], attend: true,attendDate : new Date(), new: true };
381+
if ($scope.item.group.paymentMethod && $scope.item.group.paymentMethod.name == "lecture") {
382+
stu.paidType = "notPaid";
383+
}
384+
$scope.item.studentList.push(stu);
385+
$scope.numberAbsencesAttendance();
386+
} else {
387+
$scope.error = "##word.Student Exist##";
388+
}
389+
} else {
390+
$scope.error = "##word.Not Found##";
391+
}
392+
$scope.item.$studentSearch = "";
393+
},
394+
function (err) {
395+
$scope.busyAttend = false;
396+
$scope.error = err;
397+
}
398+
);
346399
}
347400
}
348401
};
@@ -388,13 +441,15 @@ app.controller("preparingGroups", function ($scope, $http, $timeout) {
388441
$("#thermalPrint").addClass("hidden");
389442
}, 8000);
390443
};
391-
$scope.studentPAid = function (item, type) {
444+
$scope.studentPaid = function (item, type) {
392445
$scope.error = "";
393-
if (type == "paid") {
446+
if (type == "donePaid") {
394447
item.price = $scope.item.group.price;
448+
item.paidType = type;
395449
$scope.thermalPrint(item);
396-
} else if (type == "unpaid") {
450+
} else if (type == "notPaid") {
397451
item.price = 0;
452+
item.paidType = type;
398453
}
399454
};
400455
$scope.searchAll = function () {

appsTeacher/preparingQuizzes/site_files/html/studentsModal.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<div class="modal-body">
1212
<div class="row">
1313
<div class="col5">
14-
<i-button type="search" label="##word.All##" ng-click="$search = ''"></i-button>
15-
<i-button type="search" label="##word.Attendance##" ng-click="$search = 'true'"></i-button>
16-
<i-button type="search" label="##word.Absences##" ng-click="$search = 'false'"></i-button>
14+
<i-button type="search" label="##word.All##" ng-click="$search = ''; $search2 = ''"></i-button>
15+
<i-button type="search" label="##word.Attendance##" ng-click="$search2 = 'true'"></i-button>
16+
<i-button type="search" label="##word.Absences##" ng-click="$search2 = 'false'"></i-button>
1717
</div>
1818
<div class="table-responsive col6">
1919
<table class="table hover bold" id="t-students">
@@ -32,7 +32,7 @@
3232
</div>
3333

3434
<div class="row">
35-
<i-control type="text" ng-keydown="attendStudent($search,$event)" ng-model="$search" label="##word.Student Search##"></i-control>
35+
<i-control type="text" ng-keydown="attendStudent($search,$event)" ng-model="$search" label="##word.Student Search##"></i-control>
3636
</div>
3737
<p class="error">{{error}}</p>
3838
<div class="row">
@@ -47,8 +47,8 @@
4747
<th class="w200">##word.Degree##</th>
4848
<th class="not-print">##word.Actions##</th>
4949
</tr>
50-
<tr ng-repeat="s in item.studentList | filter:$search">
51-
<td class="center">{{s.student.firstName}}</td>
50+
<tr ng-repeat="s in item.studentList | filter:$search | filter:$search2">
51+
<td class="center" ng-class="{'bg-yellow' : s.new === true}">{{s.student.firstName}}</td>
5252
<td class="center userPrint">{{s.student.barcode}}</td>
5353
<td class="center">
5454
<a target="_blank" ng-class="{'change-color-link' : s.clickStudentMoblie}" ng-click="clickMoblie(s,'studentMobile')" href="https://wa.me/{{s.student.mobile}}">
@@ -74,6 +74,7 @@
7474
<i-button ng-show="!s.attend" label="##word.Attended##" ng-click="setAttendance(s,'attend');numberAbsencesAttendance()"></i-button>
7575
<i-button ng-show="s.attend && !s.departureDate" label="##word.Departure##" ng-click="setAttendance(s,'departure')"></i-button>
7676
<i-button type="close" ng-hide="s.attend == false && s.departureDate" label="##word.Absence##" ng-click="setAttendance(s,'absence');numberAbsencesAttendance()"></i-button>
77+
<i-button type="delete" label="##word.Delete##" ng-show="s.new == true" ng-click="item.studentList.splice($index,1)"></i-button>
7778
</td>
7879
</tr>
7980
</table>

appsTeacher/preparingQuizzes/site_files/js/index.js

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,20 +321,63 @@ app.controller("preparingQuizzes", function ($scope, $http, $timeout) {
321321
$scope.error = "";
322322
$scope.item.attendanceCount = $scope.item.studentList.filter((s) => s.attend).length;
323323
$scope.item.absenceCount = $scope.item.studentList.filter((s) => !s.attend).length;
324+
$scope.$applyAsync();
325+
324326
};
325327

326328
$scope.attendStudent = function (search, ev) {
327329
$scope.error = "";
328330
if (ev.which == 13) {
331+
if ($scope.busyAttend) {
332+
return;
333+
}
334+
$scope.busyAttend = true;
329335
let index = $scope.item.studentList.findIndex((itm) => itm.student.barcode == search);
330-
if (index !== -1 && !$scope.item.studentList[index].attend) {
331-
$scope.item.studentList[index].attendDate = new Date();
332-
$scope.item.studentList[index].attend = true;
333-
$scope.numberAbsencesAttendance();
336+
if (index !== -1) {
337+
if (!$scope.item.studentList[index].attend) {
338+
$scope.item.studentList[index].attendDate = new Date();
339+
$scope.item.studentList[index].attend = true;
340+
$scope.numberAbsencesAttendance();
341+
}
342+
$scope.busyAttend = false;
343+
} else {
344+
$http({
345+
method: "POST",
346+
url: "/api/manageUsers/all",
347+
data: {
348+
where: {
349+
type: "student",
350+
barcode: search,
351+
"educationalLevel.id": $scope.item.educationalLevel.id,
352+
"schoolYear.id": $scope.item.schoolYear.id,
353+
active: true,
354+
},
355+
select: { id: 1, firstName: 1, barcode: 1, mobile: 1, parentMobile: 1 },
356+
},
357+
}).then(
358+
function (response) {
359+
$scope.busyAttend = false;
360+
if (response.data.done && response.data.list.length > 0) {
361+
if (!$scope.item.studentList.some((k) => k.student && k.student.id === response.data.list[0].id)) {
362+
let stu = { student: response.data.list[0], attend: true,attendDate : new Date(), new: true };
363+
$scope.item.studentList.push(stu);
364+
$scope.numberAbsencesAttendance();
365+
} else {
366+
$scope.error = "##word.Student Exist##";
367+
}
368+
} else {
369+
$scope.error = "##word.Not Found##";
370+
}
371+
$scope.item.$studentSearch = "";
372+
},
373+
function (err) {
374+
$scope.busyAttend = false;
375+
$scope.error = err;
376+
}
377+
);
334378
}
335379
}
336380
};
337-
338381
$scope.showSearch = function () {
339382
$scope.error = "";
340383
site.showModal($scope.modalSearchID);

site_files/css/teacher-style.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ legend {
192192
padding: 2px;
193193
border-radius: 50%;
194194
}
195-
195+
.bg-yellow {
196+
background: yellow !important;
197+
}
196198
.cart-number {
197199
color: var(--theme-color);
198200
font-size: 20px;

0 commit comments

Comments
 (0)