diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php index 3953c6a3d..59212d4fa 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/pdf.blade.php @@ -129,15 +129,17 @@ - -

{{ $invoice->order->billing_address->company_name ?? '' }}

-

{{ $invoice->order->billing_address->name }}

-

{{ $invoice->order->billing_address->address1 }}

-

{{ $invoice->order->billing_address->city }}

-

{{ $invoice->order->billing_address->state }}

-

{{ core()->country_name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}

- {{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->billing_address->phone }} - + @if ($invoice->order->billing_address) + +

{{ $invoice->order->billing_address->company_name ?? '' }}

+

{{ $invoice->order->billing_address->name }}

+

{{ $invoice->order->billing_address->address1 }}

+

{{ $invoice->order->billing_address->city }}

+

{{ $invoice->order->billing_address->state }}

+

{{ core()->country_name($invoice->order->billing_address->country) }} {{ $invoice->order->billing_address->postcode }}

+ {{ __('shop::app.checkout.onepage.contact') }} : {{ $invoice->order->billing_address->phone }} + + @endif @if ($invoice->order->shipping_address) diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php index 06fb088b8..0d392ac9b 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php @@ -107,14 +107,14 @@
{{ __('admin::app.sales.orders.customer-name') }} - {{ $invoice->address->name }} + {{ $invoice->order->customer_full_name }}
{!! view_render_event('sales.invoice.customer_name.after', ['order' => $order]) !!}
{{ __('admin::app.sales.orders.email') }} - {{ $invoice->address->email }} + {{ $invoice->order->customer_email }}
{!! view_render_event('sales.invoice.customer_email.after', ['order' => $order]) !!} @@ -124,36 +124,40 @@
- -
+ @if ($order->billing_address || $order->shipping_address) + +
-
-
- {{ __('admin::app.sales.orders.billing-address') }} -
+ @if ($order->billing_address) +
+
+ {{ __('admin::app.sales.orders.billing-address') }} +
-
- @include ('admin::sales.address', ['address' => $order->billing_address]) +
+ @include ('admin::sales.address', ['address' => $order->billing_address]) - {!! view_render_event('sales.invoice.billing_address.after', ['order' => $order]) !!} -
+ {!! view_render_event('sales.invoice.billing_address.after', ['order' => $order]) !!} +
+
+ @endif + + @if ($order->shipping_address) +
+
+ {{ __('admin::app.sales.orders.shipping-address') }} +
+ +
+ @include ('admin::sales.address', ['address' => $order->shipping_address]) + + {!! view_render_event('sales.invoice.shipping_address.after', ['order' => $order]) !!} +
+
+ @endif
- - @if ($order->shipping_address) -
-
- {{ __('admin::app.sales.orders.shipping-address') }} -
- -
- @include ('admin::sales.address', ['address' => $order->shipping_address]) - - {!! view_render_event('sales.invoice.shipping_address.after', ['order' => $order]) !!} -
-
- @endif -
-
+ + @endif
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php index 9eea51a26..ae545fdf6 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php @@ -284,6 +284,7 @@ @foreach ($order->items as $item) + {{ $item->getTypeInstance()->getOrderedItem($item)->sku }} @@ -467,13 +468,12 @@ - @foreach ($order->invoices as $invoice) #{{ $invoice->id }} {{ $invoice->created_at }} #{{ $invoice->order->increment_id }} - {{ $invoice->address->name }} + {{ $invoice->order->customer_full_name }} @if($invoice->state == "paid") {{ __('admin::app.sales.orders.invoice-status-paid') }} diff --git a/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php index 2d21639df..ef1db5579 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php @@ -87,7 +87,7 @@ - {{ $shipment->address->name }} + {{ $shipment->order->customer_full_name }}
@@ -97,7 +97,7 @@ - {{ $shipment->address->email }} + {{ $shipment->order->customer_email }}
@@ -106,37 +106,41 @@
- -
+ @if ($order->billing_address || $order->shipping_address) + +
-
-
- {{ __('admin::app.sales.orders.billing-address') }} -
+ @if ($order->billing_address) +
+
+ {{ __('admin::app.sales.orders.billing-address') }} +
-
+
- @include ('admin::sales.address', ['address' => $order->billing_address]) + @include ('admin::sales.address', ['address' => $order->billing_address]) + +
+
+ @endif + + @if ($order->shipping_address) +
+
+ {{ __('admin::app.sales.orders.shipping-address') }} +
+ +
+ + @include ('admin::sales.address', ['address' => $order->shipping_address]) + +
+
+ @endif -
- - @if ($order->shipping_address) -
-
- {{ __('admin::app.sales.orders.shipping-address') }} -
- -
- - @include ('admin::sales.address', ['address' => $order->shipping_address]) - -
-
- @endif - -
-
+ + @endif
diff --git a/packages/Webkul/Core/src/Database/Migrations/2020_08_12_114128_removing_foriegn_key.php b/packages/Webkul/Core/src/Database/Migrations/2020_08_12_114128_removing_foriegn_key.php new file mode 100644 index 000000000..0cbeb99e4 --- /dev/null +++ b/packages/Webkul/Core/src/Database/Migrations/2020_08_12_114128_removing_foriegn_key.php @@ -0,0 +1,53 @@ +dropForeign(['order_address_id']); + + OrderAddress::query() + ->orderBy('id', 'asc') // for some reason each() needs an orderBy in before + ->each(static function ($row) { + Invoice::query() + ->where('order_address_id', $row->additional['old_order_address_id']) + ->update(['order_address_id' => $row->id]); + }); + }); + + Schema::table('shipments', static function (Blueprint $table) { + $table->dropForeign(['order_address_id']); + + OrderAddress::query() + ->orderBy('id', 'asc') // for some reason each() needs an orderBy in before + ->each(static function ($row) { + Shipment::query() + ->where('order_address_id', $row->additional['old_order_address_id']) + ->update(['order_address_id' => $row->id]); + }); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + + } +}