Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleTerms.js
index 22eab3e..ad646c4 100644 (file)
@@ -40,11 +40,11 @@ Pman.Dialog.XtupleTerms = {
             collapsible : false,
             title : "Create / Edit Terms",
             xtype : 'LayoutDialog',
-            width : 500,
+            width : 550,
             xns : Roo,
             closable : false,
             resizable : false,
-            height : 550,
+            height : 300,
             buttons : [
                 {
                        '|xns' : 'Roo',
@@ -85,11 +85,12 @@ Pman.Dialog.XtupleTerms = {
                     items : [
                        {
                             '|xns' : 'Roo.form',
-                            url : baseURL + '/Roo/cntct.php',
-                            method : 'POST',
+                            url : baseURL + '/Roo/terms.php',
                             xtype : 'Form',
+                            method : 'POST',
                             style : 'margin:10px;',
                             xns : Roo.form,
+                            labelWidth : 150,
                             listeners : {
                                actioncomplete : function(_self,action)
                                   {
@@ -109,9 +110,9 @@ Pman.Dialog.XtupleTerms = {
                                           _this.dialog.hide();
                                       
                                            if (_this.callback) {
-                                               _this.form.setValues(action.result.data);
                                               _this.callback.call(_this, _this.form.getValues());
                                            }
+                                           
                                            _this.form.reset();
                                            return;
                                       }
@@ -124,293 +125,83 @@ Pman.Dialog.XtupleTerms = {
                             items : [
                                {
                                     '|xns' : 'Roo.form',
-                                    xtype : 'FieldSet',
-                                    legend : "Details",
-                                    style : 'width:420px',
+                                    fieldLabel : 'Code',
+                                    xtype : 'TextField',
+                                    allowBlank : false,
+                                    width : 300,
                                     xns : Roo.form,
-                                    items : [
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'First Name',
-                                            xtype : 'TextField',
-                                            allowBlank : false,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_first_name'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Last Name',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_last_name'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Phone',
-                                            xtype : 'TextField',
-                                            regex : /^[0-9 +-]+$/,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_phone'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Alt',
-                                            xtype : 'TextField',
-                                            regex : /^[0-9 +-]+$/,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_phone2'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            allowBlank : false,
-                                            fieldLabel : 'Email',
-                                            vtype : 'email',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_email'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Password',
-                                            xtype : 'TextField',
-                                            inputType : 'password',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'password'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Confirm PW',
-                                            xtype : 'TextField',
-                                            inputType : 'password',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'password2'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            checked : true,
-                                            fieldLabel : 'Active',
-                                            xtype : 'Checkbox',
-                                            valueOff : 0,
-                                            xns : Roo.form,
-                                            inputValue : true,
-                                            name : 'cntct_active'
-                                        }
-                                    ]
-
+                                    name : 'terms_code'
                                 },
                                {
                                     '|xns' : 'Roo.form',
-                                    legend : "Address",
-                                    style : 'width:420px',
-                                    xtype : 'FieldSet',
+                                    fieldLabel : 'Description',
+                                    width : 300,
+                                    xtype : 'TextArea',
                                     xns : Roo.form,
-                                    items : [
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Line 1',
-                                            xtype : 'TextField',
-                                            allowBlank : false,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_line1'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Line 2',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_line2'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Line 3',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_line3'
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/addr.php',
-                                                    method : 'GET',
-                                                    xtype : 'HttpProxy',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'addr_state',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    fields : [ "addr_state"],
-                                                    xns : Roo.data,
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'addr_state' },
-                                                xns : Roo.data,
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              
-                                                             // o.params.state_country_id_country_name = _this.form.findField('addr_country').getValue();
-                                                              //if (!o.params.state_country_id_country_name.length) {
-                                                              //    Roo.MessageBox.alert("Select Country First");
-                                                          //        return false;
-                                                            //  }
-                                                            
-                                                             o.params._distinct = 'addr_state';
-                                                             o.params._columns = 'addr_state';
-                                                             o.params.limit = 999;
-                                                              // set more here
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'State',
-                                            selectOnFocus : true,
-                                            displayField : 'addr_state',
-                                            emptyText : "State",
-                                            hiddenName : 'cntct_addr_id_addr_state',
-                                            minChars : 2,
-                                            valueField : 'addr_state',
-                                            xtype : 'ComboBox',
-                                            allowBlank : true,
-                                            typeAhead : true,
-                                            editable : true,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_state',
-                                            qtip : "Select State",
-                                            queryParam : 'query[addr_state]',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{addr_state}</b> </div>',
-                                            loadingText : "Searching...",
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'City',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_city'
-                                        },
-                                       {
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'Zip code',
-                                            xtype : 'TextField',
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_postalcode'
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Roo/country.php',
-                                                    method : 'GET',
-                                                    xtype : 'HttpProxy',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    id : 'country_id',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    fields : [{"name":"country_id","type":"int"},"county_name"],
-                                                    xns : Roo.data,
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                remoteSort : true,
-                                                sortInfo : { direction : 'ASC', field: 'country_name' },
-                                                xns : Roo.data,
-                                                listeners : {
-                                                       beforeload : function (_self, o){
-                                                              o.params = o.params || {};
-                                                              // set more here
-                                                              o.params.limit = 999;
-                                                          }
-                                                },
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'Country',
-                                            selectOnFocus : true,
-                                            displayField : 'country_name',
-                                            emptyText : "Country",
-                                            hiddenName : 'cntct_addr_id_addr_country',
-                                            minChars : 2,
-                                            valueField : 'country_name',
-                                            xtype : 'ComboBox',
-                                            allowBlank : true,
-                                            typeAhead : true,
-                                            editable : true,
-                                            width : 300,
-                                            xns : Roo.form,
-                                            name : 'cntct_addr_id_addr_country',
-                                            qtip : "Select Country",
-                                            queryParam : 'query[country_name]',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{country_name}</b> </div>',
-                                            loadingText : "Searching...",
-                                            items : [
-
-                                            ]
-
-                                        }
-                                    ]
-
+                                    name : 'terms_descrip'
                                 },
                                {
                                     '|xns' : 'Roo.form',
-                                    xtype : 'Hidden',
-                                    value : "AGENT",
+                                    allowBlank : false,
+                                    fieldLabel : 'Due Days',
+                                    allowDecimals : true,
+                                    xtype : 'NumberField',
+                                    decimalPrecision : 0,
+                                    width : 300,
                                     xns : Roo.form,
-                                    name : 'cntct_registrar_type'
+                                    value : 0,
+                                    name : 'terms_duedays',
+                                    minValue : 0
                                 },
                                {
                                     '|xns' : 'Roo.form',
-                                    xtype : 'Hidden',
+                                    fieldLabel : 'Discount Day',
+                                    allowDecimals : true,
+                                    xtype : 'NumberField',
+                                    decimalPrecision : 0,
+                                    width : 300,
                                     xns : Roo.form,
-                                    name : 'customer_id'
+                                    value : 0,
+                                    name : 'terms_discdays',
+                                    minValue : 0
                                 },
                                {
                                     '|xns' : 'Roo.form',
-                                    xtype : 'Hidden',
+                                    fieldLabel : 'Cut Off Day',
+                                    xtype : 'NumberField',
+                                    allowDecimals : true,
+                                    decimalPrecision : 0,
+                                    width : 300,
+                                    xns : Roo.form,
+                                    value : 0,
+                                    name : 'terms_cutoffday',
+                                    minValue : 0
+                                },
+                               {
+                                    '|xns' : 'Roo.form',
+                                    checked : true,
+                                    fieldLabel : 'Used in Payables',
+                                    xtype : 'Checkbox',
+                                    valueOff : 0,
+                                    xns : Roo.form,
+                                    inputValue : true,
+                                    name : 'terms_ap'
+                                },
+                               {
+                                    '|xns' : 'Roo.form',
+                                    checked : true,
+                                    fieldLabel : 'Used in Receivables',
+                                    xtype : 'Checkbox',
+                                    valueOff : 0,
                                     xns : Roo.form,
-                                    name : 'cntct_addr_id'
+                                    inputValue : true,
+                                    name : 'terms_ar'
                                 },
                                {
                                     '|xns' : 'Roo.form',
                                     xtype : 'Hidden',
                                     xns : Roo.form,
-                                    name : 'cntct_id'
+                                    name : 'terms_id'
                                 }
                             ]