SKYCIV.utils


This namespace provides helpful utility methods.


Alerts#

SKYCIV.utils.alert#

Description: Create a notification that requires action.

Operation Type: Asynchronous

Params: SKYCIV.utils.alert(Object)

Object properties:

KeyTypeAcceptsDescription
titlehtml-The title of the notification.
contenthtml-The body of the notification.

Sample:

alert.js
SKYCIV.utils.alert({
title: 'Success โœ…',
content: 'The action has been completed!',
time: 5000,
auto_hide: true,
theme: 'dark',
});


SKYCIV.utils.alert.sideNotify#

Description: Create an alert non-intrusive notification.

Operation Type: Asynchronous

Params: SKYCIV.utils.alert.sideNotify(Object)

Object properties:

KeyTypeAcceptsDescription
titlehtml-The title of the notification.
bodyhtml-The body of the notification.
timeinteger-Defaults to 5000. The time in milliseconds to display the notificiation.
auto_hidebooleantrue, falseIf false, the user will need to dismiss the notification.
themestringlight, darkPreferred settings of the user.

Sample:

sideNotify.js
SKYCIV.utils.alert.sideNotify({
title: 'Success โœ…',
body: 'The action has been completed!',
time: 5000,
auto_hide: true,
theme: 'dark',
});


Reporting#

SKYCIV.utils.report#

Description: Build a PDF with HTML.

Operation Type: Synchronous

Sample:

pdf_report.js
SKYCIV.utils.report.init(false); // If true, you will be presented with a preview.
let html_content = `
<style>
Include any CSS that must be included in the report if addObject is used as below
</style>
<div>
<h1>Report title</h1>
<br/>
<div>Add some content as required.</div>
</div>
`;
SKYCIV.utils.report.addHTML(html_content);
// Add an HTML element from the page - good for S3D apps.
SKYCIV.utils.report.addObject(jQuery('#results-container'));
SKYCIV.utils.report.build(
{
name: 'report_001',
margins: {
top: '10mm',
bottom: '30mm',
left: '20mm',
right: '20mm',
},
orientation: 'portrait', // "landscape"
scale: 1.0,
add_company_info: false,
},
function (html_document_object) {
console.log('The HTML element:', html_document_object);
},
function (results) {
console.log('The results object:', results);
console.log(`Download your report here: ${results.download_link}`);
// Save the report
const link = SKYCIV.utils.report.getLastDownloadLink();
SKYCIV.utils.project_reports.saveReport(link, 'Summary Analysis', true);
}
);
important

To make sure the CSS is included in the report, include it directly in the html_content variable.