@@ -14,12 +14,7 @@ window.CRM.APIRequest = function (options) {
1414 jqXHR . url = settings . url ;
1515 } ;
1616 options . error = function ( jqXHR , textStatus , errorThrown ) {
17- window . CRM . system . handlejQAJAXError (
18- jqXHR ,
19- textStatus ,
20- errorThrown ,
21- options . suppressErrorDialog ,
22- ) ;
17+ window . CRM . system . handlejQAJAXError ( jqXHR , textStatus , errorThrown , options . suppressErrorDialog ) ;
2318 } ;
2419 return $ . ajax ( options ) ;
2520} ;
@@ -36,12 +31,7 @@ window.CRM.DisplayErrorMessage = function (endpoint, error) {
3631 ": " +
3732 error . message ;
3833 if ( error . trace ) {
39- message +=
40- "</p>" +
41- i18next . t ( "Stack Trace" ) +
42- ": <pre>" +
43- JSON . stringify ( error . trace , undefined , 2 ) +
44- "</pre>" ;
34+ message += "</p>" + i18next . t ( "Stack Trace" ) + ": <pre>" + JSON . stringify ( error . trace , undefined , 2 ) + "</pre>" ;
4535 }
4636 bootbox . alert ( {
4737 title : i18next . t ( "ERROR" ) ,
@@ -50,9 +40,7 @@ window.CRM.DisplayErrorMessage = function (endpoint, error) {
5040} ;
5141
5242window . CRM . VerifyThenLoadAPIContent = function ( url ) {
53- var error = i18next . t (
54- "There was a problem retrieving the requested object" ,
55- ) ;
43+ var error = i18next . t ( "There was a problem retrieving the requested object" ) ;
5644
5745 // Helper function to fetch error message from JSON response
5846 function fetchErrorMessage ( targetUrl , fallbackError , callback ) {
@@ -63,8 +51,7 @@ window.CRM.VerifyThenLoadAPIContent = function (url) {
6351 async : false ,
6452 dataType : "json" ,
6553 success : function ( data ) {
66- var msg =
67- data && data . message ? data . message : fallbackError ;
54+ var msg = data && data . message ? data . message : fallbackError ;
6855 callback ( msg ) ;
6956 } ,
7057 error : function ( ) {
@@ -109,8 +96,7 @@ window.CRM.kiosks = {
10996 window . CRM . APIRequest ( {
11097 path : "kiosks/" + id + "/reloadKiosk" ,
11198 method : "POST" ,
112- } ) . done ( function ( data ) {
113- } ) ;
99+ } ) . done ( function ( data ) { } ) ;
114100 } ,
115101 enableRegistration : function ( ) {
116102 return window . CRM . APIRequest ( {
@@ -222,27 +208,21 @@ window.CRM.groups = {
222208 throw i18next . t ( "GroupID required for role selection prompt" ) ;
223209 }
224210 initFunction = function ( ) {
225- window . CRM . groups
226- . getRoles ( selectOptions . GroupID )
227- . done ( function ( rdata ) {
228- let rolesList = rdata . map ( function ( item ) {
229- return {
230- text : i18next . t ( item . OptionName ) , // to translate the Teacher and Student in localize text
231- id : item . OptionId ,
232- } ;
233- } ) ;
234- $ ( "#targetRoleSelection" ) . select2 ( {
235- data : rolesList ,
236- dropdownParent : $ ( ".bootbox" ) ,
237- } ) ;
211+ window . CRM . groups . getRoles ( selectOptions . GroupID ) . done ( function ( rdata ) {
212+ let rolesList = rdata . map ( function ( item ) {
213+ return {
214+ text : i18next . t ( item . OptionName ) , // to translate the Teacher and Student in localize text
215+ id : item . OptionId ,
216+ } ;
238217 } ) ;
218+ $ ( "#targetRoleSelection" ) . select2 ( {
219+ data : rolesList ,
220+ dropdownParent : $ ( ".bootbox" ) ,
221+ } ) ;
222+ } ) ;
239223 } ;
240224 }
241- if (
242- selectOptions . Type ===
243- ( window . CRM . groups . selectTypes . Group |
244- window . CRM . groups . selectTypes . Role )
245- ) {
225+ if ( selectOptions . Type === ( window . CRM . groups . selectTypes . Group | window . CRM . groups . selectTypes . Role ) ) {
246226 options . title = i18next . t ( "Select Group and Role" ) ;
247227 options . buttons . confirm . callback = function ( ) {
248228 selection = {
@@ -262,34 +242,28 @@ window.CRM.groups = {
262242 id : item . Id ,
263243 } ;
264244 } ) ;
265- $ ( "#targetGroupSelection" )
266- . parents ( ".bootbox" )
267- . removeAttr ( "tabindex" ) ;
245+ $ ( "#targetGroupSelection" ) . parents ( ".bootbox" ) . removeAttr ( "tabindex" ) ;
268246 $groupSelect2 = $ ( "#targetGroupSelection" ) . select2 ( {
269247 data : groupsList ,
270248 dropdownParent : $ ( ".bootbox" ) ,
271249 } ) ;
272250
273251 $groupSelect2 . on ( "select2:select" , function ( e ) {
274- var targetGroupId = $ (
275- "#targetGroupSelection option:selected" ,
276- ) . val ( ) ;
252+ var targetGroupId = $ ( "#targetGroupSelection option:selected" ) . val ( ) ;
277253 $parent = $ ( "#targetRoleSelection" ) . parent ( ) ;
278254 $ ( "#targetRoleSelection" ) . empty ( ) ;
279- window . CRM . groups
280- . getRoles ( targetGroupId )
281- . done ( function ( rdata ) {
282- rolesList = rdata . map ( function ( item ) {
283- return {
284- text : i18next . t ( item . OptionName ) , // this is for the Teacher and Student role
285- id : item . OptionId ,
286- } ;
287- } ) ;
288- $ ( "#targetRoleSelection" ) . select2 ( {
289- data : rolesList ,
290- dropdownParent : $ ( ".bootbox" ) ,
291- } ) ;
255+ window . CRM . groups . getRoles ( targetGroupId ) . done ( function ( rdata ) {
256+ rolesList = rdata . map ( function ( item ) {
257+ return {
258+ text : i18next . t ( item . OptionName ) , // this is for the Teacher and Student role
259+ id : item . OptionId ,
260+ } ;
292261 } ) ;
262+ $ ( "#targetRoleSelection" ) . select2 ( {
263+ data : rolesList ,
264+ dropdownParent : $ ( ".bootbox" ) ,
265+ } ) ;
266+ } ) ;
293267 } ) ;
294268 } ) ;
295269 } ,
@@ -358,17 +332,9 @@ window.CRM.system = {
358332 suppressErrorDialog : true ,
359333 } ) ;
360334 } ,
361- handlejQAJAXError : function (
362- jqXHR ,
363- textStatus ,
364- errorThrown ,
365- suppressErrorDialog ,
366- ) {
335+ handlejQAJAXError : function ( jqXHR , textStatus , errorThrown , suppressErrorDialog ) {
367336 if ( jqXHR . status === 401 ) {
368- window . location =
369- window . CRM . root +
370- "/session/begin?location=" +
371- window . location . pathname ;
337+ window . location = window . CRM . root + "/session/begin?location=" + window . location . pathname ;
372338 }
373339 try {
374340 var CRMResponse = JSON . parse ( jqXHR . responseText ) ;
@@ -392,18 +358,14 @@ window.CRM.dashboard = {
392358 renderers : {
393359 EventsCounters : function ( data ) {
394360 if ( document . getElementById ( "BirthdateNumber" ) != null ) {
395- document . getElementById ( "BirthdateNumber" ) . innerText =
396- data . Birthdays ;
397- document . getElementById ( "AnniversaryNumber" ) . innerText =
398- data . Anniversaries ;
361+ document . getElementById ( "BirthdateNumber" ) . innerText = data . Birthdays ;
362+ document . getElementById ( "AnniversaryNumber" ) . innerText = data . Anniversaries ;
399363 document . getElementById ( "EventsNumber" ) . innerText = data . Events ;
400364 }
401365 } ,
402366 PageLocale : function ( data ) {
403367 $ ( ".fi" ) . addClass ( "fi-" + data . countryFlagCode ) ;
404- $ ( "#translationInfo" ) . html (
405- data . name + " [" + window . CRM . locale + "]" ,
406- ) ;
368+ $ ( "#translationInfo" ) . html ( data . name + " [" + window . CRM . locale + "]" ) ;
407369 if ( data . displayPerCompleted && data . poPerComplete < 90 ) {
408370 $ ( "#translationPer" ) . html ( data . poPerComplete + "%" ) ;
409371 $ ( "#localePer" ) . removeClass ( "hidden" ) ;
@@ -414,10 +376,7 @@ window.CRM.dashboard = {
414376 window . CRM . APIRequest ( {
415377 method : "GET" ,
416378 path :
417- "background/page?token=" +
418- Math . random ( ) +
419- "&name=" +
420- window . CRM . PageName . replace ( window . CRM . root , "" ) ,
379+ "background/page?token=" + Math . random ( ) + "&name=" + window . CRM . PageName . replace ( window . CRM . root , "" ) ,
421380 suppressErrorDialog : true ,
422381 } ) . done ( function ( data ) {
423382 for ( var key in data ) {
0 commit comments