updated checkout flow
This commit is contained in:
@@ -1,24 +1,29 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Http\Requests;
|
use App\Http\Requests;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use App\Traits\CaptchaTrait;
|
use App\Traits\CaptchaTrait;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Models\user\UserModel;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class CustomAuthController extends Controller {
|
class CustomAuthController extends Controller
|
||||||
|
{
|
||||||
use CaptchaTrait;
|
use CaptchaTrait;
|
||||||
|
|
||||||
public function authenticate(Request $request){
|
public function authenticate(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$post = $request->all();
|
$post = $request->all();
|
||||||
$email = $post['email'];
|
$email = $post['email'];
|
||||||
$password = $post['password'];
|
$password = $post['password'];
|
||||||
|
|
||||||
if (Auth::attempt(['email' => $email, 'password' => $password])){
|
if (Auth::attempt(['email' => $email, 'password' => $password])) {
|
||||||
|
|
||||||
if (Auth::user()->role == 'admin') {
|
if (Auth::user()->role == 'admin') {
|
||||||
$message = '
|
$message = '
|
||||||
@@ -27,8 +32,8 @@ class CustomAuthController extends Controller {
|
|||||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||||
You are not allowed to enter to this site.
|
You are not allowed to enter to this site.
|
||||||
</div>';
|
</div>';
|
||||||
return response()->json(array('success' => false, 'message'=>$message));
|
return response()->json(array('success' => false, 'message' => $message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$message = "success";
|
$message = "success";
|
||||||
@@ -37,11 +42,11 @@ class CustomAuthController extends Controller {
|
|||||||
|
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message'=>$message,
|
'message' => $message,
|
||||||
'navbar'=>$navbar,
|
'navbar' => $navbar,
|
||||||
'save_design_button' => $save_design_button
|
'save_design_button' => $save_design_button
|
||||||
));
|
));
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
$message = '
|
$message = '
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
@@ -50,60 +55,78 @@ class CustomAuthController extends Controller {
|
|||||||
Username or Password is incorrect.
|
Username or Password is incorrect.
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
return response()->json(array('success' => false, 'message'=>$message));
|
return response()->json(array('success' => false, 'message' => $message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postRegister(Request $request){
|
public function postRegister(Request $request)
|
||||||
|
{
|
||||||
$post = $request->all();
|
$post = $request->all();
|
||||||
|
$userModel = new UserModel;
|
||||||
$post['captcha'] = $this->captchaCheck();
|
$post['captcha'] = $this->captchaCheck();
|
||||||
|
|
||||||
$validator = Validator::make($post, [
|
$validator = Validator::make(
|
||||||
'username' => 'unique:user_logins',
|
$post,
|
||||||
'email' => 'unique:user_logins',
|
[
|
||||||
'g-recaptcha-response' => 'required',
|
'username' => 'unique:user_logins',
|
||||||
'captcha' => 'required|min:1'
|
'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.'
|
[
|
||||||
]);
|
'g-recaptcha-response.required' => 'Captcha is required',
|
||||||
|
'captcha.min' => 'Wrong captcha, please try again.'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails()) {
|
||||||
{
|
|
||||||
$errors = "";
|
$errors = "";
|
||||||
foreach($validator->errors()->all() as $error){
|
foreach ($validator->errors()->all() as $error) {
|
||||||
$errors .= "<li>".$error."</li>";
|
$errors .= "<li>" . $error . "</li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = '
|
$message = '
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||||
'.$errors.
|
' . $errors .
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => $message
|
'message' => $message
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
User::create([
|
$user = User::create([
|
||||||
'name' => $post['name'],
|
'name' => $post['firstname'] . ' ' . $post['lastname'],
|
||||||
'username' => $post['username'],
|
'username' => $post['email'],
|
||||||
'email' => $post['email'],
|
'email' => $post['email'],
|
||||||
'password' => bcrypt($post['password']),
|
'password' => bcrypt($post['password']),
|
||||||
'role' => 'user'
|
'role' => 'user'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'UserId' => $user->id,
|
||||||
|
'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']]);
|
Auth::attempt(['email' => $post['email'], 'password' => $post['password']]);
|
||||||
|
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => true
|
'success' => true,
|
||||||
|
'redirect' => $post['redirect']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\paypal;
|
namespace App\Http\Controllers\paypal;
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
// use Paypal;
|
// use Paypal;
|
||||||
use Netshell\Paypal\Facades\Paypal;
|
use Netshell\Paypal\Facades\Paypal;
|
||||||
@@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Session;
|
|||||||
use Illuminate\Support\Facades\Redirect;
|
use Illuminate\Support\Facades\Redirect;
|
||||||
// use Mail;
|
// use Mail;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use PayPal\Exception\PayPalConnectionException;
|
||||||
|
|
||||||
|
|
||||||
class PaypalController extends Controller
|
class PaypalController extends Controller
|
||||||
@@ -28,30 +29,42 @@ class PaypalController extends Controller
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$paypal_env = "live";
|
||||||
|
$paypal_apiUrl = 'https://api.paypal.com'; // default
|
||||||
|
|
||||||
|
if ($paypal_env == 'live') {
|
||||||
|
$paypal_apiUrl = 'https://api.paypal.com';
|
||||||
|
} else {
|
||||||
|
$paypal_apiUrl = 'https://api.sandbox.paypal.com';
|
||||||
|
}
|
||||||
|
|
||||||
$this->_apiContext = PayPal::ApiContext(
|
$this->_apiContext = PayPal::ApiContext(
|
||||||
config('services.paypal.client_id'),
|
config('services.paypal_' . $paypal_env . '.client_id'),
|
||||||
config('services.paypal.secret')
|
config('services.paypal_' . $paypal_env . '.secret')
|
||||||
|
|
||||||
|
// config('services.paypal_live.client_id'),
|
||||||
|
// config('services.paypal_live.secret')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// $this->_apiContext->setConfig(array(
|
|
||||||
// 'mode' => 'sandbox',
|
|
||||||
// 'service.EndPoint' => 'https://api.sandbox.paypal.com',
|
|
||||||
// 'http.ConnectionTimeOut' => 30,
|
|
||||||
// 'log.LogEnabled' => true,
|
|
||||||
// 'log.FileName' => storage_path('logs/paypal.log'),
|
|
||||||
// 'log.LogLevel' => 'FINE'
|
|
||||||
// ));
|
|
||||||
|
|
||||||
// live
|
|
||||||
$this->_apiContext->setConfig(array(
|
$this->_apiContext->setConfig(array(
|
||||||
'mode' => 'live',
|
'mode' => $paypal_env,
|
||||||
'service.EndPoint' => 'https://api.paypal.com',
|
'service.EndPoint' => $paypal_apiUrl,
|
||||||
'http.ConnectionTimeOut' => 30,
|
'http.ConnectionTimeOut' => 30,
|
||||||
'log.LogEnabled' => true,
|
'log.LogEnabled' => true,
|
||||||
'log.FileName' => storage_path('logs/paypal.log'),
|
'log.FileName' => storage_path('logs/paypal.log'),
|
||||||
'log.LogLevel' => 'FINE'
|
'log.LogLevel' => 'FINE'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// live
|
||||||
|
// $this->_apiContext->setConfig(array(
|
||||||
|
// 'mode' => 'sandbox',
|
||||||
|
// 'service.EndPoint' => 'https://api.paypal.com',
|
||||||
|
// 'http.ConnectionTimeOut' => 30,
|
||||||
|
// 'log.LogEnabled' => true,
|
||||||
|
// 'log.FileName' => storage_path('logs/paypal.log'),
|
||||||
|
// 'log.LogLevel' => 'FINE'
|
||||||
|
// ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -63,16 +76,54 @@ class PaypalController extends Controller
|
|||||||
|
|
||||||
public function getCheckout(Request $request)
|
public function getCheckout(Request $request)
|
||||||
{
|
{
|
||||||
|
$UserModel = new UserModel;
|
||||||
|
|
||||||
if (Auth::guest()) {
|
if (Auth::guest()) {
|
||||||
|
|
||||||
$message = 'Please <a href="' . url('auth/login') . '">Sign in</a> to your account to proceed.';
|
$message = 'Please <a href="' . url('auth/login') . '">Sign in</a> to your account to proceed.';
|
||||||
Session::flash('msg', $message);
|
Session::flash('msg', $message);
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);
|
||||||
|
|
||||||
|
if (count($array_address_book) <= 0) {
|
||||||
|
$message = 'Please complete your shipping address. <a href="user/address-book/create"> <strong> <u>click here</u> </strong></a>.';
|
||||||
|
Session::flash('cartkeyError', $message);
|
||||||
|
return Redirect::back();
|
||||||
|
}
|
||||||
|
|
||||||
|
$shipping_address_url = "user/address-book/edit/" . $array_address_book[0]->Id;
|
||||||
|
|
||||||
|
if (
|
||||||
|
count($array_address_book) <= 0 ||
|
||||||
|
$array_address_book[0]->Fullname == null ||
|
||||||
|
$array_address_book[0]->ContactNumber == null ||
|
||||||
|
$array_address_book[0]->Address == null ||
|
||||||
|
$array_address_book[0]->State == null ||
|
||||||
|
$array_address_book[0]->City == null ||
|
||||||
|
$array_address_book[0]->ZipCode == null
|
||||||
|
|
||||||
|
) {
|
||||||
|
$message = 'Please complete your shipping address. <a href="' . url($shipping_address_url) . '"> <strong> <u>click here</u> </strong></a>.';
|
||||||
|
Session::flash('cartkeyError', $message);
|
||||||
|
return Redirect::back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// $shippingAddress = [
|
||||||
|
// "recipient_name" => $array_address_book[0]->Fullname,
|
||||||
|
// "line1" => $array_address_book[0]->Address,
|
||||||
|
// "line2" => "",
|
||||||
|
// "city" => $array_address_book[0]->City,
|
||||||
|
// "country_code" => $array_address_book[0]->CountryCode,
|
||||||
|
// "postal_code" => $array_address_book[0]->ZipCode,
|
||||||
|
// "state" => $array_address_book[0]->State,
|
||||||
|
// "phone" => $array_address_book[0]->ContactNumber
|
||||||
|
// ];
|
||||||
|
|
||||||
|
|
||||||
// $request->session()->forget('cartkey');
|
// $request->session()->forget('cartkey');
|
||||||
if(!$request->session()->has('cartkey')){
|
if (!$request->session()->has('cartkey')) {
|
||||||
$message = 'Your cart is empty';
|
$message = 'Your cart is empty';
|
||||||
Session::flash('cartkeyError', $message);
|
Session::flash('cartkeyError', $message);
|
||||||
return Redirect::back();
|
return Redirect::back();
|
||||||
@@ -81,81 +132,56 @@ class PaypalController extends Controller
|
|||||||
$payer = PayPal::Payer();
|
$payer = PayPal::Payer();
|
||||||
$payer->setPaymentMethod('paypal');
|
$payer->setPaymentMethod('paypal');
|
||||||
|
|
||||||
|
// $inputFields = Paypal::InputFields();
|
||||||
|
// $inputFields->setAllowNote(true)
|
||||||
|
// ->setNoShipping(1)
|
||||||
|
// ->setAddressOverride(0);
|
||||||
|
// $webProfile = Paypal::WebProfile();
|
||||||
|
// $webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
|
||||||
|
// // ->setPresentation($presentation)
|
||||||
|
// ->setInputFields($inputFields);
|
||||||
|
|
||||||
|
// $shipping = PayPal::ShippingAddress();
|
||||||
|
// $shipping->setRecipientName($array_address_book[0]->Fullname);
|
||||||
|
// $shipping->setLine1($array_address_book[0]->Address);
|
||||||
|
// $shipping->setCity($array_address_book[0]->City);
|
||||||
|
// $shipping->setCountryCode($array_address_book[0]->CountryCode);
|
||||||
|
// $shipping->setPostalCode($array_address_book[0]->ZipCode);
|
||||||
|
// $shipping->setState($array_address_book[0]->State);
|
||||||
|
// $shipping->setPhone($array_address_book[0]->ContactNumber);
|
||||||
|
|
||||||
|
// $payerInfo = Paypal::PayerInfo();
|
||||||
|
// $payerInfo->setShippingAddress($shipping);
|
||||||
|
// $payer->setPayerInfo($payerInfo);
|
||||||
|
|
||||||
$m = new TeamStoreModel;
|
$m = new TeamStoreModel;
|
||||||
$paypal_model = new PayPalModel;
|
$paypal_model = new PayPalModel;
|
||||||
$last_id = $paypal_model->getLastIdPaymentDetails();
|
$last_id = $paypal_model->getLastIdPaymentDetails();
|
||||||
$invoice_num = str_pad($last_id[0]->Id, 4, '0', STR_PAD_LEFT);
|
// var_dump(count($last_id));
|
||||||
|
if (count($last_id) > 0) {
|
||||||
|
$lastId = $last_id[0]->Id + 1;
|
||||||
|
} else {
|
||||||
|
$lastId = 1;
|
||||||
|
}
|
||||||
|
$invoice_num = str_pad($lastId, 6, '0', STR_PAD_LEFT);
|
||||||
|
// var_dump($invoice_num);
|
||||||
$cartKey = $request->session()->get('cartkey');
|
$cartKey = $request->session()->get('cartkey');
|
||||||
|
|
||||||
$items = $m->myCart($cartKey);
|
$items = $m->myCart($cartKey);
|
||||||
|
|
||||||
$getSubtotal = $m->getSubtotal($cartKey);
|
$getSubtotal = $m->getSubtotal($cartKey);
|
||||||
|
|
||||||
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
||||||
$store_array = $m->selectTeamStore('Id', $grouped_item[0]->StoreId);
|
$store_array = $m->selectTeamStore('Id', $grouped_item[0]->StoreId);
|
||||||
|
|
||||||
$getSmallItemQty = 0;
|
|
||||||
$getBulkyItemQty = 0;
|
|
||||||
$getMaskItemQty = 0;
|
|
||||||
$getDGSItemQty = 0;
|
|
||||||
$shippingFee = 0;
|
|
||||||
|
|
||||||
|
$shippingFee = $this->getShippingFee($cartKey);
|
||||||
|
|
||||||
foreach ($items as $item) {
|
$tax = $this->getTax($cartKey)['tax'];
|
||||||
if ($item->VoucherId != null) {
|
$order_grandtotal = $this->getTax($cartKey)['order_grandtotal'];
|
||||||
$voucherIds[] = $item->VoucherId;
|
|
||||||
$voucher = $m->selectVoucherWhereIn($voucherIds);
|
|
||||||
$item_id = $item->Id;
|
|
||||||
$totalValue = $voucher[0]->VoucherValue;
|
|
||||||
if ($voucher[0]->VoucherType == "Percentage") {
|
|
||||||
$getPercentageValue = $totalValue / 100;
|
|
||||||
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
|
||||||
$data = array(
|
|
||||||
'Price' => round($getDiscountValue * -1, 2)
|
|
||||||
);
|
|
||||||
|
|
||||||
$m->updateVoucherValueInCart($data, $item_id);
|
|
||||||
} else {
|
|
||||||
$voucherData = array(
|
|
||||||
'totalValue' => $totalValue,
|
|
||||||
'type' => 'Flat'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($item->ShippingCostId == 1){
|
|
||||||
$getSmallItemQty += $item->Quantity;
|
|
||||||
}else if($item->ShippingCostId == 2){
|
|
||||||
$getBulkyItemQty += $item->Quantity;
|
|
||||||
}else if($item->ShippingCostId == 3){
|
|
||||||
$getMaskItemQty += $item->Quantity;
|
|
||||||
}else if($item->ShippingCostId == 4){
|
|
||||||
$getDGSItemQty += $item->Quantity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$getSmallItemQty = ceil($getSmallItemQty / 3) * 8;
|
|
||||||
$getBulkyItemQty = ceil($getBulkyItemQty / 1) * 8;
|
|
||||||
$getMaskItemQty = ceil($getMaskItemQty / 25) * 8;
|
|
||||||
$getMaskItemQty = ceil($getMaskItemQty / 4) * 5;
|
|
||||||
$shippingFee = $getSmallItemQty + $getBulkyItemQty + $getMaskItemQty + $getDGSItemQty;
|
|
||||||
// var_dump($shippingFee);
|
|
||||||
|
|
||||||
$order_items = array();
|
$order_items = array();
|
||||||
$updated_items = $m->myCart($cartKey);
|
$updated_items = $m->myCart($cartKey);
|
||||||
$updated_getSubtotal = $m->getSubtotal($cartKey);
|
|
||||||
|
|
||||||
// $order_subtotal = $updated_getSubtotal[0]->Subtotal;
|
|
||||||
$order_grandtotal = $updated_getSubtotal[0]->Subtotal;
|
|
||||||
|
|
||||||
if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185) {
|
|
||||||
$tax_value = 0;
|
|
||||||
} else {
|
|
||||||
$tax_value = 0.10;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tax = $order_grandtotal * $tax_value;
|
|
||||||
|
|
||||||
foreach ($updated_items as $key => $item) {
|
foreach ($updated_items as $key => $item) {
|
||||||
|
|
||||||
@@ -172,6 +198,29 @@ class PaypalController extends Controller
|
|||||||
|
|
||||||
$item_list = PayPal::ItemList();
|
$item_list = PayPal::ItemList();
|
||||||
$item_list->setItems($order_items);
|
$item_list->setItems($order_items);
|
||||||
|
|
||||||
|
$payment = PayPal::Payment();
|
||||||
|
|
||||||
|
// var_dump(array($transaction));
|
||||||
|
if ($array_address_book[0]->CountryCode == "CA") {
|
||||||
|
|
||||||
|
$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);
|
||||||
|
$shipping->setState($array_address_book[0]->State);
|
||||||
|
$shipping->setPhone($array_address_book[0]->ContactNumber);
|
||||||
|
$item_list->setShippingAddress($shipping);
|
||||||
|
|
||||||
|
$payment->setExperienceProfileId($this->createWebProfile());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// var_dump($item_list);
|
||||||
|
|
||||||
$amount_details = PayPal::Details();
|
$amount_details = PayPal::Details();
|
||||||
$amount_details->setSubtotal($order_grandtotal);
|
$amount_details->setSubtotal($order_grandtotal);
|
||||||
$amount_details->setTax($tax);
|
$amount_details->setTax($tax);
|
||||||
@@ -192,9 +241,10 @@ class PaypalController extends Controller
|
|||||||
$redirectUrls = PayPal::RedirectUrls();
|
$redirectUrls = PayPal::RedirectUrls();
|
||||||
$redirectUrls->setReturnUrl(route('getDone'));
|
$redirectUrls->setReturnUrl(route('getDone'));
|
||||||
$redirectUrls->setCancelUrl(route('getCancel'));
|
$redirectUrls->setCancelUrl(route('getCancel'));
|
||||||
|
// var_dump($shippingAddress)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$payment = PayPal::Payment();
|
|
||||||
$payment->setIntent('sale');
|
$payment->setIntent('sale');
|
||||||
$payment->setPayer($payer);
|
$payment->setPayer($payer);
|
||||||
$payment->setRedirectUrls($redirectUrls);
|
$payment->setRedirectUrls($redirectUrls);
|
||||||
@@ -233,19 +283,306 @@ class PaypalController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getShippingFee($cartKey)
|
||||||
|
{
|
||||||
|
|
||||||
|
$m = new TeamStoreModel;
|
||||||
|
$UserModel = new UserModel;
|
||||||
|
$userId = 0;
|
||||||
|
if (!Auth::guest()) {
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$items = $m->myCart($cartKey); // item from cart_tmp
|
||||||
|
$getSubtotal = $m->getSubtotal($cartKey);
|
||||||
|
$getSmallItemQty = 0;
|
||||||
|
$getBulkyItemQty = 0;
|
||||||
|
$getMaskItemQty = 0;
|
||||||
|
$getDGSItemQty = 0;
|
||||||
|
$shippingFee = 0;
|
||||||
|
$CAShippingfee = 0;
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item->VoucherId != null) {
|
||||||
|
$voucherIds[] = $item->VoucherId;
|
||||||
|
$voucher = $m->selectVoucherWhereIn($voucherIds);
|
||||||
|
$item_id = $item->Id;
|
||||||
|
$totalValue = $voucher[0]->VoucherValue;
|
||||||
|
if ($voucher[0]->VoucherType == "Percentage") {
|
||||||
|
$getPercentageValue = $totalValue / 100;
|
||||||
|
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||||
|
$data = array(
|
||||||
|
'Price' => round($getDiscountValue * -1, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
$m->updateVoucherValueInCart($data, $item_id);
|
||||||
|
} else {
|
||||||
|
$voucherData = array(
|
||||||
|
'totalValue' => $totalValue,
|
||||||
|
'type' => 'Flat'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item->ShippingCostId == 1) {
|
||||||
|
$getSmallItemQty += $item->Quantity;
|
||||||
|
} else if ($item->ShippingCostId == 2) {
|
||||||
|
$getBulkyItemQty += $item->Quantity;
|
||||||
|
} else if ($item->ShippingCostId == 3) {
|
||||||
|
$getMaskItemQty += $item->Quantity;
|
||||||
|
} else if ($item->ShippingCostId == 4) {
|
||||||
|
$getDGSItemQty += $item->Quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
$CAShippingfee += $item->Quantity; // for canada
|
||||||
|
}
|
||||||
|
|
||||||
|
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);
|
||||||
|
$countryCode = "";
|
||||||
|
if (count($array_address_book) > 0) {
|
||||||
|
$countryCode = $array_address_book[0]->CountryCode;
|
||||||
|
$CAShippingfee = ceil($CAShippingfee / 2) * 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
$getSmallItemQty = ceil($getSmallItemQty / 3) * 8;
|
||||||
|
$getBulkyItemQty = ceil($getBulkyItemQty / 1) * 8;
|
||||||
|
$getMaskItemQty = ceil($getMaskItemQty / 25) * 8;
|
||||||
|
$getDGSItemQty = ceil($getDGSItemQty / 4) * 5;
|
||||||
|
$shippingFee = $getSmallItemQty + $getBulkyItemQty + $getMaskItemQty + $getDGSItemQty;
|
||||||
|
|
||||||
|
if ($countryCode == "CA") {
|
||||||
|
$shippingFee = $CAShippingfee;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $shippingFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTax($cartKey)
|
||||||
|
{
|
||||||
|
$m = new TeamStoreModel;
|
||||||
|
$updated_getSubtotal = $m->getSubtotal($cartKey);
|
||||||
|
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
||||||
|
|
||||||
|
if (count($grouped_item) <= 0) {
|
||||||
|
$tax_value = 0;
|
||||||
|
} else {
|
||||||
|
if ($grouped_item[0]->StoreId == 76 || $grouped_item[0]->StoreId == 78 || $grouped_item[0]->StoreId == 111 || $grouped_item[0]->StoreId == 131 || $grouped_item[0]->StoreId == 30 || $grouped_item[0]->StoreId == 141 || $grouped_item[0]->StoreId == 162 || $grouped_item[0]->StoreId == 185 || $grouped_item[0]->StoreId == 244) {
|
||||||
|
$tax_value = 0;
|
||||||
|
} else {
|
||||||
|
$tax_value = 0.10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$order_grandtotal = $updated_getSubtotal[0]->Subtotal;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$tax = $order_grandtotal * $tax_value;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'tax' => $tax,
|
||||||
|
'order_grandtotal' => $order_grandtotal,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getDone(Request $request)
|
public function getDone(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$paypal_model = new PayPalModel;
|
||||||
|
$m = new TeamStoreModel;
|
||||||
|
$cartKey = $request->session()->get('cartkey');
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
$user_email = Auth::user()->email;
|
||||||
|
|
||||||
|
|
||||||
|
$checkCartKey = $paypal_model->checkCartKey($cartKey);
|
||||||
|
|
||||||
|
if (count($checkCartKey) > 0) {
|
||||||
|
$message = 'You already paid for this order. Please check your Order Page. <a href="user/orders"> <strong> <u>click here</u> </strong></a>.';
|
||||||
|
Session::put('cartkeyError', $message);
|
||||||
|
return Redirect::route('cart');
|
||||||
|
}
|
||||||
|
|
||||||
$id = $request->get('paymentId');
|
$id = $request->get('paymentId');
|
||||||
$token = $request->get('token');
|
$token = $request->get('token');
|
||||||
$payer_id = $request->get('PayerID');
|
$payer_id = $request->get('PayerID');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$payment = PayPal::getById($id, $this->_apiContext);
|
||||||
|
|
||||||
$payment = PayPal::getById($id, $this->_apiContext);
|
$paymentExecution = PayPal::PaymentExecution();
|
||||||
|
|
||||||
$paymentExecution = PayPal::PaymentExecution();
|
$paymentExecution->setPayerId($payer_id);
|
||||||
|
$executePayment = $payment->execute($paymentExecution, $this->_apiContext);
|
||||||
|
$obj = json_decode($executePayment);
|
||||||
|
// var_dump($obj);
|
||||||
|
|
||||||
|
if ($executePayment->getState() == 'approved') {
|
||||||
|
|
||||||
|
/** it's all right **/
|
||||||
|
/** Here Write your database logic like that insert record or value in database if you want **/
|
||||||
|
|
||||||
|
// \Session::put('success','Payment success');
|
||||||
|
// return Redirect::route('paywithpaypal');
|
||||||
|
$line2 = null;
|
||||||
|
|
||||||
|
//details
|
||||||
|
$total = $obj->transactions[0]->amount->total;
|
||||||
|
$sub_total = $obj->transactions[0]->amount->details->subtotal;
|
||||||
|
$tax = $obj->transactions[0]->amount->details->tax;
|
||||||
|
$shipping = $obj->transactions[0]->amount->details->shipping;
|
||||||
|
|
||||||
|
$relatedResources = $obj->transactions[0]->related_resources[0];
|
||||||
|
$saleId = $relatedResources->sale->id; // transaction_id
|
||||||
|
|
||||||
|
$currency = $obj->transactions[0]->amount->currency;
|
||||||
|
$invoice_number = $obj->transactions[0]->invoice_number;
|
||||||
|
// var_dump( $obj->transactions[0]->item_list->phone);
|
||||||
|
//shipping address details
|
||||||
|
$recipient_name = $obj->transactions[0]->item_list->shipping_address->recipient_name;
|
||||||
|
$line1 = $obj->transactions[0]->item_list->shipping_address->line1;
|
||||||
|
if (isset($obj->transactions[0]->item_list->shipping_address->line2)) {
|
||||||
|
$line2 = $obj->transactions[0]->item_list->shipping_address->line2;
|
||||||
|
}
|
||||||
|
$city = $obj->transactions[0]->item_list->shipping_address->city;
|
||||||
|
$state = $obj->transactions[0]->item_list->shipping_address->state;
|
||||||
|
$postal_code = $obj->transactions[0]->item_list->shipping_address->postal_code;
|
||||||
|
$country_code = $obj->transactions[0]->item_list->shipping_address->country_code;
|
||||||
|
|
||||||
|
// payer info
|
||||||
|
$payment_method = $obj->payer->payment_method;
|
||||||
|
$email = $obj->payer->payer_info->email;
|
||||||
|
$first_name = $obj->payer->payer_info->first_name;
|
||||||
|
$last_name = $obj->payer->payer_info->last_name;
|
||||||
|
$_payer_id = $obj->payer->payer_info->payer_id;
|
||||||
|
|
||||||
|
/// end paypal codes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$payment_details = array(
|
||||||
|
|
||||||
|
'UserId' => $userId,
|
||||||
|
'CartKey' => $cartKey,
|
||||||
|
'PaymentId' => $id,
|
||||||
|
'Token' => $token,
|
||||||
|
'PayerId' => $payer_id,
|
||||||
|
'InvoiceNumber' => $invoice_number,
|
||||||
|
'Currency' => $currency,
|
||||||
|
'Total' => $total,
|
||||||
|
'SubTotal' => $sub_total,
|
||||||
|
'Tax' => $tax,
|
||||||
|
'Payer_Email' => $email,
|
||||||
|
'Payer_Firstname' => $first_name,
|
||||||
|
'Payer_Lastname' => $last_name,
|
||||||
|
'PaymentMethod' => $payment_method,
|
||||||
|
'ShippingCost' => $shipping,
|
||||||
|
'TransactionId' => $saleId
|
||||||
|
);
|
||||||
|
|
||||||
|
$p_id = $paypal_model->insertToPaypalDetails($payment_details);
|
||||||
|
|
||||||
|
$shipping_address = array(
|
||||||
|
'PaymentDetail_Id' => $p_id,
|
||||||
|
'recipient_name' => $recipient_name,
|
||||||
|
'line1' => $line1,
|
||||||
|
'line2' => $line2,
|
||||||
|
'city' => $city,
|
||||||
|
'state' => $state,
|
||||||
|
'postal_code' => $postal_code,
|
||||||
|
'country_code' => $country_code,
|
||||||
|
);
|
||||||
|
// iinsert shipping address
|
||||||
|
$paypal_model->insertShippingAddress($shipping_address);
|
||||||
|
|
||||||
|
// insert order from cart_tmp to orders table
|
||||||
|
$l = $paypal_model->insertToOrders($cartKey); // insert to orders table
|
||||||
|
|
||||||
|
//email sending
|
||||||
|
$newUserModel = new UserModel;
|
||||||
|
$order_item_array = $newUserModel->selectOrderItem($cartKey);
|
||||||
|
$item_goup_array = $newUserModel->itemGroup($cartKey);
|
||||||
|
$item_thumbs = $newUserModel->selectDisplayItemThumb();
|
||||||
|
$array_payment_details = $newUserModel->selectPaymentDetails('CartKey', $cartKey);
|
||||||
|
$array_storename = $newUserModel->selectTeamStoreName($cartKey); // email subject
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($array_storename as $storname) {
|
||||||
|
|
||||||
|
$sName[] = $storname->StoreName;
|
||||||
|
$sid[] = $storname->Id;
|
||||||
|
}
|
||||||
|
$sName = implode(", ", $sName);
|
||||||
|
|
||||||
|
|
||||||
|
$user_loginsArray = $newUserModel->selectUserLoginsWhereIn($sid);
|
||||||
|
|
||||||
|
foreach ($user_loginsArray as $userdata) {
|
||||||
|
|
||||||
|
$other_email[] = $userdata->other_email;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($other_email[0] != null) {
|
||||||
|
$other_email = implode(", ", array_filter($other_email, function ($value) {
|
||||||
|
return !is_null($value) && $value !== '';
|
||||||
|
}));
|
||||||
|
$email_cc = "orders@crewsportswear.com" . "," . $other_email;
|
||||||
|
} else {
|
||||||
|
$email_cc = "orders@crewsportswear.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
$explode_other_email = explode(",", $email_cc);
|
||||||
|
|
||||||
|
$data = array(
|
||||||
|
'order_item_array' => $order_item_array,
|
||||||
|
'item_goup_array' => $item_goup_array,
|
||||||
|
'img_thumb' => $item_thumbs,
|
||||||
|
'array_payment_details' => $array_payment_details,
|
||||||
|
'receiver' => $user_email,
|
||||||
|
'email_cc' => $explode_other_email,
|
||||||
|
'subject' => $sName . ' ORDERS',
|
||||||
|
);
|
||||||
|
|
||||||
|
Mail::send('emails.orders', $data, function ($message) use ($data) {
|
||||||
|
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
|
||||||
|
$message->bcc($data['email_cc'], 'Orders From CREW Sportswear');
|
||||||
|
$message->to($data['receiver'])->subject($data['subject']);
|
||||||
|
});
|
||||||
|
// end email sending
|
||||||
|
|
||||||
|
|
||||||
|
$insertTracking = array(
|
||||||
|
"StepId" => 1,
|
||||||
|
"ScannedBy" => 1,
|
||||||
|
"InvoiceNumber" => $invoice_number,
|
||||||
|
"created_at" => date('Y-m-d H:i:s')
|
||||||
|
);
|
||||||
|
|
||||||
|
$ApiModel = new ApiModel;
|
||||||
|
$ApiModel->insertTracking($insertTracking);
|
||||||
|
|
||||||
|
$request->session()->forget('cartkey'); // clear session for cartkey
|
||||||
|
|
||||||
|
// redirect to thank you page.
|
||||||
|
return view('paypal.get_done')
|
||||||
|
->with('currency', $currency)
|
||||||
|
->with('total', $total);
|
||||||
|
} else {
|
||||||
|
Session::put('cartkeyError', 'Something went wrong. Please try again.');
|
||||||
|
return Redirect::route('cart');
|
||||||
|
}
|
||||||
|
} catch (PayPalConnectionException $e) {
|
||||||
|
//throw $th;
|
||||||
|
// echo $e->getCode();
|
||||||
|
echo $e->getData();
|
||||||
|
Session::put('cartkeyError', 'Invalid payment.');
|
||||||
|
return Redirect::route('cart');
|
||||||
|
}
|
||||||
|
|
||||||
$paymentExecution->setPayerId($payer_id);
|
|
||||||
$executePayment = $payment->execute($paymentExecution, $this->_apiContext);
|
|
||||||
|
|
||||||
// print_r($executePayment);
|
// print_r($executePayment);
|
||||||
// if ($executePayment->getState() == 'approved') {
|
// if ($executePayment->getState() == 'approved') {
|
||||||
@@ -257,157 +594,9 @@ class PaypalController extends Controller
|
|||||||
// // return Redirect::route('paywithpaypal');
|
// // return Redirect::route('paywithpaypal');
|
||||||
// echo 'Payment success';
|
// echo 'Payment success';
|
||||||
// }
|
// }
|
||||||
$obj = json_decode($executePayment);
|
|
||||||
|
|
||||||
|
// var_dump($obj->payer->payer_info->shipping_address);
|
||||||
$line2 = null;
|
// var_dump($obj->transactions[0]->item_list->shipping_address);
|
||||||
|
|
||||||
//details
|
|
||||||
$total = $obj->transactions[0]->amount->total;
|
|
||||||
$sub_total = $obj->transactions[0]->amount->details->subtotal;
|
|
||||||
$tax = $obj->transactions[0]->amount->details->tax;
|
|
||||||
$shipping = $obj->transactions[0]->amount->details->shipping;
|
|
||||||
|
|
||||||
$relatedResources = $obj->transactions[0]->related_resources[0];
|
|
||||||
$saleId = $relatedResources->sale->id; // transaction_id
|
|
||||||
|
|
||||||
$currency = $obj->transactions[0]->amount->currency;
|
|
||||||
$invoice_number = $obj->transactions[0]->invoice_number;
|
|
||||||
|
|
||||||
//shipping address details
|
|
||||||
$recipient_name = $obj->transactions[0]->item_list->shipping_address->recipient_name;
|
|
||||||
$line1 = $obj->transactions[0]->item_list->shipping_address->line1;
|
|
||||||
if (isset($obj->transactions[0]->item_list->shipping_address->line2)) {
|
|
||||||
$line2 = $obj->transactions[0]->item_list->shipping_address->line2;
|
|
||||||
}
|
|
||||||
$city = $obj->transactions[0]->item_list->shipping_address->city;
|
|
||||||
$state = $obj->transactions[0]->item_list->shipping_address->state;
|
|
||||||
$postal_code = $obj->transactions[0]->item_list->shipping_address->postal_code;
|
|
||||||
$country_code = $obj->transactions[0]->item_list->shipping_address->country_code;
|
|
||||||
|
|
||||||
// payer info
|
|
||||||
$payment_method = $obj->payer->payment_method;
|
|
||||||
$email = $obj->payer->payer_info->email;
|
|
||||||
$first_name = $obj->payer->payer_info->first_name;
|
|
||||||
$last_name = $obj->payer->payer_info->last_name;
|
|
||||||
$_payer_id = $obj->payer->payer_info->payer_id;
|
|
||||||
|
|
||||||
/// end paypal codes
|
|
||||||
|
|
||||||
$paypal_model = new PayPalModel;
|
|
||||||
$m = new TeamStoreModel;
|
|
||||||
$cartKey = $request->session()->get('cartkey');
|
|
||||||
$userId = Auth::user()->id;
|
|
||||||
$user_email = Auth::user()->email;
|
|
||||||
|
|
||||||
$items = $m->myCart($cartKey); // item from cart_tmp
|
|
||||||
$getSubtotal = $m->getSubtotal($cartKey);
|
|
||||||
|
|
||||||
$payment_details = array(
|
|
||||||
|
|
||||||
'UserId' => $userId,
|
|
||||||
'CartKey' => $cartKey,
|
|
||||||
'PaymentId' => $id,
|
|
||||||
'Token' => $token,
|
|
||||||
'PayerId' => $payer_id,
|
|
||||||
'InvoiceNumber' => $invoice_number,
|
|
||||||
'Currency' => $currency,
|
|
||||||
'Total' => $total,
|
|
||||||
'SubTotal' => $sub_total,
|
|
||||||
'Tax' => $tax,
|
|
||||||
'Payer_Email' => $email,
|
|
||||||
'Payer_Firstname' => $first_name,
|
|
||||||
'Payer_Lastname' => $last_name,
|
|
||||||
'PaymentMethod' => $payment_method,
|
|
||||||
'ShippingCost' => $shipping,
|
|
||||||
'TransactionId' => $saleId
|
|
||||||
);
|
|
||||||
|
|
||||||
$p_id = $paypal_model->insertToPaypalDetails($payment_details);
|
|
||||||
|
|
||||||
$shipping_address = array(
|
|
||||||
'PaymentDetail_Id' => $p_id,
|
|
||||||
'recipient_name' => $recipient_name,
|
|
||||||
'line1' => $line1,
|
|
||||||
'line2' => $line2,
|
|
||||||
'city' => $city,
|
|
||||||
'state' => $state,
|
|
||||||
'postal_code' => $postal_code,
|
|
||||||
'country_code' => $country_code,
|
|
||||||
);
|
|
||||||
// iinsert shipping address
|
|
||||||
$paypal_model->insertShippingAddress($shipping_address);
|
|
||||||
|
|
||||||
// insert order from cart_tmp to orders table
|
|
||||||
$l = $paypal_model->insertToOrders($cartKey); // insert to orders table
|
|
||||||
|
|
||||||
//email sending
|
|
||||||
$newUserModel = new UserModel;
|
|
||||||
$order_item_array = $newUserModel->selectOrderItem($cartKey);
|
|
||||||
$item_goup_array = $newUserModel->itemGroup($cartKey);
|
|
||||||
$item_thumbs = $newUserModel->selectDisplayItemThumb();
|
|
||||||
$array_payment_details = $newUserModel->selectPaymentDetails('CartKey', $cartKey);
|
|
||||||
$array_storename = $newUserModel->selectTeamStoreName($cartKey); // email subject
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($array_storename as $storname) {
|
|
||||||
|
|
||||||
$sName[] = $storname->StoreName;
|
|
||||||
$sid[] = $storname->Id;
|
|
||||||
}
|
|
||||||
$sName = implode(", ", $sName);
|
|
||||||
|
|
||||||
|
|
||||||
$user_loginsArray = $newUserModel->selectUserLoginsWhereIn($sid);
|
|
||||||
|
|
||||||
foreach ($user_loginsArray as $userdata) {
|
|
||||||
|
|
||||||
$other_email[] = $userdata->other_email;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($other_email[0] != null) {
|
|
||||||
$other_email = implode(", ", array_filter($other_email, function($value) { return !is_null($value) && $value !== ''; }));
|
|
||||||
$email_cc = "orders@crewsportswear.com" . "," . $other_email;
|
|
||||||
} else {
|
|
||||||
$email_cc = "orders@crewsportswear.com";
|
|
||||||
}
|
|
||||||
|
|
||||||
$explode_other_email = explode(",", $email_cc);
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'order_item_array' => $order_item_array,
|
|
||||||
'item_goup_array' => $item_goup_array,
|
|
||||||
'img_thumb' => $item_thumbs,
|
|
||||||
'array_payment_details' => $array_payment_details,
|
|
||||||
'receiver' => $user_email,
|
|
||||||
'email_cc' => $explode_other_email,
|
|
||||||
'subject' => $sName . ' ORDERS',
|
|
||||||
);
|
|
||||||
|
|
||||||
Mail::send('emails.orders', $data, function ($message) use ($data) {
|
|
||||||
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
|
|
||||||
$message->bcc($data['email_cc'], 'Orders From CREW Sportswear');
|
|
||||||
$message->to($data['receiver'])->subject($data['subject']);
|
|
||||||
});
|
|
||||||
// end email sending
|
|
||||||
|
|
||||||
|
|
||||||
$insertTracking = array(
|
|
||||||
"StepId" => 1,
|
|
||||||
"ScannedBy" => 1,
|
|
||||||
"InvoiceNumber" => $invoice_number,
|
|
||||||
"created_at" => date('Y-m-d H:i:s')
|
|
||||||
);
|
|
||||||
|
|
||||||
$ApiModel = new ApiModel;
|
|
||||||
$ApiModel->insertTracking($insertTracking);
|
|
||||||
|
|
||||||
$request->session()->forget('cartkey'); // clear session for cartkey
|
|
||||||
|
|
||||||
// redirect to thank you page.
|
|
||||||
return view('paypal.get_done')
|
|
||||||
->with('currency', $currency)
|
|
||||||
->with('total', $total);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -419,6 +608,10 @@ class PaypalController extends Controller
|
|||||||
$items = $m->myCart($cartKey);
|
$items = $m->myCart($cartKey);
|
||||||
$getSubtotal = $m->getSubtotal($cartKey);
|
$getSubtotal = $m->getSubtotal($cartKey);
|
||||||
|
|
||||||
|
if ($items == null) {
|
||||||
|
return redirect()->route('cart');
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
if ($item->VoucherId != null) {
|
if ($item->VoucherId != null) {
|
||||||
$voucherIds[] = $item->VoucherId;
|
$voucherIds[] = $item->VoucherId;
|
||||||
@@ -441,4 +634,47 @@ class PaypalController extends Controller
|
|||||||
|
|
||||||
return redirect()->route('cart');
|
return redirect()->route('cart');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createWebProfile()
|
||||||
|
{
|
||||||
|
$UserModel = new UserModel;
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);
|
||||||
|
if (count($array_address_book) <= 0) {
|
||||||
|
$message = 'Please add Shipping address.';
|
||||||
|
Session::flash('cartkeyError', $message);
|
||||||
|
return Redirect::back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// $shippingAddress = [
|
||||||
|
// "recipient_name" => ,
|
||||||
|
|
||||||
|
$flowConfig = PayPal::FlowConfig();
|
||||||
|
$presentation = PayPal::Presentation();
|
||||||
|
$inputFields = PayPal::InputFields();
|
||||||
|
$webProfile = PayPal::WebProfile();
|
||||||
|
|
||||||
|
|
||||||
|
// $presentation->setLogoImage("https://www.crewsportswear.com/beta/public/images/logo.png")->setBrandName("Merchbay"); //NB: Paypal recommended to use https for the logo's address and the size set to 190x60.
|
||||||
|
$presentation->setBrandName("Crewsportswear"); //NB: Paypal recommended to use https for the logo's address and the size set to 190x60.
|
||||||
|
|
||||||
|
if ($array_address_book[0]->CountryCode == "CA") {
|
||||||
|
$flowConfig->setLandingPageType("Billing"); //Set the page type
|
||||||
|
$inputFields->setAllowNote(true)->setAddressOverride(1);
|
||||||
|
} else {
|
||||||
|
$inputFields->setAllowNote(true)->setAddressOverride(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$webProfile->setName("Crewsportswear " . uniqid())
|
||||||
|
->setFlowConfig($flowConfig)
|
||||||
|
// Parameters for style and presentation.
|
||||||
|
->setPresentation($presentation)
|
||||||
|
// Parameters for input field customization.
|
||||||
|
->setInputFields($inputFields);
|
||||||
|
|
||||||
|
$createProfileResponse = $webProfile->create($this->_apiContext);
|
||||||
|
|
||||||
|
return $createProfileResponse->getId(); //The new webprofile's id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php namespace App\Http\Controllers\teamstore;
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\teamstore;
|
||||||
|
|
||||||
use App\Http\Requests;
|
use App\Http\Requests;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
@@ -13,7 +15,8 @@ use Illuminate\Support\Facades\Mail;
|
|||||||
use Analytics;
|
use Analytics;
|
||||||
|
|
||||||
|
|
||||||
class TeamStoreController extends Controller {
|
class TeamStoreController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
public function index(Request $request, $teamStoreURL)
|
public function index(Request $request, $teamStoreURL)
|
||||||
{
|
{
|
||||||
@@ -25,24 +28,24 @@ class TeamStoreController extends Controller {
|
|||||||
$product_array = $m->selectTeamStoreProducts('TeamStoreId', $store_array[0]->Id);
|
$product_array = $m->selectTeamStoreProducts('TeamStoreId', $store_array[0]->Id);
|
||||||
$user_role = '';
|
$user_role = '';
|
||||||
|
|
||||||
if (Auth::check()){
|
if (Auth::check()) {
|
||||||
$user_role = Auth::user()->role;
|
$user_role = Auth::user()->role;
|
||||||
$store_id = Auth::user()->store_id;
|
$store_id = Auth::user()->store_id;
|
||||||
}else{
|
} else {
|
||||||
$user_role = null;
|
$user_role = null;
|
||||||
$store_id = null;
|
$store_id = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($store_array[0]->Password != null){
|
if ($store_array[0]->Password != null) {
|
||||||
if($request->session()->get('teamstore_data_array') == null){
|
if ($request->session()->get('teamstore_data_array') == null) {
|
||||||
if($store_id != $store_array[0]->Id){
|
if ($store_id != $store_array[0]->Id) {
|
||||||
return redirect('teamstore');
|
return redirect('teamstore');
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
if($user_role != "store_owner"){
|
if ($user_role != "store_owner") {
|
||||||
if($request->session()->get('teamstore_data_array')[0]->StoreUrl != $store_array[0]->StoreUrl){
|
if ($request->session()->get('teamstore_data_array')[0]->StoreUrl != $store_array[0]->StoreUrl) {
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,40 +56,39 @@ class TeamStoreController extends Controller {
|
|||||||
foreach ($product_array as $p => $pr_arr) {
|
foreach ($product_array as $p => $pr_arr) {
|
||||||
|
|
||||||
$thumbnails_array = $m->getProductThumbnails($pr_arr->Id);
|
$thumbnails_array = $m->getProductThumbnails($pr_arr->Id);
|
||||||
if(!empty($thumbnails_array)){
|
if (!empty($thumbnails_array)) {
|
||||||
foreach ($thumbnails_array as $t => $thumb) {
|
foreach ($thumbnails_array as $t => $thumb) {
|
||||||
|
|
||||||
if($thumb->ImageClass == 'custom'){
|
if ($thumb->ImageClass == 'custom') {
|
||||||
$displayThumbnails = $thumb->Image;
|
$displayThumbnails = $thumb->Image;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($thumb->ImageClass == 'active'){
|
if ($thumb->ImageClass == 'active') {
|
||||||
$displayThumbnails = $thumb->Image;
|
$displayThumbnails = $thumb->Image;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$thumbnails[] = array(
|
$thumbnails[] = array(
|
||||||
'folder' => $store_array[0]->ImageFolder,
|
'folder' => $store_array[0]->ImageFolder,
|
||||||
'product_id' => $pr_arr->Id,
|
'product_id' => $pr_arr->Id,
|
||||||
'thumb' => $displayThumbnails
|
'thumb' => $displayThumbnails
|
||||||
|
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
$thumbnails[] = array(
|
$thumbnails[] = array(
|
||||||
'folder' => $store_array[0]->ImageFolder,
|
'folder' => $store_array[0]->ImageFolder,
|
||||||
'product_id' => $pr_arr->Id,
|
'product_id' => $pr_arr->Id,
|
||||||
'thumb' => "product-image-placeholder.png"
|
'thumb' => "product-image-placeholder.png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$getAnnouncement = $UserModel->getAnnouncement($store_array[0]->Id);
|
$getAnnouncement = $UserModel->getAnnouncement($store_array[0]->Id);
|
||||||
|
|
||||||
if(count($getAnnouncement) > 0){
|
if (count($getAnnouncement) > 0) {
|
||||||
$data = $getAnnouncement[0];
|
$data = $getAnnouncement[0];
|
||||||
}else{
|
} else {
|
||||||
$data = (object) array(
|
$data = (object) array(
|
||||||
'Id' => 0,
|
'Id' => 0,
|
||||||
'StoreId' => "",
|
'StoreId' => "",
|
||||||
@@ -97,10 +99,10 @@ class TeamStoreController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return view('teamstore-sublayouts.index')
|
return view('teamstore-sublayouts.index')
|
||||||
->with('store_array', $store_array)
|
->with('store_array', $store_array)
|
||||||
->with('product_array', $product_array)
|
->with('product_array', $product_array)
|
||||||
->with('announcement', $data)
|
->with('announcement', $data)
|
||||||
->with('thumbnails', $thumbnails);
|
->with('thumbnails', $thumbnails);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function storelist(Request $request)
|
public function storelist(Request $request)
|
||||||
@@ -128,31 +130,30 @@ class TeamStoreController extends Controller {
|
|||||||
$q = $request->input('q');
|
$q = $request->input('q');
|
||||||
$sort = $request->input('s');
|
$sort = $request->input('s');
|
||||||
|
|
||||||
if(isset($q) && isset($sort)){
|
if (isset($q) && isset($sort)) {
|
||||||
|
|
||||||
if($sort == "latest"){
|
if ($sort == "latest") {
|
||||||
$field = "Id";
|
$field = "Id";
|
||||||
$sort_value = "DESC";
|
|
||||||
}elseif($sort == "al-desc"){
|
|
||||||
$field = "StoreName";
|
|
||||||
$sort_value = "DESC";
|
$sort_value = "DESC";
|
||||||
}elseif($sort == "oldest"){
|
} elseif ($sort == "al-desc") {
|
||||||
|
$field = "StoreName";
|
||||||
|
$sort_value = "DESC";
|
||||||
|
} elseif ($sort == "oldest") {
|
||||||
$field = "Id";
|
$field = "Id";
|
||||||
$sort_value = "ASC";
|
$sort_value = "ASC";
|
||||||
}else{
|
} else {
|
||||||
$field = "StoreName";
|
$field = "StoreName";
|
||||||
$sort_value = "ASC";
|
$sort_value = "ASC";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($q != ""){
|
if ($q != "") {
|
||||||
// keyword and sort
|
// keyword and sort
|
||||||
$stores_array = $m->selectTeamstoreSearch($field, $sort_value, $q);
|
$stores_array = $m->selectTeamstoreSearch($field, $sort_value, $q);
|
||||||
}else{
|
} else {
|
||||||
// sort only
|
// sort only
|
||||||
$stores_array = $m->selectTeamstoreFilter($field, $sort_value);
|
$stores_array = $m->selectTeamstoreFilter($field, $sort_value);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
$field = "StoreName";
|
$field = "StoreName";
|
||||||
$sort_value = "ASC";
|
$sort_value = "ASC";
|
||||||
$sort = "al-asc";
|
$sort = "al-asc";
|
||||||
@@ -160,9 +161,9 @@ class TeamStoreController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return view('teamstore-sublayouts.stores')
|
return view('teamstore-sublayouts.stores')
|
||||||
->with('stores_array', $stores_array)
|
->with('stores_array', $stores_array)
|
||||||
->with('keyword', $q)
|
->with('keyword', $q)
|
||||||
->with('filter', $sort);
|
->with('filter', $sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkTeamStorePassword(Request $request)
|
public function checkTeamStorePassword(Request $request)
|
||||||
@@ -172,14 +173,12 @@ class TeamStoreController extends Controller {
|
|||||||
|
|
||||||
$store_array = $m->checkStorePassword($post['store_id'], $post['password']);
|
$store_array = $m->checkStorePassword($post['store_id'], $post['password']);
|
||||||
|
|
||||||
if($store_array){
|
if ($store_array) {
|
||||||
$request->session()->put('teamstore_data_array', $store_array);
|
$request->session()->put('teamstore_data_array', $store_array);
|
||||||
return redirect('teamstore/'. $store_array[0]->StoreUrl);
|
return redirect('teamstore/' . $store_array[0]->StoreUrl);
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
return redirect()->back()->with('errors', 'Invalid Password.');
|
return redirect()->back()->with('errors', 'Invalid Password.');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private $teams_array;
|
private $teams_array;
|
||||||
@@ -195,7 +194,7 @@ class TeamStoreController extends Controller {
|
|||||||
$teams_array = $m->getTeams($product_array[0]->Id);
|
$teams_array = $m->getTeams($product_array[0]->Id);
|
||||||
// $sizes_array = $m->getSizes();
|
// $sizes_array = $m->getSizes();
|
||||||
|
|
||||||
if(empty($thumbnails_array)){
|
if (empty($thumbnails_array)) {
|
||||||
|
|
||||||
$data = (object) array(
|
$data = (object) array(
|
||||||
'Image' => 'product-image-placeholder.png',
|
'Image' => 'product-image-placeholder.png',
|
||||||
@@ -207,34 +206,33 @@ class TeamStoreController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$x = explode(",", $product_array[0]->AvailableSizes );
|
$x = explode(",", $product_array[0]->AvailableSizes);
|
||||||
foreach($x as $s){
|
foreach ($x as $s) {
|
||||||
$h[] = $m->getSizesByBracket($s);
|
$h[] = $m->getSizesByBracket($s);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($h as $d){
|
foreach ($h as $d) {
|
||||||
foreach($d as $g){
|
foreach ($d as $g) {
|
||||||
$sizes_array[] = $g;
|
$sizes_array[] = $g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($product_array[0]->ProductAvailableQty != null){
|
if ($product_array[0]->ProductAvailableQty != null) {
|
||||||
$soldQty = $m->getSoldQty($product_array[0]->Id);
|
$soldQty = $m->getSoldQty($product_array[0]->Id);
|
||||||
$availableQty = $product_array[0]->ProductAvailableQty - $soldQty[0]->SoldQty;
|
$availableQty = $product_array[0]->ProductAvailableQty - $soldQty[0]->SoldQty;
|
||||||
}else{
|
} else {
|
||||||
// echo 'no qty';
|
// echo 'no qty';
|
||||||
$availableQty = null;
|
$availableQty = null;
|
||||||
}
|
}
|
||||||
// $product_array[0]->ProductAvailableQty
|
// $product_array[0]->ProductAvailableQty
|
||||||
|
|
||||||
return view('teamstore-sublayouts.product-details')
|
return view('teamstore-sublayouts.product-details')
|
||||||
->with('store_array', $store_array)
|
->with('store_array', $store_array)
|
||||||
->with('product_array', $product_array)
|
->with('product_array', $product_array)
|
||||||
->with('thumbnails_array', $thumbnails_array)
|
->with('thumbnails_array', $thumbnails_array)
|
||||||
->with('teams_array', $teams_array)
|
->with('teams_array', $teams_array)
|
||||||
->with('sizes_array', $sizes_array)
|
->with('sizes_array', $sizes_array)
|
||||||
->with('available_qty', $availableQty);
|
->with('available_qty', $availableQty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
@@ -256,32 +254,30 @@ class TeamStoreController extends Controller {
|
|||||||
$item = $TeamStoreModel->selectTeamStoreProductByIdHash($post['p_id']);
|
$item = $TeamStoreModel->selectTeamStoreProductByIdHash($post['p_id']);
|
||||||
$x = explode(",", $item[0]->AvailableSizes);
|
$x = explode(",", $item[0]->AvailableSizes);
|
||||||
|
|
||||||
foreach($x as $s){
|
foreach ($x as $s) {
|
||||||
$h[] = $TeamStoreModel->getSizesByBracket($s);
|
$h[] = $TeamStoreModel->getSizesByBracket($s);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($h as $d){
|
foreach ($h as $d) {
|
||||||
foreach($d as $g){
|
foreach ($d as $g) {
|
||||||
$sizes_array[] = $g;
|
$sizes_array[] = $g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($item[0]->ProductAvailableQty != null){
|
if ($item[0]->ProductAvailableQty != null) {
|
||||||
$soldQty = $TeamStoreModel->getSoldQty($item[0]->Id);
|
$soldQty = $TeamStoreModel->getSoldQty($item[0]->Id);
|
||||||
$availableQty = $item[0]->ProductAvailableQty - $soldQty[0]->SoldQty;
|
$availableQty = $item[0]->ProductAvailableQty - $soldQty[0]->SoldQty;
|
||||||
}else{
|
} else {
|
||||||
// echo 'no qty';
|
// echo 'no qty';
|
||||||
$availableQty = null;
|
$availableQty = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle_form = view('teamstore-sublayouts.forms.' . $item[0]->ProductForm )
|
$handle_form = view('teamstore-sublayouts.forms.' . $item[0]->ProductForm)
|
||||||
->with('sizes_array', $sizes_array)
|
->with('sizes_array', $sizes_array)
|
||||||
->with('availableQty', $availableQty)
|
->with('availableQty', $availableQty)
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
return $handle_form;
|
return $handle_form;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addToCart(Request $request)
|
public function addToCart(Request $request)
|
||||||
@@ -290,9 +286,9 @@ class TeamStoreController extends Controller {
|
|||||||
$m = new TeamStoreModel;
|
$m = new TeamStoreModel;
|
||||||
$hash_product_id = $post['p_id'];
|
$hash_product_id = $post['p_id'];
|
||||||
|
|
||||||
if($request->session()->has('cartkey')){
|
if ($request->session()->has('cartkey')) {
|
||||||
$cartKey = $request->session()->get('cartkey');
|
$cartKey = $request->session()->get('cartkey');
|
||||||
}else{
|
} else {
|
||||||
$request->session()->put('cartkey', sha1(time() . str_random(6)));
|
$request->session()->put('cartkey', sha1(time() . str_random(6)));
|
||||||
$cartKey = $cartKey = $request->session()->get('cartkey');
|
$cartKey = $cartKey = $request->session()->get('cartkey');
|
||||||
}
|
}
|
||||||
@@ -312,17 +308,17 @@ class TeamStoreController extends Controller {
|
|||||||
$store_url = $teamstore_array[0]->StoreUrl;
|
$store_url = $teamstore_array[0]->StoreUrl;
|
||||||
$store_id = $teamstore_array[0]->Id;
|
$store_id = $teamstore_array[0]->Id;
|
||||||
|
|
||||||
if($product_form == "jersey-and-shorts-form"){
|
if ($product_form == "jersey-and-shorts-form") {
|
||||||
$order_names = $post['order_names'];
|
$order_names = $post['order_names'];
|
||||||
$order_number = $post['order_number'];
|
$order_number = $post['order_number'];
|
||||||
$order_jersey_size = $post['order_jersey_size'];
|
$order_jersey_size = $post['order_jersey_size'];
|
||||||
$order_shorts_size = $post['order_shorts_size'];
|
$order_shorts_size = $post['order_shorts_size'];
|
||||||
|
|
||||||
foreach($order_names as $key => $val){
|
foreach ($order_names as $key => $val) {
|
||||||
|
|
||||||
if($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none"){
|
if ($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none") {
|
||||||
$final_price = $ProductPrice / 2;
|
$final_price = $ProductPrice / 2;
|
||||||
}else{
|
} else {
|
||||||
$final_price = $ProductPrice;
|
$final_price = $ProductPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +340,7 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}elseif($product_form == "tshirt-form"){
|
} elseif ($product_form == "tshirt-form") {
|
||||||
|
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
@@ -360,7 +356,7 @@ class TeamStoreController extends Controller {
|
|||||||
'Quantity' => $post['quantity'],
|
'Quantity' => $post['quantity'],
|
||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}elseif($product_form == "quantity-form"){
|
} elseif ($product_form == "quantity-form") {
|
||||||
|
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
@@ -375,14 +371,12 @@ class TeamStoreController extends Controller {
|
|||||||
'Quantity' => $post['quantity'],
|
'Quantity' => $post['quantity'],
|
||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
|
} elseif ($product_form == "name-number-form") {
|
||||||
|
|
||||||
}elseif($product_form == "name-number-form"){
|
|
||||||
|
|
||||||
$order_names = $post['order_names'];
|
$order_names = $post['order_names'];
|
||||||
$order_number = $post['order_number'];
|
$order_number = $post['order_number'];
|
||||||
|
|
||||||
foreach($order_names as $key => $val){
|
foreach ($order_names as $key => $val) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
'StoreURL' => $store_url,
|
'StoreURL' => $store_url,
|
||||||
@@ -399,13 +393,13 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}elseif($product_form == "name-number-size-form"){
|
} elseif ($product_form == "name-number-size-form") {
|
||||||
|
|
||||||
$order_names = $post['order_names'];
|
$order_names = $post['order_names'];
|
||||||
$order_number = $post['order_number'];
|
$order_number = $post['order_number'];
|
||||||
$order_size = $post['order_size'];
|
$order_size = $post['order_size'];
|
||||||
|
|
||||||
foreach($order_names as $key => $val){
|
foreach ($order_names as $key => $val) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
'StoreURL' => $store_url,
|
'StoreURL' => $store_url,
|
||||||
@@ -423,12 +417,11 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} elseif ($product_form == "number-form") {
|
||||||
}elseif($product_form == "number-form"){
|
|
||||||
|
|
||||||
$order_number = $post['order_number'];
|
$order_number = $post['order_number'];
|
||||||
|
|
||||||
foreach($order_number as $key => $val){
|
foreach ($order_number as $key => $val) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
'StoreURL' => $store_url,
|
'StoreURL' => $store_url,
|
||||||
@@ -444,13 +437,13 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}elseif($product_form == "name-name2-size-form"){
|
} elseif ($product_form == "name-name2-size-form") {
|
||||||
|
|
||||||
$order_names = $post['order_names'];
|
$order_names = $post['order_names'];
|
||||||
$order_names2 = $post['order_names2'];
|
$order_names2 = $post['order_names2'];
|
||||||
$order_size = $post['order_size'];
|
$order_size = $post['order_size'];
|
||||||
|
|
||||||
foreach($order_names as $key => $val){
|
foreach ($order_names as $key => $val) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
'StoreURL' => $store_url,
|
'StoreURL' => $store_url,
|
||||||
@@ -468,12 +461,12 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}elseif($product_form == "name-size-form"){
|
} elseif ($product_form == "name-size-form") {
|
||||||
|
|
||||||
$order_names = $post['order_names'];
|
$order_names = $post['order_names'];
|
||||||
$order_size = $post['order_size'];
|
$order_size = $post['order_size'];
|
||||||
|
|
||||||
foreach($order_names as $key => $val){
|
foreach ($order_names as $key => $val) {
|
||||||
$items[] = array(
|
$items[] = array(
|
||||||
'ProductId' => $product_id,
|
'ProductId' => $product_id,
|
||||||
'StoreURL' => $store_url,
|
'StoreURL' => $store_url,
|
||||||
@@ -490,18 +483,18 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}elseif($product_form == "jersey-and-shorts-quantity-form"){
|
} elseif ($product_form == "jersey-and-shorts-quantity-form") {
|
||||||
|
|
||||||
$order_shorts_size = $post['order_shorts_size'];
|
$order_shorts_size = $post['order_shorts_size'];
|
||||||
$order_jersey_size = $post['order_jersey_size'];
|
$order_jersey_size = $post['order_jersey_size'];
|
||||||
$quantity = $post['quantity'];
|
$quantity = $post['quantity'];
|
||||||
|
|
||||||
foreach($order_jersey_size as $key => $val){
|
foreach ($order_jersey_size as $key => $val) {
|
||||||
if($order_jersey_size[$key] != "none" || $order_shorts_size[$key] != "none"){
|
if ($order_jersey_size[$key] != "none" || $order_shorts_size[$key] != "none") {
|
||||||
|
|
||||||
if($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none"){
|
if ($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none") {
|
||||||
$final_price = $ProductPrice / 2;
|
$final_price = $ProductPrice / 2;
|
||||||
}else{
|
} else {
|
||||||
$final_price = $ProductPrice;
|
$final_price = $ProductPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,19 +514,18 @@ class TeamStoreController extends Controller {
|
|||||||
'ShippingCostId' => $shipping_cost_id
|
'ShippingCostId' => $shipping_cost_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}elseif($product_form == "number-jersey-shorts-form"){
|
} elseif ($product_form == "number-jersey-shorts-form") {
|
||||||
|
|
||||||
$order_number = $post['order_number'];
|
$order_number = $post['order_number'];
|
||||||
$order_jersey_size = $post['order_jersey_size'];
|
$order_jersey_size = $post['order_jersey_size'];
|
||||||
$order_shorts_size = $post['order_shorts_size'];
|
$order_shorts_size = $post['order_shorts_size'];
|
||||||
|
|
||||||
foreach($order_number as $key => $val){
|
foreach ($order_number as $key => $val) {
|
||||||
|
|
||||||
if($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none"){
|
if ($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none") {
|
||||||
$final_price = $ProductPrice / 2;
|
$final_price = $ProductPrice / 2;
|
||||||
}else{
|
} else {
|
||||||
$final_price = $ProductPrice;
|
$final_price = $ProductPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +550,7 @@ class TeamStoreController extends Controller {
|
|||||||
|
|
||||||
$i = $m->insertToCart($items);
|
$i = $m->insertToCart($items);
|
||||||
|
|
||||||
if($i['i']){
|
if ($i['i']) {
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => true
|
'success' => true
|
||||||
));
|
));
|
||||||
@@ -571,18 +563,34 @@ class TeamStoreController extends Controller {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cart(Request $request){
|
public function cart(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
$m = new TeamStoreModel;
|
$m = new TeamStoreModel;
|
||||||
|
$UserModel = new UserModel;
|
||||||
|
$array_address_book = null;
|
||||||
|
|
||||||
|
if(!Auth::guest()){
|
||||||
|
$userId = Auth::user()->id;
|
||||||
|
$array_address_book = $UserModel->selectAddresBook('UserId', $userId);
|
||||||
|
if (count($array_address_book) <= 0) {
|
||||||
|
$array_address_book = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cartKey = $request->session()->get('cartkey');
|
$cartKey = $request->session()->get('cartkey');
|
||||||
$items = $m->myCart($cartKey);
|
$items = $m->myCart($cartKey);
|
||||||
$getSubtotal = $m->getSubtotal($cartKey);
|
$getSubtotal = $m->getSubtotal($cartKey);
|
||||||
$items_group = $m->myCartGroup($cartKey);
|
$items_group = $m->myCartGroup($cartKey);
|
||||||
//var_dump($items_group);
|
//var_dump($items_group);
|
||||||
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
||||||
if($grouped_item){
|
if ($grouped_item) {
|
||||||
$defId = $grouped_item[0]->StoreId;
|
$defId = $grouped_item[0]->StoreId;
|
||||||
}else{
|
} else {
|
||||||
$defId = 0;
|
$defId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,10 +598,10 @@ class TeamStoreController extends Controller {
|
|||||||
$store_array = $m->selectTeamStore('Id', $defId);
|
$store_array = $m->selectTeamStore('Id', $defId);
|
||||||
|
|
||||||
|
|
||||||
if($items){
|
if ($items) {
|
||||||
$voucherIds = array();
|
$voucherIds = array();
|
||||||
foreach($items as $item){
|
foreach ($items as $item) {
|
||||||
if($item->VoucherId != null){
|
if ($item->VoucherId != null) {
|
||||||
$voucherIds[] = $item->VoucherId;
|
$voucherIds[] = $item->VoucherId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -601,45 +609,59 @@ class TeamStoreController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$totalValue = 0;
|
$totalValue = 0;
|
||||||
if(!empty($vouchers)){
|
if (!empty($vouchers)) {
|
||||||
foreach($vouchers as $voucher){
|
foreach ($vouchers as $voucher) {
|
||||||
$totalValue = $totalValue + $voucher->VoucherValue;
|
$totalValue = $totalValue + $voucher->VoucherValue;
|
||||||
if($voucher->VoucherType == "Percentage"){
|
if ($voucher->VoucherType == "Percentage") {
|
||||||
$voucherData = array(
|
$voucherData = array(
|
||||||
'totalValue'=> $totalValue,
|
'totalValue' => $totalValue,
|
||||||
'type'=>'Percentage'
|
'type' => 'Percentage'
|
||||||
);
|
);
|
||||||
}else{
|
} else {
|
||||||
$voucherData = array(
|
$voucherData = array(
|
||||||
'totalValue'=> $totalValue,
|
'totalValue' => $totalValue,
|
||||||
'type'=>'Flat'
|
'type' => 'Flat'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($voucherData['type'] == "Percentage"){
|
if ($voucherData['type'] == "Percentage") {
|
||||||
$getPercentageValue = $voucherData['totalValue'] / 100;
|
$getPercentageValue = $voucherData['totalValue'] / 100;
|
||||||
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||||
$finalSubTotal = $getSubtotal[0]->Subtotal - $getDiscountValue;
|
$finalSubTotal = $getSubtotal[0]->Subtotal - $getDiscountValue;
|
||||||
}else{
|
} else {
|
||||||
//Flat voucher computation here..
|
//Flat voucher computation here..
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$finalSubTotal = $getSubtotal[0]->Subtotal;
|
$finalSubTotal = $getSubtotal[0]->Subtotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($cartKey != null) {
|
||||||
|
$shippingFee = app(\App\Http\Controllers\paypal\PaypalController::class)->getShippingFee($cartKey);
|
||||||
|
$tax = app(\App\Http\Controllers\paypal\PaypalController::class)->getTax($cartKey);
|
||||||
|
}else{
|
||||||
|
$shippingFee = 0;
|
||||||
|
$tax = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return view('sublayouts.cart')
|
return view('sublayouts.cart')
|
||||||
->with('item_group', $items_group)
|
->with('item_group', $items_group)
|
||||||
->with('row', $items)
|
->with('row', $items)
|
||||||
->with('img_thumb', $item_thumbs)
|
->with('img_thumb', $item_thumbs)
|
||||||
->with('getSubtotal', $finalSubTotal)
|
->with('getSubtotal', $finalSubTotal)
|
||||||
->with('store_array', $store_array);
|
->with('store_array', $store_array)
|
||||||
|
->with('store_array', $store_array)
|
||||||
|
->with('shipping_fee', $shippingFee)
|
||||||
|
->with('tax', $tax)
|
||||||
|
->with('address_book', $array_address_book);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addVoucher(Request $request){
|
public function addVoucher(Request $request)
|
||||||
|
{
|
||||||
$cartKey = $request->session()->get('cartkey');
|
$cartKey = $request->session()->get('cartkey');
|
||||||
|
|
||||||
if($cartKey == ""){
|
if ($cartKey == "") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,12 +681,12 @@ class TeamStoreController extends Controller {
|
|||||||
|
|
||||||
$getVoucher = $TeamStoreModel->selectVoucher($data);
|
$getVoucher = $TeamStoreModel->selectVoucher($data);
|
||||||
|
|
||||||
if($getVoucher){
|
if ($getVoucher) {
|
||||||
$items = $TeamStoreModel->myCart($cartKey);
|
$items = $TeamStoreModel->myCart($cartKey);
|
||||||
|
|
||||||
// check if if voucher is already in used;
|
// check if if voucher is already in used;
|
||||||
foreach($items as $item){
|
foreach ($items as $item) {
|
||||||
if($getVoucher[0]->Id == $item->VoucherId){
|
if ($getVoucher[0]->Id == $item->VoucherId) {
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'This voucher is already in used.'
|
'message' => 'This voucher is already in used.'
|
||||||
@@ -689,59 +711,58 @@ class TeamStoreController extends Controller {
|
|||||||
|
|
||||||
//get all voucher used.
|
//get all voucher used.
|
||||||
$updated_items = $TeamStoreModel->myCart($cartKey);
|
$updated_items = $TeamStoreModel->myCart($cartKey);
|
||||||
foreach($updated_items as $item){
|
foreach ($updated_items as $item) {
|
||||||
if($item->VoucherId != null){
|
if ($item->VoucherId != null) {
|
||||||
$voucherIds[] = $item->VoucherId;
|
$voucherIds[] = $item->VoucherId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$vouchers = $TeamStoreModel->selectVoucherWhereIn($voucherIds);
|
$vouchers = $TeamStoreModel->selectVoucherWhereIn($voucherIds);
|
||||||
|
|
||||||
$totalValue = 0;
|
$totalValue = 0;
|
||||||
if(!empty($vouchers)){
|
if (!empty($vouchers)) {
|
||||||
foreach($vouchers as $voucher){
|
foreach ($vouchers as $voucher) {
|
||||||
$totalValue = $totalValue + $voucher->VoucherValue;
|
$totalValue = $totalValue + $voucher->VoucherValue;
|
||||||
if($voucher->VoucherType == "Percentage"){
|
if ($voucher->VoucherType == "Percentage") {
|
||||||
$voucherData = array(
|
$voucherData = array(
|
||||||
'totalValue'=> $totalValue,
|
'totalValue' => $totalValue,
|
||||||
'type'=>'Percentage'
|
'type' => 'Percentage'
|
||||||
);
|
);
|
||||||
}else{
|
} else {
|
||||||
$voucherData = array(
|
$voucherData = array(
|
||||||
'totalValue'=> $totalValue,
|
'totalValue' => $totalValue,
|
||||||
'type'=>'Flat'
|
'type' => 'Flat'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($voucherData['type'] == "Percentage"){
|
if ($voucherData['type'] == "Percentage") {
|
||||||
$getPercentageValue = $voucherData['totalValue'] / 100;
|
$getPercentageValue = $voucherData['totalValue'] / 100;
|
||||||
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
$getDiscountValue = ($getSubtotal[0]->Subtotal * $getPercentageValue);
|
||||||
$finalSubTotal = $getSubtotal[0]->Subtotal - $getDiscountValue;
|
$finalSubTotal = $getSubtotal[0]->Subtotal - $getDiscountValue;
|
||||||
}else{
|
} else {
|
||||||
//Flat voucher computation here..
|
//Flat voucher computation here..
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$finalSubTotal = $getSubtotal[0]->Subtotal;
|
$finalSubTotal = $getSubtotal[0]->Subtotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($getVoucher[0]->VoucherType == "Percentage"){
|
if ($getVoucher[0]->VoucherType == "Percentage") {
|
||||||
$offData = $getVoucher[0]->VoucherValue . '%';
|
$offData = $getVoucher[0]->VoucherValue . '%';
|
||||||
}else{
|
} else {
|
||||||
$offData = $getVoucher[0]->VoucherValue . ' ' . $store_array[0]->StoreCurrency;
|
$offData = $getVoucher[0]->VoucherValue . ' ' . $store_array[0]->StoreCurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$message = '<div class="btn-group">
|
$message = '<div class="btn-group">
|
||||||
<button type="button" class="btn btn-default btn-xs">'.$getVoucher[0]->VoucherCode. ' ' .$offData. ' OFF</button>
|
<button type="button" class="btn btn-default btn-xs">' . $getVoucher[0]->VoucherCode . ' ' . $offData . ' OFF</button>
|
||||||
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
<span class="sr-only"></span>
|
<span class="sr-only"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="'.$removeItemURL.'"><i class="fa fa-times"></i> Remove</a></li>
|
<li><a href="' . $removeItemURL . '"><i class="fa fa-times"></i> Remove</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
@@ -749,12 +770,9 @@ class TeamStoreController extends Controller {
|
|||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'subtotal' =>$finalSubTotal
|
'subtotal' => $finalSubTotal
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
return response()->json(array(
|
return response()->json(array(
|
||||||
'success' => false,
|
'success' => false,
|
||||||
@@ -780,10 +798,9 @@ class TeamStoreController extends Controller {
|
|||||||
$getSubtotal = $m->getSubtotal($cartKey);
|
$getSubtotal = $m->getSubtotal($cartKey);
|
||||||
|
|
||||||
return view('sublayouts.checkout')
|
return view('sublayouts.checkout')
|
||||||
->with('row', $items)
|
->with('row', $items)
|
||||||
->with('getSubtotal', $getSubtotal)
|
->with('getSubtotal', $getSubtotal)
|
||||||
->with('array_address_book', $array_address_book);
|
->with('array_address_book', $array_address_book);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mail()
|
public function mail()
|
||||||
@@ -799,13 +816,10 @@ class TeamStoreController extends Controller {
|
|||||||
|
|
||||||
|
|
||||||
// dd('Mail Send Successfully');
|
// dd('Mail Send Successfully');
|
||||||
Mail::raw('Text to e-mail', function($message)
|
Mail::raw('Text to e-mail', function ($message) {
|
||||||
{
|
|
||||||
$message->from('us@example.com', 'Laravel');
|
$message->from('us@example.com', 'Laravel');
|
||||||
|
|
||||||
$message->to('frank.begornia@yahoo.com')->subject('sample email');
|
$message->to('frank.begornia@yahoo.com')->subject('sample email');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,11 +79,13 @@ class UserController extends Controller {
|
|||||||
'ContactNumber' => $post['mobilenumber'],
|
'ContactNumber' => $post['mobilenumber'],
|
||||||
'OtherNotes' => $post['othernotes'],
|
'OtherNotes' => $post['othernotes'],
|
||||||
'Address' => $post['address'],
|
'Address' => $post['address'],
|
||||||
|
'Address2' => $post['address2'],
|
||||||
'State' => $post['state'],
|
'State' => $post['state'],
|
||||||
'City' => $post['city'],
|
'City' => $post['city'],
|
||||||
'ZipCode' => $post['zipcode']
|
'ZipCode' => $post['zipcode'],
|
||||||
|
'CountryCode' => $post['countryCode'],
|
||||||
|
'Country' => $post['country']
|
||||||
);
|
);
|
||||||
|
|
||||||
echo $i = $m->insertAddressBook($data);
|
echo $i = $m->insertAddressBook($data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -116,11 +118,15 @@ class UserController extends Controller {
|
|||||||
'ContactNumber' => $post['mobilenumber'],
|
'ContactNumber' => $post['mobilenumber'],
|
||||||
'OtherNotes' => $post['othernotes'],
|
'OtherNotes' => $post['othernotes'],
|
||||||
'Address' => $post['address'],
|
'Address' => $post['address'],
|
||||||
|
'Address2' => $post['address2'],
|
||||||
'State' => $post['state'],
|
'State' => $post['state'],
|
||||||
'City' => $post['city'],
|
'City' => $post['city'],
|
||||||
'ZipCode' => $post['zipcode']
|
'ZipCode' => $post['zipcode'],
|
||||||
|
'CountryCode' => $post['countryCode'],
|
||||||
|
'Country' => $post['country']
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
echo $i = $m->saveUpdateAddressBook($data, $id);
|
echo $i = $m->saveUpdateAddressBook($data, $id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php namespace App\Http\Middleware;
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
|
use Illuminate\Support\Facades\URL;
|
||||||
|
|
||||||
class Authenticate {
|
class Authenticate
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Guard implementation.
|
* The Guard implementation.
|
||||||
@@ -32,19 +36,19 @@ class Authenticate {
|
|||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->auth->guest())
|
if ($this->auth->guest()) {
|
||||||
{
|
if ($request->ajax()) {
|
||||||
if ($request->ajax())
|
|
||||||
{
|
|
||||||
return response('Unauthorized.', 401);
|
return response('Unauthorized.', 401);
|
||||||
}
|
} else {
|
||||||
else
|
$prev = URL::previous();
|
||||||
{
|
if (str_contains($prev, ['cart'])) {
|
||||||
|
return redirect()->guest('auth/register?redirectUrl='. $prev);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->guest('auth/login');
|
return redirect()->guest('auth/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,4 +38,14 @@ class PayPalModel extends Model {
|
|||||||
// var_dump($i);
|
// var_dump($i);
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkCartKey($ck){
|
||||||
|
|
||||||
|
$i = DB::table('payment_details')
|
||||||
|
->where('CartKey', $ck)
|
||||||
|
// ->take(1)
|
||||||
|
->get();
|
||||||
|
// var_dump($i);
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
// sandbox
|
// sandbox
|
||||||
// 'paypal' => [
|
'paypal_sandbox' => [
|
||||||
// 'client_id' => 'AQuz-HKzQiL7FygkG8skSekaWf-RP6Rgj4f1XeX1Ghp86bUFj7tQXVT1xbpluu5_WCGRbQpOVGtlJKVB',
|
'client_id' => 'AQuz-HKzQiL7FygkG8skSekaWf-RP6Rgj4f1XeX1Ghp86bUFj7tQXVT1xbpluu5_WCGRbQpOVGtlJKVB',
|
||||||
// 'secret' => 'EJAMKxQsl-mFkL_4J_90cvTamYfcsgswqgIxz9wQPiRAwJ6sy_wNsttMlmrXIpxI96JpYzdMXkLCHAPz'
|
'secret' => 'EJAMKxQsl-mFkL_4J_90cvTamYfcsgswqgIxz9wQPiRAwJ6sy_wNsttMlmrXIpxI96JpYzdMXkLCHAPz'
|
||||||
// ],
|
],
|
||||||
|
|
||||||
// live
|
// live
|
||||||
'paypal' => [
|
'paypal_live' => [
|
||||||
'client_id' => 'AUqBUFW5lfyYmrlBtFZA3RNw45sttM3ltbvS_d4qCVBMrkcMG9rEeivGvtNFSy8XTiEp50YyQ6khKxbq',
|
'client_id' => 'AUqBUFW5lfyYmrlBtFZA3RNw45sttM3ltbvS_d4qCVBMrkcMG9rEeivGvtNFSy8XTiEp50YyQ6khKxbq',
|
||||||
'secret' => 'ELlnuiupoFKwGUSc2g5j-sD1EmsvKpdhth1gFV7njpfvyNtKsK8WwIKUMOS0ehJcRatV865eMhfgsnd_'
|
'secret' => 'ELlnuiupoFKwGUSc2g5j-sD1EmsvKpdhth1gFV7njpfvyNtKsK8WwIKUMOS0ehJcRatV865eMhfgsnd_'
|
||||||
],
|
],
|
||||||
|
|||||||
372
public/api/canada.json
Normal file
372
public/api/canada.json
Normal file
@@ -0,0 +1,372 @@
|
|||||||
|
{
|
||||||
|
"Alberta": [
|
||||||
|
"Airdrie",
|
||||||
|
"Grande Prairie",
|
||||||
|
"Red Deer",
|
||||||
|
"Beaumont",
|
||||||
|
"Hanna",
|
||||||
|
"St. Albert",
|
||||||
|
"Bonnyville",
|
||||||
|
"Hinton",
|
||||||
|
"Spruce Grove",
|
||||||
|
"Brazeau",
|
||||||
|
"Irricana",
|
||||||
|
"Strathcona County",
|
||||||
|
"Breton",
|
||||||
|
"Lacombe",
|
||||||
|
"Strathmore",
|
||||||
|
"Calgary",
|
||||||
|
"Leduc",
|
||||||
|
"Sylvan Lake",
|
||||||
|
"Camrose",
|
||||||
|
"Lethbridge",
|
||||||
|
"Swan Hills",
|
||||||
|
"Canmore",
|
||||||
|
"McLennan",
|
||||||
|
"Taber",
|
||||||
|
"Didzbury",
|
||||||
|
"Medicine Hat",
|
||||||
|
"Turner Valley",
|
||||||
|
"Drayton Valley",
|
||||||
|
"Olds",
|
||||||
|
"Vermillion",
|
||||||
|
"Edmonton",
|
||||||
|
"Onoway",
|
||||||
|
"Wood Buffalo",
|
||||||
|
"Ft. Saskatchewan",
|
||||||
|
"Provost"
|
||||||
|
],
|
||||||
|
"British Columbia": [
|
||||||
|
"Burnaby",
|
||||||
|
"Lumby",
|
||||||
|
"City of Port Moody",
|
||||||
|
"Cache Creek",
|
||||||
|
"Maple Ridge",
|
||||||
|
"Prince George",
|
||||||
|
"Castlegar",
|
||||||
|
"Merritt",
|
||||||
|
"Prince Rupert",
|
||||||
|
"Chemainus",
|
||||||
|
"Mission",
|
||||||
|
"Richmond",
|
||||||
|
"Chilliwack",
|
||||||
|
"Nanaimo",
|
||||||
|
"Saanich",
|
||||||
|
"Clearwater",
|
||||||
|
"Nelson",
|
||||||
|
"Sooke",
|
||||||
|
"Colwood",
|
||||||
|
"New Westminster",
|
||||||
|
"Sparwood",
|
||||||
|
"Coquitlam",
|
||||||
|
"North Cowichan",
|
||||||
|
"Surrey",
|
||||||
|
"Cranbrook",
|
||||||
|
"North Vancouver",
|
||||||
|
"Terrace",
|
||||||
|
"Dawson Creek",
|
||||||
|
"North Vancouver",
|
||||||
|
"Tumbler",
|
||||||
|
"Delta",
|
||||||
|
"Osoyoos",
|
||||||
|
"Vancouver",
|
||||||
|
"Fernie",
|
||||||
|
"Parksville",
|
||||||
|
"Vancouver",
|
||||||
|
"Invermere",
|
||||||
|
"Peace River",
|
||||||
|
"Vernon",
|
||||||
|
"Kamloops",
|
||||||
|
"Penticton",
|
||||||
|
"Victoria",
|
||||||
|
"Kaslo",
|
||||||
|
"Port Alberni",
|
||||||
|
"Whistler",
|
||||||
|
"Langley",
|
||||||
|
"Port Hardy"
|
||||||
|
],
|
||||||
|
"Manitoba": [
|
||||||
|
"Birtle",
|
||||||
|
"Flin Flon",
|
||||||
|
"Swan River",
|
||||||
|
"Brandon",
|
||||||
|
"Snow Lake",
|
||||||
|
"The Pas",
|
||||||
|
"Cranberry Portage",
|
||||||
|
"Steinbach",
|
||||||
|
"Thompson",
|
||||||
|
"Dauphin",
|
||||||
|
"Stonewall",
|
||||||
|
"Winnipeg"
|
||||||
|
],
|
||||||
|
"New Brunswick": [
|
||||||
|
"Cap-Pele",
|
||||||
|
"Miramichi",
|
||||||
|
"Saint John",
|
||||||
|
"Fredericton",
|
||||||
|
"Moncton",
|
||||||
|
"Saint Stephen",
|
||||||
|
"Grand Bay-Westfield",
|
||||||
|
"Oromocto",
|
||||||
|
"Shippagan",
|
||||||
|
"Grand Falls",
|
||||||
|
"Port Elgin",
|
||||||
|
"Sussex",
|
||||||
|
"Memramcook",
|
||||||
|
"Sackville",
|
||||||
|
"Tracadie-Sheila"
|
||||||
|
],
|
||||||
|
"Newfoundland And Labrador": [
|
||||||
|
"Argentia",
|
||||||
|
"Corner Brook",
|
||||||
|
"Paradise",
|
||||||
|
"Bishop's Falls",
|
||||||
|
"Labrador City",
|
||||||
|
"Portaux Basques",
|
||||||
|
"Botwood",
|
||||||
|
"Mount Pearl",
|
||||||
|
"St. John's",
|
||||||
|
"Brigus"
|
||||||
|
],
|
||||||
|
"Northwest Territories": [
|
||||||
|
"Town of Hay River",
|
||||||
|
"Town of Inuvik",
|
||||||
|
"Yellowknife"
|
||||||
|
],
|
||||||
|
"Nova Scotia": [
|
||||||
|
"Amherst",
|
||||||
|
"Hants County",
|
||||||
|
"Pictou",
|
||||||
|
"Annapolis",
|
||||||
|
"Inverness County",
|
||||||
|
"Pictou County",
|
||||||
|
"Argyle",
|
||||||
|
"Kentville",
|
||||||
|
"Queens",
|
||||||
|
"Baddeck",
|
||||||
|
"County of Kings",
|
||||||
|
"Richmond",
|
||||||
|
"Bridgewater",
|
||||||
|
"Lunenburg",
|
||||||
|
"Shelburne",
|
||||||
|
"Cape Breton",
|
||||||
|
"Lunenburg County",
|
||||||
|
"Stellarton",
|
||||||
|
"Chester",
|
||||||
|
"Mahone Bay",
|
||||||
|
"Truro",
|
||||||
|
"Cumberland County",
|
||||||
|
"New Glasgow",
|
||||||
|
"Windsor",
|
||||||
|
"East Hants",
|
||||||
|
"New Minas",
|
||||||
|
"Yarmouth",
|
||||||
|
"Halifax",
|
||||||
|
"Parrsboro"
|
||||||
|
],
|
||||||
|
"Ontario": [
|
||||||
|
"Ajax",
|
||||||
|
"Halton",
|
||||||
|
"Peterborough",
|
||||||
|
"Atikokan",
|
||||||
|
"Halton Hills",
|
||||||
|
"Pickering",
|
||||||
|
"Barrie",
|
||||||
|
"Hamilton",
|
||||||
|
"Port Bruce",
|
||||||
|
"Belleville",
|
||||||
|
"Hamilton-Wentworth",
|
||||||
|
"Port Burwell",
|
||||||
|
"Blandford-Blenheim",
|
||||||
|
"Hearst",
|
||||||
|
"Port Colborne",
|
||||||
|
"Blind River",
|
||||||
|
"Huntsville",
|
||||||
|
"Port Hope",
|
||||||
|
"Brampton",
|
||||||
|
"Ingersoll",
|
||||||
|
"Prince Edward",
|
||||||
|
"Brant",
|
||||||
|
"James",
|
||||||
|
"Quinte West",
|
||||||
|
"Brantford",
|
||||||
|
"Kanata",
|
||||||
|
"Renfrew",
|
||||||
|
"Brock",
|
||||||
|
"Kincardine",
|
||||||
|
"Richmond Hill",
|
||||||
|
"Brockville",
|
||||||
|
"King",
|
||||||
|
"Sarnia",
|
||||||
|
"Burlington",
|
||||||
|
"Kingston",
|
||||||
|
"Sault Ste. Marie",
|
||||||
|
"Caledon",
|
||||||
|
"Kirkland Lake",
|
||||||
|
"Scarborough",
|
||||||
|
"Cambridge",
|
||||||
|
"Kitchener",
|
||||||
|
"Scugog",
|
||||||
|
"Chatham-Kent",
|
||||||
|
"Larder Lake",
|
||||||
|
"Souix Lookout CoC Sioux Lookout",
|
||||||
|
"Chesterville",
|
||||||
|
"Leamington",
|
||||||
|
"Smiths Falls",
|
||||||
|
"Clarington",
|
||||||
|
"Lennox-Addington",
|
||||||
|
"South-West Oxford",
|
||||||
|
"Cobourg",
|
||||||
|
"Lincoln",
|
||||||
|
"St. Catharines",
|
||||||
|
"Cochrane",
|
||||||
|
"Lindsay",
|
||||||
|
"St. Thomas",
|
||||||
|
"Collingwood",
|
||||||
|
"London",
|
||||||
|
"Stoney Creek",
|
||||||
|
"Cornwall",
|
||||||
|
"Loyalist Township",
|
||||||
|
"Stratford",
|
||||||
|
"Cumberland",
|
||||||
|
"Markham",
|
||||||
|
"Sudbury",
|
||||||
|
"Deep River",
|
||||||
|
"Metro Toronto",
|
||||||
|
"Temagami",
|
||||||
|
"Dundas",
|
||||||
|
"Merrickville",
|
||||||
|
"Thorold",
|
||||||
|
"Durham",
|
||||||
|
"Milton",
|
||||||
|
"Thunder Bay",
|
||||||
|
"Dymond",
|
||||||
|
"Nepean",
|
||||||
|
"Tillsonburg",
|
||||||
|
"Ear Falls",
|
||||||
|
"Newmarket",
|
||||||
|
"Timmins",
|
||||||
|
"East Gwillimbury",
|
||||||
|
"Niagara",
|
||||||
|
"Toronto",
|
||||||
|
"East Zorra-Tavistock",
|
||||||
|
"Niagara Falls",
|
||||||
|
"Uxbridge",
|
||||||
|
"Elgin",
|
||||||
|
"Niagara-on-the-Lake",
|
||||||
|
"Vaughan",
|
||||||
|
"Elliot Lake",
|
||||||
|
"North Bay",
|
||||||
|
"Wainfleet",
|
||||||
|
"Flamborough",
|
||||||
|
"North Dorchester",
|
||||||
|
"Wasaga Beach",
|
||||||
|
"Fort Erie",
|
||||||
|
"North Dumfries",
|
||||||
|
"Waterloo",
|
||||||
|
"Fort Frances",
|
||||||
|
"North York",
|
||||||
|
"Waterloo",
|
||||||
|
"Gananoque",
|
||||||
|
"Norwich",
|
||||||
|
"Welland",
|
||||||
|
"Georgina",
|
||||||
|
"Oakville",
|
||||||
|
"Wellesley",
|
||||||
|
"Glanbrook",
|
||||||
|
"Orangeville",
|
||||||
|
"West Carleton",
|
||||||
|
"Gloucester",
|
||||||
|
"Orillia",
|
||||||
|
"West Lincoln",
|
||||||
|
"Goulbourn",
|
||||||
|
"Osgoode",
|
||||||
|
"Whitby",
|
||||||
|
"Gravenhurst",
|
||||||
|
"Oshawa",
|
||||||
|
"Wilmot",
|
||||||
|
"Grimsby",
|
||||||
|
"Ottawa",
|
||||||
|
"Windsor",
|
||||||
|
"Guelph",
|
||||||
|
"Ottawa-Carleton",
|
||||||
|
"Woolwich",
|
||||||
|
"Haldimand-Norfork",
|
||||||
|
"Owen Sound",
|
||||||
|
"York"
|
||||||
|
],
|
||||||
|
"Prince Edward Island": [
|
||||||
|
"Alberton",
|
||||||
|
"Montague",
|
||||||
|
"Stratford",
|
||||||
|
"Charlottetown",
|
||||||
|
"Souris",
|
||||||
|
"Summerside",
|
||||||
|
"Cornwall"
|
||||||
|
],
|
||||||
|
"Quebec": [
|
||||||
|
"Alma",
|
||||||
|
"Fleurimont",
|
||||||
|
"Longueuil",
|
||||||
|
"Amos",
|
||||||
|
"Gaspe",
|
||||||
|
"Marieville",
|
||||||
|
"Anjou",
|
||||||
|
"Gatineau",
|
||||||
|
"Mount Royal",
|
||||||
|
"Aylmer",
|
||||||
|
"Hull",
|
||||||
|
"Montreal",
|
||||||
|
"Beauport",
|
||||||
|
"Joliette",
|
||||||
|
"Montreal Region",
|
||||||
|
"Bromptonville",
|
||||||
|
"Jonquiere",
|
||||||
|
"Montreal-Est",
|
||||||
|
"Brosssard",
|
||||||
|
"Lachine",
|
||||||
|
"Quebec",
|
||||||
|
"Chateauguay",
|
||||||
|
"Lasalle",
|
||||||
|
"Saint-Leonard",
|
||||||
|
"Chicoutimi",
|
||||||
|
"Laurentides",
|
||||||
|
"Sherbrooke",
|
||||||
|
"Coaticook",
|
||||||
|
"LaSalle",
|
||||||
|
"Sorel",
|
||||||
|
"Coaticook",
|
||||||
|
"Laval",
|
||||||
|
"Thetford Mines",
|
||||||
|
"Dorval",
|
||||||
|
"Lennoxville",
|
||||||
|
"Victoriaville",
|
||||||
|
"Drummondville",
|
||||||
|
"Levis"
|
||||||
|
],
|
||||||
|
"Saskatchewan": [
|
||||||
|
"Avonlea",
|
||||||
|
"Melfort",
|
||||||
|
"Swift Current",
|
||||||
|
"Colonsay",
|
||||||
|
"Nipawin",
|
||||||
|
"Tisdale",
|
||||||
|
"Craik",
|
||||||
|
"Prince Albert",
|
||||||
|
"Unity",
|
||||||
|
"Creighton",
|
||||||
|
"Regina",
|
||||||
|
"Weyburn",
|
||||||
|
"Eastend",
|
||||||
|
"Saskatoon",
|
||||||
|
"Wynyard",
|
||||||
|
"Esterhazy",
|
||||||
|
"Shell Lake",
|
||||||
|
"Yorkton",
|
||||||
|
"Gravelbourg"
|
||||||
|
],
|
||||||
|
"Yukon": [
|
||||||
|
"Carcross",
|
||||||
|
"Whitehorse"
|
||||||
|
]
|
||||||
|
}
|
||||||
238
public/api/usa.json
Normal file
238
public/api/usa.json
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Alabama",
|
||||||
|
"abbreviation": "AL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alaska",
|
||||||
|
"abbreviation": "AK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "American Samoa",
|
||||||
|
"abbreviation": "AS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arizona",
|
||||||
|
"abbreviation": "AZ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Arkansas",
|
||||||
|
"abbreviation": "AR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "California",
|
||||||
|
"abbreviation": "CA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Colorado",
|
||||||
|
"abbreviation": "CO"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Connecticut",
|
||||||
|
"abbreviation": "CT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Delaware",
|
||||||
|
"abbreviation": "DE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "District Of Columbia",
|
||||||
|
"abbreviation": "DC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Federated States Of Micronesia",
|
||||||
|
"abbreviation": "FM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Florida",
|
||||||
|
"abbreviation": "FL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Georgia",
|
||||||
|
"abbreviation": "GA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Guam",
|
||||||
|
"abbreviation": "GU"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Hawaii",
|
||||||
|
"abbreviation": "HI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Idaho",
|
||||||
|
"abbreviation": "ID"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Illinois",
|
||||||
|
"abbreviation": "IL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Indiana",
|
||||||
|
"abbreviation": "IN"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Iowa",
|
||||||
|
"abbreviation": "IA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kansas",
|
||||||
|
"abbreviation": "KS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kentucky",
|
||||||
|
"abbreviation": "KY"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Louisiana",
|
||||||
|
"abbreviation": "LA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Maine",
|
||||||
|
"abbreviation": "ME"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Marshall Islands",
|
||||||
|
"abbreviation": "MH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Maryland",
|
||||||
|
"abbreviation": "MD"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Massachusetts",
|
||||||
|
"abbreviation": "MA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Michigan",
|
||||||
|
"abbreviation": "MI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minnesota",
|
||||||
|
"abbreviation": "MN"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mississippi",
|
||||||
|
"abbreviation": "MS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Missouri",
|
||||||
|
"abbreviation": "MO"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Montana",
|
||||||
|
"abbreviation": "MT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nebraska",
|
||||||
|
"abbreviation": "NE"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nevada",
|
||||||
|
"abbreviation": "NV"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "New Hampshire",
|
||||||
|
"abbreviation": "NH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "New Jersey",
|
||||||
|
"abbreviation": "NJ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "New Mexico",
|
||||||
|
"abbreviation": "NM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "New York",
|
||||||
|
"abbreviation": "NY"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "North Carolina",
|
||||||
|
"abbreviation": "NC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "North Dakota",
|
||||||
|
"abbreviation": "ND"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Northern Mariana Islands",
|
||||||
|
"abbreviation": "MP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ohio",
|
||||||
|
"abbreviation": "OH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Oklahoma",
|
||||||
|
"abbreviation": "OK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Oregon",
|
||||||
|
"abbreviation": "OR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Palau",
|
||||||
|
"abbreviation": "PW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Pennsylvania",
|
||||||
|
"abbreviation": "PA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Puerto Rico",
|
||||||
|
"abbreviation": "PR"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Rhode Island",
|
||||||
|
"abbreviation": "RI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "South Carolina",
|
||||||
|
"abbreviation": "SC"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "South Dakota",
|
||||||
|
"abbreviation": "SD"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Tennessee",
|
||||||
|
"abbreviation": "TN"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Texas",
|
||||||
|
"abbreviation": "TX"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Utah",
|
||||||
|
"abbreviation": "UT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vermont",
|
||||||
|
"abbreviation": "VT"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Virgin Islands",
|
||||||
|
"abbreviation": "VI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Virginia",
|
||||||
|
"abbreviation": "VA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Washington",
|
||||||
|
"abbreviation": "WA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "West Virginia",
|
||||||
|
"abbreviation": "WV"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wisconsin",
|
||||||
|
"abbreviation": "WI"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wyoming",
|
||||||
|
"abbreviation": "WY"
|
||||||
|
}
|
||||||
|
]
|
||||||
250613
public/api/usaCities.json
250613
public/api/usaCities.json
File diff suppressed because it is too large
Load Diff
23909
public/api/usaCities.old.json
Normal file
23909
public/api/usaCities.old.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
@@ -27,12 +28,16 @@
|
|||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136108155-1"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136108155-1"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'UA-136108155-1');
|
gtag('config', 'UA-136108155-1');
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- <nav class="navbar navbar-default">
|
<!-- <nav class="navbar navbar-default">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -76,8 +81,8 @@
|
|||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
$('.reveal-password').click(function(e){
|
$('.reveal-password').click(function(e) {
|
||||||
var $pwd = $(".pwd");
|
var $pwd = $(".pwd");
|
||||||
if ($pwd.attr('type') === 'password') {
|
if ($pwd.attr('type') === 'password') {
|
||||||
$pwd.attr('type', 'text');
|
$pwd.attr('type', 'text');
|
||||||
@@ -88,7 +93,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if($('.data-errors').length > 0){
|
if ($('.data-errors').length > 0) {
|
||||||
$('#team-store-login').modal('show')
|
$('#team-store-login').modal('show')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -109,7 +114,7 @@
|
|||||||
var placement = $(element).data('error');
|
var placement = $(element).data('error');
|
||||||
if (placement) {
|
if (placement) {
|
||||||
$(placement).append(error);
|
$(placement).append(error);
|
||||||
}else {
|
} else {
|
||||||
error.insertAfter(element);
|
error.insertAfter(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -118,12 +123,15 @@
|
|||||||
|
|
||||||
$("#frm-register").validate({
|
$("#frm-register").validate({
|
||||||
rules: {
|
rules: {
|
||||||
name: {
|
firstname: {
|
||||||
required : true
|
required: true
|
||||||
},
|
},
|
||||||
username: {
|
lastname: {
|
||||||
required : true
|
required: true
|
||||||
},
|
},
|
||||||
|
// username: {
|
||||||
|
// required: true
|
||||||
|
// },
|
||||||
email: {
|
email: {
|
||||||
required: true,
|
required: true,
|
||||||
email: true
|
email: true
|
||||||
@@ -131,6 +139,24 @@
|
|||||||
password: {
|
password: {
|
||||||
required: true
|
required: true
|
||||||
//minlength: 6 // <-- removed underscore
|
//minlength: 6 // <-- removed underscore
|
||||||
|
},
|
||||||
|
mobilenumber: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
address: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
state: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
city: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
zipcode: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
countryCode: {
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
messages: {},
|
messages: {},
|
||||||
@@ -138,14 +164,14 @@
|
|||||||
var placement = $(element).data('error');
|
var placement = $(element).data('error');
|
||||||
if (placement) {
|
if (placement) {
|
||||||
$(placement).append(error);
|
$(placement).append(error);
|
||||||
}else {
|
} else {
|
||||||
error.insertAfter(element);
|
error.insertAfter(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
submitHandler: submitRegisterForm
|
submitHandler: submitRegisterForm
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.password-protected').click(function(){
|
$('.password-protected').click(function() {
|
||||||
|
|
||||||
$('#_teamstore_id').val($(this).data('store-id'))
|
$('#_teamstore_id').val($(this).data('store-id'))
|
||||||
// console.log($(this).data('store-id'))
|
// console.log($(this).data('store-id'))
|
||||||
@@ -162,28 +188,169 @@
|
|||||||
|
|
||||||
}); // end document ready
|
}); // end document ready
|
||||||
|
|
||||||
function submitLoginForm (){
|
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('<option value="' + key + '" selected class="dynamic-state">' + key + '</option>');
|
||||||
|
|
||||||
|
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('<option value="' + key + '" class="dynamic-city" selected>' + key + '</option>');
|
||||||
|
} else {
|
||||||
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#lst-states').append('<option value="' + key + '" class="dynamic-state">' + key + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(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('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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('<option value="' + key + '" selected class="dynamic-state">' + key + '</option>');
|
||||||
|
//
|
||||||
|
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('<option value="' + key + '" class="dynamic-city" selected>' + key + '</option>');
|
||||||
|
} else {
|
||||||
|
$('#lst-cities').append('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#lst-states').append('<option value="' + key + '" class="dynamic-state">' + key + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(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('<option value="' + key + '" class="dynamic-city">' + key + '</option>');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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') }}"
|
// method="POST" action="{{ url('/auth/login') }}"
|
||||||
var data = $("#frm-login").serialize();
|
var data = $("#frm-login").serialize();
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type: 'POST',
|
||||||
url : "{{ url('/custom/auth') }}",
|
url: "{{ url('/custom/auth') }}",
|
||||||
data : data,
|
data: data,
|
||||||
dataType : 'json',
|
dataType: 'json',
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
$("#login-response-msg").fadeOut();
|
$("#login-response-msg").fadeOut();
|
||||||
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
$("#btn-login").html('Signing in <i class="fa fa-spinner fa-spin"></i>');
|
||||||
},
|
},
|
||||||
success : function(response){
|
success: function(response) {
|
||||||
$("#login-response-msg").html("");
|
$("#login-response-msg").html("");
|
||||||
$("#login-response-msg").fadeIn(1000, function(){
|
$("#login-response-msg").fadeIn(1000, function() {
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
// $("#login-response-msg").html(response);
|
// $("#login-response-msg").html(response);
|
||||||
// console.log();
|
// console.log();
|
||||||
location.reload();
|
location.reload();
|
||||||
}else{
|
} else {
|
||||||
$("#login-response-msg").html(response.message);
|
$("#login-response-msg").html(response.message);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -194,27 +361,35 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}/* login submit */
|
} /* login submit */
|
||||||
|
|
||||||
function submitRegisterForm (){
|
function submitRegisterForm() {
|
||||||
var data = $("#frm-register").serialize();
|
var data = $("#frm-register").serializeArray();
|
||||||
|
data.push({
|
||||||
|
name: "country",
|
||||||
|
value: $("#select_country option:selected").text()
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'POST',
|
type: 'POST',
|
||||||
url : "{{ url('/custom/register') }}",
|
url: "{{ url('/custom/register') }}",
|
||||||
data : data,
|
data: data,
|
||||||
dataType : 'json',
|
dataType: 'json',
|
||||||
beforeSend: function() {
|
beforeSend: function() {
|
||||||
$("#register-response-msg").fadeOut();
|
$("#register-response-msg").fadeOut();
|
||||||
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
$("#btn-register").html('Please wait <i class="fa fa-spinner fa-spin"></i>');
|
||||||
},
|
},
|
||||||
success : function(response){
|
success: function(response) {
|
||||||
$("#register-response-msg").html("");
|
$("#register-response-msg").html("");
|
||||||
$("#register-response-msg").fadeIn(1000, function(){
|
$("#register-response-msg").fadeIn(1000, function() {
|
||||||
|
|
||||||
if(response.success){
|
if (response.success) {
|
||||||
location.reload();
|
if (response.redirect != "") {
|
||||||
}else{
|
window.location = response.redirect;
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$("#register-response-msg").html(response.message);
|
$("#register-response-msg").html(response.message);
|
||||||
}
|
}
|
||||||
$("#btn-register").html('Register');
|
$("#btn-register").html('Register');
|
||||||
@@ -226,8 +401,7 @@
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<style>
|
<style>
|
||||||
.error{
|
.error {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.g-recaptcha {
|
.g-recaptcha {
|
||||||
width:100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -22,25 +23,40 @@
|
|||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div id="register-response-msg"></div>
|
<div id="register-response-msg"></div>
|
||||||
<form role="form" id="frm-register">
|
<form role="form" id="frm-register">
|
||||||
|
<div class="form-group text-center">
|
||||||
|
<h5>Personal Information</h5>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="redirect" value="{{ Request::get('redirectUrl') }}">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Fullname</label>
|
<label class="control-label">First name</label>
|
||||||
<input type="text" class="form-control" name="name" value="{{ old('name') }}" placeholder="Fullname">
|
<input type="text" class="form-control" name="firstname" placeholder="First name">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<label class="control-label">Last name</label>
|
||||||
|
<input type="text" class="form-control" name="lastname" placeholder="Last name">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="form-group">
|
||||||
<label class="control-label">Username</label>
|
<label class="control-label">Username</label>
|
||||||
<input type="text" class="form-control" name="username" value="{{ old('username') }}" placeholder="Username">
|
<input type="text" class="form-control" name="username" value="{{ old('username') }}" placeholder="Username">
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Email Address</label>
|
<label class="control-label">Email Address</label>
|
||||||
<input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="Email Address">
|
<input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="Email Address">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Phone Number</label>
|
||||||
|
<input type="text" class="form-control" name="mobilenumber" placeholder="Phone Number">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">Password</label>
|
<label class="control-label">Password</label>
|
||||||
<input type="password" class="form-control" name="password" id="password" required placeholder="Password">
|
<input type="password" class="form-control" name="password" id="password" required placeholder="Password">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -48,6 +64,50 @@
|
|||||||
<input type="password" class="form-control" name="password_confirmation" placeholder="Confirm Password" data-rule-equalTo="#password" required>
|
<input type="password" class="form-control" name="password_confirmation" placeholder="Confirm Password" data-rule-equalTo="#password" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group text-center">
|
||||||
|
<h5>Address Information</h5>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Select Country</label>
|
||||||
|
<select name="countryCode" id="select_country" class="form-control" onchange="selectCountry(this)">
|
||||||
|
<option value="">Select Country</option>
|
||||||
|
<option value="US">United States</option>
|
||||||
|
<option value="CA">Canada</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">State / Province</label>
|
||||||
|
<label></label>
|
||||||
|
<select class="form-control" name="state" id="lst-states">
|
||||||
|
<option value="">Select State</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">City</label>
|
||||||
|
<select class="form-control" name="city" id="lst-cities">
|
||||||
|
<option value="">Select City</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Address 1</label>
|
||||||
|
<input type="text" class="form-control" name="address" placeholder="Address 1">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Address 2</label>
|
||||||
|
<input type="text" class="form-control" name="address2" placeholder="Address 2">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label">Zip Code</label>
|
||||||
|
<input type="text" class="form-control" name="zipcode" placeholder="Please enter your zip code">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="g-recaptcha text-center" data-sitekey="{{ env('CAPTCHA_SITE_KEY') }}"></div>
|
<div class="g-recaptcha text-center" data-sitekey="{{ env('CAPTCHA_SITE_KEY') }}"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
@if(Session::has('cartkeyError'))
|
@if(Session::has('cartkeyError'))
|
||||||
<div class="alert alert-danger alert-dismissible">
|
<div class="alert alert-danger alert-dismissible">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
<h4><i class="fa fa-exclamation-circle"></i> Error:</h4>
|
<h4><i class="fa fa-exclamation-circle"></i> Almost there:</h4>
|
||||||
{!! Session::get('cartkeyError') !!}
|
{!! Session::get('cartkeyError') !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -52,8 +52,41 @@
|
|||||||
<h3>Order Summary</h3>
|
<h3>Order Summary</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (!Auth::guest())
|
||||||
|
|
||||||
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
|
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
|
||||||
<h3>Subtotal: <span id="my_subtotal">{{ round($getSubtotal, 2) }}</span> <small>{{ $store_array[0]->StoreCurrency }}</small></h3>
|
|
||||||
|
<p><strong>Ship to:</strong></p>
|
||||||
|
|
||||||
|
@if ($address_book === null)
|
||||||
|
<a href="{{ url('user/address-book/create') }}">[ Add ]</a>
|
||||||
|
@else
|
||||||
|
<div>{{ $address_book[0]->Fullname }}</div>
|
||||||
|
<div>{{ $address_book[0]->ContactNumber }}</div>
|
||||||
|
<div>
|
||||||
|
{{ $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 }}
|
||||||
|
<a href="{{ url('user/address-book/edit/'.$address_book[0]->Id) }}">[ Edit ]</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div style="border: 1px solid #e2e2e2; padding: 10px; border-bottom: none;">
|
||||||
|
{{-- <h3>Subtotal: <span id="my_subtotal">{{ round($getSubtotal, 2) }}</span> <small>{{ $store_array[0]->StoreCurrency }}</small></h3> --}}
|
||||||
|
<h5><strong>Subtotal:</strong>
|
||||||
|
<span>{{ number_format($tax['order_grandtotal'], 2) . ' ' . $store_array[0]->StoreCurrency }}</span>
|
||||||
|
</h5>
|
||||||
|
<h5><strong>Shipping Fee:</strong>
|
||||||
|
<span>{{ number_format($shipping_fee, 2) . ' ' . $store_array[0]->StoreCurrency }}</span>
|
||||||
|
</h5>
|
||||||
|
<h5> <strong>Tax:</strong>
|
||||||
|
<span>{{ number_format($tax['tax'], 2) . ' ' . $store_array[0]->StoreCurrency }}</span>
|
||||||
|
</h5>
|
||||||
|
<hr>
|
||||||
|
<h3> <strong>Total:</strong> <span id="my_subtotal">{{ number_format($tax['order_grandtotal'] + $shipping_fee + $tax['tax'], 2) }}</span>
|
||||||
|
<span>{{ $store_array[0]->StoreCurrency }}</span>
|
||||||
|
</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="form-group" id="voucher_list">
|
<div class="form-group" id="voucher_list">
|
||||||
@foreach($row as $item)
|
@foreach($row as $item)
|
||||||
|
|||||||
@@ -34,15 +34,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Full name</th>
|
<th>Full name</th>
|
||||||
<th>Address</th>
|
<th>Address</th>
|
||||||
<th>Postcode</th>
|
|
||||||
<th>Phone Number</th>
|
<th>Phone Number</th>
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach($array_address_book as $row)
|
@foreach($array_address_book as $row)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $row->Fullname }}</td>
|
<td>{{ $row->Fullname }}</td>
|
||||||
<td>{{ $row->Address }}</td>
|
<td>{{ $row->Address . ' ' . $row->Address2 }}, {{ $row->State }}, {{ $row->City }}, {{ $row->Country}} {{ $row->CountryCode}}, {{ $row->ZipCode }}</td>
|
||||||
<td>{{ $row->State }}, {{ $row->City }}, {{ $row->ZipCode }}</td>
|
|
||||||
<td>{{ $row->ContactNumber }}</td>
|
<td>{{ $row->ContactNumber }}</td>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="{{ url('user/address-book/edit/') }}/{{ $row->Id }}" class="btn btn-default btn-xs"><i class="fa fa-edit"></i> Edit</a>
|
<a href="{{ url('user/address-book/edit/') }}/{{ $row->Id }}" class="btn btn-default btn-xs"><i class="fa fa-edit"></i> Edit</a>
|
||||||
|
|||||||
@@ -1,81 +1,93 @@
|
|||||||
@extends('user-layouts.user_template')
|
@extends('user-layouts.user_template')
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper" style="min-height: 916px;">
|
<div class="content-wrapper" style="min-height: 916px;">
|
||||||
<!-- Content Header (Page header) -->
|
<!-- Content Header (Page header) -->
|
||||||
<section class="content-header">
|
<section class="content-header">
|
||||||
<h1>
|
<h1>
|
||||||
Address Book
|
Address Book
|
||||||
<!-- <small>Control panel</small> -->
|
<!-- <small>Control panel</small> -->
|
||||||
</h1>
|
</h1>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li><a href="{{ url ('user') }}"><i class="fa fa-home"></i> Home</a></li>
|
<li><a href="{{ url ('user') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||||
<li><a href="{{ url ('user/address-book') }}"><i class="fa fa-address-book-o"></i> Address Book</a></li>
|
<li><a href="{{ url ('user/address-book') }}"><i class="fa fa-address-book-o"></i> Address Book</a></li>
|
||||||
<li class="active">Add New Address</li>
|
<li class="active">Add New Address</li>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Main content -->
|
<!-- Main content -->
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="box box-primary">
|
<div class="box box-primary">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
|
|
||||||
<h3 class="box-title">
|
<h3 class="box-title">
|
||||||
Add New Address
|
Add New Address
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<form role="form" id="frm-create-address-book">
|
<form role="form" id="frm-create-address-book">
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Fullname</label>
|
<label>Fullname</label>
|
||||||
<input type="text" class="form-control" name="fullname" placeholder="Fullaname">
|
<input type="text" class="form-control" name="fullname" placeholder="Fullaname">
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Mobile Number</label>
|
|
||||||
<input type="text" class="form-control" name="mobilenumber" placeholder="Please enter your mobile number">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Other Notes</label>
|
|
||||||
<input type="text" class="form-control" name="othernotes" placeholder="Please enter your notes">
|
|
||||||
</div>
|
|
||||||
<!-- /.box-body -->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label>Mobile Number</label>
|
||||||
<label>House Number, Building and Street Name</label>
|
<input type="text" class="form-control" name="mobilenumber" placeholder="Please enter your mobile number">
|
||||||
<input type="text" class="form-control" name="address" placeholder="Please enter your House Number, Building and Street Name">
|
</div>
|
||||||
</div>
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label>Other Notes</label>
|
||||||
<label>State</label>
|
<input type="text" class="form-control" name="othernotes" placeholder="Please enter your notes">
|
||||||
<select class="form-control" name="state" id="lst-states" >
|
</div>
|
||||||
<option value="">Select State</option>
|
<!-- /.box-body -->
|
||||||
</select>
|
</div>
|
||||||
</div>
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>City</label>
|
<label>Country</label>
|
||||||
<select class="form-control" name="city" id="lst-cities">
|
<select class="form-control" name="countryCode" id="select_country" onchange="selectCountry(this)">
|
||||||
<option value="">Select City</option>
|
<option value="">Select Country</option>
|
||||||
</select>
|
<option value="US">United States</option>
|
||||||
</div>
|
<option value="CA">Canada</option>
|
||||||
<div class="form-group">
|
</select>
|
||||||
<label>Zip Code</label>
|
</div>
|
||||||
<input type="text" class="form-control" name="zipcode" placeholder="Please enter your zip code">
|
<div class="form-group">
|
||||||
</div>
|
<label>State / Province</label>
|
||||||
|
<select class="form-control" name="state" id="lst-states">
|
||||||
|
<option value="">Select State</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>City</label>
|
||||||
|
<select class="form-control" name="city" id="lst-cities">
|
||||||
|
<option value="">Select City</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Address 1</label>
|
||||||
|
<textarea type="text" class="form-control" name="address" placeholder="Address 1"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Address 2</label>
|
||||||
|
<textarea type="text" class="form-control" name="address2" placeholder="Address 2"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Zip Code</label>
|
||||||
|
<input type="text" class="form-control" name="zipcode" placeholder="Please enter your zip code">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
</div>
|
||||||
<button type="submit" class="btn btn-primary btn-custom-save">Save</button>
|
<div class="box-footer">
|
||||||
</div>
|
<button type="submit" class="btn btn-primary btn-custom-save">Save</button>
|
||||||
</form>
|
</div>
|
||||||
|
</form>
|
||||||
<div>
|
<div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</section>
|
|
||||||
<!-- /.content -->
|
<!-- /.content -->
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
@@ -46,8 +46,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>House Number, Building and Street Name</label>
|
<label>Country</label>
|
||||||
<input type="text" class="form-control" name="address" placeholder="Please enter your House Number, Building and Street Name" value="{{ $array_address_book[0]->Address }}">
|
<select class="form-control" name="countryCode" id="select_country" onchange="selectCountry(this)" data-selected="{{ $array_address_book[0]->CountryCode }}">
|
||||||
|
<option value="">Select Country</option>
|
||||||
|
<option value="US">United States</option>
|
||||||
|
<option value="CA">Canada</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>State</label>
|
<label>State</label>
|
||||||
@@ -61,6 +65,15 @@
|
|||||||
<option value="">Select City</option>
|
<option value="">Select City</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Address 1</label>
|
||||||
|
<input type="text" class="form-control" name="address" placeholder="Address 1" value="{{ $array_address_book[0]->Address }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Address 2</label>
|
||||||
|
<input type="text" class="form-control" name="address2" placeholder="Address 2" value="{{ $array_address_book[0]->Address2 }}">
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Zip Code</label>
|
<label>Zip Code</label>
|
||||||
<input type="text" class="form-control" name="zipcode" placeholder="Please enter your zip code" value="{{ $array_address_book[0]->ZipCode }}">
|
<input type="text" class="form-control" name="zipcode" placeholder="Please enter your zip code" value="{{ $array_address_book[0]->ZipCode }}">
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user