text changes to registration mail content
[namibia] / public / js / app / brochure-workspace / register.js
index 31cc8e3..b7f2d5d 100644 (file)
@@ -38,7 +38,7 @@
              //     {"value":"Turnover > R3,000,000", "label":"Turnover > R3,000,000"}
              //     ]);
                        App.DataStore.loadSelectListData('permissions', true, 'User', 'Permissions.SelectList');
-                       //App.DataStore.loadSelectListData('countries', true, 'Location', 'Country.SelectList');
+                       App.DataStore.loadSelectListData('countries', true, 'Location', 'Country.SelectList');
                        //App.DataStore.loadSelectListData('groups', true, 'Company', 'Group.SelectList');
                        //App.DataStore.loadSelectListData('foundmethods', true, 'Company', 'FoundMethod.SelectList');
 
                                        value : '',
                                        maxlength : 100
                                },
-                               'permissions' : {
-                                       type        : 'select',
-                                       id          : 'permissions',
-                                       title       : 'User type',
-                                       value       : '12',
-                                       dataStoreId : 'permissions',
-                                       disabled    :true
-                               },
+                               //'permissions' : {
+                               //      type        : 'select',
+                               //      id          : 'permissions',
+                               //      title       : 'User type',
+                               //      value       : '12',
+                               //      dataStoreId : 'permissions',
+                               //      readonly    :true
+                               //},
                                'email' : {
                                        type  : 'input',
                                        id    : 'email',
                                        value : '',
                                        maxlength : 5
                                },
-                               'idNumber' : {
-                                       type  : 'input',
-                                       id    : 'idNumber',
-                                       title : 'ID Number',
-                                       value : '',
-                                       maxlength : 13,
-                                       onChange  : function() {
-                                               var dig = $(this).val().substring(0, 6);
-                                               $('#dateOfBirth').val(
-                                                               '19' + dig.substring(0, 2) +
-                                                               '-' + dig.substring(2, 4) +
-                                                               '-' + dig.substring(4, 6)
-                                                               );
-                                       }
-                               },
-                               'dateOfBirth' : {
-                                       type  : 'date',
-                                       id    : 'dateOfBirth',
-                                       title : 'Date of birth',
-                                       style : 'datepicker',
-                                       value : ''
-                               },
+                               //'idNumber' : {
+                               //      type  : 'input',
+                               //      id    : 'idNumber',
+                               //      title : 'ID Number',
+                               //      value : '',
+                               //      maxlength : 20,
+                               //      onChange  : function() {
+                               //              var dig = $(this).val().substring(0, 6);
+                               //              $('#dateOfBirth').val(
+                               //                              '19' + dig.substring(0, 2) +
+                               //                              '-' + dig.substring(2, 4) +
+                               //                              '-' + dig.substring(4, 6)
+                               //                              );
+                               //      }
+                               //},
+                               //'dateOfBirth' : {
+                               //      type  : 'date',
+                               //      id    : 'dateOfBirth',
+                               //      title : 'Date of birth',
+                               //      style : 'datepicker',
+                               //      value : ''
+                               //},
                                'mobile' : {
                                        type  : 'mobile',
                                        id    : 'mobile',
                 //
                 //
                                //// Adresses and billing contact
-                               //'country' : {
-                               //      type        : 'select',
-                               //      id          : 'country',
-                               //      title       : 'Country',
-                               //      dataStoreId : 'countries',
-                               //      value       : '',
-                               //      onChange    : function () {
-                               //              if (!App.DataStore.getItem('BuildSelect:country', false))
-                               //              {
-                               //                      App.DataStore.loadSelectListData(
-                               //                                      'regions', false, 'Location', 'Region.SelectList', null,
-                               //                                      {"Filter": {
-                               //                                              "country" : $(this).val()
-                               //                                              }}
-                               //                                      );
-                               //                      App.DataStore.setData('cities', []);
-                               //                      if ($('#sameAsBusinessAddress').prop('checked'))
-                               //                      {
-                               //                              $('#billingCountry').selectpicker('val', $('#country').val());
-                               //                      }
-                               //              }
-                               //      }
-                               //},
-                               //'region' : {
-                               //      type        : 'select',
-                               //      id          : 'region',
-                               //      title       : 'Region',
-                               //      dataStoreId : 'regions',
-                               //      value       : '',
-                               //      onChange    : function () {
-                               //              if (!App.DataStore.getItem('BuildSelect:region', false))
-                               //              {
-                               //                      App.DataStore.loadSelectListData(
-                               //                                      'cities', false, 'Location', 'Town.SelectList', null,
-                               //                                      {"Filter": {
-                               //                                              "region" : $(this).val()
-                               //                                              }}
-                               //                                      );
-                               //                      if ($('#sameAsBusinessAddress').prop('checked'))
-                               //                      {
-                               //                              $('#billingRegion').selectpicker('val', $('#region').val());
-                               //                      }
-                               //              }
-                               //      }
-                               //},
-                               //'city' : {
-                               //      type        : 'select',
-                               //      id          : 'city',
-                               //      title       : 'Town',
-                               //      dataStoreId : 'cities',
-                               //      value       : ''
-                               //},
-                               //'street' : {
-                               //      type  : 'input',
-                               //      id    : 'street',
-                               //      title : 'Street',
-                               //      value : '',
-                               //      maxlength : 75
-                               //},
-                               //'postalCode' : {
-                               //      type  : 'input',
-                               //      id    : 'postalCode',
-                               //      title : 'Code',
-                               //      value : '',
-                               //      maxlength : 10
-                               //},
+                               'country' : {
+                                       type        : 'select',
+                                       id          : 'country',
+                                       title       : 'Country',
+                                       dataStoreId : 'countries',
+                                       value       : '',
+                                       onChange    : function () {
+                                               if (!App.DataStore.getItem('BuildSelect:country', false))
+                                               {
+                                                       App.DataStore.loadSelectListData(
+                                                                       'regions', false, 'Location', 'Region.SelectList', null,
+                                                                       {"Filter": {
+                                                                               "country" : $(this).val()
+                                                                               }}
+                                                                       );
+                                                       App.DataStore.setData('cities', []);
+                                                       if ($('#sameAsBusinessAddress').prop('checked'))
+                                                       {
+                                                               $('#billingCountry').selectpicker('val', $('#country').val());
+                                                       }
+                                               }
+                                       }
+                               },
+                               'region' : {
+                                       type        : 'select',
+                                       id          : 'region',
+                                       title       : 'Region',
+                                       dataStoreId : 'regions',
+                                       value       : '',
+                                       onChange    : function () {
+                                               if (!App.DataStore.getItem('BuildSelect:region', false))
+                                               {
+                                                       App.DataStore.loadSelectListData(
+                                                                       'cities', false, 'Location', 'Town.SelectList', null,
+                                                                       {"Filter": {
+                                                                               "region" : $(this).val()
+                                                                               }}
+                                                                       );
+                                                       if ($('#sameAsBusinessAddress').prop('checked'))
+                                                       {
+                                                               $('#billingRegion').selectpicker('val', $('#region').val());
+                                                       }
+                                               }
+                                       }
+                               },
+                               'city' : {
+                                       type        : 'select',
+                                       id          : 'city',
+                                       title       : 'Town',
+                                       dataStoreId : 'cities',
+                                       value       : ''
+                               },
+                               'street' : {
+                                       type  : 'input',
+                                       id    : 'street',
+                                       title : 'Street',
+                                       value : '',
+                                       maxlength : 75
+                               },
+                               'postalCode' : {
+                                       type  : 'input',
+                                       id    : 'postalCode',
+                                       title : 'Code',
+                                       value : '',
+                                       maxlength : 10
+                               },
                                //'sameAsBusinessAddress' : {
                                //      type  : 'checkbox',
                                //      id    : 'sameAsBusinessAddress',
                                        confirmEmail: {required: true, email: true, equalTo: "#email"},
                                        pin: {required: true, digits: true},
                                        confirmPin: {required: true, digits: true, equalTo: "#pin"},
-                                       idNumber: {required: true, minlength: 13, maxlength: 13, digits: true},
-                                       dateOfBirth: {required: true, dateISO: true},
+                                       //idNumber: {required: true, minlength: 13, maxlength: 13, digits: true},
+                                       //idNumber: {required: true, minlength: 3, maxlength: 20, digits: true},
+                                       //dateOfBirth: {required: true, dateISO: true},
                                        mobile: {required: true, mobile: true},
 
                                        //contactFirstName: {required: true},
                                        //companyRegistrationNumber: {companyReg: true},
                                        //vatNumber: {digits: true},
 
-                                       //country: {required: true},
-                                       //region: {required: true},
-                                       //city: {required: true},
-                                       //street: {required: true},
-                                       //postalCode: {required: true, digits: true},
+                                       country: {required: true},
+                                       region: {required: true},
+                                       city: {required: true},
+                                       street: {required: true},
+                                       postalCode: {required: true, digits: true},
                                        //billingCountry: {required: true},
                                        //billingRegion: {required: true},
                                        //billingCity: {required: true},
                                        clientType : "This field is required."
                                },
                                submitHandler: function( form ) {
-                                       if (0 == _w.register.ownerCount) {
-                                               $('#ownerFirstName').addClass('error');
-                                               $('#ownerFamilyName').addClass('error');
-                                               $('#ownerIdNumber').addClass('error');
-                                           alert('At least 1 owner / director required.');
-                                           return false;
-                                   } else {
+                    //if (0 == _w.register.ownerCount) {
+                                               //$('#ownerFirstName').addClass('error');
+                                               //$('#ownerFamilyName').addClass('error');
+                                               //$('#ownerIdNumber').addClass('error');
+                                        //   alert('At least 1 owner / director required.');
+                                        //   return false;
+                                   //} else {
                                                $('#ownerFirstName').removeClass('error');
                                                $('#ownerFamilyName').removeClass('error');
                                                $('#ownerIdNumber').removeClass('error');
-                                   }
+                                   //}
                                        $('#btnUpdate').prop('disabled', true);
                                        var data = _w.register._prepRegisterUpdateData();
                                        App.API.execTask(
                  "pin","confirmPin","idNumber","dateOfBirth","mobile", "subscribeNewsletter"
                  ];
                        var companyFields = [
-                 "dealerType","clientType","group","groupDivision","companyType",
-                 "businessName","name","companyRegistrationNumber","vatNumber","turmiNumber",
-                 "dealerStockNumber","turnover","foundMethod","foundMethodDetail",
+                 //"dealerType","clientType","group","groupDivision","companyType",
+                 //"businessName","name","companyRegistrationNumber","vatNumber","turmiNumber",
+                 //"dealerStockNumber","turnover","foundMethod","foundMethodDetail",
                  "country","region","city","street","postalCode",
-                 "billingCountry","billingRegion","billingCity","billingStreet","billingPostalCode",
-                 "docStockCertificate","docAddressProof","docCopyOfId",
-                 "docCopyOfDirectorId","docCompanyRegistration"
+                 //"billingCountry","billingRegion","billingCity","billingStreet","billingPostalCode",
+                 //"docStockCertificate","docAddressProof","docCopyOfId",
+                 //"docCopyOfDirectorId","docCompanyRegistration"
                  ];
                        var contactFields = {
                  "contactFirstName"  : "firstName",
                                {
                                        postData.Company[field] = '' != data[field] ? data[field] : null;
                                }
-                               else if (-1 != profileFields.indexOf(field))
+                               else
+                               if (-1 != profileFields.indexOf(field))
                                {
                                        postData.Profile[field] = '' != data[field] ? data[field] : null;
                                }
-                               else if (contactFields[field])
-                               {
-                                       postData.Contact[contactFields[field]] = '' != data[field] ? data[field] : null;
-                               }
-                               else if (billingContactFields[field])
-                               {
-                                       postData.BillingContact[billingContactFields[field]] = '' != data[field] ? data[field] : null;
-                               }
+                               //else if (contactFields[field])
+                               //{
+                               //      postData.Contact[contactFields[field]] = '' != data[field] ? data[field] : null;
+                               //}
+                               //else if (billingContactFields[field])
+                               //{
+                               //      postData.BillingContact[billingContactFields[field]] = '' != data[field] ? data[field] : null;
+                               //}
                        }
                        postData.Profile.password = postData.Profile.pin;
                        postData.Company.owners = _w.register.owners;