66 lines
2.0 KiB
JavaScript
66 lines
2.0 KiB
JavaScript
/*******************************************************************
|
|
|
|
PHP Class : /Controller/System/ProfileController
|
|
Description : Profile Pengguna
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : December 7th, 2008.
|
|
Last Modified : August 29th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
var SYSProfileJS = {
|
|
PHP: '',
|
|
KODE: '',
|
|
|
|
index: function(){
|
|
$('#butSave').click(() => this.save_profile());
|
|
$('#win'+this.KODE).find('#FileGambar').off('change').change(() => {
|
|
var fd = new FormData(), files = $('#FileGambar')[0].files[0];
|
|
fd.append('Gambar1', files);
|
|
$.ajax({
|
|
url: this.PHP + '/upload_picture',
|
|
type: 'post',
|
|
data: fd,
|
|
contentType: false,
|
|
processData: false,
|
|
success: (ares) => {
|
|
if (ares.result !== 0){
|
|
FoniaJS.showInfo('Sukses upload gambar profile !');
|
|
this.get_picture();
|
|
} else {
|
|
FoniaJS.showError(ares.message);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.get_picture();
|
|
},
|
|
|
|
save_profile: function(){
|
|
new Request({
|
|
url: this.PHP + '/save_profile',
|
|
sendParam: ['Nama','Posisi','Email','HP'],
|
|
onSuccess: (ajson) => {
|
|
if (ajson.status == true) {
|
|
FoniaJS.showInfo('Sukses simpan profile!');
|
|
FoniaJS.closeWindow('#win'+this.KODE);
|
|
} else {
|
|
FoniaJS.showError('Ada masalah dalam simpan profile!');
|
|
}
|
|
}
|
|
}).send();
|
|
},
|
|
|
|
get_picture: function(){
|
|
new Request({
|
|
url: this.PHP + '/get_picture',
|
|
onSuccess: (ajson) => {
|
|
$('#imgPhoto').attr('src', ajson.src);
|
|
}
|
|
}).send();
|
|
}
|
|
|
|
};
|