|
|
@ -1,10 +1,12 @@
|
|
|
|
import FipamoApi from '../libraries/FipamoAPI';
|
|
|
|
import FipamoApi from '../libraries/FipamoAPI';
|
|
|
|
|
|
|
|
import FipamoAdminAPI from '../libraries/FipamoAdminAPI';
|
|
|
|
import DataUitls from './utils/DataUtils';
|
|
|
|
import DataUitls from './utils/DataUtils';
|
|
|
|
import * as DataEvent from './events/DataEvent';
|
|
|
|
import * as DataEvent from './events/DataEvent';
|
|
|
|
import DashManager from './controllers/DashManager';
|
|
|
|
import DashManager from './controllers/DashManager';
|
|
|
|
import Notfications from './ui/Notifications';
|
|
|
|
import Notfications from './ui/Notifications';
|
|
|
|
|
|
|
|
|
|
|
|
const api = new FipamoApi();
|
|
|
|
const api = new FipamoApi();
|
|
|
|
|
|
|
|
const admin = new FipamoAdminAPI();
|
|
|
|
const data = new DataUitls();
|
|
|
|
const data = new DataUitls();
|
|
|
|
const notify = new Notfications();
|
|
|
|
const notify = new Notfications();
|
|
|
|
|
|
|
|
|
|
|
@ -21,6 +23,10 @@ export default class Base {
|
|
|
|
//--------------------------
|
|
|
|
//--------------------------
|
|
|
|
start() {
|
|
|
|
start() {
|
|
|
|
if (document.getElementById('dash-form') || document.getElementById('dash-init')) {
|
|
|
|
if (document.getElementById('dash-form') || document.getElementById('dash-init')) {
|
|
|
|
|
|
|
|
var options = document.getElementsByClassName('init-option');
|
|
|
|
|
|
|
|
for (let index = 0; index < options.length; index++) {
|
|
|
|
|
|
|
|
options[index].addEventListener('click', e => this.handleOptions(e));
|
|
|
|
|
|
|
|
}
|
|
|
|
if (document.getElementById('dash-form')) {
|
|
|
|
if (document.getElementById('dash-form')) {
|
|
|
|
document
|
|
|
|
document
|
|
|
|
.getElementById('login-btn')
|
|
|
|
.getElementById('login-btn')
|
|
|
@ -29,6 +35,9 @@ export default class Base {
|
|
|
|
document
|
|
|
|
document
|
|
|
|
.getElementById('init-blog')
|
|
|
|
.getElementById('init-blog')
|
|
|
|
.addEventListener('click', e => this.handleSetup(e));
|
|
|
|
.addEventListener('click', e => this.handleSetup(e));
|
|
|
|
|
|
|
|
document
|
|
|
|
|
|
|
|
.getElementById('blog-restore')
|
|
|
|
|
|
|
|
.addEventListener('click', e => this.handleRestore(e));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
new DashManager();
|
|
|
|
new DashManager();
|
|
|
@ -76,4 +85,43 @@ export default class Base {
|
|
|
|
notify.alert(err, false);
|
|
|
|
notify.alert(err, false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
handleRestore(e) {
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
var form = document.getElementById('init-restore');
|
|
|
|
|
|
|
|
admin
|
|
|
|
|
|
|
|
.handleInitRestore(form)
|
|
|
|
|
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
if (response.type === DataEvent.REQUEST_LAME) {
|
|
|
|
|
|
|
|
notify.alert(response.message, false);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
notify.alert(response.message, true);
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
//window.location = '/@/dashboard';
|
|
|
|
|
|
|
|
}, 700);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(err => {
|
|
|
|
|
|
|
|
notify.alert(err, false);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
handleOptions(e) {
|
|
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
let init = document.getElementById('dash-init');
|
|
|
|
|
|
|
|
let restore = document.getElementById('dash-restore');
|
|
|
|
|
|
|
|
if (e.target.id === 'init-switch-restore') {
|
|
|
|
|
|
|
|
init.style.display = 'none';
|
|
|
|
|
|
|
|
init.style.visibility = 'hidden';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
restore.style.display = 'block';
|
|
|
|
|
|
|
|
restore.style.visibility = 'visible';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
init.style.display = 'block';
|
|
|
|
|
|
|
|
init.style.visibility = 'visible';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
restore.style.display = 'none';
|
|
|
|
|
|
|
|
restore.style.visibility = 'hidden';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|