Skip to content

Commit 2dccd08

Browse files
unknownunknown
authored andcommitted
#5-08-2024
1 parent 4d124b8 commit 2dccd08

File tree

21 files changed

+291
-71
lines changed

21 files changed

+291
-71
lines changed

appsTeacher/groups/app.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,31 @@ module.exports = function init(site) {
347347
});
348348
}
349349

350+
site.post({ name: `/api/${app.name}/clickMobile`, public: true }, (req, res) => {
351+
let response = {
352+
done: false,
353+
};
354+
355+
let _data = req.data;
356+
app.view(_data, (err, doc) => {
357+
if (!err && doc) {
358+
response.done = true;
359+
let index = doc.studentList.findIndex((itm) => itm.student.id === _data.studentId);
360+
if (index !== -1) {
361+
if (_data.type == "studentMobile") {
362+
doc.studentList[index].clickStudentMoblie = true;
363+
} else if (_data.type == "parentMobile") {
364+
doc.studentList[index].clickSParentMobile = true;
365+
}
366+
app.update(doc);
367+
}
368+
} else {
369+
response.error = err?.message || "Not Exists";
370+
}
371+
res.json(response);
372+
});
373+
});
374+
350375
site.bookingAppointmentGroup = function (_options) {
351376
app.view({ id: _options.groupId }, (err, doc) => {
352377
if (doc) {

appsTeacher/groups/site_files/html/studentsModal.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,18 @@
2727
<tr ng-repeat="s in item.studentList | filter:$search">
2828
<td class="center">{{s.student.firstName}}</td>
2929
<td class="center userPrint">{{s.student.barcode}}</td>
30-
<td class="center">{{s.student.mobile}}</td>
31-
<td class="center">{{s.student.parentMobile}}</td>
30+
<td class="center">
31+
<a target="_blank" ng-class="{'change-color-link' : s.clickStudentMoblie}" ng-click="clickMoblie(s,'studentMobile')" href="https://wa.me/{{s.student.mobile}}">
32+
<i class="fas fa-mobile-alt"></i>
33+
{{s.student.mobile}}
34+
</a>
35+
</td>
36+
<td class="center">
37+
<a target="_blank" ng-class="{'change-color-link' : s.clickSParentMobile}" ng-click="clickMoblie(s,'parentMobile')" href="https://wa.me/{{s.student.parentMobile}}">
38+
<i class="fas fa-mobile-alt"></i>
39+
{{s.student.parentMobile}}
40+
</a>
41+
</td>
3242
<td class="center not-print">
3343
<i-button type="delete" label="##word.Delete##" ng-click="item.studentList.splice($index,1)"></i-button>
3444
</td>

appsTeacher/groups/site_files/js/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,28 @@ app.controller("groups", function ($scope, $http, $timeout) {
378378
);
379379
};
380380

381+
$scope.clickMoblie = function (item, type) {
382+
$scope.busy = true;
383+
$http({
384+
method: "POST",
385+
url: `${$scope.baseURL}/api/${$scope.appName}/clickMobile`,
386+
data: { id: $scope.item.id, studentId: item.student.id, type: type },
387+
}).then(
388+
function (response) {
389+
$scope.busy = false;
390+
if (type == "studentMobile") {
391+
item.clickStudentMoblie = true;
392+
} else if (type == "parentMobile") {
393+
item.clickSParentMobile = true;
394+
}
395+
},
396+
function (err) {
397+
$scope.busy = false;
398+
$scope.error = err;
399+
}
400+
);
401+
};
402+
381403
$scope.generateAppointments = function (item) {
382404
$scope.error = "";
383405
if (item.startDate && item.endDate) {

appsTeacher/manageUsers/app.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,22 @@ module.exports = function init(site) {
146146
name: app.name,
147147
},
148148
(req, res) => {
149+
let appName = req.word("Manage Users");
150+
if (req.query) {
151+
if (req.query.type == "student") {
152+
appName = req.word("Manage Students");
153+
} else if (req.query.type == "teacher") {
154+
appName = req.word("Manage Teachers");
155+
} else if (req.query.type == "parent") {
156+
appName = req.word("Manage Parents");
157+
}
158+
}
159+
149160
res.render(
150161
app.name + "/index.html",
151162
{
152163
title: app.name,
153-
appName: req.word("Manage Users"),
164+
appName: appName,
154165
setting: site.getSiteSetting(req.host),
155166
},
156167
{ parser: "html", compres: true }
@@ -223,7 +234,7 @@ module.exports = function init(site) {
223234
if (!setting.isShared && !setting.isCenter) {
224235
site.addNewHost({ domain: doc.userName, filter: doc.userName });
225236
}
226-
if (doc.type == "student" && setting.isCenter) {
237+
if (doc.type == "student" && setting.isCenter && setting.autoStudentBarcode) {
227238
doc.barcode = doc.id.toString() + "00" + d + h + m;
228239
app.update(doc, (err1, result) => {
229240
if (!err1 && doc) {
Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,47 @@
11
<div id="manageUsersManageModal" class="modal full" fixed>
2-
<div class="modal-content">
3-
<div class="modal-header">
4-
<span class="close">&times;</span>
5-
<p class="center" ng-show="mode == 'add' ">
6-
##word.New## ##word.Manage User##
7-
<i class="fa fa-plus"></i>
8-
</p>
9-
<p class="center" ng-show="mode == 'edit' ">
10-
##word.Edit## ##word.Manage User##
11-
<i class="fa fa-pencil"></i>
12-
</p>
13-
<p class="center" ng-show="mode == 'delete' ">
14-
##word.Delete## ##word.Manage User##
15-
<i class="fa fa-trash"></i>
16-
</p>
17-
<p class="center" ng-show="mode == 'view' ">
18-
##word.Manage User## ##word.Details##
19-
<i class="fa fa-file"></i>
20-
</p>
21-
</div>
2+
<div class="modal-content">
3+
<div class="modal-header">
4+
<span class="close">&times;</span>
5+
<p class="center" ng-show="mode == 'add' ">
6+
<span ng-show="'##query.type##' == 'student'">##word.Student##</span>
7+
<span ng-show="'##query.type##' == 'teacher'">##word.Teacher##</span>
8+
<span ng-show="'##query.type##' == 'parent'">##word.Parent##</span>
9+
##word.New##
10+
<i class="fa fa-plus"></i>
11+
</p>
12+
<p class="center" ng-show="mode == 'edit' ">
13+
##word.Edit##
14+
<span ng-show="'##query.type##' == 'student'">##word.Student##</span>
15+
<span ng-show="'##query.type##' == 'teacher'">##word.Teacher##</span>
16+
<span ng-show="'##query.type##' == 'parent'">##word.Parent##</span>
17+
<i class="fa fa-pencil"></i>
18+
</p>
19+
<p class="center" ng-show="mode == 'delete' ">
20+
##word.Delete##
21+
<span ng-show="'##query.type##' == 'student'">##word.Student##</span>
22+
<span ng-show="'##query.type##' == 'teacher'">##word.Teacher##</span>
23+
<span ng-show="'##query.type##' == 'parent'">##word.Parent##</span>
24+
<i class="fa fa-trash"></i>
25+
</p>
26+
<p class="center" ng-show="mode == 'view' ">
27+
<span ng-show="'##query.type##' == 'student'">##word.Student##</span>
28+
<span ng-show="'##query.type##' == 'teacher'">##word.Teacher##</span>
29+
<span ng-show="'##query.type##' == 'parent'">##word.Parent##</span>
30+
##word.Details##
31+
<i class="fa fa-file"></i>
32+
</p>
33+
</div>
2234

23-
<div class="modal-body">
24-
<div x-import="manageUsers/modalContent.html"></div>
25-
</div>
35+
<div class="modal-body">
36+
<div x-import="manageUsers/modalContent.html"></div>
37+
</div>
2638

27-
<div class="modal-footer center">
28-
<p class="error">{{error}}</p>
29-
<i-button ng-show="mode == 'add' " type="add" label="##word.Add##" ng-click="add(item)"></i-button>
30-
<i-button ng-show="mode == 'edit' " type="edit" label="##word.Save##" ng-click="update(item)"></i-button>
31-
<i-button ng-show="mode == 'delete' " type="delete" title="##word.Delete##" ng-click="delete(item)"> </i-button>
32-
<i-button type="close" label="##word.Close##" onclick="site.hideModal( '#manageUsersManageModal')"></i-button>
33-
</div>
39+
<div class="modal-footer center">
40+
<p class="error">{{error}}</p>
41+
<i-button ng-show="mode == 'add' " type="add" label="##word.Add##" ng-click="add(item)"></i-button>
42+
<i-button ng-show="mode == 'edit' " type="edit" label="##word.Save##" ng-click="update(item)"></i-button>
43+
<i-button ng-show="mode == 'delete' " type="delete" title="##word.Delete##" ng-click="delete(item)"> </i-button>
44+
<i-button type="close" label="##word.Close##" onclick="site.hideModal( '#manageUsersManageModal')"></i-button>
3445
</div>
46+
</div>
3547
</div>

appsTeacher/manageUsers/site_files/html/modalContent.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<i-control label="##word.Prefix##" ng-show="item.type == 'teacher'" ng-model="item.prefix"> </i-control>
1616
<i-control label="##word.Title##" ng-show="item.type == 'teacher' && setting.isShared" ng-model="item.title"> </i-control>
1717
<i-control label="##word.Bio##" ng-show="item.type == 'teacher' && setting.isShared" ng-model="item.bio"> </i-control>
18+
<i-control label="##word.Barcode##" ng-show="item.type == 'student' && setting.isCenter && !setting.autoStudentBarcode" ng-model="item.barcode"> </i-control>
1819
</div>
1920
</div>
2021
<div class="col3 center">
@@ -63,17 +64,17 @@
6364
</div>
6465
</div>
6566
<div class="row" ng-show="item.type == 'student'">
66-
<i-list label="##word.Department##" x-data="setting.isCenter" class="col4" ng-model="item.department" display="name" items="departmentsList"></i-list>
6767
<i-list
68-
class="col4"
69-
label="##word.Educational Level##"
70-
ng-change="getSchoolYearsList(item.educationalLevel)"
71-
ng-model="item.educationalLevel"
72-
display="name"
73-
items="educationalLevelsList"
74-
ng-search="item.$educationalLevel"
68+
class="col4"
69+
label="##word.Educational Level##"
70+
ng-change="getSchoolYearsList(item.educationalLevel)"
71+
ng-model="item.educationalLevel"
72+
display="name"
73+
items="educationalLevelsList"
74+
ng-search="item.$educationalLevel"
7575
></i-list>
7676
<i-list label="##word.School Year##" class="col4" ng-model="item.schoolYear" display="name" items="schoolYearsList"></i-list>
77+
<i-list label="##word.Department##" x-data="setting.isCenter" class="col4" ng-model="item.department" display="name" items="departmentsList"></i-list>
7778
</div>
7879
</fieldset>
7980
<fieldset>

appsTeacher/menu/site_files/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
</a>
122122
</li>
123123

124-
<li class="menu-item">
124+
<li class="menu-item" x-data="setting.showParent">
125125
<a class="tab-link" href="/manageUsers?type=parent">
126126
<i class="fas fa-users"></i>
127127
<span> ##word.Manage Parents## </span>

appsTeacher/preparingGroups/app.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = function init(site) {
22
let app = {
33
name: "preparingGroups",
4-
allowMemory: true,
4+
allowMemory: false,
55
memoryList: [],
66
allowCache: false,
77
cacheList: [],
@@ -269,6 +269,8 @@ module.exports = function init(site) {
269269
id: 1,
270270
name: 1,
271271
teacher: 1,
272+
group: 1,
273+
date: 1,
272274
subject: 1,
273275
active: 1,
274276
};
@@ -304,13 +306,39 @@ module.exports = function init(site) {
304306
where["host"] = site.getHostFilter(req.host);
305307
}
306308
app.all({ where, select, limit, sort: { id: -1 } }, (err, docs) => {
309+
307310
res.json({
308311
done: true,
309312
list: docs,
310313
});
311314
});
312315
});
313316
}
317+
318+
site.post({ name: `/api/${app.name}/clickMobile`, public: true }, (req, res) => {
319+
let response = {
320+
done: false,
321+
};
322+
323+
let _data = req.data;
324+
app.view(_data, (err, doc) => {
325+
if (!err && doc) {
326+
response.done = true;
327+
let index = doc.studentList.findIndex((itm) => itm.student.id === _data.studentId);
328+
if (index !== -1) {
329+
if (_data.type == "studentMobile") {
330+
doc.studentList[index].clickStudentMoblie = true;
331+
} else if (_data.type == "parentMobile") {
332+
doc.studentList[index].clickSParentMobile = true;
333+
}
334+
app.update(doc);
335+
}
336+
} else {
337+
response.error = err?.message || "Not Exists";
338+
}
339+
res.json(response);
340+
});
341+
});
314342
}
315343

316344
app.init();

appsTeacher/preparingGroups/site_files/html/modalContent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</div>
3232
<div class="row">
3333
<div class="col7">
34-
<p class="bold"><span class="darkGray">##word.Tacher## : </span> {{item.teacher.firstName}}</p>
34+
<p class="bold"><span class="darkGray">##word.Teacher## : </span> {{item.teacher.firstName}}</p>
3535
</div>
3636
<div class="col5">
3737
<p class="bold"><span class="darkGray">##word.Mobile## : </span> {{item.teacher.mobile}}</p>

appsTeacher/preparingGroups/site_files/html/studentsModal.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,31 @@
3030
<th>##word.Status##</th>
3131
<th>##word.Attendance##</th>
3232
<th>##word.Departure##</th>
33+
<th>##word.Notes##</th>
3334
<th class="not-print">##word.Actions##</th>
3435
</tr>
3536
<tr ng-repeat="s in item.studentList | filter:$search">
3637
<td class="center">{{s.student.firstName}}</td>
3738
<td class="center userPrint">{{s.student.barcode}}</td>
38-
<td class="center">{{s.student.mobile}}</td>
39-
<td class="center">{{s.student.parentMobile}}</td>
39+
<td class="center">
40+
<a target="_blank" ng-class="{'change-color-link' : s.clickStudentMoblie}" ng-click="clickMoblie(s,'studentMobile')" href="https://wa.me/{{s.student.mobile}}">
41+
<i class="fas fa-mobile-alt"></i>
42+
{{s.student.mobile}}
43+
</a>
44+
</td>
45+
<td class="center">
46+
<a target="_blank" ng-class="{'change-color-link' : s.clickSParentMobile}" ng-click="clickMoblie(s,'parentMobile')" href="https://wa.me/{{s.student.parentMobile}}">
47+
<i class="fas fa-mobile-alt"></i>
48+
{{s.student.parentMobile}}
49+
</a>
50+
</td>
4051
<td class="center">
4152
<span class="text-success" ng-show="s.attend">##word.Attended##</span>
4253
<span class="text-danger" ng-show="s.attend == false">##word.Absence##</span>
4354
</td>
4455
<td class="center">{{s.attendDate | date : 'mm : hh '}}</td>
4556
<td class="center">{{s.departureDate | date : 'mm : hh '}}</td>
57+
<td class="center"><i-control ng-model="s.notes"></i-control></td>
4658
<td class="center not-print">
4759
<i-button ng-show="!s.attend" label="##word.Attended##" ng-click="setAttendance(s,'attend')"></i-button>
4860
<i-button ng-show="s.attend && !s.departureDate" label="##word.Departure##" ng-click="setAttendance(s,'departure')"></i-button>

0 commit comments

Comments
 (0)