dev (#1)
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
All checks were successful
Deploy Production (merchbay.com) / deploy (push) Successful in 2m11s
Co-authored-by: Frank John Begornia <frank.begornia@yahoo.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -399,7 +399,8 @@ class PaypalController extends Controller
|
||||
public function getTax($cartKey)
|
||||
{
|
||||
$m = new TeamStoreModel;
|
||||
$updated_getSubtotal = $m->getSubtotal($cartKey);
|
||||
$updated_getSubtotal = $m->getSubtotalNew($cartKey);
|
||||
$original_subtotal = $m->getSubtotal($cartKey); // withoutTanle
|
||||
$grouped_item = $m->selectTeamStoreGroupByCartKey($cartKey);
|
||||
|
||||
if (count($grouped_item) <= 0) {
|
||||
@@ -414,10 +415,11 @@ class PaypalController extends Controller
|
||||
|
||||
|
||||
$order_grandtotal = $updated_getSubtotal[0]->Subtotal;
|
||||
$order_subtotal = $original_subtotal[0]->Subtotal;
|
||||
|
||||
|
||||
|
||||
|
||||
$tax = $order_grandtotal * $tax_value;
|
||||
$tax = $order_subtotal * $tax_value;
|
||||
|
||||
return [
|
||||
'tax' => $tax,
|
||||
|
||||
@@ -499,6 +499,30 @@ class TeamStoreController extends Controller
|
||||
'ShippingCostId' => $shipping_cost_id
|
||||
);
|
||||
}
|
||||
} elseif ($product_form == "number-size-form") {
|
||||
|
||||
// $order_names = $post['order_names'];
|
||||
$order_number = $post['order_number'];
|
||||
$order_size = $post['order_size'];
|
||||
|
||||
foreach ($order_size as $key => $val) {
|
||||
$items[] = array(
|
||||
'ProductId' => $product_id,
|
||||
'StoreURL' => $store_url,
|
||||
'StoreId' => $store_id,
|
||||
'FormUsed' => $product_form,
|
||||
'CartKey' => $cartKey,
|
||||
'DesignCode' => $design_code,
|
||||
'ProductURL' => $ProductURL,
|
||||
'ProductName' => $product_name,
|
||||
'Name' => $product_name,
|
||||
'Size' => $order_size[$key],
|
||||
'Number' => $order_number[$key],
|
||||
'Price' => $ProductPrice,
|
||||
'Quantity' => 1,
|
||||
'ShippingCostId' => $shipping_cost_id
|
||||
);
|
||||
}
|
||||
} elseif ($product_form == "number-form") {
|
||||
|
||||
$order_number = $post['order_number'];
|
||||
@@ -954,6 +978,7 @@ class TeamStoreController extends Controller
|
||||
'shippingFee' => number_format($shippingFee, 2),
|
||||
'total' => number_format($finalSubTotal + $shippingFee + $tax["tax"], 2),
|
||||
'subtotal' => number_format($finalSubTotal, 2),
|
||||
'tax' => $tax["tax"],
|
||||
'remaining_shippingfee' => number_format(99 - $finalSubTotal, 2)
|
||||
));
|
||||
} else {
|
||||
|
||||
@@ -34,10 +34,10 @@ class UserController extends Controller
|
||||
|
||||
$post_data = array(
|
||||
'isStoreOwner' => true,
|
||||
'store_order' => $countStoreOrder[0]->count_order,
|
||||
'store_income' => $storeIncome[0]->store_income,
|
||||
'store_product_count' => $countStoreProduct[0]->store_product_count,
|
||||
'store_published_product' => $countStorePublishedProduct[0]->store_published_product
|
||||
'store_order' => isset($countStoreOrder[0]->count_order) ? $countStoreOrder[0]->count_order : 0,
|
||||
'store_income' => isset($storeIncome[0]->store_income) ? $storeIncome[0]->store_income : 0,
|
||||
'store_product_count' => isset($countStoreProduct[0]->store_product_count) ? $countStoreProduct[0]->store_product_count : 0,
|
||||
'store_published_product' => isset($countStorePublishedProduct[0]->store_published_product) ? $countStorePublishedProduct[0]->store_published_product : 0
|
||||
);
|
||||
} else {
|
||||
$post_data = array(
|
||||
@@ -348,14 +348,16 @@ class UserController extends Controller
|
||||
$newTeamStoreModel = new TeamStoreModel;
|
||||
|
||||
$product_array = $newTeamStoreModel->selectTeamStoreProducts('ProductURL', $url);
|
||||
$roster = $newUserModel->getRoster($product_array[0]->Id);
|
||||
$thumbnails_array = $newTeamStoreModel->getThumbnails($product_array[0]->Id);
|
||||
$available_size = explode(",", $product_array[0]->AvailableSizes);
|
||||
$shipping_cost = $newUserModel->selectShippingCost();
|
||||
|
||||
return view('user-layouts.view-store-item')->with('product_array', $product_array)
|
||||
->with('available_size', $available_size)
|
||||
->with('thumbnails_array', $thumbnails_array)
|
||||
->with('shipping_cost', $shipping_cost);
|
||||
->with('shipping_cost', $shipping_cost)
|
||||
->with('roster', $roster);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1344,4 +1346,76 @@ class UserController extends Controller
|
||||
|
||||
return $array_address_book;
|
||||
}
|
||||
}
|
||||
|
||||
function roster(Request $request)
|
||||
{
|
||||
$UserModel = new UserModel;
|
||||
$post = $request->all();
|
||||
|
||||
$response = $UserModel->insertRoster($post['data']);
|
||||
|
||||
if($response) {
|
||||
return response()->json(array(
|
||||
'status' => true,
|
||||
'message' => "Roster is successfully saved."
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json(array(
|
||||
'status' => false,
|
||||
'message' => "Something went wrong. Please try again"
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
function deleteRoster(Request $request) {
|
||||
$UserModel = new UserModel;
|
||||
$post = $request->all();
|
||||
|
||||
$response = $UserModel->deleteRoster($post['data']);
|
||||
|
||||
if($response) {
|
||||
return response()->json(array(
|
||||
'status' => true,
|
||||
'message' => "Roster is successfully deleted."
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json(array(
|
||||
'status' => false,
|
||||
'message' => "Something went wrong. Please try again"
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function rosterUpdate(Request $request)
|
||||
{
|
||||
$UserModel = new UserModel;
|
||||
$post = $request->all();
|
||||
|
||||
$response = $UserModel->updateRoster($post['data']);
|
||||
|
||||
if($response) {
|
||||
return response()->json(array(
|
||||
'status' => true,
|
||||
'message' => "Roster is successfully updated."
|
||||
));
|
||||
}
|
||||
|
||||
return response()->json(array(
|
||||
'status' => false,
|
||||
'message' => "Something went wrong. Please try again"
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
function getCurrentRoster(Request $request) {
|
||||
$productId = $request->query('product-id');
|
||||
$newUserModel = new UserModel;
|
||||
$roster = $newUserModel->getRoster($productId);
|
||||
return response()->json($roster);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -149,6 +149,11 @@ Route::group(['middleware' => 'normaluser'], function () {
|
||||
|
||||
|
||||
Route::post('user/store-items/personal-design', 'user\UserController@saveNewItemFromDesigner');
|
||||
|
||||
Route::post('user/roster', 'user\UserController@roster');
|
||||
Route::get('user/roster', 'user\UserController@getCurrentRoster');
|
||||
Route::post('user/roster-delete', 'user\UserController@deleteRoster');
|
||||
Route::post('user/roster-update', 'user\UserController@rosterUpdate');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'auth'], function () {
|
||||
|
||||
@@ -189,6 +189,16 @@ class TeamStoreModel extends Model
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getSubtotalNew($cartKey)
|
||||
{
|
||||
|
||||
$i = DB::table('cart_tmp')->select(DB::raw('SUM(Quantity * Price) AS Subtotal'))
|
||||
->where('CartKey', '=', $cartKey)
|
||||
// ->where('VoucherId', '=', null)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateStoreItem($data, $url)
|
||||
{
|
||||
$i = DB::table('teamstore_products')->where('ProductURL', $url)
|
||||
|
||||
@@ -425,4 +425,44 @@ class UserModel extends Model
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
function insertRoster($data) {
|
||||
$i = DB::table('roster')
|
||||
->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getRoster($productId)
|
||||
{
|
||||
$i = DB::table('roster')
|
||||
->where('ProductId', $productId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deleteRoster($idArray)
|
||||
{
|
||||
$deletedRows = DB::table('roster')
|
||||
->whereIn('Id', $idArray) // Replace 'id' with the actual column name if different
|
||||
->delete();
|
||||
|
||||
return $deletedRows; // Returns the number of rows deleted
|
||||
}
|
||||
|
||||
function updateRoster($data)
|
||||
{
|
||||
$updatedRows = 0;
|
||||
|
||||
foreach ($data as $item) {
|
||||
// Assuming each item contains an 'id' and the fields to update
|
||||
$id = $item['Id'];
|
||||
unset($item['Id']); // Remove 'id' from the update data
|
||||
|
||||
$updatedRows += DB::table('roster')
|
||||
->where('Id', $id)
|
||||
->update($item);
|
||||
}
|
||||
|
||||
return $updatedRows; // Returns the total number of rows updated
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,11 @@ class AppServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
// Force HTTPS URLs when behind a proxy (Traefik)
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
|
||||
\URL::forceSchema('https');
|
||||
}
|
||||
|
||||
Blade::extend(function($value) {
|
||||
return preg_replace('/\@define(.+)/', '<?php ${1}; ?>', $value);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user