From 018584111e1ca2d7c6dee2a17dc4f649cd9d2089 Mon Sep 17 00:00:00 2001 From: Purvesh Date: Sun, 8 Jul 2018 10:49:40 +1200 Subject: [PATCH 1/4] updates for custom module upload and extract from admin --- resources/views/layouts/app.blade.php | 9 +++++ resources/views/module/create.blade.php | 42 +++++++++++++++++++++++ routes/web.php | 2 +- src/Http/Controllers/ModuleController.php | 38 ++++++++++++++++++++ src/Http/Requests/UploadModuleRequest.php | 31 +++++++++++++++++ 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 resources/views/module/create.blade.php create mode 100644 src/Http/Requests/UploadModuleRequest.php diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d329c47..00d51fd 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -48,6 +48,15 @@ @endif + @if(session()->has('errorNotificationText')) + + @endif {!! Breadcrumb::render(Route::getCurrentRoute()->getName() ) !!} diff --git a/resources/views/module/create.blade.php b/resources/views/module/create.blade.php new file mode 100644 index 0000000..3b4c45e --- /dev/null +++ b/resources/views/module/create.blade.php @@ -0,0 +1,42 @@ +@extends('avored-ecommerce::layouts.app') + +@section('content') + +
+
+
+
+ {{ __('avored-ecommerce::module.module-upload') }} +
+
+
+ + @csrf() + +
+ + +
+ +
+ + + Cancel +
+ +
+ +
+
+
+
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index fdf0aa3..712e9a3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -69,7 +69,7 @@ /** -------- Modules ROUTES -------- **/ Route::get('module', 'ModuleController@index')->name('module.index'); Route::get('module/create', 'ModuleController@create')->name('module.create'); - Route::get('module/{module}', 'ModuleController@show')->name('module.show'); + Route::post('module', 'ModuleController@store')->name('module.store'); Route::get('themes', 'ThemeController@index')->name('theme.index'); Route::get('themes/create', 'ThemeController@create')->name('theme.create'); diff --git a/src/Http/Controllers/ModuleController.php b/src/Http/Controllers/ModuleController.php index 5b29425..4de62d5 100644 --- a/src/Http/Controllers/ModuleController.php +++ b/src/Http/Controllers/ModuleController.php @@ -3,6 +3,8 @@ namespace AvoRed\Ecommerce\Http\Controllers; use AvoRed\Framework\Modules\Facade as Module; +use AvoRed\Ecommerce\Http\Requests\UploadModuleRequest; +use ZipArchive; class ModuleController extends Controller { @@ -18,4 +20,40 @@ public function index() return view('avored-ecommerce::module.index') ->with('modules', $modules); } + + /** + * Display upload module forms + * + * @return \Illuminate\Http\Response + */ + public function create() + { + return view('avored-ecommerce::module.create'); + } + + /** + * Store and Extract upload module zip files + * + * @param \AvoRed\Ecommerce\Http\Requests\UploadModuleRequest $request + * @return \Illuminate\Http\RedirectResponse + */ + public function store(UploadModuleRequest $request) + { + $path = storage_path('app/' . $request->module_zip_file->store('public/uploads/modules')); + + $zip = new ZipArchive; + + if ($zip->open($path) === true) { + $extractPath = base_path('modules'); + $zip->extractTo($extractPath); + $zip->close(); + + return redirect()->route('admin.module.index') + ->with('notificationText', 'Module Extracted successfully'); + } else { + return redirect() + ->back() + ->with('errorNotificationText', 'There is some issue: Please check your permission and try again later!'); + } + } } diff --git a/src/Http/Requests/UploadModuleRequest.php b/src/Http/Requests/UploadModuleRequest.php new file mode 100644 index 0000000..4c7d545 --- /dev/null +++ b/src/Http/Requests/UploadModuleRequest.php @@ -0,0 +1,31 @@ + Date: Mon, 9 Jul 2018 13:55:53 +1200 Subject: [PATCH 2/4] updated view file to use vuejs component --- resources/lang/en/lang.php | 4 +- resources/views/attribute/_fields.blade.php | 26 +++++-- resources/views/attribute/create.blade.php | 28 ++++++- resources/views/attribute/edit.blade.php | 28 ++++++- .../views/auth/passwords/email.blade.php | 45 ++++++----- .../views/auth/passwords/reset.blade.php | 75 ++++++++++--------- resources/views/category/_fields.blade.php | 3 - resources/views/page/_fields.blade.php | 59 +++++++++++++-- resources/views/page/create.blade.php | 28 ++++++- resources/views/page/edit.blade.php | 28 ++++++- resources/views/page/index.blade.php | 2 +- 11 files changed, 242 insertions(+), 84 deletions(-) diff --git a/resources/lang/en/lang.php b/resources/lang/en/lang.php index f97437f..9176d8c 100644 --- a/resources/lang/en/lang.php +++ b/resources/lang/en/lang.php @@ -1,7 +1,6 @@ 'AvoRed Admin Login', 'admin-login-forget-password-link' => 'Forgot your Password?', 'admin-login-button-title' => 'Login', + 'admin-reset-button-title' => 'Send Password Reset Link', 'admin-password-label' => 'Password', + 'admin-confirm-password-label' => 'Confirm Password', 'admin-email-label' => 'Email Address', 'admin-dashboard-total-user-title' => 'Total User', @@ -40,5 +41,4 @@ 'address.configuration.title' => 'Address Configuration List', 'cancel' => 'Cancel', - ]; diff --git a/resources/views/attribute/_fields.blade.php b/resources/views/attribute/_fields.blade.php index fbbaa5b..84e62aa 100644 --- a/resources/views/attribute/_fields.blade.php +++ b/resources/views/attribute/_fields.blade.php @@ -1,5 +1,22 @@ -@include('avored-ecommerce::forms.text',['name' => 'name','label' => __('avored-ecommerce::attribute.name')]) -@include('avored-ecommerce::forms.text',['name' => 'identifier','label' => __('avored-ecommerce::attribute.identifier')]) + + + + + + attributeDropdownOptions->count() > 0) { $editMode = true; - $hiddenClass = ""; + $hiddenClass = ''; } ?> diff --git a/resources/views/attribute/create.blade.php b/resources/views/attribute/create.blade.php index 5fa2ad0..761fb3c 100644 --- a/resources/views/attribute/create.blade.php +++ b/resources/views/attribute/create.blade.php @@ -2,7 +2,7 @@ @section('content') -
+
{{ __('avored-ecommerce::attribute.create') }}
@@ -25,4 +25,28 @@
-@endsection \ No newline at end of file +@endsection + +@push('scripts') + + + + +@endpush \ No newline at end of file diff --git a/resources/views/attribute/edit.blade.php b/resources/views/attribute/edit.blade.php index 0587d76..e6f53a5 100644 --- a/resources/views/attribute/edit.blade.php +++ b/resources/views/attribute/edit.blade.php @@ -2,7 +2,7 @@ @section('content') -
+
{{ __('avored-ecommerce::attribute.edit') }}
@@ -27,4 +27,28 @@
-@endsection \ No newline at end of file +@endsection + +@push('scripts') + + + + +@endpush \ No newline at end of file diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php index 7b893d1..020f872 100644 --- a/resources/views/auth/passwords/email.blade.php +++ b/resources/views/auth/passwords/email.blade.php @@ -41,23 +41,22 @@ action="{{ route('admin.password.reset.token') }}"> @csrf -
- - - - @if ($errors->has('email')) - - {{ $errors->first('email') }} - - @endif - -
+ +
- -
@@ -80,17 +79,23 @@ var app = new Vue({ el: '#reset-password-page', data : { - email: '' + email: '', + autofocus:true }, computed: { - isLoginDisbled: function() { - + isSendPasswordSubmitDisbled: function() { if(this.email != "") { return false; } - return true; - + } + }, + methods: { + changeModelValue: function(val,fieldName) { + + if(fieldName == "email") { + this.email = val; + } } } }); diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php index f80a12d..b288302 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/auth/passwords/reset.blade.php @@ -36,44 +36,36 @@ action="{{ route('admin.password.email.post') }}"> @csrf -
- - + + + + + + + + - @if ($errors->has('email')) - - {{ $errors->first('email') }} - - @endif -
- -
- - - - @if ($errors->has('password')) - - {{ $errors->first('password') }} - - @endif - -
- -
- - - - @if ($errors->has('password_confirmation')) - - {{ $errors->first('password_confirmation') }} - - @endif - -
- -@include('avored-ecommerce::forms.text',['name' => 'meta_title','label' => 'Meta Title']) -@include('avored-ecommerce::forms.text',['name' => 'meta_description','label' => 'Meta Description']) + + + + +
diff --git a/resources/views/page/create.blade.php b/resources/views/page/create.blade.php index f8cc4b7..34732e8 100644 --- a/resources/views/page/create.blade.php +++ b/resources/views/page/create.blade.php @@ -1,7 +1,7 @@ @extends('avored-ecommerce::layouts.app') @section('content') -
+
@@ -26,4 +26,28 @@
-@endsection \ No newline at end of file +@endsection + +@push('scripts') + + + + +@endpush diff --git a/resources/views/page/edit.blade.php b/resources/views/page/edit.blade.php index e2d1617..2673830 100644 --- a/resources/views/page/edit.blade.php +++ b/resources/views/page/edit.blade.php @@ -1,7 +1,7 @@ @extends('avored-ecommerce::layouts.app') @section('content') -
+
@@ -26,4 +26,28 @@
-@endsection \ No newline at end of file +@endsection + +@push('scripts') + + + + +@endpush \ No newline at end of file diff --git a/resources/views/page/index.blade.php b/resources/views/page/index.blade.php index ef3d023..d2a16eb 100644 --- a/resources/views/page/index.blade.php +++ b/resources/views/page/index.blade.php @@ -10,4 +10,4 @@ {!! DataGrid::render($dataGrid) !!}
-@stop \ No newline at end of file +@stop From 23b349584aa9d14ed7549c530c71a1ada44b9609 Mon Sep 17 00:00:00 2001 From: Purvesh Date: Fri, 13 Jul 2018 08:52:17 +1200 Subject: [PATCH 3/4] fixed the stripe payment currency code --- resources/views/payment/stripe/index.blade.php | 6 ------ src/Payment/Stripe/Payment.php | 15 ++------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/resources/views/payment/stripe/index.blade.php b/resources/views/payment/stripe/index.blade.php index cee0d7a..bdb477b 100644 --- a/resources/views/payment/stripe/index.blade.php +++ b/resources/views/payment/stripe/index.blade.php @@ -121,12 +121,6 @@ function stripeTokenHandler(token) { hiddenInput.setAttribute('value', token.id); formWrapper.appendChild(hiddenInput); - var hiddenInput = document.createElement('input'); - hiddenInput.setAttribute('type', 'hidden'); - hiddenInput.setAttribute('name', 'payment_option'); - hiddenInput.setAttribute('value', 'stripe'); - formWrapper.appendChild(hiddenInput); - } diff --git a/src/Payment/Stripe/Payment.php b/src/Payment/Stripe/Payment.php index 2818846..0b0d969 100644 --- a/src/Payment/Stripe/Payment.php +++ b/src/Payment/Stripe/Payment.php @@ -7,7 +7,6 @@ use AvoRed\Framework\Models\Database\Configuration; use AvoRed\Framework\Payment\Payment as PaymentEcommerce; use AvoRed\Framework\Payment\Contracts\Payment as PaymentContracts; -use AvoRed\Ecommerce\Models\Database\User; class Payment extends PaymentEcommerce implements PaymentContracts { @@ -91,20 +90,10 @@ public function process($orderData, $cartProducts, $request) $apiKey = Configuration::getConfiguration(self::CONFIG_SECRET_KEY); Stripe::setApiKey($apiKey); - //dd($orderData); - //$user = User::find($orderData['user_id']); - //$customer = \Stripe\Customer::create([ - // 'email' => $user->email, - // 'description' => 'Customer for One of Charge ' . $user->id, - // 'source' => $request->get('stripeToken') - // ]); - - //dd($request->all()); - //dd($request->get('stripeToken')); - + $currencyCode = Configuration::getConfiguration('general_site_currency'); $response = Charge::create([ 'amount' => $totalCents, - 'currency' => 'nzd', + 'currency' => $currencyCode, 'source' => $request->get('stripeToken'), // obtained with Stripe.js 'description' => 'AvoRed E commerce Payment', ]); From 9b211078d9231007b457bd11f47bc2e96ef5d79a Mon Sep 17 00:00:00 2001 From: Purvesh Date: Mon, 16 Jul 2018 13:37:41 +1200 Subject: [PATCH 4/4] updated free shipping to use new avoredfieldcheckout --- .../views/shipping/free-shipping.blade.php | 36 +++++++++++++++++++ src/Shipping/FreeShipping.php | 16 +++++++-- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/resources/views/shipping/free-shipping.blade.php b/resources/views/shipping/free-shipping.blade.php index 526fa52..188aa98 100644 --- a/resources/views/shipping/free-shipping.blade.php +++ b/resources/views/shipping/free-shipping.blade.php @@ -1,3 +1,39 @@ + +@if($shippingOption->enable()) +
+ + has('shipping_option')) + class="is-invalid form-check-input shipping_option_radio" + @else + class="shipping_option_radio form-check-input" + @endif + + /> + + + @if ($errors->has('shipping_option')) +
+ {{ $errors->first('shipping_option') }} +
+ @endif + +
+ +@endif + @push('scripts')