admin mail notification, review price

This commit is contained in:
prateek srivastava 2019-04-30 12:55:11 +05:30
parent 22e1ac57be
commit 4c101aa646
7 changed files with 244 additions and 13 deletions

View File

@ -30,6 +30,8 @@ MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SHOP_MAIL_FROM=shop@bagsaas.com
ADMIN_MAIL_TO=admin@bagsaas.com
PUSHER_APP_ID=
PUSHER_APP_KEY=

View File

@ -20,12 +20,13 @@ class Order {
/**
* @param mixed $order
*
* Send new shipment mail to the customer and inventory source
* Send new order Mail to the customer and admin
*/
public function sendNewOrderMail($order)
{
try {
Mail::send(new NewOrderNotification($order));
Mail::send(new NewAdminNotification($order));
} catch (\Exception $e) {
}

View File

@ -0,0 +1,49 @@
<?php
namespace Webkul\Admin\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
/**
* New Admin Mail class
*
* @author Jitendra Singh <jitendra@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class NewAdminNotification extends Mailable
{
use Queueable, SerializesModels;
/**
* The order instance.
*
* @var Order
*/
public $order;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($order)
{
$this->order = $order;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->to(env('ADMIN_MAIL_TO'))
->subject(trans('shop::app.mail.order.subject'))
->view('shop::emails.sales.new-admin-order');
}
}

View File

@ -457,7 +457,9 @@ return [
'subject' => 'New Order Confirmation',
'heading' => 'Order Confirmation!',
'dear' => 'Dear :customer_name',
'dear-admin' => 'Dear :admin_name',
'greeting' => 'Thanks for your Order :order_id placed on :created_at',
'greeting-admin' => 'Order Id :order_id placed on :created_at',
'summary' => 'Summary of Order',
'shipping-address' => 'Shipping Address',
'billing-address' => 'Billing Address',

View File

@ -0,0 +1,175 @@
@component('shop::emails.layouts.master')
<div style="text-align: center;">
<a href="{{ config('app.url') }}">
<img src="{{ bagisto_asset('images/logo.svg') }}">
</a>
</div>
<div style="padding: 30px;">
<div style="font-size: 20px;color: #242424;line-height: 30px;margin-bottom: 34px;">
<span style="font-weight: bold;">
{{ __('shop::app.mail.order.heading') }}
</span> <br>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{{ __('shop::app.mail.order.dear-admin', ['admin_name' => config('mail.from.name')]) }},
</p>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{!! __('shop::app.mail.order.greeting-admin', [
'order_id' => '<a href="' . route('customer.orders.view', $order->id) . '" style="color: #0041FF; font-weight: bold;">#' . $order->id . '</a>',
'created_at' => $order->created_at
])
!!}
</p>
</div>
<div style="font-weight: bold;font-size: 20px;color: #242424;line-height: 30px;margin-bottom: 20px !important;">
{{ __('shop::app.mail.order.summary') }}
</div>
<div style="display: flex;flex-direction: row;margin-top: 20px;justify-content: space-between;margin-bottom: 40px;">
<div style="line-height: 25px;">
<div style="font-weight: bold;font-size: 16px;color: #242424;">
{{ __('shop::app.mail.order.shipping-address') }}
</div>
<div>
{{ $order->shipping_address->name }}
</div>
<div>
{{ $order->shipping_address->address1 }}, {{ $order->shipping_address->state }}
</div>
<div>
{{ country()->name($order->shipping_address->country) }} {{ $order->shipping_address->postcode }}
</div>
<div>---</div>
<div style="margin-bottom: 40px;">
{{ __('shop::app.mail.order.contact') }} : {{ $order->shipping_address->phone }}
</div>
<div style="font-size: 16px;color: #242424;">
{{ __('shop::app.mail.order.shipping') }}
</div>
<div style="font-weight: bold;font-size: 16px;color: #242424;">
{{ $order->shipping_title }}
</div>
</div>
<div style="line-height: 25px;">
<div style="font-weight: bold;font-size: 16px;color: #242424;">
{{ __('shop::app.mail.order.billing-address') }}
</div>
<div>
{{ $order->billing_address->name }}
</div>
<div>
{{ $order->billing_address->address1 }}, {{ $order->billing_address->state }}
</div>
<div>
{{ country()->name($order->billing_address->country) }} {{ $order->billing_address->postcode }}
</div>
<div>---</div>
<div style="margin-bottom: 40px;">
{{ __('shop::app.mail.order.contact') }} : {{ $order->billing_address->phone }}
</div>
<div style="font-size: 16px; color: #242424;">
{{ __('shop::app.mail.order.payment') }}
</div>
<div style="font-weight: bold;font-size: 16px; color: #242424;">
{{ core()->getConfigData('sales.paymentmethods.' . $order->payment->method . '.title') }}
</div>
</div>
</div>
@foreach ($order->items as $item)
<div style="background: #FFFFFF;border: 1px solid #E8E8E8;border-radius: 3px;padding: 20px;margin-bottom: 10px">
<p style="font-size: 18px;color: #242424;line-height: 24px;margin-top: 0;margin-bottom: 10px;font-weight: bold;">
{{ $item->name }}
</p>
<div style="margin-bottom: 10px;">
<label style="font-size: 16px;color: #5E5E5E;">
{{ __('shop::app.mail.order.price') }}
</label>
<span style="font-size: 18px;color: #242424;margin-left: 40px;font-weight: bold;">
{{ core()->formatPrice($item->price, $order->order_currency_code) }}
</span>
</div>
<div style="margin-bottom: 10px;">
<label style="font-size: 16px;color: #5E5E5E;">
{{ __('shop::app.mail.order.quantity') }}
</label>
<span style="font-size: 18px;color: #242424;margin-left: 40px;font-weight: bold;">
{{ $item->qty_ordered }}
</span>
</div>
@if ($html = $item->getOptionDetailHtml())
<div style="">
<label style="margin-top: 10px; font-size: 16px;color: #5E5E5E; display: block;">
{{ $html }}
</label>
</div>
@endif
</div>
@endforeach
<div style="font-size: 16px;color: #242424;line-height: 30px;float: right;width: 40%;margin-top: 20px;">
<div>
<span>{{ __('shop::app.mail.order.subtotal') }}</span>
<span style="float: right;">
{{ core()->formatPrice($order->sub_total, $order->order_currency_code) }}
</span>
</div>
<div>
<span>{{ __('shop::app.mail.order.shipping-handling') }}</span>
<span style="float: right;">
{{ core()->formatPrice($order->shipping_amount, $order->order_currency_code) }}
</span>
</div>
<div>
<span>{{ __('shop::app.mail.order.tax') }}</span>
<span style="float: right;">
{{ core()->formatPrice($order->tax_amount, $order->order_currency_code) }}
</span>
</div>
<div style="font-weight: bold">
<span>{{ __('shop::app.mail.order.grand-total') }}</span>
<span style="float: right;">
{{ core()->formatPrice($order->grand_total, $order->order_currency_code) }}
</span>
</div>
</div>
<div style="margin-top: 65px;font-size: 16px;color: #5E5E5E;line-height: 24px;display: inline-block">
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{!!
__('shop::app.mail.order.help', [
'support_email' => '<a style="color:#0041FF" href="mailto:' . env('ADMIN_MAIL_TO') . '">' . env('ADMIN_MAIL_TO'). '</a>'
])
!!}
</p>
<p style="font-size: 16px;color: #5E5E5E;line-height: 24px;">
{{ __('shop::app.mail.order.thanks') }}
</p>
</div>
</div>
@endcomponent

View File

@ -0,0 +1,13 @@
<div class="product-price mt-10">
@inject ('priceHelper', 'Webkul\Product\Helpers\Price')
@if ($product->type == 'configurable')
<span class="pro-price">{{ core()->currency($priceHelper->getMinimalPrice($product)) }}</span>
@else
@if ($priceHelper->haveSpecialPrice($product))
<span class="pro-price">{{ core()->currency($priceHelper->getSpecialPrice($product)) }}</span>
@else
<span class="pro-price">{{ core()->currency($product->price) }}</span>
@endif
@endif
</div>

View File

@ -26,19 +26,8 @@
</a>
</div>
<div class="product-price mt-10">
@inject ('priceHelper', 'Webkul\Product\Helpers\Price')
@include('shop::products.review-price')
@if ($product->type == 'configurable')
<span class="pro-price">{{ core()->currency($priceHelper->getMinimalPrice($product)) }}</span>
@else
@if ($priceHelper->haveSpecialPrice($product))
<span class="pro-price">{{ core()->currency($priceHelper->getSpecialPrice($product)) }}</span>
@else
<span class="pro-price">{{ core()->currency($product->price) }}</span>
@endif
@endif
</div>
</div>
<div class="review-form">