PaymentTypeCombo = {
    TYPE_OTHER: 'Other',
    TYPE_AE: 'AE', // AE
    TYPE_CASH: 'Cash', // Cash
    TYPE_CHEQUE: 'Cheque', // Cheque
    TYPE_CHQ: 'Chq', // Chq
    TYPE_CUP: 'Cup', // Cup
    TYPE_MASTER: 'Master', // Master
    TYPE_VISA: 'Visa', // Visa
    TYPE_UNION_PAY: 'Union Pay', //Union Pay
    TYPE_ALIPAY: 'Alipay', //Alipay,
    TYPE_WECHAT_PAY: 'Wechat Pay',
    TYPE_OCTOPUS: 'Octopus',
};

Ext.apply(PaymentTypeCombo, {
    convertToString: function(value) {
        switch (value) {
            case this.TYPE_VISA:
                return App.localeRes("Visa");
            case this.TYPE_MASTER:
                return App.localeRes("Master");
            case this.TYPE_AE:
                return App.localeRes("AE");
            case this.TYPE_CASH:
                return App.localeRes("Cash");
            case this.TYPE_UNION_PAY:
                return App.localeRes("Union Pay");
            case this.TYPE_ALIPAY:
                return App.localeRes("Alipay");
            case this.TYPE_WECHAT_PAY:
                return App.localeRes("Wechat Pay");
            case this.TYPE_OCTOPUS:
                return App.localeRes("Octopus");
            case this.TYPE_CHEQUE:
                return App.localeRes("Cheque");
            case this.TYPE_CHQ:
                return App.localeRes("Chq");
            case this.TYPE_CUP:
                return App.localeRes("Cup");
            default :
                return App.localeRes("Other");
        }
        return;
    }
});

//Payment Type Combo
Ext.define("App.view.PaymentTypeCombo", {
    extend: "Ext.form.field.ComboBox",
    alias: "widget.paymentTypeCombo",

    fieldLabel: App.localeRes("Payment Method"),
    name: "method",
    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: PaymentTypeCombo.TYPE_VISA,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_VISA)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_MASTER,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_MASTER)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_AE,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_AE)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_CASH,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_CASH)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_UNION_PAY,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_UNION_PAY)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_ALIPAY,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_ALIPAY)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_WECHAT_PAY,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_WECHAT_PAY)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_OCTOPUS,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_OCTOPUS)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_CHEQUE,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_CHEQUE)
                    },
                    /*
                    {
                        value: PaymentTypeCombo.TYPE_CHQ,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_CHQ)
                    },
                    {
                        value: PaymentTypeCombo.TYPE_CUP,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_CUP)
                    },
                    */
                    {
                        value: PaymentTypeCombo.TYPE_OTHER,
                        name: PaymentTypeCombo.convertToString(PaymentTypeCombo.TYPE_OTHER)
                    },
                ]
            });

        me.callParent();
    }
});
