Skip to content

Commit 9748b98

Browse files
committed
run prettier on javascript code
1 parent 8eb5191 commit 9748b98

10 files changed

+606
-441
lines changed

Gruntfile.js

+434-313
Large diffs are not rendered by default.

scripts/startNewRelease.js

+32-25
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/usr/bin/env node
22

3-
const fs = require('fs').promises;
4-
const { dirname } = require('path');
5-
const { promisify } = require('util');
6-
const exec = promisify(require('child_process').exec);
7-
3+
const fs = require("fs").promises;
4+
const { dirname } = require("path");
5+
const { promisify } = require("util");
6+
const exec = promisify(require("child_process").exec);
87

98
async function saveJSONFile(fileName, data) {
109
await fs.writeFile(fileName, JSON.stringify(data, null, 4));
1110
}
1211

1312
async function readJSONFile(fileName) {
14-
const content = await fs.readFile(fileName, 'utf8');
13+
const content = await fs.readFile(fileName, "utf8");
1514
return JSON.parse(content);
1615
}
1716

@@ -44,49 +43,57 @@ async function updateDBDemoSQL(newVersion, oldVersion) {
4443

4544
async function updateNpmLock(jsProjectDir) {
4645
try {
47-
console.log('Updating package-lock.json...');
48-
const { stdout, stderr } = await exec('npm install', {
49-
cwd: jsProjectDir // Set the working directory to jsProjectDir (./)
46+
console.log("Updating package-lock.json...");
47+
const { stdout, stderr } = await exec("npm install", {
48+
cwd: jsProjectDir, // Set the working directory to jsProjectDir (./)
5049
});
5150

5251
if (stdout) {
53-
console.log('npm install output:', stdout);
52+
console.log("npm install output:", stdout);
5453
}
5554
if (stderr) {
56-
console.error('npm install error:', stderr);
55+
console.error("npm install error:", stderr);
5756
}
5857
} catch (error) {
59-
console.error('Error updating package-lock.json:', error.message);
58+
console.error("Error updating package-lock.json:", error.message);
6059
}
6160
}
6261

6362
async function updateNpm(pathToPackageJson, newVersion) {
64-
const oldVersionPackage = await updateVersion(pathToPackageJson, 'version', newVersion);
63+
const oldVersionPackage = await updateVersion(
64+
pathToPackageJson,
65+
"version",
66+
newVersion,
67+
);
6568
await updateNpmLock(dirname(pathToPackageJson));
6669

6770
return oldVersionPackage;
6871
}
6972

7073
async function updateComposerLock(phpProjectDir) {
7174
try {
72-
console.log('Updating composer.lock...');
73-
const { stdout, stderr } = await exec('composer update --lock', {
74-
cwd: phpProjectDir // Set the working directory to phpProjectDir (src)
75+
console.log("Updating composer.lock...");
76+
const { stdout, stderr } = await exec("composer update --lock", {
77+
cwd: phpProjectDir, // Set the working directory to phpProjectDir (src)
7578
});
7679

7780
if (stdout) {
78-
console.log('Composer update output:', stdout);
81+
console.log("Composer update output:", stdout);
7982
}
8083
if (stderr) {
81-
console.error('Composer update error:', stderr);
84+
console.error("Composer update error:", stderr);
8285
}
8386
} catch (error) {
84-
console.error('Error updating composer.lock:', error.message);
87+
console.error("Error updating composer.lock:", error.message);
8588
}
8689
}
8790

8891
async function updateComposer(pathToComposerJson, newVersion) {
89-
const oldVersionPackage = await updateVersion(pathToComposerJson, 'version', newVersion);
92+
const oldVersionPackage = await updateVersion(
93+
pathToComposerJson,
94+
"version",
95+
newVersion,
96+
);
9097
await updateComposerLock(dirname(pathToComposerJson));
9198

9299
return oldVersionPackage;
@@ -96,24 +103,24 @@ async function main() {
96103
const [, , newVersion] = process.argv;
97104

98105
if (!newVersion) {
99-
console.log('Please pass in a version number');
106+
console.log("Please pass in a version number");
100107
process.exit(1);
101108
}
102109

103110
console.log(`Starting build: ${newVersion}`);
104111

105112
const updatePackageFilePromises = [
106-
updateNpm('package.json', newVersion),
107-
updateComposer('src/composer.json', newVersion),
113+
updateNpm("package.json", newVersion),
114+
updateComposer("src/composer.json", newVersion),
108115
];
109116

110117
let oldVersion;
111118
for (const updatePromise of updatePackageFilePromises) {
112119
oldVersion = await updatePromise;
113120
}
114121

115-
await updateDBVersion('src/mysql/upgrade.json', newVersion, oldVersion);
122+
await updateDBVersion("src/mysql/upgrade.json", newVersion, oldVersion);
116123
await updateDBDemoSQL(newVersion, oldVersion);
117124
}
118125

119-
main();
126+
main();

src/skin/js/CRMJSOM.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ window.CRM.groups = {
439439

440440
$groupSelect2.on("select2:select", function (e) {
441441
var targetGroupId = $(
442-
"#targetGroupSelection option:selected"
442+
"#targetGroupSelection option:selected",
443443
).val();
444444
$parent = $("#targetRoleSelection").parent();
445445
$("#targetRoleSelection").empty();
@@ -577,16 +577,24 @@ window.CRM.dashboard = {
577577
},
578578
SystemUpgrade: function (data) {
579579
if (data.newVersion) {
580-
$("#upgradeToVersion").html(data.newVersion.MAJOR + "." + data.newVersion.MINOR + "." + data.newVersion.PATCH);
580+
$("#upgradeToVersion").html(
581+
data.newVersion.MAJOR +
582+
"." +
583+
data.newVersion.MINOR +
584+
"." +
585+
data.newVersion.PATCH,
586+
);
581587
$("#systemUpdateMenuItem").removeClass("d-none");
582588
}
583-
}
589+
},
584590
},
585591
refresh: function () {
586592
window.CRM.APIRequest({
587593
method: "GET",
588594
path:
589-
"background/page?token=" + Math.random() + "&name=" +
595+
"background/page?token=" +
596+
Math.random() +
597+
"&name=" +
590598
window.CRM.PageName.replace(window.CRM.root, ""),
591599
suppressErrorDialog: true,
592600
}).done(function (data) {

src/skin/js/Calendar.js

+46-39
Original file line numberDiff line numberDiff line change
@@ -385,43 +385,52 @@ function initializeCalendar() {
385385
window.CRM.isCalendarLoading = false;
386386
// initialize the calendar
387387
// -----------------------------------------------------------------
388-
window.CRM.fullcalendar = new FullCalendar.Calendar(document.getElementById('calendar'), {
389-
headerToolbar: {
390-
start: "prev,next today",
391-
center: "title",
392-
end: "dayGridMonth,timeGridWeek,timeGridDay,listMonth",
393-
},
394-
height: 600,
395-
selectable: true,
396-
editable: window.CRM.calendarJSArgs.isModifiable,
397-
eventDrop: window.moveEventModal.handleEventDrop,
398-
eventResize: window.moveEventModal.handleEventResize,
399-
selectMirror: true,
400-
select: window.showNewEventForm, // This starts the React app
401-
eventClick: function (info) {
402-
var { event: eventData, jsEvent } = info;
403-
jsEvent.preventDefault(); // don't let the browser navigate
388+
window.CRM.fullcalendar = new FullCalendar.Calendar(
389+
document.getElementById("calendar"),
390+
{
391+
headerToolbar: {
392+
start: "prev,next today",
393+
center: "title",
394+
end: "dayGridMonth,timeGridWeek,timeGridDay,listMonth",
395+
},
396+
height: 600,
397+
selectable: true,
398+
editable: window.CRM.calendarJSArgs.isModifiable,
399+
eventDrop: window.moveEventModal.handleEventDrop,
400+
eventResize: window.moveEventModal.handleEventResize,
401+
selectMirror: true,
402+
select: window.showNewEventForm, // This starts the React app
403+
eventClick: function (info) {
404+
var { event: eventData, jsEvent } = info;
405+
jsEvent.preventDefault(); // don't let the browser navigate
404406

405-
var eventSourceParams = eventData.source.url.split("/");
406-
var eventSourceType = eventSourceParams[eventSourceParams.length - 3];
407-
if (eventData.url) { // this event has a URL, so we should redirect the user to that URL
408-
window.open(eventData.url);
409-
} else if (eventData.editable || (eventData.startEditable || eventData.durationEditable)) {
410-
// this event is "Editable", so we should display the edit form.
411-
//
412-
// NOTE: for some reaons, `editable` field is not in the event so we're estimating
413-
// this value based on `startEditable` and `durationEditable`
414-
window.showEventForm(eventData); // This starts the React app
415-
} else {
416-
// but holidays don't currently have a URL from the backend #4962
417-
alert(i18next.t("Holiday") + ": " + eventData.title);
418-
}
419-
},
420-
locale: window.CRM.lang,
421-
loading: function (isLoading, view) {
422-
window.CRM.isCalendarLoading = isLoading;
407+
var eventSourceParams = eventData.source.url.split("/");
408+
var eventSourceType =
409+
eventSourceParams[eventSourceParams.length - 3];
410+
if (eventData.url) {
411+
// this event has a URL, so we should redirect the user to that URL
412+
window.open(eventData.url);
413+
} else if (
414+
eventData.editable ||
415+
eventData.startEditable ||
416+
eventData.durationEditable
417+
) {
418+
// this event is "Editable", so we should display the edit form.
419+
//
420+
// NOTE: for some reaons, `editable` field is not in the event so we're estimating
421+
// this value based on `startEditable` and `durationEditable`
422+
window.showEventForm(eventData); // This starts the React app
423+
} else {
424+
// but holidays don't currently have a URL from the backend #4962
425+
alert(i18next.t("Holiday") + ": " + eventData.title);
426+
}
427+
},
428+
locale: window.CRM.lang,
429+
loading: function (isLoading, view) {
430+
window.CRM.isCalendarLoading = isLoading;
431+
},
423432
},
424-
});
433+
);
425434
}
426435

427436
function getCalendarFilterElement(calendar, type, parent) {
@@ -499,9 +508,7 @@ function registerCalendarSelectionEvents() {
499508
return element.url === eventSourceURL;
500509
});
501510
if (!alreadyPresent) {
502-
window.CRM.fullcalendar.addEventSource(
503-
eventSourceURL,
504-
);
511+
window.CRM.fullcalendar.addEventSource(eventSourceURL);
505512
}
506513
} else {
507514
var eventSource = window.CRM.fullcalendar
@@ -640,7 +647,7 @@ function displayAccessTokenAPITest() {
640647
}
641648
}
642649

643-
document.addEventListener('DOMContentLoaded', function() {
650+
document.addEventListener("DOMContentLoaded", function () {
644651
//window.CRM.calendarJSArgs.isModifiable = false;
645652
initializeCalendar();
646653
initializeFilterSettings();

src/skin/js/DepositSlipEditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function initPaymentTable() {
1111
depositSlipID +
1212
"&GroupKey=" +
1313
full.GroupKey +
14-
'\'><i class="fa ' +
14+
"'><i class=\"fa " +
1515
(isDepositClosed ? "fa-search-plus" : "fa-pencil") +
1616
'"></i></a>' +
1717
familyName

src/skin/js/FamilyRegister.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ $(document).ready(function () {
143143
}).done(function (data) {
144144
let familyCountry = $("#familyCountry");
145145
$.each(data, function (idx, country) {
146-
let selected = familyCountry.data("system-default") === country.name;
146+
let selected =
147+
familyCountry.data("system-default") === country.name;
147148
familyCountry.append(
148149
new Option(country.name, country.code, selected, selected),
149150
);

src/skin/js/FindDepositSlip.js

+41-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var dataT = 0;
22

3-
document.addEventListener("DOMContentLoaded", function() {
3+
document.addEventListener("DOMContentLoaded", function () {
44
function updateSelectedCount() {
55
var selectedRows = dataT.rows(".selected").data().length;
66
$("#deleteSelectedRows").prop("disabled", !selectedRows);
@@ -10,53 +10,69 @@ document.addEventListener("DOMContentLoaded", function() {
1010
$("#exportSelectedRows").prop("disabled", !selectedRows);
1111
$("#exportSelectedRows").html(
1212
'<i class="fa fa-download"></i> Export (' +
13-
selectedRows +
14-
") Selected Rows (OFX)",
13+
selectedRows +
14+
") Selected Rows (OFX)",
1515
);
1616
$("#exportSelectedRowsCSV").prop("disabled", !selectedRows);
1717
$("#exportSelectedRowsCSV").html(
1818
'<i class="fa fa-download"></i> Export (' +
19-
selectedRows +
20-
") Selected Rows (CSV)",
19+
selectedRows +
20+
") Selected Rows (CSV)",
2121
);
2222
$("#generateDepositSlip").prop("disabled", !selectedRows);
2323
$("#generateDepositSlip").html(
2424
'<i class="fa fa-download"></i> Generate Deposit Split for Selected (' +
25-
selectedRows +
26-
") Rows (PDF)",
25+
selectedRows +
26+
") Rows (PDF)",
2727
);
2828
}
2929

30-
$('#deleteSelectedRows').click(function () {
31-
var deletedRows = dataT.rows('.selected').data()
30+
$("#deleteSelectedRows").click(function () {
31+
var deletedRows = dataT.rows(".selected").data();
3232
bootbox.confirm({
3333
title: i18next.t("Confirm Delete"),
34-
message: '<p>' + i18next.t("Are you sure you want to delete the selected") + ' ' + deletedRows.length + ' ' + i18next.t("Deposit(s)") + '?</p>' +
35-
'<p>' + i18next.t("This will also delete all payments associated with this deposit") + '</p>' +
36-
'<p>' + i18next.t("This action CANNOT be undone, and may have legal implications!") + '</p>' +
37-
'<p>' + i18next.t("Please ensure this what you want to do.") + '</p>',
34+
message:
35+
"<p>" +
36+
i18next.t("Are you sure you want to delete the selected") +
37+
" " +
38+
deletedRows.length +
39+
" " +
40+
i18next.t("Deposit(s)") +
41+
"?</p>" +
42+
"<p>" +
43+
i18next.t(
44+
"This will also delete all payments associated with this deposit",
45+
) +
46+
"</p>" +
47+
"<p>" +
48+
i18next.t(
49+
"This action CANNOT be undone, and may have legal implications!",
50+
) +
51+
"</p>" +
52+
"<p>" +
53+
i18next.t("Please ensure this what you want to do.") +
54+
"</p>",
3855
buttons: {
39-
cancel : {
40-
label: i18next.t("Close")
56+
cancel: {
57+
label: i18next.t("Close"),
4158
},
4259
confirm: {
43-
label: i18next.t("Delete")
44-
}
60+
label: i18next.t("Delete"),
61+
},
4562
},
4663
callback: function (result) {
4764
if (result) {
4865
$.each(deletedRows, function (index, value) {
4966
window.CRM.APIRequest({
50-
method: 'DELETE',
51-
path: 'deposits/' + value.Id
52-
})
53-
.done(function (data) {
54-
dataT.rows('.selected').remove().draw(false);
55-
updateSelectedCount();
56-
});
67+
method: "DELETE",
68+
path: "deposits/" + value.Id,
69+
}).done(function (data) {
70+
dataT.rows(".selected").remove().draw(false);
71+
updateSelectedCount();
72+
});
5773
});
5874
}
59-
}
75+
},
6076
});
6177
});
6278

0 commit comments

Comments
 (0)