import DataUtils, {
    REQUEST_TYPE_GET,
    REQUEST_TYPE_PUT,
    REQUEST_TYPE_POST,
    REQUEST_TYPE_DELETE,
    CONTENT_TYPE_JSON,
    CONTENT_TYPE_FORM
} from '../tools/utilities/DataUtils.jsx';
import * as DataEvent from '../tools/events/DataEvent.jsx';
import ProjectFolio from '../tasks/ProjectFolio.jsx';
import Animate from '../tools/effects/Animate.jsx';
import * as Ease from '../tools/effects/Animate.jsx';
class DisplayAdminFolio {
    //--------------------------
    // constructor
    //--------------------------
    constructor() {
        var self = this;
        this.uploadFiles;
        this.start();
    }
    //--------------------------
    // methods
    //--------------------------
    start() {
        let self = this;
        new Animate().object({
            targets: document.getElementById('loader'),
            duration: 300,
            opacity: 0,
            easing: 'easeInOutQuad',
            complete: function () {
                document.getElementById('loader').style.display = 'none';
                document.getElementById('loader').style.visibility = 'hidden';
                if (document.getElementById('project-list')) {
                    sortable('.project-list', {
                        handle: '.drag-handle'
                    })[0].addEventListener('sortupdate', function (e) {
                        let sortList = [];
                        let sortItems = document.getElementById('project-list').children;
                        for (var i = 0; i < sortItems.length; i++) {
                            sortList.push({
                                'sortIndex': i,
                                'sortID': sortItems[i].getAttribute('data-id')
                            });
                        }
                        new DataUtils().request('/api/folio/sort', DataEvent.PROJECTS_SORTED, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, sortList)
                            .then((response) => {
                                console.log(JSON.parse(response.request))
                            }).catch((err) => {
                                console.log(err)
                            })
                    });
                }
                new Animate().object({
                    targets: document.getElementById('header'),
                    duration: 10,
                    opacity: 1,
                    easing: 'easeInOutQuad',
                    complete: function () {}
                });
            }
        });
        
    }
    //--------------------------
    // event handlers
    //--------------------------
    
}
DisplayAdminFolio.uploadFiles = [];
export {
    DisplayAdminFolio as
    default
}
