import ngModule from '../module';
import Section from 'salix/components/section';

export default class Controller extends Section {
    preview(order) {
        this.selectedOrder = order;
        this.$.summary.show();
    }

    compareDate(date) {
        let today = Date.vnNew();
        today.setHours(0, 0, 0, 0);

        date = new Date(date);
        date.setHours(0, 0, 0, 0);

        const timeDifference = today - date;
        if (timeDifference == 0) return 'warning';
        if (timeDifference < 0) return 'success';
    }
}

ngModule.vnComponent('vnOrderIndex', {
    template: require('./index.html'),
    controller: Controller
});