Merge pull request #116 from bagisto/jitendra

Jitendra
This commit is contained in:
JItendra Singh 2018-11-01 19:23:53 +05:30 committed by GitHub
commit 233eb2f80c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 1204 additions and 32916 deletions

View File

@ -9,6 +9,7 @@
"type": "project",
"require": {
"php": "^7.1.3",
"barryvdh/laravel-dompdf": "^0.8.0@dev",
"dimsav/laravel-translatable": "^9.0",
"fideloper/proxy": "^4.0",
"flynsarmy/db-blade-compiler": "*",
@ -31,22 +32,22 @@
"phpunit/phpunit": "^7.0"
},
"replace": {
"webkul/laravel-user": "self.version",
"webkul/laravel-admin": "self.version",
"webkul/laravel-ui": "self.version",
"webkul/laravel-core": "self.version",
"webkul/laravel-attribute": "self.version",
"webkul/laravel-checkout": "self.version",
"webkul/laravel-customer": "self.version",
"webkul/laravel-inventory": "self.version",
"webkul/laravel-category": "self.version",
"webkul/laravel-product": "self.version",
"webkul/laravel-shop": "self.version",
"webkul/laravel-theme": "self.version",
"webkul/laravel-shipping": "self.version",
"webkul/laravel-payment": "self.version",
"webkul/laravel-sales": "self.version",
"webkul/laravel-tax": "self.version"
"webkul/laravel-user": "v0.1.0",
"webkul/laravel-admin": "v0.1.0",
"webkul/laravel-ui": "v0.1.0",
"webkul/laravel-core": "v0.1.0",
"webkul/laravel-attribute": "v0.1.0",
"webkul/laravel-checkout": "v0.1.0",
"webkul/laravel-customer": "v0.1.0",
"webkul/laravel-inventory": "v0.1.0",
"webkul/laravel-category": "v0.1.0",
"webkul/laravel-product": "v0.1.0",
"webkul/laravel-shop": "v0.1.0",
"webkul/laravel-theme": "v0.1.0",
"webkul/laravel-shipping": "v0.1.0",
"webkul/laravel-payment": "v0.1.0",
"webkul/laravel-sales": "v0.1.0",
"webkul/laravel-tax": "v0.1.0"
},
"autoload": {
"classmap": [

View File

@ -199,6 +199,7 @@ return [
Prettus\Repository\Providers\RepositoryServiceProvider::class,
Konekt\Concord\ConcordServiceProvider::class,
Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
//Webkul packages
Webkul\Theme\Providers\ThemeServiceProvider::class,
@ -270,6 +271,7 @@ return [
'Image' => Intervention\Image\Facades\Image::class,
'Cart' => Webkul\Checkout\Facades\Cart::class,
'Core' => Webkul\Core\Facades\Core::class,
'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class
'DbView' => Flynsarmy\DbBladeCompiler\Facades\DbView::class,
'PDF' => Barryvdh\DomPDF\Facade::class
],
];
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/admin.js": "/js/admin.js",
"/css/admin.css": "/css/admin.css"
}
"/js/admin.js": "/js/admin.js?id=f1263c1a00f0c20034d6",
"/css/admin.css": "/css/admin.css?id=201f91bc553baa11139f"
}

View File

@ -103,10 +103,12 @@ class OrderDataGrid
'label' => 'Status',
'sortable' => true,
'wrapper' => function ($value) {
if($value == 'completed')
if($value == 'processing')
return '<span class="badge badge-md badge-success">Processing</span>';
else if($value == 'completed')
return '<span class="badge badge-md badge-success">Completed</span>';
else if($value == "cancelled")
return '<span class="badge badge-md badge-danger">Cancelled</span>';
else if($value == "canceled")
return '<span class="badge badge-md badge-danger">Canceled</span>';
else if($value == "closed")
return '<span class="badge badge-md badge-info">Closed</span>';
else if($value == "pending")

View File

@ -7,6 +7,7 @@ use Illuminate\Http\Response;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Sales\Repositories\OrderRepository as Order;
use Webkul\Sales\Repositories\InvoiceRepository as Invoice;
use PDF;
/**
* Sales Invoice controller
@ -135,4 +136,19 @@ class InvoiceController extends Controller
return view($this->_config['view'], compact('invoice'));
}
/**
* Print and download the for the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function print($id)
{
$invoice = $this->invoice->find($id);
$pdf = PDF::loadView('admin::sales.invoices.pdf', compact('invoice'))->setPaper('a4');
return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
}
}

View File

@ -139,6 +139,10 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::sales.invoices.view'
])->name('admin.sales.invoices.view');
Route::get('/invoices/print/{id}', 'Webkul\Admin\Http\Controllers\Sales\InvoiceController@print')->defaults('_config', [
'view' => 'admin::sales.invoices.print'
])->name('admin.sales.invoices.print');
// Sales Shipments Routes
Route::get('/shipments', 'Webkul\Admin\Http\Controllers\Sales\ShipmentController@index')->defaults('_config', [

View File

@ -28,14 +28,26 @@ $(document).ready(function () {
},
methods: {
onSubmit(e) {
onSubmit: function (e) {
this.toggleButtonDisable(true);
this.$validator.validateAll().then(result => {
if (result) {
e.target.submit();
} else {
this.toggleButtonDisable(false);
}
});
},
toggleButtonDisable (value) {
var buttons = document.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
buttons[i].disabled = value;
}
},
addServerErrors() {
var scope = null;
for (var key in serverErrors) {

View File

@ -145,6 +145,7 @@ return [
],
'invoices' => [
'id' => 'Id',
'invoice-id' => 'Invoice Id',
'date' => 'Invoice Date',
'order-id' => 'Order Id',
'customer-name' => 'Customer Name',
@ -157,6 +158,10 @@ return [
'qty-ordered' => 'Qty Ordered',
'qty-to-invoice' => 'Qty to Invoice',
'view-title' => 'Invoice #:invoice_id',
'bill-to' => 'Bill to',
'ship-to' => 'Ship to',
'print' => 'Print',
'order-date' => 'Order Date'
],
'shipments' => [
'id' => 'Id',
@ -318,6 +323,7 @@ return [
'zip_from' => 'Zip From',
'zip_to' => 'Zip To',
'state' => 'State',
'select-state' => 'Select a region, state or province.',
'country' => 'Country',
'tax_rate' => 'Rate',
'edit' => [
@ -325,7 +331,7 @@ return [
'edit-button-title' => 'Edit Rate'
],
'zip_code' => 'Zip Code',
'is_zip' => 'Enable Zip Range'
'is_zip' => 'Enable Zip Range',
],
],
@ -457,7 +463,10 @@ return [
'phone' => 'Phone',
'customer_group' => 'Customer Group',
'save-btn-title' => 'Save Customer',
'channel_name' => 'Channel Name'
'channel_name' => 'Channel Name',
'state' => 'State',
'select-state' => 'Select a region, state or province.',
'country' => 'Country'
],
'reviews' => [
'title' => 'Reviews',

View File

@ -37,7 +37,7 @@
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('admin::app.account.email') }}</label>
<label for="email" class="required">{{ __('admin::app.account.email') }}</label>
<input type="text" v-validate="'required|email'" class="control" id="email" name="email" value="{{ $user->email }}"/>
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>

View File

@ -0,0 +1,76 @@
<country-state></country-state>
@push('scripts')
<script type="text/x-template" id="country-state-template">
<div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">
{{ __('admin::app.customers.customers.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="country" name="country" v-model="country">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('country')">
@{{ errors.first('country') }}
</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">
{{ __('admin::app.customers.customers.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="!haveStates()"/>
<select v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="haveStates()">
<option value="">{{ __('admin::app.customers.customers.select-state') }}</option>
<option v-for='(state, index) in countryStates[country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
<span class="control-error" v-if="errors.has('state')">
@{{ errors.first('state') }}
</span>
</div>
</div>
</script>
<script>
Vue.component('country-state', {
template: '#country-state-template',
inject: ['$validator'],
data: () => ({
country: "{{ $countryCode }}",
state: "{{ $stateCode }}",
countryStates: @json(core()->groupedStatesByCountries())
}),
methods: {
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}
});
</script>
@endpush

View File

@ -1,4 +1,6 @@
{{ $address->name }}</br>
{{ $address->address1 }}, {{ $address->address2 ? $address->address2 . ',' : '' }} {{ $address->state }}</br>
{{ country()->name($address->country) }} {{ $address->postcode }}</br>
{{ $address->address1 }}, {{ $address->address2 ? $address->address2 . ',' : '' }}</br>
{{ $address->city }}</br>
{{ $address->state }}</br>
{{ country()->name($address->country) }} {{ $address->postcode }}</br></br>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $address->phone }}

View File

@ -0,0 +1,225 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Cache-control" content="no-cache">
<style type="text/css">
body, th, td, h5 {
font-size: 12px;
color: #000;
}
.container {
padding: 20px;
display: block;
}
.invoice-summary {
margin-bottom: 20px;
}
.table {
margin-top: 20px;
}
.table table {
width: 100%;
border-collapse: collapse;
text-align: left;
}
.table thead th {
font-weight: 700;
border-top: solid 1px #d3d3d3;
border-bottom: solid 1px #d3d3d3;
border-left: solid 1px #d3d3d3;
padding: 5px 10px;
background: #F4F4F4;
}
.table thead th:last-child {
border-right: solid 1px #d3d3d3;
}
.table tbody td {
padding: 5px 10px;
border-bottom: solid 1px #d3d3d3;
border-left: solid 1px #d3d3d3;
color: $font-color;
vertical-align: middle;
}
.table tbody td p {
margin: 0;
}
.table tbody td:last-child {
border-right: solid 1px #d3d3d3;
}
.sale-summary {
margin-top: 40px;
float: right;
}
.sale-summary tr td {
padding: 3px 5px;
}
.sale-summary tr.bold {
font-weight: 600;
}
.label {
color: #000;
font-weight: 600;
}
</style>
</head>
<body style="background-image: none;background-color: #fff;">
<div class="container">
<div class="invoice-summary">
<div class="row">
<span class="label">{{ __('admin::app.sales.invoices.invoice-id') }} -</span>
<span class="value">#{{ $invoice->id }}</span>
</div>
<div class="row">
<span class="label">{{ __('admin::app.sales.invoices.order-id') }} -</span>
<span class="value">#{{ $invoice->order_id }}</span>
</div>
<div class="row">
<span class="label">{{ __('admin::app.sales.invoices.order-date') }} -</span>
<span class="value">{{ $invoice->created_at->format('M d, Y') }}</span>
</div>
<div class="table address">
<table>
<thead>
<tr>
<th style="width: 50%">{{ __('admin::app.sales.invoices.bill-to') }}</th>
<th>{{ __('admin::app.sales.invoices.ship-to') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>{{ $invoice->order->billing_address->name }}</p>
<p>{{ $invoice->order->billing_address->address1 }}, {{ $invoice->order->billing_address->address2 ? $invoice->order->billing_address->address2 . ',' : '' }}</p>
<p>{{ $invoice->order->billing_address->city }}</p>
<p>{{ $invoice->order->billing_address->state }}</p>
<p>{{ country()->name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->billing_address->phone }}
</td>
<td>
<p>{{ $invoice->order->shipping_address->name }}</p>
<p>{{ $invoice->order->shipping_address->address1 }}, {{ $invoice->order->shipping_address->address2 ? $invoice->order->shipping_address->address2 . ',' : '' }}</p>
<p>{{ $invoice->order->shipping_address->city }}</p>
<p>{{ $invoice->order->shipping_address->state }}</p>
<p>{{ country()->name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
{{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->shipping_address->phone }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="table payment-shipment">
<table>
<thead>
<tr>
<th style="width: 50%">{{ __('admin::app.sales.orders.payment-method') }}</th>
<th>{{ __('admin::app.sales.orders.shipping-method') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ core()->getConfigData('paymentmethods.' . $invoice->order->payment->method . '.title') }}
</td>
<td>
{{ $invoice->order->shipping_title }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="table items">
<table>
<thead>
<tr>
<th>{{ __('admin::app.sales.orders.SKU') }}</th>
<th>{{ __('admin::app.sales.orders.product-name') }}</th>
<th>{{ __('admin::app.sales.orders.price') }}</th>
<th>{{ __('admin::app.sales.orders.qty') }}</th>
<th>{{ __('admin::app.sales.orders.subtotal') }}</th>
<th>{{ __('admin::app.sales.orders.tax-amount') }}</th>
<th>{{ __('admin::app.sales.orders.grand-total') }}</th>
</tr>
</thead>
<tbody>
@foreach ($invoice->items as $item)
<tr>
<td>{{ $item->child ? $item->child->sku : $item->sku }}</td>
<td>
{{ $item->name }}
@if ($html = $item->getOptionDetailHtml())
<p>{{ $html }}</p>
@endif
</td>
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
<td>{{ $item->qty }}</td>
<td>{{ core()->formatBasePrice($item->base_total) }}</td>
<td>{{ core()->formatBasePrice($item->base_tax_amount) }}</td>
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<table class="sale-summary">
<tr>
<td>{{ __('admin::app.sales.orders.subtotal') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_sub_total) }}</td>
</tr>
<tr>
<td>{{ __('admin::app.sales.orders.shipping-handling') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_shipping_amount) }}</td>
</tr>
<tr>
<td>{{ __('admin::app.sales.orders.tax') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_tax_amount) }}</td>
</tr>
<tr class="bold">
<td>{{ __('admin::app.sales.orders.grand-total') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($invoice->base_grand_total) }}</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@ -15,6 +15,9 @@
</div>
<div class="page-action">
<a href="{{ route('admin.sales.invoices.print', $invoice->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.invoices.print') }}
</a>
</div>
</div>

View File

@ -23,104 +23,72 @@
<div class="form-container">
@csrf()
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ old('identifier') }}"/>
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">{{ __('admin::app.configuration.tax-rates.state') }}</label>
<input v-validate="'required'" class="control" id="state" name="state" value="{{ old('state') }}"/>
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">{{ __('admin::app.configuration.tax-rates.country') }}</label>
<input v-validate="'required'" class="control" id="country" name="country" value="{{ old('country') }}"/>
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip" onclick="myFunction()">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
<label for="zip_code">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
<input class="control" id="zip_code" name="zip_code" value="{{ old('zip_code') }}"/>
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']" id="zip_from">
<label for="zip_from">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
<input v-validate="'numeric'" class="control" name="zip_from" value="{{ old('zip_from') }}"/>
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']" id="zip_to">
<label for="zip_to">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
<input v-validate="'numeric'" class="control" name="zip_to" value="{{ old('zip_to') }}"/>
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ old('tax_rate') }}"/>
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
<tax-rate-form></tax-rate-form>
</div>
</div>
</form>
</div>
@push('scripts')
<script>
@stop
window.onload = function () {
document.getElementById("zip_from").style.display = "none";
@push('scripts')
document.getElementById("zip_to").style.display = "none";
};
<script type="text/x-template" id="tax-rate-form-template">
<div>
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ old('identifier') }}"/>
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
function myFunction() {
value = document.getElementById('is_zip').checked;
@include ('admin::customers.country-state', ['countryCode' => old('country'), 'stateCode' => old('state')])
// console.log(value);
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip" v-model="is_zip">
<label class="checkbox-view" for="is_zip"></label>
{{ __('admin::app.configuration.tax-rates.is_zip') }}
</span>
</div>
if(value) {
document.getElementById("zip_from").style.display = "";
<div v-if="!is_zip" class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
<label for="zip_code" class="required">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
<input v-validate="'required'" class="control" id="zip_code" name="zip_code" value="{{ old('zip_code') }}"/>
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
</div>
document.getElementById("zip_to").style.display = "";
<span v-if="is_zip">
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']" id="zip_from">
<label for="zip_from" class="required">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
<input v-validate="'required'" class="control" name="zip_from" value="{{ old('zip_from') }}"/>
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
document.getElementById("zip_code").style.display = "none";
} else {
document.getElementById("zip_from").style.display = "none";
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']" id="zip_to">
<label for="zip_to" class="required">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
<input v-validate="'required'" class="control" name="zip_to" value="{{ old('zip_to') }}"/>
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
</span>
document.getElementById("zip_to").style.display = "none";
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ old('tax_rate') }}"/>
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
</div>
</script>
document.getElementById("zip_code").style.display = "";
}
}
</script>
@endpush
@stop
<script>
Vue.component('tax-rate-form', {
template: '#tax-rate-form-template',
inject: ['$validator'],
data: () => ({
is_zip: false
}),
});
</script>
@endpush

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.tax-rates.update', $data['id']) }}" @submit.prevent="onSubmit">
<form method="POST" action="{{ route('admin.tax-rates.update', $taxRate->id) }}" @submit.prevent="onSubmit">
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.configuration.tax-rates.edit.title') }}</h1>
@ -22,70 +22,46 @@
<div class="page-content">
<div class="form-container">
@method('PUT')
@csrf()
<accordian :title="'{{ __('admin::app.configuration.tax-rates.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
<div class="control-group" :class="[errors.has('identifier') ? 'has-error' : '']">
<label for="identifier" class="required">{{ __('admin::app.configuration.tax-rates.identifier') }}</label>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ $taxRate->identifier }}" disabled="disabled"/>
<input type="hidden" name="identifier" value="{{ $taxRate->identifier }}"/>
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
<input v-validate="'required'" class="control" id="identifier" name="identifier" value="{{ $data['identifier'] }}"/>
@include ('admin::customers.country-state', ['countryCode' => old('country') ?? $taxRate->country, 'stateCode' => old('state') ?? $taxRate->state])
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
<label for="zip_from" class="required">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ $data['zip_from'] }}" />
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
<label for="zip_to" class="required">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ $data['zip_to'] }}" />
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">{{ __('admin::app.configuration.tax-rates.state') }}</label>
<input v-validate="'required'" class="control" id="state" name="state" value="{{ $data['state'] }}" />
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">{{ __('admin::app.configuration.tax-rates.country') }}</label>
<input v-validate="'required'" class="control" id="country" name="country" value="{{ $data['country'] }}" />
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ $data['tax_rate'] }}" />
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
@if ($taxRate->is_zip)
<input type="hidden" id="is_zip" name="is_zip" value="{{ $taxRate->is_zip }}">
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
<label for="zip_from" class="required">{{ __('admin::app.configuration.tax-rates.zip_from') }}</label>
<input v-validate="'required'" class="control" id="zip_from" name="zip_from" value="{{ $taxRate->zip_from }}" />
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
</accordian>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
<label for="zip_to" class="required">{{ __('admin::app.configuration.tax-rates.zip_to') }}</label>
<input v-validate="'required'" class="control" id="zip_to" name="zip_to" value="{{ $taxRate->zip_to }}" />
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
@else
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']">
<label for="zip_code" class="required">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
<input v-validate="'required'" class="control" id="zip_code" name="zip_code" value="{{ $taxRate->zip_code }}" />
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
</div>
@endif
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.tax-rates.tax_rate') }}</label>
<input v-validate="'required'" class="control" id="tax_rate" name="tax_rate" value="{{ $taxRate->tax_rate }}" />
<span class="control-error" v-if="errors.has('tax_rate')">@{{ errors.first('tax_rate') }}</span>
</div>
</div>
</div>
</form>

View File

@ -1,8 +1,8 @@
const { mix } = require("laravel-mix");
require("laravel-mix-merge-manifest");
// var publicPath = 'publishable/assets';
var publicPath = "../../../public/vendor/webkul/admin/assets";
var publicPath = 'publishable/assets';
// var publicPath = "../../../public/vendor/webkul/admin/assets";
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();

View File

@ -21,7 +21,6 @@ class CreateCustomersTable extends Migration
$table->string('last_name');
$table->enum('gender', ['Male', 'Female']);
$table->date('date_of_birth')->nullable();
$table->string('phone')->unique()->nullable();
$table->string('email')->unique();
$table->tinyInteger('status')->default(1);
$table->string('password');

View File

@ -23,10 +23,15 @@ class AddressController extends Controller
* @return \Illuminate\Http\Response
*/
protected $_config;
protected $customer;
protected $address;
public function __construct(CustomerRepository $customer, CustomerAddressRepository $address)
public function __construct(
CustomerRepository $customer,
CustomerAddressRepository $address
)
{
$this->middleware('customer');
@ -42,7 +47,8 @@ class AddressController extends Controller
*
* @return view
*/
public function index() {
public function index()
{
return view($this->_config['view'])->with('addresses', $this->customer->addresses);
}
@ -51,7 +57,8 @@ class AddressController extends Controller
*
* @return view
*/
public function show() {
public function create()
{
return view($this->_config['view']);
}
@ -60,16 +67,17 @@ class AddressController extends Controller
*
* @return view
*/
public function create() {
public function store()
{
$data = collect(request()->input())->except('_token')->toArray();
$this->validate(request(), [
'address1' => 'string|required',
'address2' => 'string|required',
'country' => 'string|required',
'state' => 'string|required',
'city' => 'string|required',
'postcode' => 'required',
'phone' => 'required'
]);
$cust_id['customer_id'] = $this->customer->id;
@ -95,10 +103,11 @@ class AddressController extends Controller
*
* @return view
*/
public function showEdit($id) {
$address = $this->customer->addresses->where('id', $id);
public function edit($id)
{
$address = $this->address->find($id);
return view($this->_config['view'])->with('address', $address->first());
return view($this->_config['view'], compact('address'));
}
/**
@ -107,35 +116,32 @@ class AddressController extends Controller
*
* @return redirect
*/
public function edit($id) {
public function update($id)
{
$this->validate(request(), [
'address1' => 'string|required',
'address2' => 'string|required',
'country' => 'string|required',
'state' => 'string|required',
'city' => 'string|required',
'postcode' => 'required',
'postcode' => 'required'
]);
$data = collect(request()->input())->except('_token')->toArray();
if($this->address->update($data, $id)) {
Session()->flash('success','Address Updated Successfully.');
$this->address->update($data, $id);
return redirect()->route('customer.address.index');
} else {
Session()->flash('success','Address Cannot be Updated.');
Session()->flash('success','Address Updated Successfully.');
return redirect()->route('customer.address.edit');
}
return redirect()->route('customer.address.index');
}
/**
* To change the default address or make the default address, by default when first address is created will be the default address
*
* @return Mixed | @return response
* @return Response
*/
public function makeDefault($id) {
public function makeDefault($id)
{
if($default = $this->customer->default_address) {
$this->address->find($default->id)->update(['default_address' => 0]);
}
@ -156,7 +162,8 @@ class AddressController extends Controller
*
* @return response mixed
*/
public function destroy($id) {
public function destroy($id)
{
$this->address->delete($id);
session()->flash('success', trans('shop::app.address.delete.success'));

View File

@ -23,6 +23,12 @@ class CustomerController extends Controller
* @return \Illuminate\Http\Response
*/
protected $_config;
/**
* CustomerRepository object
*
* @var array
*/
protected $customer;
/**
@ -35,11 +41,14 @@ class CustomerController extends Controller
/**
* Create a new Repository instance.
*
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview
* @param Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview
* @return void
*/
public function __construct(CustomerRepository $customer , ProductReview $productReview)
public function __construct(
CustomerRepository $customer,
ProductReview $productReview
)
{
$this->middleware('customer');
@ -50,27 +59,16 @@ class CustomerController extends Controller
$this->productReview = $productReview;
}
/**
* For taking the customer to the dashboard after authentication
*
* @return view
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
}
/**
* Taking the customer to profile details page
*
* @return View
*/
public function index() {
$id = auth()->guard('customer')->user()->id;
public function index()
{
$customer = $this->customer->find(auth()->guard('customer')->user()->id);
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
return view($this->_config['view'], compact('customer'));
}
/**
@ -78,12 +76,11 @@ class CustomerController extends Controller
*
* @return View
*/
public function editIndex() {
$id = auth()->guard('customer')->user()->id;
public function editIndex()
{
$customer = $this->customer->find(auth()->guard('customer')->user()->id);
$customer = $this->getCustomer($id);
return view($this->_config['view'])->with('customer', $customer);
return view($this->_config['view'], compact('customer'));
}
/**
@ -91,7 +88,8 @@ class CustomerController extends Controller
*
* @return Redirect.
*/
public function edit() {
public function edit()
{
$id = auth()->guard('customer')->user()->id;
@ -101,7 +99,6 @@ class CustomerController extends Controller
'last_name' => 'string',
'gender' => 'required',
'date_of_birth' => 'date',
'phone' => 'string|size:10',
'email' => 'email|unique:customers,email,'.$id,
'password' => 'confirmed|required_if:oldpassword,!=,null'
@ -110,8 +107,8 @@ class CustomerController extends Controller
$data = collect(request()->input())->except('_token')->toArray();
if($data['oldpassword'] == null) {
$data = collect(request()->input())->except(['_token','password','password_confirmation','oldpassword'])->toArray();
if($this->customer->update($data, $id)) {
Session()->flash('success','Profile Updated Successfully');
@ -121,9 +118,7 @@ class CustomerController extends Controller
return redirect()->back();
}
} else {
$data = collect(request()->input())->except(['_token','oldpassword'])->toArray();
$data['password'] = bcrypt($data['password']);
@ -145,7 +140,8 @@ class CustomerController extends Controller
*
* @return Mixed
*/
public function orders() {
public function orders()
{
return view($this->_config['view']);
}
@ -154,7 +150,8 @@ class CustomerController extends Controller
*
* @return Mixed
*/
public function wishlist() {
public function wishlist()
{
return view($this->_config['view']);
}
@ -163,10 +160,11 @@ class CustomerController extends Controller
*
* @return Mixed
*/
public function reviews() {
public function reviews()
{
$reviews = $this->productReview->getCustomerReview();
return view($this->_config['view'],compact('reviews'));
return view($this->_config['view'], compact('reviews'));
}
/**
@ -174,7 +172,8 @@ class CustomerController extends Controller
*
* @return Mixed
*/
public function address() {
public function address()
{
return view($this->_config['view']);
}
}

View File

@ -15,7 +15,7 @@ class Customer extends Authenticatable
protected $table = 'customers';
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'phone', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter'];
protected $fillable = ['first_name', 'channel_id', 'last_name', 'gender', 'date_of_birth', 'email', 'password', 'customer_group_id', 'subscribed_to_news_letter'];
protected $hidden = ['password', 'remember_token'];

View File

@ -7,5 +7,5 @@ class CustomerAddress extends Model
{
protected $table = 'customer_addresses';
protected $fillable = ['customer_id' ,'address1', 'address2', 'country', 'state', 'city', 'postcode', 'default_address'];
protected $fillable = ['customer_id' ,'address1', 'address2', 'country', 'state', 'city', 'postcode', 'phone', 'default_address'];
}

View File

@ -195,7 +195,7 @@ class OrderRepository extends Repository
$totalQtyOrdered = 0;
$totalQtyCanceled = 0;
foreach($order->items as $item) {
foreach($order->items as $item) {
$totalQtyOrdered += $item->qty_ordered;
$totalQtyCanceled += $item->qty_canceled;
}
@ -241,8 +241,7 @@ class OrderRepository extends Repository
if($this->isInCanceledState($order))
$status = 'canceled';
if($this->isInClosedState($order))
elseif($this->isInClosedState($order))
$status = 'closed';
$order->status = $status;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,14 @@
"/js/shop.js": "/js/shop.js",
"/css/shop.css": "/css/shop.css"
}
=======
<<<<<<< HEAD
"/js/shop.js": "/js/shop.js",
"/css/shop.css": "/css/shop.css"
}
=======
"/js/shop.js": "/js/shop.js?id=55f8798e657b22f380c9",
"/css/shop.css": "/css/shop.css?id=9aad6e8b5717a4ac508c"
}
>>>>>>> b92c299cfd943822554521d62e1e7946f2ff8031
>>>>>>> dcf8dc17752b718972e34e478eac2fb8c5845450

View File

@ -5,7 +5,9 @@ namespace Webkul\Shop\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\InvoiceRepository;
use Auth;
use PDF;
/**
* Customer controlller for the customer basically for the tasks of customers
@ -30,19 +32,32 @@ class OrderController extends Controller
*/
protected $order;
/**
* InvoiceRepository object
*
* @var array
*/
protected $invoice;
/**
* Create a new controller instance.
*
* @param Webkul\Order\Repositories\OrderRepository $order
* @param Webkul\Order\Repositories\OrderRepository $order
* @param Webkul\Order\Repositories\InvoiceRepository $invoice
* @return void
*/
public function __construct(OrderRepository $order)
public function __construct(
OrderRepository $order,
InvoiceRepository $invoice
)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->order = $order;
$this->invoice = $invoice;
}
/**
@ -70,4 +85,19 @@ class OrderController extends Controller
return view($this->_config['view'], compact('order'));
}
/**
* Print and download the for the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function print($id)
{
$invoice = $this->invoice->find($id);
$pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4');
return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
}
}

View File

@ -178,36 +178,36 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
/* Routes for Addresses */
//Customer Address Show
Route::get('address/index', 'Webkul\Customer\Http\Controllers\AddressController@index')->defaults('_config', [
'view' => 'shop::customers.account.address.address'
Route::get('addresses', 'Webkul\Customer\Http\Controllers\AddressController@index')->defaults('_config', [
'view' => 'shop::customers.account.address.index'
])->name('customer.address.index');
//Customer Address Create Form Show
Route::get('address/create', 'Webkul\Customer\Http\Controllers\AddressController@show')->defaults('_config', [
Route::get('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@create')->defaults('_config', [
'view' => 'shop::customers.account.address.create'
])->name('customer.address.create');
//Customer Address Create Form Store
Route::post('address/create', 'Webkul\Customer\Http\Controllers\AddressController@create')->defaults('_config', [
Route::post('addresses/create', 'Webkul\Customer\Http\Controllers\AddressController@store')->defaults('_config', [
'view' => 'shop::customers.account.address.address',
'redirect' => 'customer.address.index'
])->name('customer.address.create');
//Customer Address Edit Form Show
Route::get('address/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@showEdit')->defaults('_config', [
Route::get('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [
'view' => 'shop::customers.account.address.edit'
])->name('customer.address.edit');
//Customer Address Edit Form Store
Route::post('address/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@edit')->defaults('_config', [
Route::put('addresses/edit/{id}', 'Webkul\Customer\Http\Controllers\AddressController@update')->defaults('_config', [
'redirect' => 'customer.address.index'
])->name('customer.address.edit');
//Customer Address Make Default
Route::get('address/default/{id}', 'Webkul\Customer\Http\Controllers\AddressController@makeDefault')->name('make.default.address');
Route::get('addresses/default/{id}', 'Webkul\Customer\Http\Controllers\AddressController@makeDefault')->name('make.default.address');
//Customer Address Delete
Route::get('address/delete/{id}', 'Webkul\Customer\Http\Controllers\AddressController@destroy')->name('address.delete');
Route::get('addresses/delete/{id}', 'Webkul\Customer\Http\Controllers\AddressController@destroy')->name('address.delete');
/* Wishlist route */
//Customer wishlist(listing)
@ -226,6 +226,11 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
'view' => 'shop::customers.account.orders.view'
])->name('customer.orders.view');
//Prints invoice
Route::get('orders/print/{id}', 'Webkul\Shop\Http\Controllers\OrderController@print')->defaults('_config', [
'view' => 'shop::customers.account.orders.print'
])->name('customer.orders.print');
/* Reviews route */
//Customer reviews(listing) only approved
Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [
@ -233,7 +238,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
])->name('customer.reviews.index');
//Customer review delete
Route::get('review/delete/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@destroy')->defaults('_config', [
Route::get('reviews/delete/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@destroy')->defaults('_config', [
'redirect' => 'customer.reviews.index'
])->name('customer.review.delete');
});

View File

@ -23,13 +23,25 @@ $(document).ready(function () {
methods: {
onSubmit: function (e) {
this.toggleButtonDisable(true);
this.$validator.validateAll().then(result => {
if (result) {
e.target.submit();
} else {
this.toggleButtonDisable(false);
}
});
},
toggleButtonDisable (value) {
var buttons = document.getElementsByTagName("button");
for (var i = 0; i < buttons.length; i++) {
buttons[i].disabled = value;
}
},
addServerErrors: function (scope = null) {
for (var key in serverErrors) {
var inputNames = [];

View File

@ -2862,7 +2862,6 @@ section.review {
td {
width: 250px;
text-transform: capitalize;
}
}
}
@ -2887,7 +2886,7 @@ section.review {
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
padding: 25px 1px 22px 15px;
padding: 20px;
margin-right: 15px;
margin-bottom: 15px;
@ -2899,11 +2898,9 @@ section.review {
.details {
font-weight: lighter;
margin-left: 15px;
span {
display: block;
margin: 8px;
}
.control-links {
@ -2921,8 +2918,8 @@ section.review {
.default-address {
position: absolute;
top: -3px;
right: -3px;
top: 10px;
right: 10px;
}
}
}

View File

@ -134,7 +134,8 @@ return [
'create' => 'Create Address',
'delete' => 'Delete',
'make-default' => 'Make Default',
'default' => 'Default'
'default' => 'Default',
'contact' => 'Contact'
],
'create' => [
@ -144,15 +145,17 @@ return [
'address2' => 'Address Line 2',
'country' => 'Country',
'state' => 'State',
'select-state' => 'Select a region, state or province.',
'city' => 'City',
'postcode' => 'Postal Code',
'submit' => 'Create Address'
'phone' => 'Phone',
'submit' => 'Save Address'
],
'edit' => [
'page-title' => 'Customer - Edit Address',
'title' => 'Edit Address',
'submit' => 'Edit Address'
'submit' => 'Save Address'
],
'delete' => [
'success' => 'Address Successfully Deleted',
@ -203,6 +206,13 @@ return [
'payment-method' => 'Payment Method',
'individual-invoice' => 'Invoice #:invoice_id',
'individual-shipment' => 'Shipment #:shipment_id',
'print' => 'Print',
'invoice-id' => 'Invoice Id',
'order-id' => 'Order Id',
'order-date' => 'Order Date',
'bill-to' => 'Bill to',
'ship-to' => 'Ship to',
'contact' => 'Contact'
]
],

View File

@ -0,0 +1,76 @@
<country-state></country-state>
@push('scripts')
<script type="text/x-template" id="country-state-template">
<div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country" class="required">
{{ __('shop::app.customer.account.address.create.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="country" name="country" v-model="country">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('country')">
@{{ errors.first('country') }}
</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">
{{ __('shop::app.customer.account.address.create.state') }}
</label>
<input type="text" v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="!haveStates()"/>
<select v-validate="'required'" class="control" id="state" name="state" v-model="state" v-if="haveStates()">
<option value="">{{ __('shop::app.customer.account.address.create.select-state') }}</option>
<option v-for='(state, index) in countryStates[country]' :value="state.code">
@{{ state.default_name }}
</option>
</select>
<span class="control-error" v-if="errors.has('state')">
@{{ errors.first('state') }}
</span>
</div>
</div>
</script>
<script>
Vue.component('country-state', {
template: '#country-state-template',
inject: ['$validator'],
data: () => ({
country: "{{ $countryCode }}",
state: "{{ $stateCode }}",
countryStates: @json(core()->groupedStatesByCountries())
}),
methods: {
haveStates() {
if(this.countryStates[this.country] && this.countryStates[this.country].length)
return true;
return false;
},
}
});
</script>
@endpush

View File

@ -1,9 +1,13 @@
@extends('shop::layouts.master')
@section('page_title')
{{ __('shop::app.customer.account.address.create.page-title') }}
@endsection
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="account-layout">
@ -12,13 +16,14 @@
<span class="account-heading">{{ __('shop::app.customer.account.address.create.title') }}</span>
<span></span>
</div>
<form method="post" action="{{ route('customer.address.create') }}" @submit.prevent="onSubmit">
<div class="account-table-content">
@csrf
<div class="control-group" :class="[errors.has('address1') ? 'has-error' : '']">
<label for="address1">{{ __('shop::app.customer.account.address.create.address1') }}</label>
<label for="address1" class="required">{{ __('shop::app.customer.account.address.create.address1') }}</label>
<input type="text" class="control" name="address1" v-validate="'required'">
<span class="control-error" v-if="errors.has('address1')">@{{ errors.first('address1') }}</span>
</div>
@ -29,37 +34,38 @@
<span class="control-error" v-if="errors.has('address2')">@{{ errors.first('address2') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country">{{ __('shop::app.customer.account.address.create.country') }}</label>
<input type="text" class="control" name="country" v-validate="'required'">
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state">{{ __('shop::app.customer.account.address.create.state') }}</label>
<input type="text" class="control" name="state" v-validate="'required'">
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country'), 'stateCode' => old('state')])
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city">{{ __('shop::app.customer.account.address.create.city') }}</label>
<label for="city" class="required">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" v-validate="'required'">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
</div>
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<label for="postcode" class="required">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" v-validate="'required'">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="required">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'required'">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="button-group">
<input class="btn btn-primary btn-lg" type="submit" value="{{ __('shop::app.customer.account.address.create.submit') }}">
<button class="btn btn-primary btn-lg" type="submit">
{{ __('shop::app.customer.account.address.edit.submit') }}
</button>
</div>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,8 +1,11 @@
@extends('shop::layouts.master')
@section('page_title')
{{ __('shop::app.customer.account.address.edit.page-title') }}
@endsection
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
@ -14,49 +17,48 @@
<span></span>
</div>
<form method="post" action="{{ route('customer.address.edit', $address['id']) }}">
<form method="post" action="{{ route('customer.address.edit', $address->id) }}" @submit.prevent="onSubmit">
<div class="account-table-content">
@method('PUT')
@csrf
<div class="control-group" :class="[errors.has('address1') ? 'has-error' : '']">
<label for="first_name">{{ __('shop::app.customer.account.address.create.address1') }}</label>
<input type="text" class="control" name="address1" v-validate="'required'" value ="{{ $address['address1'] }}">
<label for="first_name" class="required">{{ __('shop::app.customer.account.address.create.address1') }}</label>
<input type="text" class="control" name="address1" v-validate="'required'" value="{{ $address->address1 }}">
<span class="control-error" v-if="errors.has('address1')">@{{ errors.first('address1') }}</span>
</div>
<div class="control-group" :class="[errors.has('address2') ? 'has-error' : '']">
<label for="address2">{{ __('shop::app.customer.account.address.create.address2') }}</label>
<input type="text" class="control" name="address2" value ="{{ $address['address2'] }}">
<input type="text" class="control" name="address2" value ="{{ $address->address2 }}">
<span class="control-error" v-if="errors.has('address2')">@{{ errors.first('address2') }}</span>
</div>
<div class="control-group" :class="[errors.has('country') ? 'has-error' : '']">
<label for="country">{{ __('shop::app.customer.account.address.create.country') }}</label>
<input type="text" class="control" name="country" v-validate="'required'" value ="{{ $address['country'] }}">
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state">{{ __('shop::app.customer.account.address.create.state') }}</label>
<input type="text" class="control" name="state" v-validate="'required'" value ="{{ $address['state'] }}">
<span class="control-error" v-if="errors.has('state')">@{{ errors.first('state') }}</span>
</div>
@include ('shop::customers.account.address.country-state', ['countryCode' => old('country') ?? $address->country, 'stateCode' => old('state') ?? $address->state])
<div class="control-group" :class="[errors.has('city') ? 'has-error' : '']">
<label for="city">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" v-validate="'required|alpha_spaces'" value ="{{ $address['city'] }}">
<label for="city" class="required">{{ __('shop::app.customer.account.address.create.city') }}</label>
<input type="text" class="control" name="city" v-validate="'required|alpha_spaces'" value="{{ $address->city }}">
<span class="control-error" v-if="errors.has('city')">@{{ errors.first('city') }}</span>
</div>
<div class="control-group" :class="[errors.has('postcode') ? 'has-error' : '']">
<label for="postcode">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" v-validate="'required'" value ="{{ $address['postcode'] }}">
<label for="postcode" class="required">{{ __('shop::app.customer.account.address.create.postcode') }}</label>
<input type="text" class="control" name="postcode" v-validate="'required'" value="{{ $address->postcode }}">
<span class="control-error" v-if="errors.has('postcode')">@{{ errors.first('postcode') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone" class="required">{{ __('shop::app.customer.account.address.create.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'required'" value="{{ $address->phone }}">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="button-group">
<input class="btn btn-primary btn-lg" type="submit" value="{{ __('shop::app.customer.account.address.edit.submit') }}">
<button class="btn btn-primary btn-lg" type="submit">
{{ __('shop::app.customer.account.address.create.submit') }}
</button>
</div>
</div>
@ -64,4 +66,5 @@
</div>
</div>
@endsection

View File

@ -35,37 +35,34 @@
<div class="address-holder">
@foreach($addresses as $address)
<div class="address-card-1">
{{-- <div class="control-group">
<label class="radio-container">
<input class="control" type="radio" name="radio">
<span class="checkmark"></span>
</label>
</div> --}}
<div class="details">
<span class="bold">{{ auth()->guard('customer')->user()->name }}</span>
<span>{{ $address['address1'] }}</span>
<span>{{ $address['address2'] }}</span>
<span>{{ $address['country'] }}</span>
<span>{{ $address['state'] }}</span>
<span>{{ $address['city'] }}</span>
<span>{{ $address['postcode'] }}</span>
{{ $address->name }}</br>
{{ $address->address1 }}, {{ $address->address2 ? $address->address2 . ',' : '' }}</br>
{{ $address->city }}</br>
{{ $address->state }}</br>
{{ country()->name($address->country) }} {{ $address->postcode }}</br></br>
{{ __('shop::app.customer.account.address.index.contact') }} : {{ $address->phone }}
<div class="control-links mt-20">
<span>
<a href="{{ route('customer.address.edit', $address['id']) }}"><i class="icon pencil-lg-icon"></i></a>
<a href="{{ route('customer.address.edit', $address->id) }}">
{{ __('shop::app.customer.account.address.index.edit') }}
</a>
</span>
<span>
<a href="{{ route('address.delete', $address['id']) }}"><i class="icon trash-icon"></i></a>
<a href="{{ route('address.delete', $address->id) }}">
{{ __('shop::app.customer.account.address.index.delete') }}
</a>
</span>
</div>
@if($address['default_address'] == 1)
@if($address->default_address)
<span class="default-address badge badge-md badge-success">{{ __('shop::app.customer.account.address.index.default') }}</span>
@else
<div class="make-default mt-20">
<a href="{{ route('make.default.address', $address['id']) }}" class="btn btn-md btn-primary">{{ __('shop::app.customer.account.address.index.make-default') }}</a>
<a href="{{ route('make.default.address', $address->id) }}" class="btn btn-md btn-primary">{{ __('shop::app.customer.account.address.index.make-default') }}</a>
</div>
@endif

View File

@ -0,0 +1,225 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Cache-control" content="no-cache">
<style type="text/css">
body, th, td, h5 {
font-size: 12px;
color: #000;
}
.container {
padding: 20px;
display: block;
}
.invoice-summary {
margin-bottom: 20px;
}
.table {
margin-top: 20px;
}
.table table {
width: 100%;
border-collapse: collapse;
text-align: left;
}
.table thead th {
font-weight: 700;
border-top: solid 1px #d3d3d3;
border-bottom: solid 1px #d3d3d3;
border-left: solid 1px #d3d3d3;
padding: 5px 10px;
background: #F4F4F4;
}
.table thead th:last-child {
border-right: solid 1px #d3d3d3;
}
.table tbody td {
padding: 5px 10px;
border-bottom: solid 1px #d3d3d3;
border-left: solid 1px #d3d3d3;
color: $font-color;
vertical-align: middle;
}
.table tbody td p {
margin: 0;
}
.table tbody td:last-child {
border-right: solid 1px #d3d3d3;
}
.sale-summary {
margin-top: 40px;
float: right;
}
.sale-summary tr td {
padding: 3px 5px;
}
.sale-summary tr.bold {
font-weight: 600;
}
.label {
color: #000;
font-weight: 600;
}
</style>
</head>
<body style="background-image: none;background-color: #fff;">
<div class="container">
<div class="invoice-summary">
<div class="row">
<span class="label">{{ __('shop::app.customer.account.order.view.invoice-id') }} -</span>
<span class="value">#{{ $invoice->id }}</span>
</div>
<div class="row">
<span class="label">{{ __('shop::app.customer.account.order.view.order-id') }} -</span>
<span class="value">#{{ $invoice->order_id }}</span>
</div>
<div class="row">
<span class="label">{{ __('shop::app.customer.account.order.view.order-date') }} -</span>
<span class="value">{{ core()->formatDate($invoice->order->created_at, 'M d, Y') }}</span>
</div>
<div class="table address">
<table>
<thead>
<tr>
<th style="width: 50%">{{ __('shop::app.customer.account.order.view.bill-to') }}</th>
<th>{{ __('shop::app.customer.account.order.view.ship-to') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>{{ $invoice->order->billing_address->name }}</p>
<p>{{ $invoice->order->billing_address->address1 }}, {{ $invoice->order->billing_address->address2 ? $invoice->order->billing_address->address2 . ',' : '' }}</p>
<p>{{ $invoice->order->billing_address->city }}</p>
<p>{{ $invoice->order->billing_address->state }}</p>
<p>{{ country()->name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}</p>
{{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->billing_address->phone }}
</td>
<td>
<p>{{ $invoice->order->shipping_address->name }}</p>
<p>{{ $invoice->order->shipping_address->address1 }}, {{ $invoice->order->shipping_address->address2 ? $invoice->order->shipping_address->address2 . ',' : '' }}</p>
<p>{{ $invoice->order->shipping_address->city }}</p>
<p>{{ $invoice->order->shipping_address->state }}</p>
<p>{{ country()->name($invoice->order->shipping_address->country) }} {{ $invoice->order->shipping_address->postcode }}</p>
{{ __('shop::app.customer.account.order.view.contact') }} : {{ $invoice->order->shipping_address->phone }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="table payment-shipment">
<table>
<thead>
<tr>
<th style="width: 50%">{{ __('shop::app.customer.account.order.view.payment-method') }}</th>
<th>{{ __('shop::app.customer.account.order.view.shipping-method') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{ core()->getConfigData('paymentmethods.' . $invoice->order->payment->method . '.title') }}
</td>
<td>
{{ $invoice->order->shipping_title }}
</td>
</tr>
</tbody>
</table>
</div>
<div class="table items">
<table>
<thead>
<tr>
<th>{{ __('shop::app.customer.account.order.view.SKU') }}</th>
<th>{{ __('shop::app.customer.account.order.view.product-name') }}</th>
<th>{{ __('shop::app.customer.account.order.view.price') }}</th>
<th>{{ __('shop::app.customer.account.order.view.qty') }}</th>
<th>{{ __('shop::app.customer.account.order.view.subtotal') }}</th>
<th>{{ __('shop::app.customer.account.order.view.tax-amount') }}</th>
<th>{{ __('shop::app.customer.account.order.view.grand-total') }}</th>
</tr>
</thead>
<tbody>
@foreach ($invoice->items as $item)
<tr>
<td>{{ $item->child ? $item->child->sku : $item->sku }}</td>
<td>
{{ $item->name }}
@if ($html = $item->getOptionDetailHtml())
<p>{{ $html }}</p>
@endif
</td>
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
<td>{{ $item->qty }}</td>
<td>{{ core()->formatBasePrice($item->base_total) }}</td>
<td>{{ core()->formatBasePrice($item->base_tax_amount) }}</td>
<td>{{ core()->formatBasePrice($item->base_total + $item->base_tax_amount) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<table class="sale-summary">
<tr>
<td>{{ __('shop::app.customer.account.order.view.subtotal') }}</td>
<td>-</td>
<td>{{ core()->formatPrice($invoice->base_sub_total, $invoice->order->order_currency_code) }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.order.view.shipping-handling') }}</td>
<td>-</td>
<td>{{ core()->formatPrice($invoice->base_shipping_amount, $invoice->order->order_currency_code) }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.order.view.tax') }}</td>
<td>-</td>
<td>{{ core()->formatPrice($invoice->base_tax_amount, $invoice->order->order_currency_code) }}</td>
</tr>
<tr class="bold">
<td>{{ __('shop::app.customer.account.order.view.grand-total') }}</td>
<td>-</td>
<td>{{ core()->formatPrice($invoice->base_grand_total, $invoice->order->order_currency_code) }}</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@ -230,8 +230,6 @@
</div>
</tab>
{{-- {{ dd($order->invoices) }} --}}
@if ($order->invoices->count())
<tab name="{{ __('shop::app.customer.account.order.view.invoices') }}">
@ -240,6 +238,10 @@
<div class="sale-section">
<div class="secton-title">
<span>{{ __('shop::app.customer.account.order.view.individual-invoice', ['invoice_id' => $invoice->id]) }}</span>
<a href="{{ route('customer.orders.print', $invoice->id) }}" class="pull-right">
{{ __('shop::app.customer.account.order.view.print') }}
</a>
</div>
<div class="section-content">

View File

@ -25,41 +25,34 @@
@csrf
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name">{{ __('shop::app.customer.account.profile.fname') }}</label>
<input type="text" class="control" name="first_name" value="{{ $customer['first_name'] }}" v-validate="'required'">
<label for="first_name" class="required">{{ __('shop::app.customer.account.profile.fname') }}</label>
<input type="text" class="control" name="first_name" value="{{ old('first_name') ?? $customer->first_name }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name">{{ __('shop::app.customer.account.profile.lname') }}</label>
<input type="text" class="control" name="last_name" value="{{ $customer['last_name'] }}" v-validate="'required'">
<label for="last_name" class="required">{{ __('shop::app.customer.account.profile.lname') }}</label>
<input type="text" class="control" name="last_name" value="{{ old('last_name') ?? $customer->last_name }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
<label for="email">{{ __('shop::app.customer.account.profile.gender') }}</label>
<label for="email" class="required">{{ __('shop::app.customer.account.profile.gender') }}</label>
<select name="gender" class="control" v-validate="'required'">
<option value="Male" @if($customer['gender']=="Male") selected @endif>Male</option>
<option value="Female" @if($customer['gender']=="Female") selected @endif>Female</option>
<option value="Male" @if($customer->gender == "Male") selected @endif>Male</option>
<option value="Female" @if($customer->gender == "Female") selected @endif>Female</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
<div class="control-group">
<label for="date_of_birth">{{ __('shop::app.customer.account.profile.dob') }}</label>
<input type="date" class="control" name="date_of_birth" value="{{ $customer['date_of_birth'] }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('shop::app.customer.account.profile.phone') }}</label>
<input type="text" class="control" name="phone" value="{{ $customer['phone'] }}" v-validate="'required|digits:10'">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
<input type="date" class="control" name="date_of_birth" value="{{ old('date_of_birth') ?? $customer->date_of_birth }}">
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('shop::app.customer.account.profile.email') }}</label>
<input type="email" class="control" name="email" value="{{ $customer['email'] }}" v-validate="'required'">
<label for="email" class="required">{{ __('shop::app.customer.account.profile.email') }}</label>
<input type="email" class="control" name="email" value="{{ old('email') ?? $customer->email }}" v-validate="'required'">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>

View File

@ -30,32 +30,27 @@
<tbody>
<tr>
<td>{{ __('shop::app.customer.account.profile.fname') }}</td>
<td>{{ $customer['first_name'] }}</td>
<td>{{ $customer->first_name }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.lname') }}</td>
<td>{{ $customer['last_name'] }}</td>
<td>{{ $customer->last_name }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.gender') }}</td>
<td>{{ $customer['gender'] }}</td>
<td>{{ $customer->gender }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.dob') }}</td>
<td>{{ $customer['date_of_birth'] }}</td>
<td>{{ $customer->date_of_birth }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.email') }}</td>
<td>{{ $customer['email'] }}</td>
</tr>
<tr>
<td>{{ __('shop::app.customer.account.profile.phone') }}</td>
<td>{{ $customer['phone'] }}</td>
<td>{{ $customer->email }}</td>
</tr>
</tbody>
</table>

View File

@ -83,7 +83,7 @@
@push('scripts')
<script type="text/x-template" id="product-view-template">
<form method="POST" action="{{ route('cart.add', $product->id) }}" @click.prevent="onSubmit($event)">
<form method="POST" id="product-form" action="{{ route('cart.add', $product->id) }}" @click.prevent="onSubmit($event)">
<slot></slot>
@ -108,7 +108,7 @@
if(e.target.getAttribute('data-href')) {
window.location.href = e.target.getAttribute('data-href');
} else {
e.target.submit();
document.getElementById('product-form').submit();
}
}
});
@ -130,7 +130,6 @@
}
window.onload = function() {
var thumbList = document.getElementsByClassName('thumb-list')[0];
var thumbFrame = document.getElementsByClassName('thumb-frame');
var productHeroImage = document.getElementsByClassName('product-hero-image')[0];
@ -160,14 +159,6 @@
thumbList.style.height = productHeroImage.offsetHeight + "px";
}
}
};
</script>
@endpush
@endpush

View File

@ -73,21 +73,19 @@ class TaxRateController extends Controller
* @return mixed
*/
public function create() {
// dd(request()->all());
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier',
'is_zip' => 'sometimes',
'zip_code' => 'sometimes|required_without:is_zip',
'zip_from' => 'nullable|numeric|required_with:is_zip',
'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
'state' => 'required|string',
'country' => 'required|string',
'tax_rate' => 'required|numeric'
]);
$data = request()->all();
// dd($data);
if(isset($data['is_zip'])) {
$data['is_zip'] = 1;
unset($data['zip_code']);
@ -115,13 +113,11 @@ class TaxRateController extends Controller
*
* @return mixed
*/
public function edit($id)
{
$taxRate = $this->taxRate->find($id);
public function edit($id) {
$data = collect($this->taxRate->findOneByField('id', $id));
return view($this->_config['view'])->with('data', $data);
return view($this->_config['view'])->with('taxRate', $taxRate);
}
/**
@ -130,13 +126,13 @@ class TaxRateController extends Controller
*
* @return mixed
*/
public function update($id) {
public function update($id)
{
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier,'.$id,
'is_zip' => 'sometimes',
'zip_from' => 'nullable|numeric|required_with:is_zip',
'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
'state' => 'required|string',
'country' => 'required|string',
'tax_rate' => 'required|numeric'

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=b25a07d206dd0b89048f",
"/css/ui.css": "/css/ui.css?id=4335baa2920f1dd3e530"
"/css/ui.css": "/css/ui.css?id=856413ffffbe95f7b91d"
}

View File

@ -109,6 +109,7 @@ h2 {
color: #ffffff;
}
&:disabled,
&[disabled="disabled"],
&[disabled="disabled"]:hover,
&[disabled="disabled"]:active {
@ -118,6 +119,7 @@ h2 {
opacity: 1;
}
}
.dropdown-open {
position: relative;
}