Issue #6010 fixed'

This commit is contained in:
jitendra 2022-03-15 10:37:58 +05:30
parent 0cbb94b91b
commit 32b6bd2bbe
9 changed files with 31 additions and 34 deletions

View File

@ -44,7 +44,7 @@
</div>
<notification
notif-title="{{ __('admin::app.notification.notification-title') }}"
notif-title="{{ __('admin::app.notification.notification-title', ['read' => 0]) }}"
get-notification-url="{{ route('admin.notification.get-notification') }}"
view-all="{{ route('admin.notification.index') }}"
order-view-url="{{ \URL::to('/') }}/admin/viewed-notifications/"

View File

@ -41,7 +41,7 @@
text-align: center;
}
.page-item .pagination-page-nav .active .page-link{
.page-item .pagination-page-nav .active .page-link {
color:#fff !important;
}
</style>

View File

@ -1,3 +0,0 @@
{
"/js/notification-app.js": "/js/notification-app.js"
}

View File

@ -14,7 +14,6 @@ class NotificationController extends Controller
*/
protected $_config;
/**
* NotificationRepository
*
@ -55,21 +54,19 @@ class NotificationController extends Controller
{
$params = request()->all();
$searchResults = [];
if(isset($params) && isset($params['page'])){
if (isset($params) && isset($params['page'])) {
unset($params['page']);
}
if(isset($params) && $params != NULL){
if (isset($params) && $params != NULL) {
$searchResults = $this->notificationRepository->getParamsData($params);
}else{
} else {
$searchResults = $this->notificationRepository->with('order')->latest()->paginate(10);
}
return [
'search_results' => $searchResults,
'total_unread' => $this->notificationRepository->where('read',0)->count()
'total_unread' => $this->notificationRepository->where('read', 0)->count()
];
}
@ -78,10 +75,12 @@ class NotificationController extends Controller
*
* @return \Illuminate\View\View
*/
public function viewedNotifications($orderId){
public function viewedNotifications($orderId)
{
if($notification = $this->notificationRepository->where('order_id',$orderId)->first()){
if ($notification = $this->notificationRepository->where('order_id', $orderId)->first()) {
$notification->read = 1;
$notification->save();
return redirect()->route('admin.sales.orders.view',$orderId);
@ -95,20 +94,20 @@ class NotificationController extends Controller
*
* @return array
*/
public function readAllNotifications(){
$this->notificationRepository->where('read',0)->update(['read' => 1]);
public function readAllNotifications()
{
$this->notificationRepository->where('read', 0)->update(['read' => 1]);
$params = [
"limit" => 5,
"read" => 0
"read" => 0
];
$searchResults = $this->notificationRepository->getParamsData($params);
return [
'search_results' => $searchResults,
'total_unread' => $this->notificationRepository->where('read',0)->count(),
'search_results' => $searchResults,
'total_unread' => $this->notificationRepository->where('read', 0)->count(),
'success_message' => trans('admin::app.notification.notification-marked-success')
];

View File

@ -17,7 +17,7 @@ class Order
protected $notificationRepository;
/**
* Create a new event instance.
* Create a new listener instance.
*
* @return void
*/
@ -33,7 +33,7 @@ class Order
*/
public function createOrder($order)
{
$this->notificationRepository->create(['type' => 'order','order_id' => $order->id]);
$this->notificationRepository->create(['type' => 'order', 'order_id' => $order->id]);
event(new CreateOrderNotification);
}
@ -45,9 +45,9 @@ class Order
*/
public function updateOrder($order)
{
$orderArray =[
'id' => $order->id,
'status' => $order->status
$orderArray = [
'id' => $order->id,
'status' => $order->status,
];
event(new UpdateOrderNotification($orderArray));

View File

@ -23,22 +23,22 @@ class NotificationRepository extends Repository
*/
public function getParamsData($params)
{
if(isset($params['id']) && isset($params['status'])){
return $params['status'] != 'All' ? $this->model->where(function($qry)use ($params){
if (isset($params['id']) && isset($params['status'])) {
return $params['status'] != 'All' ? $this->model->where(function($qry)use ($params) {
$qry->whereHas('order',function ($q) use ($params) {
$q->where(['status' => $params['status']]);
});
})->where('order_id',$params['id'])->with('order')->paginate(10) : $this->model->where('order_id',$params['id'])->with('order')->paginate(10) ;
}elseif (isset($params['status'])) {
})->where('order_id', $params['id'])->with('order')->paginate(10) : $this->model->where('order_id', $params['id'])->with('order')->paginate(10) ;
} else if (isset($params['status'])) {
return $params['status'] != 'All' ? $this->model->where(function($qry)use ($params){
$qry->whereHas('order',function ($q) use ($params) {
$q->where(['status' => $params['status']]);
});
})->with('order')->paginate(10): $this->model->with('order')->latest()->paginate(10);
}elseif(isset($params['limit'])){
} else if(isset($params['limit'])) {
return $this->model->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
}elseif(isset($params['id'])){
return $this->model->where('order_id',$params['id'])->with('order')->paginate(10);
} else if(isset($params['id'])) {
return $this->model->where('order_id', $params['id'])->with('order')->paginate(10);
}
return [];

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=f4cfa6bfa7a408f0ce86",
"/css/shop.css": "/css/shop.css?id=b082e3fe809438e6daf2"
"/css/shop.css": "/css/shop.css?id=0198b96b5e7871291a68"
}

View File

@ -3300,6 +3300,7 @@ section.review {
img {
height: 280px;
width: 280px;
max-width: 100%;
}
}