Ext.define('TradePortal.store.processComplete', {
    extend: 'Ext.data.Store',
    model: 'TradePortal.model.processComplete',
    storeId: 'processComplete',
    proxy: {
        type: 'jsonajax',
        url: BASE_URL + '/fluid/FluidAppServerProxy?ipApi=presenter&ipService=Frameworks.Interfaces.Mobile.TradePortal&ipFunction=processComplete',
        extraParams: {
            tpaID: 'tportal'
        }
    },
    listeners: {
        load: {
            fn: function (store, records, options) {
                if (!records[0].data.errorTable) {
                    Ext.getCmp('siteContact').up('form').getForm().reset();
                    Ext.Msg.alert('Message', 'Your transaction has now been saved. For future reference your transaction number is #' + records[0].data.quoteNumber, Ext.emptyFn);
                    Ext.getStore('createCart').load({
                        params: {
                            deviceID: Ext.getStore('Config').data.last().data.device_id,
                            customerID: Ext.getStore('HomeStatistic').data.items[0].data.id_cust
                        }
                    });
                } else {
                    Ext.Msg.alert('Alert', 'Error', Ext.emptyFn);
                }

                Ext.getCmp('viewport').setLoading(false);
            }
        }
    }

});
