120 lines
4.3 KiB
JavaScript
120 lines
4.3 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/System/AboutController
|
|
Description : Informasi Aplikasi
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : November 23th, 2011.
|
|
Last Modified : November 2nd, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var AboutJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index() {
|
|
let _html = [];
|
|
if (typeof jQuery !== undefined) _html.push('jQuery v'+$().jquery);
|
|
if (typeof bootstrap !== undefined) _html.push('Bootstrap v'+$.fn.tooltip.Constructor.VERSION);
|
|
if (typeof DataTable !== undefined) _html.push('DataTable v'+DataTable.version);
|
|
if (typeof Chart !== undefined) _html.push('Chart.js v'+Chart.version);
|
|
if (typeof qz !== undefined) _html.push('QZ Connector v'+qz.version);
|
|
if (typeof FoniaJS !== undefined) _html.push('FoniaJS v'+FoniaJS.version);
|
|
$('#win'+this.KODE).find('#divBuildInfo').html(`<p>${_html.join('<i class="bi-nut px-1"></i>')}</p>`);
|
|
|
|
$('#butDBCek').click(() => this.db_check());
|
|
$('#butDBOpti').click(() => this.db_opti());
|
|
$('#butUpdateCek').click(() => this.update_check());
|
|
new Request({
|
|
url: this.PHP + '/composer',
|
|
onSuccess: (ajson) => {
|
|
$('#win'+this.KODE).find('#divComposerInfo').html(ajson.html);
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
db_check() {
|
|
new Request({
|
|
url: this.PHP + '/db_check',
|
|
onSuccess: (ajson) => {
|
|
this.winCheck = FoniaJS.showWindow('CekDB', 'Cek Database', ajson.html, 500, [{},{i:'butTutup'}], () => this.db_run(ajson.db_count));
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
db_opti() {
|
|
new Request({
|
|
url: this.PHP + '/db_check',
|
|
onSuccess: (ajson) => {
|
|
this.winCheck = FoniaJS.showWindow('CekDB', 'Optimalisasi Database', ajson.html, 500, [{},{i:'butTutup'}], () => this.opti_run(ajson.db_count));
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
update_check() {
|
|
new Request({
|
|
url: this.PHP + '/update_check',
|
|
onSuccess: (ajson) => {
|
|
var tomb = [{},{i:'butTutup'},{i:'butWUpdate',v:'Proses Update !',c:'success'}];
|
|
if (ajson.is_update) tomb.pop();
|
|
this.winUpdate = FoniaJS.showWindow('CekApp', 'Cek dan Update Aplikasi', ajson.html, 500, tomb, () => {
|
|
$('#winCekApp').find('#butWUpdate').click(() => this.update_run());
|
|
});
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
db_run(db_count = 0) {
|
|
if (db_count === 0) return false;
|
|
var items = Array(db_count).fill(0).map((_, index) => index);
|
|
var $ul = $('#db-list').empty();
|
|
items.reduce((prev, curr) => {
|
|
return prev.then(() => {
|
|
return $.ajax({
|
|
url: this.PHP + '/db_proses',
|
|
data: {'Nomor': curr},
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
}).done((response) => {
|
|
$ul.append('<li>' + response.html + '</li>');
|
|
});
|
|
});
|
|
}, $.Deferred().resolve().promise());
|
|
},
|
|
|
|
opti_run(db_count = 0) {
|
|
if (db_count === 0) return false;
|
|
var items = Array(db_count).fill(0).map((_, index) => index);
|
|
var $ul = $('#db-list').empty();
|
|
items.reduce((prev, curr) => {
|
|
return prev.then(() => {
|
|
return $.ajax({
|
|
url: this.PHP + '/opti_proses',
|
|
data: {'Nomor': curr},
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
}).done((response) => {
|
|
$ul.append('<li>' + response.html + '</li>');
|
|
});
|
|
});
|
|
}, $.Deferred().resolve().promise());
|
|
},
|
|
|
|
update_run() {
|
|
new Request({
|
|
url: this.PHP + '/update_proses',
|
|
onSuccess: (adata) => {
|
|
if (adata.success==true) {
|
|
$('#spanStatus').html(adata.message);
|
|
FoniaJS.showInfo('Aplikasi telah di Update.<br>Silakan refresh browser Anda!');
|
|
} else {
|
|
FoniaJS.showInfo('Aplikasi gagal di Update.');
|
|
}
|
|
}
|
|
}).send();
|
|
}
|
|
|
|
};
|