diff --git a/app/Http/Controllers/CustomAuthController.php b/app/Http/Controllers/CustomAuthController.php index 24bd01b..7310717 100755 --- a/app/Http/Controllers/CustomAuthController.php +++ b/app/Http/Controllers/CustomAuthController.php @@ -78,23 +78,23 @@ class CustomAuthController extends Controller $post['captcha'] = $this->captchaCheck(); $validator = Validator::make( - $post, - [ - 'username' => 'unique:user_logins', - 'email' => 'unique:user_logins', - 'g-recaptcha-response' => 'required', - 'captcha' => 'required|min:1' - ], - [ - 'g-recaptcha-response.required' => 'Captcha is required', - 'captcha.min' => 'Wrong captcha, please try again.' - ] - // $post, // [ // 'username' => 'unique:user_logins', // 'email' => 'unique:user_logins', + // 'g-recaptcha-response' => 'required', + // 'captcha' => 'required|min:1' + // ], + // [ + // 'g-recaptcha-response.required' => 'Captcha is required', + // 'captcha.min' => 'Wrong captcha, please try again.' // ] + + $post, + [ + 'username' => 'unique:user_logins', + 'email' => 'unique:user_logins', + ] ); @@ -123,20 +123,36 @@ class CustomAuthController extends Controller )); } + // var_dump($post); + $user = User::create([ - 'name' => $post['name'], - 'username' => $post['username'], + 'name' => $post['firstname'] . ' ' . $post['lastname'], + 'username' => $post['email'], 'email' => $post['email'], 'password' => bcrypt($post['password']), 'role' => 'user' ]); - $country = explode("_", $post['country']); + // $country = explode("_", $post['country']); + + // $data = array( + // 'UserId' => $user->id, + // 'CountryCode' => $country[0], + // 'Country' => $country[1] + // ); $data = array( 'UserId' => $user->id, - 'CountryCode' => $country[0], - 'Country' => $country[1] + 'Fullname' => $post['firstname'] . ' ' . $post['lastname'], + 'ContactNumber' => $post['mobilenumber'], + // 'OtherNotes' => $post['othernotes'], + 'Address' => $post['address'], + 'Address2' => $post['address2'], + 'State' => $post['state'], + 'City' => $post['city'], + 'ZipCode' => $post['zipcode'], + 'CountryCode' => $post['countryCode'], + 'Country' => $post['country'] ); $userModel->insertAddressBook($data); Auth::attempt(['email' => $post['email'], 'password' => $post['password']]); diff --git a/app/Http/Controllers/paypal/PaypalController.php b/app/Http/Controllers/paypal/PaypalController.php index 62bed6d..dc9b64f 100755 --- a/app/Http/Controllers/paypal/PaypalController.php +++ b/app/Http/Controllers/paypal/PaypalController.php @@ -201,6 +201,7 @@ class PaypalController extends Controller $shipping = PayPal::ShippingAddress(); $shipping->setRecipientName($array_address_book[0]->Fullname); $shipping->setLine1($array_address_book[0]->Address); + $shipping->setLine2($array_address_book[0]->Address2); $shipping->setCity($array_address_book[0]->City); $shipping->setCountryCode($array_address_book[0]->CountryCode); $shipping->setPostalCode($array_address_book[0]->ZipCode); diff --git a/app/Http/Controllers/user/UserController.php b/app/Http/Controllers/user/UserController.php index 2e9e2d8..6f92af8 100755 --- a/app/Http/Controllers/user/UserController.php +++ b/app/Http/Controllers/user/UserController.php @@ -79,6 +79,7 @@ class UserController extends Controller { 'ContactNumber' => $post['mobilenumber'], 'OtherNotes' => $post['othernotes'], 'Address' => $post['address'], + 'Address2' => $post['address2'], 'State' => $post['state'], 'City' => $post['city'], 'ZipCode' => $post['zipcode'], @@ -118,6 +119,7 @@ class UserController extends Controller { 'ContactNumber' => $post['mobilenumber'], 'OtherNotes' => $post['othernotes'], 'Address' => $post['address'], + 'Address2' => $post['address2'], 'State' => $post['state'], 'City' => $post['city'], 'ZipCode' => $post['zipcode'], diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 8877d0f..88fa98c 100755 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -1,82 +1,131 @@ @extends('merchbay_main') @section('main-content') -
-
-
-
-
-

Register

-
-
-
-
-
-
-
- - -
- - -
+
+
+
+
+
+

Register

+
+
+
+
+
+
+ + + -
+
+ Personal Information +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ + -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
-
-
- - -
-
- Have already an account? - Login here -
-
+
+ Address Information
+ +
+ + +
+ +
+ + + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+
+
+ + +
+
+ Have already an account? + Login here
-@endsection +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/merchbay/cart.blade.php b/resources/views/merchbay/cart.blade.php index 9b81aa0..c1437b5 100755 --- a/resources/views/merchbay/cart.blade.php +++ b/resources/views/merchbay/cart.blade.php @@ -1,432 +1,403 @@ @extends('merchbay_main') @section('main-content') - - +
+
+
-
-
-
- - {{-- breadcrumbs --}} -
-
-
- -
+ {{-- breadcrumbs --}} +
+
+
+
+
-
-
-

Shopping Cart

- @if (Session::has('cartkeyError')) - {{--
+
+
+

Shopping Cart

+ @if (Session::has('cartkeyError')) + {{--

Error:

{!! Session::get('cartkeyError') !!}
--}} - - @endif + + @endif +
+
+ + @if (count($row) > 0) +
+
+
+
+ {{ $store_array[0]->StoreName }} +
+
+ @foreach ($item_group as $item) + @if ($item->VoucherId == null) +
+
+
+
+ @foreach ($img_thumb as $img) + @if ($img->ProductId == $item->ProductId) + + @endif + @endforeach +
+
+
+

+ {{ $item->ProductName }} +

+

Total Price: + {{ $item->total_price . ' ' . $store_array[0]->StoreCurrency }} + • Row(s): {{ $item->qty }} +

+
+ + + @if ($item->FormUsed == 'jersey-and-shorts-form') + + + + + + + + + + @elseif($item->FormUsed=="tshirt-form") + + + + + + + + @elseif($item->FormUsed=="quantity-form") + + + + + + + + @elseif($item->FormUsed=="name-number-form") + + + + + + + + + @elseif($item->FormUsed=="name-number-size-form") + + + + + + + + + + @elseif($item->FormUsed=="number-form") + + + + + + + @elseif($item->FormUsed=="name-name2-size-form") + + + + + + + + + @elseif($item->FormUsed=="name-size-form") + + + + + + + + @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") + + + + + + + + @elseif($item->FormUsed=="number-jersey-shorts-form") + + + + + + + + + @else + + @endif + + @foreach ($row as $sub_item) + @if ($sub_item->ProductId == $item->ProductId) + + @if ($item->FormUsed == 'jersey-and-shorts-form') + + + + + + + + + + @elseif($item->FormUsed=="tshirt-form") + + + + + + + @elseif($item->FormUsed=="quantity-form") + + + + + + @elseif($item->FormUsed=="name-number-form") + + + + + + + + @elseif($item->FormUsed=="name-number-size-form") + + + + + + + + + @elseif($item->FormUsed=="number-form") + + + + + + + @elseif($item->FormUsed=="name-name2-size-form") + + + + + + + + + @elseif($item->FormUsed=="name-size-form") + + + + + + + + @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") + + + + + + + + @elseif($item->FormUsed=="number-jersey-shorts-form") + + + + + + + + + @else + + @endif + + @endif + @endforeach +
NameNumberJersey SizeShorts SizePriceQuantity
SizePriceQuantity
PriceQuantity
NameNumberPriceQuantity
NameNumberSizePriceQuantity
NumberPriceQuantity
Gamer TagNameSizePriceQuantity
NameSizePriceQuantity
Jersey SizeShorts SizePriceQuantity
NumberJersey SizeShorts SizePriceQuantity
@if ($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif {{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Name2 }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} + {{ $sub_item->Quantity }}
+
+
+
+
+ @endif + @endforeach
- @if (count($row) > 0) -
-
-
-
- {{ $store_array[0]->StoreName }}
-
- @foreach ($item_group as $item) - @if ($item->VoucherId == null) -
-
-
-
- @foreach ($img_thumb as $img) - @if ($img->ProductId == $item->ProductId) - - @endif - @endforeach -
-
-
-

- {{ $item->ProductName }} -

-

Total Price: - {{ $item->total_price . ' ' . $store_array[0]->StoreCurrency }} - • Row(s): {{ $item->qty }}

-
- - - @if ($item->FormUsed == 'jersey-and-shorts-form') - - - - - - - - - - @elseif($item->FormUsed=="tshirt-form") - - - - - - - - @elseif($item->FormUsed=="quantity-form") - - - - - - - - @elseif($item->FormUsed=="name-number-form") - - - - - - - - - @elseif($item->FormUsed=="name-number-size-form") - - - - - - - - - - @elseif($item->FormUsed=="number-form") - - - - - - - @elseif($item->FormUsed=="name-name2-size-form") - - - - - - - - - @elseif($item->FormUsed=="name-size-form") - - - - - - - - @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") - - - - - - - - @elseif($item->FormUsed=="number-jersey-shorts-form") - - - - - - - - - @else - - @endif - - @foreach ($row as $sub_item) - @if ($sub_item->ProductId == $item->ProductId) - - @if ($item->FormUsed == 'jersey-and-shorts-form') - - - - - - - - - - @elseif($item->FormUsed=="tshirt-form") - - - - - - - @elseif($item->FormUsed=="quantity-form") - - - - - - @elseif($item->FormUsed=="name-number-form") - - - - - - - - @elseif($item->FormUsed=="name-number-size-form") - - - - - - - - - @elseif($item->FormUsed=="number-form") - - - - - - - @elseif($item->FormUsed=="name-name2-size-form") - - - - - - - - - @elseif($item->FormUsed=="name-size-form") - - - - - - - - @elseif($item->FormUsed=="jersey-and-shorts-quantity-form") - - - - - - - - @elseif($item->FormUsed=="number-jersey-shorts-form") - - - - - - - - - @else - - @endif - - @endif - @endforeach -
NameNumberJersey SizeShorts SizePriceQuantity
SizePriceQuantity
PriceQuantity
NameNumberPriceQuantity
NameNumberSizePriceQuantity
NumberPriceQuantity
Gamer TagNameSizePriceQuantity
NameSizePriceQuantity
Jersey SizeShorts SizePriceQuantity
NumberJersey SizeShorts SizePriceQuantity
@if ($sub_item->Name != '') {{ $sub_item->Name }} @else -- @endif {{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Number }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Name2 }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Name }}{{ $sub_item->Size }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
{{ $sub_item->Number }}{{ $sub_item->JerseySize }}{{ $sub_item->ShortsSize }}{{ $sub_item->Price . ' ' . $store_array[0]->StoreCurrency }} - {{ $sub_item->Quantity }}
-
-
-
-
- @endif - @endforeach +
+
+ @if (Session::has('msg')) +
+ +

Warning:

+ {!! Session::get('msg') !!}
+ @endif +

Order Summary

+
+ @if (!Auth::guest()) -
-
- @if (Session::has('msg')) -
- -

Warning:

- {!! Session::get('msg') !!} -
+
+ +

Ship to:

+ + @if ($address_book === null) + [ Add ] + @else +
{{ $address_book[0]->Fullname }}
+
{{ $address_book[0]->ContactNumber }}
+
+ {{ $address_book[0]->Address . ' ' . $address_book[0]->Address2 . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }} + [ Edit ] +
+ @endif + +
+ @endif +
+
Subtotal: + {{ number_format($tax['order_grandtotal'], 2) . ' ' . $store_array[0]->StoreCurrency }} +
+
Shipping Fee: + {{ number_format($shipping_fee, 2) . ' ' . $store_array[0]->StoreCurrency }} +
+
Tax: + {{ number_format($tax['tax'], 2) . ' ' . $store_array[0]->StoreCurrency }} +
+
+

Total: {{ number_format($tax['order_grandtotal'] + $shipping_fee + $tax['tax'], 2) }} + {{ $store_array[0]->StoreCurrency }} +

+ + {{-- {{ var_dump($tax) }} + {{ var_dump($shipping_fee) }} --}} +
+
+ @foreach ($row as $item) + @if ($item->VoucherId != null) +
+ @if ($item->VoucherType == 'Percentage') + + @else + @endif -

Order Summary

-
- @if (!Auth::guest()) - -
- -

Ship to:

- - @if ($address_book === null) - [ Add ] - @else -
{{ $address_book[0]->Fullname }}
-
{{ $address_book[0]->ContactNumber }}
-
- {{ $address_book[0]->Address . ', ' . $address_book[0]->State . ', ' . $address_book[0]->City . ', ' . $address_book[0]->Country . ', ' . $address_book[0]->CountryCode . ' ' . $address_book[0]->ZipCode }} - [ Edit ] -
- @endif - +
@endif -
-
Subtotal: - {{ number_format($tax['order_grandtotal'], 2) . ' ' . $store_array[0]->StoreCurrency }} -
-
Shipping Fee: - {{ number_format($shipping_fee, 2) . ' ' . $store_array[0]->StoreCurrency }} -
-
Tax: - {{ number_format($tax['tax'], 2) . ' ' . $store_array[0]->StoreCurrency }} -
-
-

Total: {{ number_format($tax['order_grandtotal'] + $shipping_fee + $tax['tax'], 2) }} - {{ $store_array[0]->StoreCurrency }} -

+ @endforeach - {{-- {{ var_dump($tax) }} - {{ var_dump($shipping_fee) }} --}} -
-
- @foreach ($row as $item) - @if ($item->VoucherId != null) -
- @if ($item->VoucherType == 'Percentage') - - @else - - @endif - -
- @endif - @endforeach - -
-
-
- - - - -
- -
-
+
+
+
+ + + +
+ +
+
+
-
- Checkout
- -
- Be advised payments made on merchbay will show up as crewsportswear on your receipt -
-
- - - +
+ Payments made on Merchbay will show up as Crewsportswear on your order confirmations and receipt.
-
- @else -
-
-

Your cart is currently empty.

+
+ Store payments are processed through PayPal. A PayPal account is not required to make a purchase. If you do not have a PayPal account click on “Pay with Debit or Credit Card” on the PayPal check out page
- @endif + + + +
+ @else +
+
+

Your cart is currently empty.

+
+
+ @endif +
+
-@endsection +@endsection \ No newline at end of file diff --git a/resources/views/merchbay_main.blade.php b/resources/views/merchbay_main.blade.php index fadd72e..8cb6f18 100755 --- a/resources/views/merchbay_main.blade.php +++ b/resources/views/merchbay_main.blade.php @@ -115,12 +115,15 @@ $("#frm-register").validate({ rules: { - name: { + firstname: { required: true }, - username: { + lastname: { required: true }, + // username: { + // required: true + // }, email: { required: true, email: true @@ -128,6 +131,24 @@ password: { required: true //minlength: 6 // <-- removed underscore + }, + mobilenumber: { + required: true + }, + address: { + required: true + }, + state: { + required: true + }, + city: { + required: true + }, + zipcode: { + required: true + }, + countryCode: { + required: true } }, messages: {}, @@ -182,6 +203,148 @@ }); // end document ready + + function getSelectedCountry() { + var selectedState = $('#select_country').data('selected'); + if (selectedState) { + // console.log(selectedState) + $("#select_country").val(selectedState).change(); + // selectCountry() + } + + } + + function selectCountry(item) { + + const country = item.options[item.selectedIndex].text; + const countryCode = item.options[item.selectedIndex].value + console.log(countryCode) + + if (countryCode === "US") { + fetchUSA() + } + + if (countryCode === "CA") { + fetchCanada() + } + + } + + function fetchCanada() { + $.getJSON("{{ asset('/public/api/canada.json') }}", function(items) { + var states = []; + + Object.keys(items).forEach(function(state) { + states.push(state) + }); + + var uniqueStates = Array.from(new Set(states)); + var selectedState = $('#lst-states').data('selected'); + + $('.dynamic-state').remove(); + $('.dynamic-city').remove(); + uniqueStates.sort().forEach(function(key) { + if (selectedState == key) { + $('#lst-states').append(''); + + var cities = []; + cities = items[selectedState]; + var uniqueCities = Array.from(new Set(cities)); + var selectedCity = $('#lst-cities').data('selected'); + $('.dynamic-city').remove(); + uniqueCities.sort().forEach(function(key) { + if (selectedCity == key) { + $('#lst-cities').append(''); + } else { + $('#lst-cities').append(''); + } + }); + + } else { + $('#lst-states').append(''); + } + }); + + + $(document).on('select change', '#lst-states', function() { + var cities = []; + var selectedState = $(this).val() + cities = items[selectedState]; + var uniqueCities = Array.from(new Set(cities)); + $('.dynamic-city').remove(); + uniqueCities.sort().forEach(function(key) { + $('#lst-cities').append(''); + }); + }); + }); + } + + function fetchUSA() { + $.getJSON("{{ asset('/public/api/usaCities.json') }}", function(data) { + var states = []; + + for (i = 0; i < data.length; i++) { + states.push(data[i]['state']); + } + var uniqueStates = Array.from(new Set(states)); + var selectedState = $('#lst-states').data('selected'); + $('.dynamic-state').remove(); + $('.dynamic-city').remove(); + uniqueStates.sort().forEach(function(key) { + if (selectedState == key) { + $('#lst-states').append(''); + // + var cities = []; + for (i = 0; i < data.length; i++) { + console.log(data[i]) + cities.push(data[i]); + } + var city = getCities(cities, key); + var uniqueCities = Array.from(new Set(city)); + var selectedCity = $('#lst-cities').data('selected'); + $('.dynamic-city').remove(); + uniqueCities.sort().forEach(function(key) { + if (selectedCity == key) { + $('#lst-cities').append(''); + } else { + $('#lst-cities').append(''); + } + }); + + } else { + $('#lst-states').append(''); + } + }); + + + + $(document).on('select change', '#lst-states', function() { + var cities = []; + for (i = 0; i < data.length; i++) { + cities.push(data[i]); + } + var city = getCities(cities, $(this).val()); + var uniqueCities = Array.from(new Set(city)); + $('.dynamic-city').remove(); + uniqueCities.sort().forEach(function(key) { + + $('#lst-cities').append(''); + }); + }); + + }); + } + + function getCities(arr, q) { + var sd = []; + arr.find(function(element) { + if (element['state'] == q) { + sd.push(element['city']); + } + }); + return sd; + } + function submitLoginForm() { // method="POST" action="{{ url('/auth/login') }}" var data = $("#frm-login").serialize(); @@ -218,7 +381,13 @@ } /* login submit */ function submitRegisterForm() { - var data = $("#frm-register").serialize(); + + var data = $("#frm-register").serializeArray(); + data.push({ + name: "country", + value: $("#select_country option:selected").text() + }); + // var data = $("#frm-register").serialize(); $.ajax({ type: 'POST', diff --git a/resources/views/user-layouts/address_book.blade.php b/resources/views/user-layouts/address_book.blade.php index 3f98646..3d6957c 100755 --- a/resources/views/user-layouts/address_book.blade.php +++ b/resources/views/user-layouts/address_book.blade.php @@ -40,7 +40,7 @@ @foreach($array_address_book as $row) {{ $row->Fullname }} - {{ $row->Address }}, {{ $row->State }}, {{ $row->City }}, {{ $row->Country}} {{ $row->CountryCode}}, {{ $row->ZipCode }} + {{ $row->Address . ' ' . $row->Address2 }}, {{ $row->State }}, {{ $row->City }}, {{ $row->Country}} {{ $row->CountryCode}}, {{ $row->ZipCode }} {{ $row->ContactNumber }} Edit diff --git a/resources/views/user-layouts/create_address_book.blade.php b/resources/views/user-layouts/create_address_book.blade.php index 4cd4126..a27f9fa 100755 --- a/resources/views/user-layouts/create_address_book.blade.php +++ b/resources/views/user-layouts/create_address_book.blade.php @@ -66,8 +66,12 @@
- - + + +
+
+ +
diff --git a/resources/views/user-layouts/edit_address_book.blade.php b/resources/views/user-layouts/edit_address_book.blade.php index 6262e4a..8075802 100755 --- a/resources/views/user-layouts/edit_address_book.blade.php +++ b/resources/views/user-layouts/edit_address_book.blade.php @@ -66,8 +66,13 @@
- - + + +
+ +
+ +