Skip to content

Commit

Permalink
Merge pull request bagisto#245 from naresh-webkul/master
Browse files Browse the repository at this point in the history
Fixed issues
  • Loading branch information
vivek-webkul authored Apr 8, 2022
2 parents f5dbeef + f0e45fb commit 348b58f
Show file tree
Hide file tree
Showing 46 changed files with 706 additions and 215 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG for v1.3.x.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# CHANGELOG for v1.3.2
# CHANGELOG for v1.3.x

#### This changelog consists the bug & security fixes and new features being included in the releases listed below.

## **v1.3.3(31th of Nov, 2021)** - *Release*

* [feature] Compatible With bagisto v1.3.3

## **v1.3.2(31th of March, 2021)** - *Release*

* [feature] functionality to edit home page layout from admin panel.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It packs with lots of demanding features that allows your business to scale in n

### 2. Requirements:

* **Bagisto**: v1.3.2.
* **Bagisto**: v1.3.3.


### 3. Installation:
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
"vue": "^2.1.10"
},
"dependencies": {
"ajv": "^6.9.1",
"firebase": "^6.3.0",
"flatpickr": "^4.6.6",
"imagemin": "^5.0.0",
"ajv": "^8.8.2",
"firebase": "^9.5.0",
"flatpickr": "^4.6.9",
"imagemin": "^8.0.1",
"vee-validate": "2.0.0-rc.26",
"vue-carousel": "^0.18.0",
"vue-currency-filter": "^3.4.2",
"vue-i18n": "^8.11.2",
"vue-moment": "^4.0.0",
"vue-router": "^3.0.2",
"vue-slider-component": "^3.0.16",
"vue-toasted": "^1.1.27",
"vuex": "^3.6.0"
"vue-currency-filter": "^5.2.0",
"vue-i18n": "^8.26.7",
"vue-moment": "^4.1.0",
"vue-router": "^3.5.3",
"vue-slider-component": "^3.2.15",
"vue-toasted": "^1.1.28",
"vuex": "^3.6.2"
},
"name": "pwa",
"version": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion publishable/assets/css/pwa.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion publishable/assets/js/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions publishable/assets/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=35d444ff4d960ad3fe8c",
"/js/app.js": "/js/app.js?id=f5b09c06997f60ebceb5",
"/css/pwa-admin.css": "/css/pwa-admin.css?id=7073d876ccd90f556cb1",
"/css/pwa.css": "/css/pwa.css?id=c4298c8f5bceee667d50"
"/css/pwa.css": "/css/pwa.css?id=47a878dd8a6be606f8b7"
}
16 changes: 8 additions & 8 deletions publishable/pwa/dist/service-worker.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ function formFilter(response) {
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js');
var firebaseConfig = {
apiKey: "AIzaSyC-HKvgBpSVK27IZdxv5U7s-WDTzODswO8",
authDomain: "laravel-pwa-5c45c.firebaseapp.com",
databaseURL: "https://laravel-pwa-5c45c.firebaseio.com",
projectId: "laravel-pwa-5c45c",
apiKey: "{{core()->getConfigData('pwa.settings.push-notification.web-api-key')}}",
authDomain: "{{core()->getConfigData('pwa.settings.push-notification.auth-domain')}}",
databaseURL: "{{core()->getConfigData('pwa.settings.push-notification.database-url')}}",
projectId: "{{core()->getConfigData('pwa.settings.push-notification.project-id')}}",
storageBucket: "",
messagingSenderId: "444825614301",
appId: "1:444825614301:web:ee31ac20d8c7de3e"
messagingSenderId: "{{core()->getConfigData('pwa.settings.push-notification.messaging-id')}}",
appId: "{{core()->getConfigData('pwa.settings.push-notification.app-id')}}"
}; // Initialize the Firebase app in the service worker by passing in themessagingSenderId.

firebase.initializeApp({
'messagingSenderId': '444825614301'
'messagingSenderId': "{{core()->getConfigData('pwa.settings.push-notification.messaging-id')}}"
}); // Retrieve an instance of Firebase Messaging so that it can handle background messages

var messaging = firebase.messaging(); // Add the public key generated from the console here.
Expand All @@ -191,4 +191,4 @@ var messaging = firebase.messaging(); // Add the public key generated from the c
// };
// return self.registration.showNotification(notificationTitle,
// notificationOptions);
// });
// });
2 changes: 1 addition & 1 deletion publishable/pwa/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ messaging.setBackgroundMessageHandler(function(payload)
event.waitUntil(
clients.openWindow(action_click)
);
});
});
2 changes: 1 addition & 1 deletion publishable/pwa/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"type": "image/png"
}
],
"gcm_sender_id": "103953800507"
"gcm_sender_id": "709349998192"
}
7 changes: 3 additions & 4 deletions publishable/pwa/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ function formFilter(response) {

// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries are not available in the service worker.
importScripts('http://www.gstatic.com/firebasejs/4.8.1/firebase-app.js');
importScripts('http://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js');
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js');

const firebaseConfig = {
apiKey: "{{core()->getConfigData('pwa.settings.push-notification.web-api-key')}}",
Expand All @@ -210,7 +210,6 @@ const firebaseConfig = {
firebase.initializeApp({
'messagingSenderId': "{{core()->getConfigData('pwa.settings.push-notification.messaging-id')}}"
});

// Retrieve an instance of Firebase Messaging so that it can handle background messages
const messaging = firebase.messaging();

Expand Down Expand Up @@ -240,4 +239,4 @@ const messaging = firebase.messaging();

// return self.registration.showNotification(notificationTitle,
// notificationOptions);
// });
// });
2 changes: 2 additions & 0 deletions src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
'title' => 'pwa::app.admin.system.theme-color',
'type' => 'text',
'validation' => 'required',
'info' => 'pwa::app.admin.system.info',
'channel_based' => true,
'locale_based' => false
], [
'name' => 'background_color',
'title' => 'pwa::app.admin.system.background-color',
'type' => 'text',
'validation' => 'required',
'info' => 'pwa::app.admin.system.info',
'channel_based' => true,
'locale_based' => false
], [
Expand Down
11 changes: 5 additions & 6 deletions src/Http/Controllers/Admin/PushNotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function pushtofirebase($id) // send push notification to multiple device

$headers = array(
'Content-Type:application/json',
'Authorization:key=' . $server_key,
'Authorization:key='.$server_key,
);

// Open connection
Expand All @@ -189,15 +189,14 @@ public function pushtofirebase($id) // send push notification to multiple device
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $fields ) );
// Execute post
$result = curl_exec( $ch );

if ( $result === false ) {
session()->flash('error', 'Curl failed: ' . curl_error($ch));
curl_close( $ch );
$resp = json_decode($result);
if ( empty($resp->message_id) ) {
session()->flash('error', 'Invalid Credentials');
} else {
session()->flash('success', trans('pwa::app.admin.push-notification.success-notification'));
}

curl_close( $ch );

// Close connection
return redirect()->back();
} else {
Expand Down
6 changes: 4 additions & 2 deletions src/Http/Controllers/Shop/AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Webkul\PWA\Http\Controllers\Shop;

use Webkul\Customer\Repositories\CustomerAddressRepository;
use Webkul\Customer\Rules\VatIdRule;
use Webkul\API\Http\Controllers\Shop\Controller;
use Webkul\Customer\Repositories\CustomerAddressRepository;
use Webkul\API\Http\Resources\Customer\CustomerAddress as CustomerAddressResource;

class AddressController extends Controller
Expand Down Expand Up @@ -67,7 +68,7 @@ public function store()
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))),
'customer_id' => $customer->id,
]);
}
}

$this->validate(request(), [
'address1' => 'string|required',
Expand All @@ -76,6 +77,7 @@ public function store()
'city' => 'string|required',
'postcode' => 'required',
'phone' => 'required',
'vat_id' => new VatIdRule()
]);

$customerAddress = $this->customerAddressRepository->create(request()->all());
Expand Down
20 changes: 19 additions & 1 deletion src/Http/Controllers/Shop/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Shipping\Facades\Shipping;
use Webkul\Payment\Facades\Payment;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\PWA\Http\Resources\Checkout\Cart as CartResource;
use Webkul\API\Http\Resources\Checkout\CartShippingRate as CartShippingRateResource;
use Webkul\PWA\Http\Resources\Sales\Order as OrderResource;
Expand Down Expand Up @@ -43,6 +44,8 @@ class CheckoutController extends Controller
*/
protected $cartItemRepository;

protected $productRepository;

/**
* Controller instance
*
Expand All @@ -53,7 +56,8 @@ class CheckoutController extends Controller
public function __construct(
CartRepository $cartRepository,
CartItemRepository $cartItemRepository,
OrderRepository $orderRepository
OrderRepository $orderRepository,
ProductRepository $productRepository
) {
$this->guard = request()->has('token') ? 'api' : 'customer';

Expand All @@ -69,6 +73,8 @@ public function __construct(
$this->cartItemRepository = $cartItemRepository;

$this->orderRepository = $orderRepository;

$this->productRepository = $productRepository;
}

/**
Expand All @@ -94,6 +100,18 @@ public function saveAddress(CustomerAddressForm $request)
unset($data['shipping']['address_id']);
}

foreach(Cart::getCart()->items()->get() as $cartitem)
{
$product = $this->productRepository->find($cartitem->product_id);
if($product->type != 'booking' && $product->getTypeInstance()->totalQuantity() < $cartitem->quantity)
{
return response()->json([
'error'=>"qty_unavailable",
'message'=>"Requested Quantity for ".$product->product->name." is not Available"
]);
}
}

if (Cart::hasError() || ! Cart::saveCustomerAddress($data) || ! Shipping::collectRates())
abort(400);

Expand Down
5 changes: 1 addition & 4 deletions src/Http/Controllers/Shop/ComparisonController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,12 @@ public function addCompareProduct()
$productFlatRepository = app('\Webkul\Product\Models\ProductFlat');

$productFlat = $productFlatRepository
->where('id', $productId)
->orWhere('parent_id', $productId)
->orWhere('id', $productId)
->where('product_id', $productId)
->get()
->first();

if ($productFlat) {
$productId = $productFlat->id;

$this->compareProductsRepository->create([
'customer_id' => $customerId,
'product_flat_id' => $productId,
Expand Down
12 changes: 6 additions & 6 deletions src/Http/Controllers/Shop/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function index()
if (isset ($data['new'])) {
$result = app(ProductFlatRepository::class)->scopeQuery(function($query) {
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());

$locale = request()->get('locale') ?: app()->getLocale();

return $query->distinct()
->addSelect('product_flat.*')
->where('product_flat.status', 1)
Expand All @@ -57,14 +57,14 @@ public function index()
->where('product_flat.locale', $locale)
->orderBy('product_id', 'desc');
})->paginate($data['count'] ?? '4');

$result;
} else if (isset($data['featured'])) {
$result = app(ProductFlatRepository::class)->scopeQuery(function($query) {
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());

$locale = request()->get('locale') ?: app()->getLocale();

return $query->distinct()
->addSelect('product_flat.*')
->where('product_flat.status', 1)
Expand All @@ -74,7 +74,7 @@ public function index()
->where('product_flat.locale', $locale)
->orderBy('product_id', 'desc');
})->paginate($data['count'] ?? '4');

$result;
} else {
$result = $this->productRepository->getAll(request()->input('category_id'));
Expand Down
12 changes: 7 additions & 5 deletions src/Http/Resources/Catalog/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Webkul\PWA\Http\Resources\Catalog;

use Illuminate\Http\Resources\Json\JsonResource;
use Webkul\API\Http\Resources\Catalog\ProductImage;
use Webkul\API\Http\Resources\Catalog\Attribute;

class Product extends JsonResource
Expand All @@ -19,6 +18,8 @@ public function __construct($resource)

$this->productReviewHelper = app('Webkul\Product\Helpers\Review');

$this->wishlistHelper = app('Webkul\Customer\Helpers\Wishlist');

parent::__construct($resource);
}

Expand Down Expand Up @@ -63,7 +64,7 @@ public function toArray($request)

$downloadableLinks = $product->downloadable_links;
$downloadableSamples = $product->downloadable_samples;

foreach ($downloadableSamples as $index => $downloadableSample) {
$sample = $downloadableSample->toArray();
$data['downloadable_samples'][$index] = $sample;
Expand All @@ -76,7 +77,7 @@ public function toArray($request)
if (isset($downloadableLink['sample_file'])) {
$data['downloadable_links'][$index]['price'] = core()->currency($downloadableLink->price);
$data['downloadable_links'][$index]['sample_download_url'] = route('shop.downloadable.download_sample', ['type' => 'link', 'id' => $downloadableLink['id']]);

}
}
break;
Expand Down Expand Up @@ -159,8 +160,8 @@ public function toArray($request)
'short_description' => $this->short_description,
'description' => $this->description,
'sku' => $this->sku,
'images' => $pwa_images,
'videos' => productvideo()->getVideos($product),
'images' => $pwa_images,
'videos' => productvideo()->getVideos($product),
'base_image' => productimage()->getProductBaseImage($product),
'variants' => Self::collection($this->variants),
'in_stock' => $product->haveSufficientQuantity(1),
Expand Down Expand Up @@ -190,6 +191,7 @@ public function toArray($request)
'percentage' => $total ? json_encode($this->productReviewHelper->getPercentageRating($product)) : [],
],
'is_saved' => false,
'is_wishlisted' => $this->wishlistHelper->getWishlistProduct($product) ? true : false,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
Expand Down
3 changes: 1 addition & 2 deletions src/Resources/assets/firebase/firebase-messaging-sw.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.8.1/firebase-messaging.js');

var messagingId = "1007045788486";
var messagingId = "709349998192";

firebase.initializeApp({messagingSenderId: messagingId});

const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler(function(payload) {
Expand Down
2 changes: 0 additions & 2 deletions src/Resources/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import i18n from './plugins/i18n';
import App from './components/app';
import VueCurrencyFilter from 'vue-currency-filter';
import './plugins/push-notification';
// import './../../../../../../../public/firebase-messaging-sw'; // (File from the public folder)
// import './../../../../publishable/pwa/firebase-messaging-sw'; // (File from the pwa foder where main service-worker is kept)

window.axios = require('axios');
window.jQuery = window.$ = require('jquery');
Expand Down
Loading

0 comments on commit 348b58f

Please sign in to comment.