StatusCombo = {
    STATUS_IGNORE: -2, // Cancelled
    STATUS_CANCELLED: -1, // Cancelled
    STATUS_ON_HAND: 0, // On Hand
    STATUS_COMPLETED: 1, // Completed
    convertToString: function(value) {
        switch (parseInt(value)) {
            case this.STATUS_CANCELLED:
                return App.localeRes("Cancelled");
            case this.STATUS_ON_HAND:
                return App.localeRes("On Hand");
            case this.STATUS_COMPLETED:
                return App.localeRes("Completed");
            case this.STATUS_IGNORE:
                return App.localeRes("Ignored");
        }
        return;
    }
};

WorkshopStatusCombo = {
    WS_STATUS_PENDING: 0, // Pending
    WS_STATUS_COMPLETED: 1, // Completed
    convertToString: function(value) {
        switch (parseInt(value)) {
            case this.WS_STATUS_PENDING:
                return App.localeRes("待完成");
            case this.WS_STATUS_COMPLETED:
                return App.localeRes("完成");
        }
        return;
    }
};

StockInOutStatusCombo = {
    StockInOutStatus_BLANK: null, // Blank
    StockInOutStatus_PENDING: 1, // Pending
    StockInOutStatus_RECEIVED: 2, // Received
    convertToString: function(value) {
        switch (value) {
            case this.StockInOutStatus_BLANK:
                return App.localeRes("-- Blank --");
            case this.StockInOutStatus_PENDING:
                return App.localeRes("Pending");
            case this.StockInOutStatus_RECEIVED:
                return App.localeRes("Received");
        }
        return;
    }
};



//Service Log Status Combo
Ext.define("App.view.OrderStatusCombo", {
    extend: "Ext.form.field.ComboBox",
    alias: "widget.orderStatusCombo",

    fieldLabel: App.localeRes("Status"),
    name: "status",
    displayField: "name",
    valueField: "value",
    editable: true,
    tpl: '<tpl for="."><div class="x-boundlist-item">{name}</div></tpl>',

    initComponent: function() {
        var me = this;

        if (!me.store)
            me.store = Ext.create("Ext.data.Store", {
                fields: ["value", "name"],
                data: [
                    {
                        value: StatusCombo.STATUS_ON_HAND,
                        name: StatusCombo.convertToString(StatusCombo.STATUS_ON_HAND)
                    },
                    {
                        value: StatusCombo.STATUS_COMPLETED,
                        name: StatusCombo.convertToString(StatusCombo.STATUS_COMPLETED)
                    },
                    {
                        value: StatusCombo.STATUS_CANCELLED,
                        name: StatusCombo.convertToString(StatusCombo.STATUS_CANCELLED)
                    },
                    {
                        value: StatusCombo.STATUS_IGNORE,
                        name: StatusCombo.convertToString(StatusCombo.STATUS_IGNORE)
                    },
                ]
            });

        me.callParent();
    }
});

//Service Log Status Combo
Ext.define("App.view.WorkshopStatusCombo", {
    extend: "Ext.form.field.ComboBox",
    alias: "widget.workshopStatusCombo",

    fieldLabel: App.localeRes("Status"),
    name: "status",
    displayField: "name",
    valueField: "value",
    editable: true,
    tpl: '<tpl for="."><div class="x-boundlist-item">{name}</div></tpl>',

    initComponent: function() {
        var me = this;

        if (!me.store)
            me.store = Ext.create("Ext.data.Store", {
                fields: ["value", "name"],
                data: [
                    {
                        value: WorkshopStatusCombo.WS_STATUS_PENDING,
                        name: WorkshopStatusCombo.convertToString(WorkshopStatusCombo.WS_STATUS_PENDING)
                    },
                    {
                        value: WorkshopStatusCombo.WS_STATUS_COMPLETED,
                        name: WorkshopStatusCombo.convertToString(WorkshopStatusCombo.WS_STATUS_COMPLETED)
                    },
                ]
            });

        me.callParent();
    }
});

//Stock In Out Status Combo
Ext.define("App.view.StockInOutStatusCombo", {
    extend: "Ext.form.field.ComboBox",
    alias: "widget.stockInOutStatusCombo",
    name: "status",
    displayField: "name",
    valueField: "value",
    editable: true,
    tpl: '<tpl for="."><div class="x-boundlist-item">{name2}</div></tpl>',

    initComponent: function() {
        var me = this;

        if (!me.store)
            me.store = Ext.create("Ext.data.Store", {
                fields: ["value", "name"],
                data: [
                    {
                        value: StockInOutStatusCombo.StockInOutStatus_BLANK,
                        name: "",
                        name2: StockInOutStatusCombo.convertToString(StockInOutStatusCombo.StockInOutStatus_BLANK)
                    },
                    {
                        value: StockInOutStatusCombo.StockInOutStatus_PENDING,
                        name: StockInOutStatusCombo.convertToString(StockInOutStatusCombo.StockInOutStatus_PENDING),
                        name2: StockInOutStatusCombo.convertToString(StockInOutStatusCombo.StockInOutStatus_PENDING)
                    },
                    {
                        value: StockInOutStatusCombo.StockInOutStatus_RECEIVED,
                        name: StockInOutStatusCombo.convertToString(StockInOutStatusCombo.StockInOutStatus_RECEIVED),
                        name2: StockInOutStatusCombo.convertToString(StockInOutStatusCombo.StockInOutStatus_RECEIVED)
                    },
                ]
            });

        me.callParent();
    }
});

