notifications finish
This commit is contained in:
parent
c62359287a
commit
437cf39bda
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Sarga\API\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Sarga\API\Http\Resources\Customer\OrderResource;
|
||||
use Sarga\Shop\Repositories\OrderItemRepository;
|
||||
use Sarga\Shop\Repositories\OrderRepository;
|
||||
|
|
@ -41,6 +42,8 @@ class Orders extends OrderController
|
|||
$order = $this->orderRepository->updateOrderStatus($order);
|
||||
$order = $this->orderRepository->calculateTotals($order);
|
||||
|
||||
Event::dispatch('sales.order.update-status.item', $order);
|
||||
|
||||
return response(['data'=>[
|
||||
'order' => new OrderResource($order)],
|
||||
'success' => true,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\Admin\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class OrderChangedEvent implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(protected $data)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Broadcast with data.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function broadcastWith()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return new Channel('notification');
|
||||
}
|
||||
|
||||
/**
|
||||
* Seperate queue.
|
||||
*
|
||||
* Command: `php artisan queue:work --queue=broadcastable`
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function broadcastQueue()
|
||||
{
|
||||
return 'broadcastable';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast as.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'update-notification';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\Admin\Listeners;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Sarga\Admin\Events\OrderChangedEvent;
|
||||
use Webkul\Notification\Repositories\NotificationRepository;
|
||||
|
||||
class Notification implements ShouldQueue
|
||||
{
|
||||
|
||||
public function orderItem(\Webkul\Sales\Models\Order $order){
|
||||
// $this->notificationRepository->create(['type' => 'order', 'order_id' => $order->id]);
|
||||
$orderArray = [
|
||||
'id' => $order->id,
|
||||
'status' => 'item_cancelled',
|
||||
];
|
||||
event(new OrderChangedEvent);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\Admin\src\Listeners;
|
||||
namespace Sarga\Admin\Listeners;
|
||||
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Log;
|
|||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Sarga\Admin\Listeners\Customer;
|
||||
use Sarga\Admin\Listeners\Notification;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
|
@ -19,6 +20,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
public function boot(){
|
||||
Event::listen('customer.registration.after', [Customer::class,'register']);
|
||||
Event::listen('checkout.order.save.after', 'Webkul\Marketplace\Listeners\Order@afterPlaceOrder');
|
||||
Event::listen('sales.order.update-status.item', [Notification::class,'orderItem']);
|
||||
// select engine, count(*) as TABLES, concat(round(sum(table_rows)/1000000,2),'M') as rowlar, concat(round(sum(data_length)/(1024*1024*1024),2),'G') as DATA, concat(round(sum(index_length)/(1024*1024*1024),2),'G') as idx from information_schema.TABLES where table_schema not in('mysql', 'merformance_schema', 'information_schema') group by engine order by sum(data_length+index_length) desc limit 10;
|
||||
// Event::listen('bagisto.admin.catalog.category.create_form_accordian.general.after', function($viewRenderEventManager) {
|
||||
// $viewRenderEventManager->addTemplate('sarga_admin::catalog.categories.scrap.create');
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
$orderStatus = [
|
||||
'all' => trans('admin::app.notification.status.all'),
|
||||
'pending' => trans('admin::app.notification.status.pending'),
|
||||
'item_cancelled' => trans('admin::app.notification.status.pending'),
|
||||
'canceled'=> trans('admin::app.notification.status.canceled'),
|
||||
'closed' => trans('admin::app.notification.status.closed'),
|
||||
'completed'=> trans('admin::app.notification.status.completed'),
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
|
||||
$orderStatusMessages = [
|
||||
'pending' => trans('admin::app.notification.order-status-messages.pending'),
|
||||
'item_cancelled' => trans('admin::app.notification.order-status-messages.pending'),
|
||||
'canceled'=> trans('admin::app.notification.order-status-messages.canceled'),
|
||||
'closed' => trans('admin::app.notification.order-status-messages.closed'),
|
||||
'completed'=> trans('admin::app.notification.order-status-messages.completed'),
|
||||
|
|
@ -47,6 +49,14 @@
|
|||
.page-item .pagination-page-nav .active .page-link {
|
||||
color:#fff !important;
|
||||
}
|
||||
.notif li .item_cancelled {
|
||||
background-color: darkgreen;
|
||||
}
|
||||
.item_cancelled {
|
||||
background-image: url(../images/notification-checked.svg);
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
|
|
@ -140,6 +150,10 @@
|
|||
icon: 'pending-icon',
|
||||
message: 'Order Pending'
|
||||
},
|
||||
item_cancelled : {
|
||||
icon: 'pending-icon',
|
||||
message: 'Order Changed'
|
||||
},
|
||||
processing : {
|
||||
icon: 'processing-icon',
|
||||
message: 'Order Processing'
|
||||
|
|
|
|||
Loading…
Reference in New Issue