PluginProbe
School Management System – WPSchoolPress / 2.2.38
School Management System – WPSchoolPress v2.2.38
2.2.48 2.2.47 2.2.46 2.2.45 2.2.44 2.2.43 2.2.42 2.2.41 2.2.40 2.2.39 2.2.38 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 All 103 releases
wpschoolpress / js / wpsp-class.js

wpsp-class.js in School Management System – WPSchoolPress 2.2.38, at js/wpsp-class.js

199 lines 7.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 $(document).ready(function() {
2 $("input.numbers").bind("keypress", function(a) {
3 return 8 == a.which || 0 == a.which || !(a.which < 48 || a.which > 57)
4 }), $(".wpsp-start-date").datepicker({
5 autoclose: !0,
6 dateFormat: date_format,
7 todayHighlight: !0,
8 changeMonth: !0,
9 changeYear: !0,
10 startDate: "0m"
11 }), $(".wpsp-start-date").on("change", function() {
12 console.log($(".wpsp-start-date").val()), $(".wpsp-end-date").datepicker("remove"), $(".wpsp-end-date").datepicker({
13 autoclose: !0,
14 dateFormat: date_format,
15 todayHighlight: !0,
16 changeMonth: !0,
17 changeYear: !0,
18 startDate: $(".wpsp-start-date").val(),
19 setStartDate: $(".wpsp-start-date").val()
20 }), $(".wpsp-end-date").datepicker("update", $(".wpsp-start-date").val())
21 }), $("#class_table").dataTable({
22 language: {
23 paginate: {
24 next: '<i class="fa fa-angle-double-right" aria-hidden="true"></i>',
25 previous: '<i class="fa fa-angle-double-left" aria-hidden="true"></i>'
26 },
27 search: "",
28 searchPlaceholder: "Search..."
29 },
30 dom: '<"wpsp-dataTable-top"f>rt<"wpsp-dataTable-bottom"<"wpsp-length-info"li>p<"clear">>',
31 order: [],
32 columnDefs: [{
33 targets: "nosort",
34 orderable: !1
35 }],
36 drawCallback: function(a) {
37 $(this).closest(".dataTables_wrapper").find(".dataTables_paginate").toggle(this.api().page.info().pages > 1)
38 },
39 responsive: !0
40 }), $("#ClassAddForm").validate({
41 rules: {
42 Name: {
43 required: (jQuery("input[name='Name']").data("is_required")) ? true : false,
44 minlength: 2
45 },
46 Number: {
47 required: (jQuery("input[name='Number']").data("is_required")) ? true : false,
48 digits: true,
49 min: 1
50 },
51 capacity: {
52 required: (jQuery("input[name='capacity']").data("is_required")) ? true : false,
53 digits: true,
54 min: 1
55 },
56 Sdate: {
57 required: (jQuery("input[name='Sdate']").data("is_required")) ? true : false,
58 },
59 Edate: {
60 required: (jQuery("input[name='Edate']").data("is_required")) ? true : false,
61 },
62 ClassTeacherID: {
63 required: (jQuery("select[name='ClassTeacherID']").data("is_required")) ? true : false
64 }
65 },
66 messages: {
67 Name: {
68 required: "Please enter class name",
69 minlength: "Class must consist of at least 2 characters"
70 },
71 capacity: {
72 max: "Class Out of capacity",
73 required: "Please enter class capacity",
74 number: "Only Number Allowed",
75 },
76 Number: {
77 required: "Please enter class number",
78 number: "Only Number Allowed",
79 min: "More then 0"
80
81 },
82 Sdate: "Please enter Start Date",
83 Edate: "Please enter End Date",
84 ClassTeacherID: "Please enter Class Teacher",
85 },
86 submitHandler: function(a) {
87 var e = $("#ClassAddForm").serializeArray();
88 e.push({
89 name: "action",
90 value: "AddClass"
91 }), $.ajax({
92 type: "POST",
93 url: ajax_url,
94 data: e,
95 beforeSend: function() {
96 $("#SavingModal").css("display", "block"), $("#c_submit").attr("disabled", "disabled")
97 },
98 success: function(a) {
99 if ("inserted" === jQuery.trim(a)) {
100 $("#SuccessModal .wpsp-success-text").html("Class created successfully !"), $("#SuccessModal").css("display", "block"), $("#SavingModal").css("display", "none"), $("#SuccessModal").addClass("wpsp-popVisible");
101 var e = $("#wpsp_locationginal").val() + "/admin.php?page=sch-class";
102 setTimeout(function() {
103 window.location.href = e
104 }, 1e3);
105 $("#ClassAddForm").trigger("reset"), $("#c_submit").attr("disabled", !0)
106 } else $("#c_submit").attr("disabled", false), $(".wpsp-popup-return-data").html(a), $("#SavingModal").css("display", "none"), $("#WarningModal").css("display", "block"), $("#WarningModal").addClass("wpsp-popVisible")
107 },
108 complete: function() {}
109 })
110 }
111 }), $("#ClassEditForm").validate({
112 rules: {
113 Name: {
114 required: (jQuery("input[name='Name']").data("is_required")) ? true : false,
115 minlength: 2
116 },
117 capacity: {
118 required: (jQuery("input[name='capacity']").data("is_required")) ? true : false,
119 },
120 ClassTeacherID: {
121 required: (jQuery("input[name='ClassTeacherID']").data("is_required")) ? true : false,
122 },
123 Sdate: {
124 required: (jQuery("input[name='Sdate']").data("is_required")) ? true : false,
125 },
126 Edate: {
127 required: (jQuery("input[name='Edate']").data("is_required")) ? true : false,
128 },
129 ClassTeacherID: {
130 required: (jQuery("select[name='ClassTeacherID']").data("is_required")) ? true : false
131 }
132 },
133 messages: {
134 Name: {
135 required: "Please enter classname",
136 minlength: "Class must consist of at least 2 characters"
137 },
138 capacity: {
139 max: "Class Out of capacity"
140 },
141 ClassTeacherID: "Please enter Class Teacher",
142 },
143 submitHandler: function(a) {
144 var e = $("#ClassEditForm").serializeArray();
145 e.push({
146 name: "action",
147 value: "UpdateClass"
148 }), $.ajax({
149 type: "POST",
150 url: ajax_url,
151 data: e,
152 beforeSend: function() {
153 $("#SavingModal").css("display", "block"), $("#c_submit").attr("disabled", "disabled")
154 },
155 success: function(a) {
156 if ("updated" == jQuery.trim(a)) {
157 $("#SuccessModal .wpsp-success-text").html("Class updated successfully !"), $("#SuccessModal").css("display", "block"), $("#SavingModal").css("display", "none"), $("#SuccessModal").addClass("wpsp-popVisible");
158 var e = $("#wpsp_locationginal").val() + "/admin.php?page=sch-class";
159 setTimeout(function() {
160 window.location.href = e
161 }, 1e3);
162 $("#c_submit").attr("disabled", "disabled")
163 } else $(".wpsp-popup-return-data").html(a), $("#SavingModal").css("display", "none"), $("#WarningModal").css("display", "block"), $("#WarningModal").addClass("wpsp-popVisible")
164 },
165 complete: function() {}
166 })
167 }
168 }), $(document).on("click", "#d_teacher", function(a) {
169 var e = $(this).data("id");
170 console.log(e), $("#teacherid").val(e), $("#DeleteModal").css("display", "block")
171 }), $(document).on("click", ".ClassDeleteBt", function(a) {
172
173 deleteprocess.call(this);
174
175 if(!$("#SuccessModal").hasClass('wpsp-popVisible')){
176 $("#SuccessModal").addClass('wpsp-popVisible');
177 }
178
179 var nn = $('#wps_generate_nonce').val();
180 var e = $("#teacherid").val(),
181 s = [];
182 s.push({
183 name: "action",
184 value: "DeleteClass"
185 }, {
186 name: "cid",
187 value: e
188 },{
189 name: "wps_generate_nonce",
190 value: nn
191 }), jQuery.post(ajax_url, s, function(a) {
192 "success" == jQuery.trim(a) ? ($("#DeleteModal").css("display", "none"),$("#SuccessModal").css("display", "block"), $("#SuccessModal .wpsp-success-text").text('Class Deleted Successfully'),
193 setTimeout(function() {
194 location.reload();
195 }, 2000)) : ($(".wpsp-popup-return-data").html("Operation failed.Something went wrong!"), $("#SavingModal").css("display", "none"), $("#WarningModal").css("display", "block"), $("#WarningModal").addClass("wpsp-popVisible"))
196 })
197 })
198 });
199