UPDATE to Registration process to include location details and create dealership
authorMark <mark@nirph.com>
Wed, 22 Feb 2017 12:49:52 +0000 (14:49 +0200)
committerMark <mark@nirph.com>
Wed, 22 Feb 2017 12:49:52 +0000 (14:49 +0200)
module/Company/src/Company/Entity/Company.php
module/User/src/User/DataBin/Registration.php
module/User/src/User/Service/Registration.php
public/js/app/brochure-workspace/register.js
public/templates/page/register.html
public/templates/page/register.js

index 7048e81..fa043a7 100644 (file)
@@ -67,13 +67,13 @@ class Company
 
        /**
         * @ORM\ManyToOne(targetEntity="\Location\Entity\Region")
-        * @ORM\JoinColumn(nullable=false, name="lib_region_id")
+        * @ORM\JoinColumn( name="lib_region_id")
         **/
        protected $region;
 
        /**
         * @ORM\ManyToOne(targetEntity="\Location\Entity\Town")
-        * @ORM\JoinColumn(nullable=false, name="lib_town_id")
+        * @ORM\JoinColumn(name="lib_town_id")
         **/
        protected $city;
 
@@ -105,7 +105,7 @@ class Company
 
        /**
         * @ORM\ManyToOne(targetEntity="\Location\Entity\Town")
-        * @ORM\JoinColumn(nullable=false, nullable=true, name="auction_lib_town_id")
+        * @ORM\JoinColumn(nullable=true, name="auction_lib_town_id")
         **/
        protected $auctionCity;
 
@@ -122,12 +122,12 @@ class Company
        /**
         * @ORM\Column(type="string", length=25, name="dealer_type")
         */
-       protected $dealerType = 'Trader';
+       protected $dealerType = 'Dealer';
 
        /**
         * @ORM\Column(type="string", length=25, name="client_type")
         */
-       protected $clientType = 'Seller';
+       protected $clientType = 'Buyer';
 
        /**
         * @ORM\Column(type="string", length=100, nullable=true, name="company_registration_number")
index 8bb7ca6..4cb8aba 100644 (file)
@@ -44,10 +44,10 @@ class Registration extends \Workspace\Service\DataBin
 //                                                     'dealerType'            => 'DealerType',
 //                                                     'name'                  => 'String100',
 //                                                     'businessName'          => 'String100',
-//                                                     'region'                => 'Id',
-//                                                     'city'                  => 'Id',
-//                                                     'postalCode'            => 'String10',
-//                                                     'street'                => 'String75',
+                                                       'region'                => 'Id',
+                                                       'city'                  => 'Id',
+                                                       'postalCode'            => 'String10',
+                                                       'street'                => 'String75',
 //
 //                                                     'billingCity'       => 'Id',
 //                                                     'billingPostalCode' => 'String10',
index 2986a90..5bf1fd8 100644 (file)
@@ -23,13 +23,26 @@ class Registration extends \User\DataBin\Registration
        {
                $contactService = new \Person\Service\Contact();
                $contactService->setWorkflow(new \Person\Workflow());
-//             $companyService = new \Company\Service\Company();
-//             $companyService->setWorkflow(new \Company\Workflow());
+               $companyService = new \Company\Service\Company();
+               $companyService->setWorkflow(new \Company\Workflow());
                $profileService = new \User\Service\Profile();
                $profileService->setWorkflow(new \User\Workflow());
                //\Utility\Debug::errorLog('create contact', $session->Contact);
+
+               $session->Contact['firstName']=$session->Profile['firstName'];
+               $session->Contact['familyName']=$session->Profile['familyName'];
+               $session->Contact['email']=$session->Profile['email'];
+               $session->Contact['mobile']=$session->Profile['mobile'];
+
+
                $contact = $contactService->create($session->Contact);
                $session->Company['contact'] = $contact->id;
+               $session->Company['name']= $session->Profile['firstName'].' '.$session->Profile['familyName'];
+               $session->Company['businessName']= $session->Profile['firstName'].' '.$session->Profile['familyName'];
+               $session->Company['group']= '3';
+               $session->Company['groupDivision']= '3';
+//             $session->Company['region']= '1';
+//             $session->Company['city']= '1';
 //             if (isset($session->BillingContact))
 //             {
 //             //\Utility\Debug::errorLog('create billing contact', $session->BillingContact);
@@ -37,8 +50,8 @@ class Registration extends \User\DataBin\Registration
 //                     $session->Company['contbillingContactact'] = $billingContact->id;
 //             }
                //\Utility\Debug::errorLog('create company', $session->Company);
-//             $company = $companyService->create($session->Company);
-//             $session->Profile['company'] = $company->id;
+               $company = $companyService->create($session->Company);
+               $session->Profile['company'] = $company->id;
 //             if ($session->Profile['permissions'] < 5 || $session->Profile['permissions'] > 8)
 //             {
 //                     $session->Profile['permissions'] = 5;
index 4ab2aa1..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');
 
                 //
                 //
                                //// 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',
                                        //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},
                  "firstName","familyName","permissions","email","confirmEmail",
                  "pin","confirmPin","idNumber","dateOfBirth","mobile", "subscribeNewsletter"
                  ];
-                       //var companyFields = [
-             //    "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"
-             //    ];
+                       var companyFields = [
+                 //"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"
+                 ];
                        var contactFields = {
                  "contactFirstName"  : "firstName",
                  "contactFamilyName" : "familyName",
                        };
                        for (var field in data)
                        {
-                               //if (-1 != companyFields.indexOf(field))
-                               //{
-                               //      postData.Company[field] = '' != data[field] ? data[field] : null;
-                               //}
-                               //else
+                               if (-1 != companyFields.indexOf(field))
+                               {
+                                       postData.Company[field] = '' != data[field] ? data[field] : null;
+                               }
+                               else
                                if (-1 != profileFields.indexOf(field))
                                {
                                        postData.Profile[field] = '' != data[field] ? data[field] : null;
index 5437e1b..254e31f 100644 (file)
@@ -89,7 +89,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                                        </div>
                                        <br>
 
-                                       <!--<div class="customer-details-form span4">-->
+                                       <div class="customer-details-form span4">
                                                <!--<div class="visible-phone mobile-form-headers">-->
                                                        <!--<p>-->
                                                                <!--<span class="btn-content">-->
@@ -154,24 +154,24 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                                                                <!--Billing information-->
                                                        <!--</p>-->
                                                <!--</div>-->
-                                               <!--<p class="hidden-phone form-header"><i class="icon-user icon-white"></i> Billing information</p>-->
-                                               <!--<div class="form-horizontal">-->
+                                               <p class="hidden-phone form-header"><i class="icon-user icon-white"></i> Location information</p>
+                                               <div class="form-horizontal">
                                                    <!--<h5>Business address</h5>-->
-                                                       <!--<div class="control-group mobile-control-group" id="[tid]_country">-->
-                                                               <!--[country]-->
-                                                   <!--</div>-->
-                                                       <!--<div class="control-group mobile-control-group" id="[tid]_region">-->
-                                                               <!--[region]-->
-                                                   <!--</div>-->
-                                                       <!--<div class="control-group mobile-control-group" id="[tid]_city">-->
-                                                               <!--[city]-->
-                                                   <!--</div>-->
-                                                       <!--<div class="control-group mobile-control-group" id="[tid]_street">-->
-                                                               <!--[street]-->
-                                                   <!--</div>-->
-                                                       <!--<div class="control-group mobile-control-group" id="[tid]_postalCode">-->
-                                                               <!--[postalCode]-->
-                                                   <!--</div>-->
+                                                       <div class="control-group mobile-control-group" id="[tid]_country">
+                                                               [country]
+                                                   </div>
+                                                       <div class="control-group mobile-control-group" id="[tid]_region">
+                                                               [region]
+                                                   </div>
+                                                       <div class="control-group mobile-control-group" id="[tid]_city">
+                                                               [city]
+                                                   </div>
+                                                       <div class="control-group mobile-control-group" id="[tid]_street">
+                                                               [street]
+                                                   </div>
+                                                       <div class="control-group mobile-control-group" id="[tid]_postalCode">
+                                                               [postalCode]
+                                                   </div>
                                                    <!--<hr/>-->
                                                    <!--<h5>Billing address</h5>-->
                                                        <!--<div class="control-group mobile-control-group" id="[tid]_sameAsBusinessAddress">-->
@@ -213,8 +213,8 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                                                                <!--[billingEmail]-->
                                                    <!--</div>-->
                                                <!--</div>-->
-                                       <!--</div>-->
-                               <!--</div>-->
+                                       </div>
+                               </div>
 
 
                                <!--<div class="row-fluid page-top-forms-wrapper">-->
@@ -273,7 +273,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                                                    <!--</div>-->
                                                <!--</div>-->
                                        <!--</div>-->
-                               <!--</div>-->
+                               </div>
 
 
                                <div class="row-fluid page-top-forms-wrapper ">
index 47483de..f796f26 100644 (file)
@@ -34,11 +34,11 @@ var template_register = function( static )
                        //foundMethod : new App.TemplateElement.FieldComponent('foundMethod'),
                        //foundMethodDetail : new App.TemplateElement.FieldComponent('foundMethodDetail'),
 
-                       //country : new App.TemplateElement.FieldComponent('country'),
-                       //region : new App.TemplateElement.FieldComponent('region'),
-                       //city : new App.TemplateElement.FieldComponent('city'),
-                       //street : new App.TemplateElement.FieldComponent('street'),
-                       //postalCode : new App.TemplateElement.FieldComponent('postalCode'),
+                       country : new App.TemplateElement.FieldComponent('country'),
+                       region : new App.TemplateElement.FieldComponent('region'),
+                       city : new App.TemplateElement.FieldComponent('city'),
+                       street : new App.TemplateElement.FieldComponent('street'),
+                       postalCode : new App.TemplateElement.FieldComponent('postalCode'),
                        //sameAsBusinessAddress : new App.TemplateElement.FieldComponent('sameAsBusinessAddress'),
                        //billingCountry : new App.TemplateElement.FieldComponent('billingCountry'),
                        //billingRegion : new App.TemplateElement.FieldComponent('billingRegion'),