Modules preorder, customer document and group catalog updated
|
|
@ -98,7 +98,7 @@
|
|||
"Webkul\\CustomerCreditMax\\": "packages/Webkul/CustomerCreditMax",
|
||||
"Webkul\\CustomerGroupCatalog\\": "packages/Webkul/CustomerGroupCatalog",
|
||||
"Webkul\\ShowPriceAfterLogin\\": "packages/Webkul/ShowPriceAfterLogin/src",
|
||||
"Webkul\\SAASPreOrder\\": "packages/Webkul/SAASPreOrder/src"
|
||||
"Webkul\\PreOrder\\": "packages/Webkul/PreOrder/src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ return [
|
|||
Webkul\StripeConnect\Providers\StripeConnectServiceProvider::class,
|
||||
Webkul\ShowPriceAfterLogin\Providers\ShowPriceAfterLoginServiceProvider::class,
|
||||
Webkul\CustomerCreditMax\Providers\CustomerCreditMaxServiceProvider::class,
|
||||
Webkul\SAASPreOrder\Providers\SAASPreOrderServiceProvider::class,
|
||||
Webkul\PreOrder\Providers\PreOrderServiceProvider::class,
|
||||
Webkul\SAASCustomizer\Providers\SAASCustomizerServiceProvider::class,
|
||||
Webkul\CustomerGroupCatalog\Providers\CustomerGroupCatalogServiceProvider::class
|
||||
],
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ return [
|
|||
\Webkul\User\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\Discount\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\StripeConnect\Providers\ModuleServiceProvider::class,
|
||||
\Webkul\SAASPreOrder\Providers\ModuleServiceProvider::class
|
||||
\Webkul\PreOrder\Providers\ModuleServiceProvider::class
|
||||
]
|
||||
];
|
||||
|
|
@ -6,7 +6,7 @@ return [
|
|||
'name' => 'customerdocument::app.admin.customers.documents',
|
||||
'route' => 'admin.documents.index',
|
||||
'sort' => 6,
|
||||
'icon-class' => 'document-icon',
|
||||
'icon-class' => 'sales-icon',
|
||||
], [
|
||||
'key' => 'documents.files',
|
||||
'name' => 'customerdocument::app.admin.documents.b2b-files',
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ class CustomerDocumentsTable extends Migration
|
|||
$table->string('type');
|
||||
$table->string('path');
|
||||
$table->integer('customer_id')->default(0);
|
||||
$table->integer('company_id')->unsigned();
|
||||
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,28 +4,10 @@ namespace Webkul\CustomerDocument\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\CustomerDocument\Contracts\CustomerDocument as CustomerDocumentContract;
|
||||
use Company;
|
||||
|
||||
class CustomerDocument extends Model implements CustomerDocumentContract
|
||||
{
|
||||
protected $table = 'customer_documents';
|
||||
|
||||
protected $fillable = ['name', 'path', 'customer_id', 'description', 'type', 'status', 'company_id'];
|
||||
|
||||
/**
|
||||
* Create a new Eloquent query builder for the model.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function newEloquentBuilder($query)
|
||||
{
|
||||
$company = Company::getCurrent();
|
||||
|
||||
if (auth()->guard('super-admin')->check() || ! isset($company->id)) {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query);
|
||||
} else {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query->where('customer_documents' . '.company_id', $company->id));
|
||||
}
|
||||
}
|
||||
protected $fillable = ['name', 'path', 'customer_id', 'description', 'type', 'status'];
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ $documents = $customerDocumentRepository->findWhere(['customer_id' => $customer-
|
|||
|
||||
<style>
|
||||
.modal-container {
|
||||
top: 20px !important;
|
||||
top: 20px !important;
|
||||
}
|
||||
</style>
|
||||
@stop
|
||||
|
|
@ -71,7 +71,7 @@ $documents = $customerDocumentRepository->findWhere(['customer_id' => $customer-
|
|||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required|alpha_spaces'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}" />
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required|alpha_spaces'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}"/>
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}"" value="{{ old('name') }}"/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<div class="control-group" :class="[errors.has('name') ? 'has-error' : '']">
|
||||
<label for="name" class="required">{{ __('customerdocument::app.admin.customers.name') }}</label>
|
||||
<input v-validate="'required|alpha_spaces'" type="text" class="control" id="name" name="name" value="{{ $document->name }}" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}""/>
|
||||
<input v-validate="'required'" type="text" class="control" id="name" name="name" value="{{ $document->name }}" data-vv-as=""{{ __('customerdocument::app.admin.customers.name') }}""/>
|
||||
<span class="control-error" v-if="errors.has('name')">@{{ errors.first('name') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -100,4 +100,4 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
@stop
|
||||
|
|
@ -114,4 +114,4 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
@endpush
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
namespace Webkul\CustomerGroupCatalog\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\SAASCustomizer\Models\Customer\CustomerGroup as BaseCustomerGroup;
|
||||
use Webkul\Customer\Models\CustomerGroup as BaseCustomerGroup;
|
||||
use Webkul\Product\Models\ProductProxy;
|
||||
use Webkul\Category\Models\CategoryProxy;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ class CategoryRepository extends BaseCategoryRepository
|
|||
return $this->getModel()->join('category_translations', function ($join) {
|
||||
$join->on('categories.id', 'category_translations.category_id')
|
||||
->where('category_translations.locale', app()->getLocale())
|
||||
->where('categories.parent_id', '!=', null)
|
||||
->where('category_translations.name', 'like', '%' . urldecode(request()->input('query')) . '%');
|
||||
})
|
||||
->select('categories.*')
|
||||
|
|
@ -55,44 +54,14 @@ class CategoryRepository extends BaseCategoryRepository
|
|||
|
||||
$categoryIds = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->findOneByField('code', 'guest')->categories()->pluck('id')->toArray();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$parentCategoryIds[] = $category->id;
|
||||
$parentCategory = $this->getParentCategory($category->parent_id);
|
||||
|
||||
$result = array_merge($parentCategoryIds, $parentCategory);
|
||||
$count = 0;
|
||||
foreach($result as $cat) {
|
||||
if (in_array($cat, $categoryIds)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($result) == $count) {
|
||||
$showCategories[] = $category->id;
|
||||
}
|
||||
}
|
||||
$showCategories = $this->getShowAbleCatyegory($categories, $categoryIds);
|
||||
} else {
|
||||
if ($customer->group) {
|
||||
$categories = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->find($customer->group->id)->categories()->get();
|
||||
|
||||
$categoryIds = app('Webkul\CustomerGroupCatalog\Repositories\CustomerGroupRepository')->find($customer->group->id)->categories()->pluck('id')->toArray();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$parentCategoryIds[] = $category->id;
|
||||
$parentCategory = $this->getParentCategory($category->parent_id);
|
||||
|
||||
$result = array_merge($parentCategoryIds, $parentCategory);
|
||||
$count = 0;
|
||||
foreach($result as $cat) {
|
||||
if (in_array($cat, $categoryIds)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($result) == $count) {
|
||||
$showCategories[] = $category->id;
|
||||
}
|
||||
}
|
||||
$showCategories = $this->getShowAbleCatyegory($categories, $categoryIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +80,35 @@ class CategoryRepository extends BaseCategoryRepository
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get show able category
|
||||
*
|
||||
* @param integer array
|
||||
* @return array
|
||||
*/
|
||||
public function getShowAbleCatyegory($categories, $categoryIds) {
|
||||
$showCategories = [];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$parentCategoryIds[] = $category->id;
|
||||
$parentCategory = $this->getParentCategory($category->parent_id);
|
||||
|
||||
$result = array_merge($parentCategoryIds, $parentCategory);
|
||||
$count = 0;
|
||||
foreach($result as $cat) {
|
||||
if (in_array($cat, $categoryIds)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($result) == $count) {
|
||||
$showCategories[] = $category->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $showCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* get parent category
|
||||
*
|
||||
|
|
@ -122,7 +120,7 @@ class CategoryRepository extends BaseCategoryRepository
|
|||
$parentCategory = $this->getModel()->where('id', $parentId)->first();
|
||||
|
||||
if ($parentCategory->parent_id != null) {
|
||||
$parentCategories[] = $parentCategory->id;
|
||||
$parentCategories[] = array_push($parentCategories, $parentCategory->id);
|
||||
$this->getParentCategory($parentCategory->parent_id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Commands\Console;
|
||||
namespace Webkul\PreOrder\Commands\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ use Webkul\Attribute\Repositories\AttributeFamilyRepository;
|
|||
use Validator;
|
||||
|
||||
/**
|
||||
* SAASPreOrderSeeder
|
||||
* PreOrderSeeder
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com> @prashant-webkul
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'preorderseeder' => 'Webkul\PreOrder\Helpers\PreOrderDataPurger'
|
||||
];
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\PreOrder\Contracts;
|
||||
|
||||
interface PreOrderItem
|
||||
{
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\DataGrids\Admin;
|
||||
namespace Webkul\PreOrder\DataGrids\Admin;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
|
@ -39,7 +39,6 @@ class Order extends DataGrid
|
|||
|
||||
$this->addFilter('billed_to', DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name)'));
|
||||
$this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)'));
|
||||
$this->addFilter('is_preorder', DB::raw('COUNT(pre_order_items.id)'));
|
||||
$this->addFilter('id', 'orders.id');
|
||||
$this->addFilter('status', 'orders.status');
|
||||
$this->addFilter('created_at', 'orders.created_at');
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\DataGrids\Admin;
|
||||
namespace Webkul\PreOrder\DataGrids\Admin;
|
||||
|
||||
use Webkul\Ui\DataGrid\DataGrid;
|
||||
use DB;
|
||||
|
|
@ -47,4 +47,4 @@ class CreatePreOrderItemsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('pre_order_items');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Database\Seeders;
|
||||
namespace Webkul\PreOrder\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use DB;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Database\Seeders;
|
||||
namespace Webkul\PreOrder\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Helpers;
|
||||
namespace Webkul\PreOrder\Helpers;
|
||||
|
||||
use Webkul\Attribute\Repositories\AttributeRepository as Attribute;
|
||||
use Webkul\Attribute\Repositories\AttributeFamilyRepository as AttributeFamily;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Helpers;
|
||||
namespace Webkul\PreOrder\Helpers;
|
||||
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Carbon\Carbon;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Http\Controllers\Admin;
|
||||
namespace Webkul\PreOrder\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Http\Controllers\Admin;
|
||||
namespace Webkul\PreOrder\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Webkul\SAASPreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\SAASPreOrder\Mail\ProductInStockNotification;
|
||||
use Webkul\PreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\PreOrder\Mail\ProductInStockNotification;
|
||||
|
||||
/**
|
||||
* PreOrder controller
|
||||
|
|
@ -33,7 +33,7 @@ class PreOrderController extends Controller
|
|||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param \Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param \Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -51,7 +51,7 @@ class PreOrderController extends Controller
|
|||
* @return Mixed
|
||||
*/
|
||||
public function index($url)
|
||||
{
|
||||
{
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Http\Controllers\Shop;
|
||||
namespace Webkul\PreOrder\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Http\Controllers\Shop;
|
||||
namespace Webkul\PreOrder\Http\Controllers\Shop;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
|
@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Mail;
|
|||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Sales\Repositories\OrderItemRepository;
|
||||
use Webkul\SAASPreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\PreOrder\Repositories\PreOrderItemRepository;
|
||||
use Cart;
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +45,7 @@ class PreOrderController extends Controller
|
|||
*
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param Webkul\Sales\Repositories\OrderItemRepository $orderItemRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -75,13 +75,16 @@ class PreOrderController extends Controller
|
|||
if (! $preOrderItem)
|
||||
return abort(404);
|
||||
|
||||
if ($preOrderItem->payment_order_item_id != null)
|
||||
throw new \Exception('Payment has been done for this order');
|
||||
|
||||
$orderItem = $this->orderItemRepository->findOrFail($preOrderItem->order_item_id);
|
||||
|
||||
if (! $this->preOrderItemRepository->canBeComplete($orderItem)) {
|
||||
session()->flash('error', trans('preorder::app.shop.preorders.complete-preorder-error'));
|
||||
|
||||
if (request()->route('token'))
|
||||
return redirct()->route('shop.home.index');
|
||||
return redirect()->route('shop.home.index');
|
||||
else
|
||||
return back();
|
||||
}
|
||||
|
|
@ -7,12 +7,12 @@ Route::group(['middleware' => ['web']], function () {
|
|||
Route::group(['middleware' => ['admin']], function () {
|
||||
|
||||
//Seller routes
|
||||
Route::get('preorders', 'Webkul\SAASPreOrder\Http\Controllers\Admin\PreOrderController@index')->defaults('_config', [
|
||||
Route::get('preorders', 'Webkul\PreOrder\Http\Controllers\Admin\PreOrderController@index')->defaults('_config', [
|
||||
'view' => 'preorder::admin.preorders.index'
|
||||
])->name('admin.preorder.preorders.index');
|
||||
|
||||
//product massdelete
|
||||
Route::post('preorders/notify-customer', 'Webkul\SAASPreOrder\Http\Controllers\Admin\PreOrderController@notifyCustomer')->defaults('_config', [
|
||||
Route::post('preorders/notify-customer', 'Webkul\PreOrder\Http\Controllers\Admin\PreOrderController@notifyCustomer')->defaults('_config', [
|
||||
'redirect' => 'admin.preorder.preorders.index'
|
||||
])->name('admin.preorder.preorders.notify-customer');
|
||||
});
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function () {
|
||||
Route::get('/complete-preorder/{token}', 'Webkul\PreOrder\Http\Controllers\Shop\PreOrderController@complete')->name('preorder.shop.preorder.complete');
|
||||
});
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Listeners;
|
||||
namespace Webkul\PreOrder\Listeners;
|
||||
|
||||
use Cart as CartFacade;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Product\Helpers\Price as PriceHelper;
|
||||
use Webkul\SAASPreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\PreOrder\Repositories\PreOrderItemRepository;
|
||||
|
||||
/**
|
||||
* Cart event handler
|
||||
|
|
@ -41,7 +41,7 @@ class Cart
|
|||
*
|
||||
* @param Webkul\Product\Helpers\Price $priceHelper
|
||||
* @param Webkul\Product\Repositories\ProductRepository $productRepository
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -161,8 +161,8 @@ class Cart
|
|||
$product = $this->productRepository->find($cartItem->product_id);
|
||||
|
||||
if ($product->type == 'configurable') {
|
||||
if (isset($cartItem->child->product_id)) {
|
||||
$product = $this->productRepository->find($cartItem->child->product_id);
|
||||
if (isset($cartItem['additional']['selected_configurable_option'])) {
|
||||
$product = $this->productRepository->find($cartItem['additional']['selected_configurable_option']);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Listeners;
|
||||
namespace Webkul\PreOrder\Listeners;
|
||||
|
||||
use Webkul\SAASPreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\PreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\Sales\Repositories\OrderRepository;
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@ class Invoice
|
|||
/**
|
||||
* Create a new Order event listener instance.
|
||||
*
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\Sales\Repositories\OrderRepository $orderRepository
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Listeners;
|
||||
namespace Webkul\PreOrder\Listeners;
|
||||
|
||||
use Cart as CartFacade;
|
||||
use Webkul\SAASPreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\PreOrder\Repositories\PreOrderItemRepository;
|
||||
use Webkul\Product\Helpers\Price as PriceHelper;
|
||||
|
||||
/**
|
||||
|
|
@ -32,7 +32,7 @@ class Order
|
|||
* Create a new Order event listener instance.
|
||||
*
|
||||
* @param Webkul\Product\Helpers\Price $priceHelper
|
||||
* @param Webkul\SAASPreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @param Webkul\PreOrder\Repositories\PreOrderItemRepository $preOrderItemRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
|
|
@ -61,16 +61,14 @@ class Order
|
|||
'payment_order_item_id' => $item->id
|
||||
], $preOrderItem->id);
|
||||
} else {
|
||||
if ($item->product->type == 'configurable') {
|
||||
if (isset($item->child->product_id)) {
|
||||
if ($item->child->product->totalQuantity() > 0 || ! $item->child->product->allow_preorder)
|
||||
continue;
|
||||
} else {
|
||||
return;
|
||||
if ($item->type == 'configurable') {
|
||||
if ($item->child->product->totalQuantity() > -1 || ! $item->child->product->allow_preorder) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if ($item->product->totalQuantity() > 0 || ! $item->product->allow_preorder)
|
||||
if ($item->product->totalQuantity() > -1 || ! $item->product->allow_preorder) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (core()->getConfigData('preorder.settings.general.preorder_type') == 'partial') {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Mail;
|
||||
namespace Webkul\PreOrder\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
|
|
@ -16,7 +16,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
class ProductInStockNotification extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
|
||||
/**
|
||||
* The order item instance.
|
||||
*
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Models;
|
||||
namespace Webkul\PreOrder\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Webkul\SAASPreOrder\Contracts\PreOrderItem as PreOrderItemContract;
|
||||
use Webkul\PreOrder\Contracts\PreOrderItem as PreOrderItemContract;
|
||||
use Webkul\Sales\Models\OrderProxy;
|
||||
use Webkul\Sales\Models\OrderItemProxy;
|
||||
|
||||
class PreOrderItem extends Model implements PreOrderItemContract
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['preorder_type', 'preorder_percent', 'status', 'email_sent', 'paid_amount', 'base_paid_amount', 'base_remaining_amount', 'order_id', 'order_item_id', 'payment_order_item_id', 'token', 'company_id'];
|
||||
protected $fillable = ['preorder_type', 'preorder_percent', 'status', 'email_sent', 'paid_amount', 'base_paid_amount', 'base_remaining_amount', 'order_id', 'order_item_id', 'payment_order_item_id', 'token'];
|
||||
|
||||
protected $statusLabel = [
|
||||
'pending' => 'Pending',
|
||||
|
|
@ -68,22 +68,4 @@ class PreOrderItem extends Model implements PreOrderItemContract
|
|||
{
|
||||
return $this->typeLabel[$this->preorder_type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Eloquent query builder for the model.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function newEloquentBuilder($query)
|
||||
{
|
||||
|
||||
$company = \Company::getCurrent();
|
||||
|
||||
if (auth()->guard('super-admin')->check() || ! isset($company->id)) {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query);
|
||||
} else {
|
||||
return new \Illuminate\Database\Eloquent\Builder($query->where('pre_order_items' . '.company_id', $company->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Models;
|
||||
namespace Webkul\PreOrder\Models;
|
||||
|
||||
use Konekt\Concord\Proxies\ModelProxy;
|
||||
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Observers;
|
||||
namespace Webkul\PreOrder\Observers;
|
||||
|
||||
use Webkul\SAASPreOrder\Models\PreOrderItem;
|
||||
use Webkul\PreOrder\Models\PreOrderItem;
|
||||
|
||||
use Company;
|
||||
|
||||
class SAASPreOrderItemObserver
|
||||
class PreOrderItemObserver
|
||||
{
|
||||
public function creating(PreOrderItem $model)
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Providers;
|
||||
namespace Webkul\PreOrder\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
|
@ -22,14 +22,14 @@ class EventServiceProvider extends ServiceProvider
|
|||
$viewRenderEventManager->addTemplate('preorder::shop.products.preorder-info');
|
||||
});
|
||||
|
||||
Event::listen('checkout.cart.add.before', 'Webkul\SAASPreOrder\Listeners\Cart@cartItemAddBefore');
|
||||
Event::listen('checkout.cart.add.before', 'Webkul\PreOrder\Listeners\Cart@cartItemAddBefore');
|
||||
|
||||
Event::listen('checkout.cart.update.before', 'Webkul\SAASPreOrder\Listeners\Cart@cartItemUpdateBefore');
|
||||
Event::listen('checkout.cart.update.before', 'Webkul\PreOrder\Listeners\Cart@cartItemUpdateBefore');
|
||||
|
||||
Event::listen('checkout.cart.add.after', 'Webkul\SAASPreOrder\Listeners\Cart@cartItemAddAfter');
|
||||
Event::listen('checkout.cart.add.after', 'Webkul\PreOrder\Listeners\Cart@cartItemAddAfter');
|
||||
|
||||
Event::listen('checkout.order.save.after', 'Webkul\SAASPreOrder\Listeners\Order@afterPlaceOrder');
|
||||
Event::listen('checkout.order.save.after', 'Webkul\PreOrder\Listeners\Order@afterPlaceOrder');
|
||||
|
||||
Event::listen('sales.invoice.save.after', 'Webkul\SAASPreOrder\Listeners\Invoice@afterInvoice');
|
||||
Event::listen('sales.invoice.save.after', 'Webkul\PreOrder\Listeners\Invoice@afterInvoice');
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Providers;
|
||||
namespace Webkul\PreOrder\Providers;
|
||||
|
||||
use Konekt\Concord\BaseModuleServiceProvider;
|
||||
|
||||
class ModuleServiceProvider extends BaseModuleServiceProvider
|
||||
{
|
||||
protected $models = [
|
||||
\Webkul\SAASPreOrder\Models\PreOrderItem::class,
|
||||
\Webkul\PreOrder\Models\PreOrderItem::class,
|
||||
];
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Providers;
|
||||
namespace Webkul\PreOrder\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Routing\Router;
|
||||
use Webkul\SAASPreOrder\Shipping;
|
||||
use Webkul\PreOrder\Shipping;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Webkul\Shipping\Facades\Shipping as ShippingFacade;
|
||||
|
||||
class SAASPreOrderServiceProvider extends ServiceProvider
|
||||
class PreOrderServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $commands = [
|
||||
'Webkul\SAASPreOrder\Commands\Console\GenerateData'
|
||||
'Webkul\PreOrder\Commands\Console\GenerateData'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -54,7 +54,7 @@ class SAASPreOrderServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function bootModelObservers()
|
||||
{
|
||||
\Webkul\SAASPreOrder\Models\PreOrderItem::observe(\Webkul\SAASPreOrder\Observers\SAASPreOrderItemObserver::class);
|
||||
\Webkul\PreOrder\Models\PreOrderItem::observe(\Webkul\PreOrder\Observers\PreOrderItemObserver::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Repositories;
|
||||
namespace Webkul\PreOrder\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ class PreOrderItemRepository extends Repository
|
|||
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\SAASPreOrder\Contracts\PreOrderItem';
|
||||
return 'Webkul\PreOrder\Contracts\PreOrderItem';
|
||||
}
|
||||
|
||||
/**
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
|
@ -11,14 +11,14 @@
|
|||
<div class="page-title">
|
||||
<h1>{{ __('preorder::app.admin.preorders.title') }}</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="page-action">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
|
||||
{!! app('Webkul\SAASPreOrder\DataGrids\Admin\PreOrder')->render() !!}
|
||||
{!! app('Webkul\PreOrder\DataGrids\Admin\PreOrder')->render() !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
@inject('orderGrid', 'Webkul\SAASPreOrder\DataGrids\Admin\Order')
|
||||
|
||||
@inject('orderGrid', 'Webkul\PreOrder\DataGrids\Admin\Order')
|
||||
|
||||
{!! $orderGrid->render() !!}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
</a>
|
||||
@endif
|
||||
|
||||
@if ($order->canShip() && ! app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->resetScope()->isPreOrderPaymentOrder($order->id))
|
||||
@if ($order->canShip() && ! app('Webkul\PreOrder\Repositories\PreOrderItemRepository')->resetScope()->isPreOrderPaymentOrder($order->id))
|
||||
<a href="{{ route('admin.sales.shipments.create', $order->id) }}" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.sales.orders.shipment-btn-title') }}
|
||||
</a>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
<div class="sale-container">
|
||||
|
||||
<?php
|
||||
$preOrderItemRepository = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository');
|
||||
$preOrderItemRepository = app('Webkul\PreOrder\Repositories\PreOrderItemRepository');
|
||||
|
||||
$havePreOrderItems = $preOrderItemRepository->havePreOrderItems($order->id);
|
||||
?>
|
||||
|
|
@ -296,7 +296,7 @@
|
|||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@elseif ($preOrderItem = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->findOneByField('payment_order_item_id', $item->id))
|
||||
@elseif ($preOrderItem = app('Webkul\PreOrder\Repositories\PreOrderItemRepository')->findOneByField('payment_order_item_id', $item->id))
|
||||
<div class="pre-order-item-info">
|
||||
<span class="heading" @if($item->type == 'configurable')style="margin-top: 0"@endif>
|
||||
{{ __('preorder::app.admin.sales.orders.preorder-payment-information') }}
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
<tab name="{{ __('shop::app.customer.account.order.view.info') }}" :selected="true">
|
||||
|
||||
<?php
|
||||
$preOrderItemRepository = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository');
|
||||
$preOrderItemRepository = app('Webkul\PreOrder\Repositories\PreOrderItemRepository');
|
||||
|
||||
$havePreOrderItems = $preOrderItemRepository->havePreOrderItems($order->id);
|
||||
?>
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
</span>
|
||||
@endif
|
||||
</div>
|
||||
@elseif ($preOrderItem = app('Webkul\SAASPreOrder\Repositories\PreOrderItemRepository')->resetScope()->findOneByField('payment_order_item_id', $item->id))
|
||||
@elseif ($preOrderItem = app('Webkul\PreOrder\Repositories\PreOrderItemRepository')->resetScope()->findOneByField('payment_order_item_id', $item->id))
|
||||
<div class="pre-order-item-info">
|
||||
<span class="heading" @if($item->type == 'configurable')style="margin-top: 0"@endif>
|
||||
{{ __('preorder::app.shop.sales.orders.preorder-payment-information') }}
|
||||
|
|
@ -3,8 +3,6 @@
|
|||
@if (core()->getConfigData('preorder.settings.general.preorder_type') == 'partial')
|
||||
<p>{{ __('preorder::app.shop.products.percent-to-pay', ['percent' => core()->getConfigData('preorder.settings.general.percent')]) }}</p>
|
||||
@endif
|
||||
@else
|
||||
<p>{{ __('preorder::app.shop.products.nothing-to-pay') }}</p>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
|
@ -4,8 +4,6 @@
|
|||
@if (core()->getConfigData('preorder.settings.general.preorder_type') == 'partial')
|
||||
@if (core()->getConfigData('preorder.settings.general.percent'))
|
||||
<p style="font-weight: 600;">{{ __('preorder::app.shop.products.percent-to-pay', ['percent' => core()->getConfigData('preorder.settings.general.percent')]) }}</p>
|
||||
@else
|
||||
<p style="font-weight: 600;">{{ __('preorder::app.shop.products.nothing-to-pay') }}</p>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
|
@ -29,8 +27,6 @@
|
|||
@if (core()->getConfigData('preorder.settings.general.preorder_type') == 'partial')
|
||||
@if (core()->getConfigData('preorder.settings.general.percent'))
|
||||
<p style="font-weight: 600;">{{ __('preorder::app.shop.products.percent-to-pay', ['percent' => core()->getConfigData('preorder.settings.general.percent')]) }}</p>
|
||||
@else
|
||||
<p style="font-weight: 600;">{{ __('preorder::app.shop.products.nothing-to-pay') }}</p>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
|
@ -45,7 +41,7 @@
|
|||
@push('scripts')
|
||||
|
||||
<script>
|
||||
var variants = @json(app('Webkul\SAASPreOrder\Helpers\Product')->getPreOrderVariants($product));
|
||||
var variants = @json(app('Webkul\PreOrder\Helpers\Product')->getPreOrderVariants($product));
|
||||
|
||||
eventBus.$on('configurable-variant-selected-event', function(variantId) {
|
||||
if (typeof variants[variantId] != "undefined") {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder;
|
||||
namespace Webkul\PreOrder;
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Webkul\Checkout\Facades\Cart;
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'preorderseeder' => 'Webkul\SAASPreOrder\Helpers\PreOrderDataPurger'
|
||||
];
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\SAASPreOrder\Contracts;
|
||||
|
||||
interface PreOrderItem
|
||||
{
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function () {
|
||||
Route::get('/complete-preorder/{token}', 'Webkul\SAASPreOrder\Http\Controllers\Shop\PreOrderController@complete')->name('preorder.shop.preorder.complete');
|
||||
});
|
||||
|
|
@ -300,16 +300,16 @@ class StripeConnectController extends Controller
|
|||
|
||||
// admin or owner commission
|
||||
$ownerCommissionRate = env('STRIPE_ADMIN_COMMISSION') ?? 0.0;
|
||||
$ownerCommission = $baseGrandTotal * $ownerCommissionRate;
|
||||
$ownerCommission = ($baseGrandTotal * $ownerCommissionRate) / 100;
|
||||
|
||||
$applicationFee = round($ownerCommission, 2) * 100;
|
||||
$applicationFee = round($ownerCommission, 2);
|
||||
|
||||
$result = StripeCharge::create([
|
||||
"amount" => round(Cart::getCart()->base_grand_total - $applicationFee, 2) * 100,
|
||||
"currency" => Cart::getCart()->base_currency_code,
|
||||
"source" => $stripeToken,
|
||||
"description" => "Purchased ".Cart::getCart()->items_count." items on ".config('app.name'),
|
||||
"application_fee_amount" => $applicationFee,
|
||||
"application_fee_amount" => $applicationFee * 100,
|
||||
"statement_descriptor" => $this->statementDescriptor
|
||||
], [
|
||||
"stripe_account" => $sellerUserId
|
||||
|
|
@ -319,9 +319,9 @@ class StripeConnectController extends Controller
|
|||
|
||||
// admin's or owner's commission
|
||||
$ownerCommissionRate = env('STRIPE_ADMIN_COMMISSION') ?? 0.0;
|
||||
$ownerCommission = $baseGrandTotal * $ownerCommissionRate;
|
||||
$ownerCommission = ($baseGrandTotal * $ownerCommissionRate) / 100;
|
||||
|
||||
$applicationFee = round($ownerCommission, 2) * 100;
|
||||
$applicationFee = round($ownerCommission, 2);
|
||||
|
||||
$cart->update([
|
||||
'base_grand_total' => $cart->grand_total + $applicationFee,
|
||||
|
|
@ -333,7 +333,7 @@ class StripeConnectController extends Controller
|
|||
"currency" => Cart::getCart()->base_currency_code,
|
||||
"source" => $stripeToken,
|
||||
"description" => "Purchased ".Cart::getCart()->items_count." items on ".config('app.name'),
|
||||
"application_fee_amount" => $applicationFee,
|
||||
"application_fee_amount" => $applicationFee * 100,
|
||||
"statement_descriptor" => $this->statementDescriptor
|
||||
], [
|
||||
"stripe_account" => $sellerUserId
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<div class="item-detail" id="discount-detail" @if ($cart->discount_amount && $cart->discount_amount > 0) style="display: block;" @else style="display: none;" @endif>
|
||||
<label>
|
||||
<b>{{ __('shop::app.checkout.total.disc-amount') }}</b>
|
||||
|
|
|
|||