Skip to content

Commit

Permalink
Merge pull request #468 from avored/developed
Browse files Browse the repository at this point in the history
Developed to master
  • Loading branch information
indpurvesh authored Sep 4, 2020
2 parents 2b2ccf5 + 06b5e50 commit 9ae834b
Show file tree
Hide file tree
Showing 31 changed files with 126,435 additions and 301 deletions.
63 changes: 63 additions & 0 deletions app/Http/Controllers/Account/OrderCommentController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace App\Http\Controllers\Account;

use App\Http\Controllers\Controller;
use App\Http\Requests\Account\OrderCommentRequest;
use App\Mails\OrderCommentMail;
use AvoRed\Framework\Database\Contracts\ConfigurationModelInterface;
use AvoRed\Framework\Database\Contracts\OrderCommentModelInterface;
use AvoRed\Framework\Database\Models\Customer;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;

class OrderCommentController extends Controller
{

/**
* Order Comment Repository
* @param OrderCommentRepository $orderCommentRepository
*/
protected $orderCommentRepository;
/**
* Configuration Repository
* @param ConfigurationRepository $configurationRepository
*/
protected $configurationRepository;


/**
* Order Comment Construct
* @param OrderCommentRepository $orderCommentRepository
*/
public function __construct(
OrderCommentModelInterface $orderCommentRepository,
ConfigurationModelInterface $configurationRepository
) {
$this->orderCommentRepository = $orderCommentRepository;
$this->configurationRepository = $configurationRepository;
}

/**
* Store Order Comment into database
* @param int $orderId //Do not need route binding at this stage.
* @param OrderCommentRequest $request
* @return Redirect
*/
public function store($orderId, OrderCommentRequest $request)
{
$data = $request->all();
$data['order_id'] = $orderId;
$data['commentable_id'] = Auth::guard('customer')->user()->id;
$data['commentable_type'] = Customer::class;
$data['is_private'] = false;

$this->orderCommentRepository->create($data);
$email = $this->configurationRepository->getValueByCode('order_email_address');
$url = route('admin.order.show', $orderId);
Mail::to($email)->send(new OrderCommentMail($url));

return redirect()->route('account.order.show', $orderId);
}

}
1 change: 1 addition & 0 deletions app/Http/Controllers/Account/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function index()
*/
public function show(Order $order)
{
$order->load(['products', 'orderComments.commentable', 'customer', 'shippingAddress.country', 'billingAddress.country']);
return view('account.order.show')
->with(compact('order'));
}
Expand Down
21 changes: 21 additions & 0 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;

class ForgotPasswordController extends Controller
{
Expand All @@ -29,4 +31,23 @@ public function __construct()
{
$this->middleware('guest');
}

/**
* Using an Customer Guard for the Auth.
* @return \Illuminate\Auth\SessionGuard
*/
protected function guard()
{
return Auth::guard('customer');
}

/**
* Get the broker to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker()
{
return Password::broker('customers');
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function create(array $data)
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'email' => $data['email'],
'password' => $data['password'],
'password' => bcrypt($data['password']),
]);
}

Expand Down
23 changes: 22 additions & 1 deletion app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;

class ResetPasswordController extends Controller
{
Expand All @@ -25,7 +27,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand All @@ -36,4 +38,23 @@ public function __construct()
{
$this->middleware('guest');
}

/**
* Using an Customer Guard for the Auth.
* @return \Illuminate\Auth\SessionGuard
*/
protected function guard()
{
return Auth::guard('customer');
}

/**
* Get the broker to be used during password reset.
*
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker()
{
return Password::broker('customers');
}
}
30 changes: 30 additions & 0 deletions app/Http/Requests/Account/OrderCommentRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Http\Requests\Account;

use Illuminate\Foundation\Http\FormRequest;

class OrderCommentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'content' => 'required'
];
}
}
37 changes: 37 additions & 0 deletions app/Mails/OrderCommentMail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Mails;

use AvoRed\Framework\Database\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class OrderCommentMail extends Mailable
{
use Queueable, SerializesModels;

/**
* User Order Show Url
* @param string $url
*/
public $url;


public function __construct(string $url)
{
$this->url = $url;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this
->subject('Order Comment')
->markdown('mails.comment-mail')
->with('url', $this->url);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"avored-components": "^0.1.6",
"avored-components": "^0.1",
"axios": "^0.19.2",
"cross-env": "^7.0.2",
"laravel-mix": "^5.0.4",
Expand Down
87,447 changes: 87,446 additions & 1 deletion public/css/app.css

Large diffs are not rendered by default.

25,704 changes: 25,702 additions & 2 deletions public/js/app.js

Large diffs are not rendered by default.

12,622 changes: 12,620 additions & 2 deletions public/js/avored.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions resources/components/CartPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ export default {
this.total += item.tax
this.totalTax += item.tax
})
this.total = this.subtotal + this.totalTax
this.total = this.subtotal + this.totalTax
}
}
};
Expand Down
7 changes: 4 additions & 3 deletions resources/components/CheckoutPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ export default {
this.shippingOption = val
},
changeSelectedShippingAddress(val) {
console.log(val[0] == this.newShippingAddressId)
console.log(val[0])
if (val[0] == this.newShippingAddressId) {
this.displayShippingAddressFields = true
this.selectedShippingAddress = null
this.shippingAddressId = null
} else {
this.selectedShippingAddress = this.shippingAddresses[val[0]]
this.shippingAddressId = this.shippingAddresses[val[0]]
this.shippingAddressId = val[0]
this.displayShippingAddressFields = false
}
},
Expand All @@ -98,7 +99,7 @@ export default {
this.billingAddressId = null
} else {
this.selectedBillingAddress = this.billingAddresses[val[0]]
this.billingAddressId = this.billingAddresses[val[0]]
this.billingAddressId = val[0]
this.displayBillingAddressFields = false
}
},
Expand Down
22 changes: 22 additions & 0 deletions resources/components/account/order/OrderShow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script>
import VueSimplemde from 'vue-simplemde'
export default {
props: [],
components: {
'vue-simplemde': VueSimplemde
},
data() {
return {
};
},
methods: {
}
};
</script>
<style>
@import '~simplemde/dist/simplemde.min.css';
</style>
1 change: 1 addition & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import './services/components'

/*************** AVORED CREATED VUE COMPONENTS ***************/

Vue.component('user-order-show', require('../components/account/order/OrderShow.vue').default)
Vue.component('address-save', require('../components/address/AddressSave.vue').default)
Vue.component('user-order-table', require('../components/account/order/OrderTable.vue').default)
Vue.component('account-upload', require('../components/account/AccountUpload.vue').default)
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/en/avored.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
],

'home' => 'Home',
'reset_password' => 'Reset Password',
'login' => 'Login',
'password_update' => 'Update Password',
'user_dashboard' => 'User Dashboard',
'show_order' => 'Show Order',
'cart' => 'Cart',
'page' => 'Page',
'product' => 'Product',
Expand Down
Loading

0 comments on commit 9ae834b

Please sign in to comment.