105 lines
3.8 KiB
JavaScript
105 lines
3.8 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/System/AboutController
|
|
Description : Informasi Aplikasi
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : November 23th, 2011.
|
|
Last Modified : August 13th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var AboutJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(){
|
|
$('#win'+this.KODE).find('#divBuildInfo').html('<p>Aplikasi dibuat dengan komponen :<br>- jQuery Version '+$().jquery+' <br>- Bootstrap Version '+$.fn.tooltip.Constructor.VERSION+' <br>- FoniaJS Version '+FoniaJS.version+' <br>- FoniaPHP Version '+FoniaJS.version+'</p>');
|
|
$('#butDBCek').click(() => this.db_check());
|
|
$('#butDBOpti').click(() => this.db_opti());
|
|
$('#butUpdateCek').click(() => this.update_check());
|
|
},
|
|
|
|
db_check: function(){
|
|
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: function(){
|
|
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: function(){
|
|
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: function(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: function(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: function(){
|
|
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();
|
|
}
|
|
};
|