//---------------------------------------------------------------------------------------------
// This file was AUTO-GENERATED by "SPA Views" Xomega.Net generator.
//
// Manual CHANGES to this file WILL BE LOST when the code is regenerated.
//---------------------------------------------------------------------------------------------

import { CustomerCriteria } from 'DataObjects/Sales/CustomerCriteria';
import { CustomerList } from 'DataObjects/Sales/CustomerList';
import * as router from 'plugins/router';
import { SearchViewModel, ViewParams } from 'xomega';
import * as controls from 'xomega-controls';

class CustomerListView extends SearchViewModel {

    constructor() {
        super();
        this.ListObject = new CustomerList();
        this.ListObject.CriteriaObject = new CustomerCriteria();
    }

    protected getBaseTitle(): string {
        return 'Customer List';
    }

    public attached(view, parent) {
        if (this.Params[ViewParams.Mode] == ViewParams.ModePopup)
            controls.modalViewPopup(this, view);
        else if (this.Params[ViewParams.Mode] == ViewParams.ModeInline)
            controls.vSplitViewPopup(this, view);
    }

    public permalink() {
        router.navigate('#' + router.activeInstruction().fragment + this.getPermalink());
    }
}

export = CustomerListView;
