Skip to content

Commit

Permalink
Merge pull request #533 from avored/developed
Browse files Browse the repository at this point in the history
Developed
  • Loading branch information
indpurvesh authored Jan 31, 2021
2 parents d59df37 + 422fe79 commit ad2aed3
Show file tree
Hide file tree
Showing 17 changed files with 959 additions and 838 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ docker-compose.yml
docker-command.md
public/avored-admin
public/mix-manifest.json
/vue
48 changes: 42 additions & 6 deletions app/Http/Requests/Order/OrderPlaceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace App\Http\Requests\Order;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;

class OrderPlaceRequest extends FormRequest
{
Expand All @@ -23,11 +25,45 @@ public function authorize()
*/
public function rules()
{
return [
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email|unique:users,email',
'password' => 'required|string|min:6|confirmed'
];
$rules = [];
$request = $this->request->all();

if (!Auth::guard('customer')->check()) {
$rules['first_name'] = 'required|max:255';
$rules['last_name'] = 'required|max:255';
$rules['email'] = 'required|email|unique:users,email';
$rules['password'] = 'required|string|min:6|confirmed';
}

if (Arr::get($request, 'use_different_address')) {
$rules['billing.first_name'] = 'required|max:255';
$rules['billing.last_name'] = 'required|max:255';
$rules['billing.company_name'] = 'required|max:255';
$rules['billing.phone'] = 'required|max:255';
$rules['billing.address1'] = 'required|max:255';
$rules['billing.address2'] = 'required|max:255';
$rules['billing.country_id'] = 'required';
$rules['billing.state'] = 'required';
$rules['billing.city'] = 'required|max:255';
$rules['billing.postcode'] = 'required|max:255';
}

if (!Arr::get($request, 'shipping.address_id')) {
$rules['shipping.first_name'] = 'required|max:255';
$rules['shipping.last_name'] = 'required|max:255';
$rules['shipping.company_name'] = 'required|max:255';
$rules['shipping.phone'] = 'required|max:255';
$rules['shipping.address1'] = 'required|max:255';
$rules['shipping.address2'] = 'required|max:255';
$rules['shipping.country_id'] = 'required';
$rules['shipping.state'] = 'required';
$rules['shipping.city'] = 'required|max:255';
$rules['shipping.postcode'] = 'required|max:255';
}

$rules['payment_option'] = 'required';
$rules['shipping_option'] = 'required';

return $rules;
}
}
2 changes: 1 addition & 1 deletion modules/avored/cash-on-delivery/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require" : {
"php": "^7.2",
"avored/module-installer" : "1.*",
"avored/framework" : "~3.1"
"avored/framework" : "~3.2"
},
"autoload" : {
"classmap" : [
Expand Down
3 changes: 3 additions & 0 deletions modules/avored/cash-on-delivery/dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/vendor/avored/js/cash-on-delivery.js": "/vendor/avored/js/cash-on-delivery.js"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<template>
<div>
<avored-toggle
label-text="Cash On Delivery"
field-name="payment_option"
toggle-on-value="a-cash-on-delivery"
></avored-toggle>
</div>
</template>

<script>
export default {
Expand Down
10 changes: 8 additions & 2 deletions modules/avored/cash-on-delivery/resources/views/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<avored-cash-on-delivery>
<avored-cash-on-delivery inline-template>
<avored-toggle
label-text="Cash On Delivery"
field-name="payment_option"
error-text="{{ $errors->first('payment_option') }}"
toggle-on-value="a-cash-on-delivery"
></avored-toggle>
</avored-cash-on-delivery>
@push('scripts')
<script src="{{ asset('vendor/avored/js/cash-on-delivery.js') }}"></script>
<script src="{{ asset('vendor/avored/js/cash-on-delivery.js') }}"></script>
@endpush
2 changes: 1 addition & 1 deletion modules/avored/pickup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require" : {
"php": "^7.2",
"avored/module-installer" : "1.*",
"avored/framework" : "~3.1"
"avored/framework" : "~3.2"
},
"autoload" : {
"classmap" : [
Expand Down
2 changes: 1 addition & 1 deletion modules/avored/review/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"require" : {
"php" : ">=7.1.3",
"avored/module-installer" : "1.*",
"avored/framework": "^3.0"
"avored/framework": "^3.2"
},
"autoload" : {
"classmap" : [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
:init-reviews="{{ json_encode($reviews) }}"></catawlog-avored-review>
</div>
@push('scripts')
<script src="/admin/js/avored-review.js"></script>
<script src="{{ route('admin.script', 'avored.admin.review.js') }}"></script>
@endpush
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ class="px-4 py-2 font-semibold inline-block text-white leading-7 hover:text-whit
</div>

@push('scripts')
<script src="/js/avored-review.js"></script>
<script src="{{ route('admin.script', 'avored.review.js') }}"></script>
@endpush
20 changes: 19 additions & 1 deletion modules/avored/review/src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace AvoRed\Review;

use AvoRed\Assets\AssetItem;
use AvoRed\Assets\Support\Facades\Asset;
use AvoRed\Review\Database\Contracts\ProductReviewModelInterface;
use AvoRed\Review\Database\Repository\ProductReviewRepository;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use AvoRed\Review\Http\ViewComposers\ProductReviewComposer;
use AvoRed\Framework\Support\Facades\Breadcrumb as BreadcrumbFacade;
use AvoRed\Framework\Support\Facades\Tab;
use AvoRed\Framework\Tab\TabItem;

Expand All @@ -32,8 +33,25 @@ public function boot()
public function register()
{
$this->app->bind(ProductReviewModelInterface::class, ProductReviewRepository::class);
$this->registerAssets();
}


/**
* Registering AvoRed Assets.
* @return void
*/
public function registerAssets()
{
Asset::registerJS(function (AssetItem $item) {
$item->key('avored.admin.review.js')
->path(__DIR__ . '/../dist/js/admin-review.js');
});
Asset::registerJS(function (AssetItem $item) {
$item->key('avored.review.js')
->path(__DIR__ . '/../dist/js/review.js');
});
}
/**
* Registering AvoRed featured Resource
* e.g. Route, View, Database & Translation Path
Expand Down
Loading

0 comments on commit ad2aed3

Please sign in to comment.