From: Mark Date: Wed, 22 Feb 2017 12:49:52 +0000 (+0200) Subject: UPDATE to Registration process to include location details and create dealership X-Git-Url: https://xp-dev.com/git/namibia/commitdiff_plain/da65b17bf1eab0ee9bcbc9b57e07a3465e49bf55 UPDATE to Registration process to include location details and create dealership --- diff --git a/module/Company/src/Company/Entity/Company.php b/module/Company/src/Company/Entity/Company.php index 7048e81..fa043a7 100644 --- a/module/Company/src/Company/Entity/Company.php +++ b/module/Company/src/Company/Entity/Company.php @@ -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") diff --git a/module/User/src/User/DataBin/Registration.php b/module/User/src/User/DataBin/Registration.php index 8bb7ca6..4cb8aba 100644 --- a/module/User/src/User/DataBin/Registration.php +++ b/module/User/src/User/DataBin/Registration.php @@ -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', diff --git a/module/User/src/User/Service/Registration.php b/module/User/src/User/Service/Registration.php index 2986a90..5bf1fd8 100644 --- a/module/User/src/User/Service/Registration.php +++ b/module/User/src/User/Service/Registration.php @@ -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; diff --git a/public/js/app/brochure-workspace/register.js b/public/js/app/brochure-workspace/register.js index 4ab2aa1..b7f2d5d 100644 --- a/public/js/app/brochure-workspace/register.js +++ b/public/js/app/brochure-workspace/register.js @@ -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'); @@ -331,72 +331,72 @@ // // //// 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', @@ -720,11 +720,11 @@ //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}, @@ -793,15 +793,15 @@ "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", @@ -818,11 +818,11 @@ }; 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; diff --git a/public/templates/page/register.html b/public/templates/page/register.html index 5437e1b..254e31f 100644 --- a/public/templates/page/register.html +++ b/public/templates/page/register.html @@ -89,7 +89,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
- +
@@ -154,24 +154,24 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= - - +

Location information

+
- - - - - - - - - - - - - - - +
+ [country] +
+
+ [region] +
+
+ [city] +
+
+ [street] +
+
+ [postalCode] +
@@ -213,8 +213,8 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= - - +
+
@@ -273,7 +273,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= - +
diff --git a/public/templates/page/register.js b/public/templates/page/register.js index 47483de..f796f26 100644 --- a/public/templates/page/register.js +++ b/public/templates/page/register.js @@ -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'),