<div class="aiz-topbar-item ml-2">
<div class="align-items-stretch d-flex dropdown">
<a class="dropdown-toggle no-arrow" data-toggle="dropdown" href="javascript:void(0);" role="button"
aria-haspopup="false" aria-expanded="false">
<span class="btn btn-icon p-0 d-flex justify-content-center align-items-center">
<span class="d-flex align-items-center position-relative">
<i class="las la-bell fs-24"></i>
<?php if($notificationsCount > 0): ?>
<span
class="badge badge-sm badge-dot badge-circle badge-primary position-absolute absolute-top-right"
style="padding: 6px"><?php echo e($notificationsCount); ?></span>
<?php endif; ?>
</span>
</span>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-animated dropdown-menu-lg py-0">
<div class="notifications" style="max-height: 300px; overflow-y: scroll;">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item active">
<a class="nav-link" data-toggle="tab" data-type="order" href="#orders-notifications"
role="tab" id="orders-tab"><?php echo e(translate('Orders')); ?></a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="orders-notifications" role="tabpanel">
<?php $__empty_1 = true; $__currentLoopData = $this->notifications->filter(function ($notification) {
return auth()->user()->user_type == 'seller' &&
isset($notification->data['status']) &&
$notification->data['status'] == 'confirmed';
}); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $notification): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
<li class="list-group-item d-flex justify-content-between align-items-center py-3">
<div class="media text-inherit">
<div class="media-body">
<p class="mb-1 text-truncate-2">
<?php $user_type = auth()->user()->user_type; ?>
<?php if($notification->type == 'App\Notifications\OrderNotification'): ?>
<?php
if ($user_type == 'admin'){
$route = route('all_orders.show', encrypt($notification->data['order_id']));
}
if ($user_type == 'seller'){
$route = route('seller.orders.show', encrypt($notification->data['order_id']));
}
?>
<?php if($notification->data['status'] != 'on_the_way'): ?>
<a href="<?php echo e($route); ?>"><?php echo e(translate('Order code: ')); ?>
: <?php echo e($notification->data['order_code']); ?>
- <?php echo e(translate(' has been ' . ucfirst(str_replace('_', ' ', $notification->data['status'])))); ?></a>
<?php else: ?>
<a href="<?php echo e($route); ?>"><?php echo e(translate('Order code: ')); ?>
: <?php echo e($notification->data['order_code']); ?>
- Se encuentra en camino</a>
<?php endif; ?>
<?php elseif($notification->type == 'App\Notifications\ShopVerificationNotification'): ?>
<?php if($user_type == 'admin'): ?>
<?php if($is_linkable): ?>
<a href="<?php echo e(route('sellers.show_verification_request', $notification->data['id'])); ?>">
<?php endif; ?>
<?php echo e($notification->data['name']); ?>:
<?php if($is_linkable): ?>
</a>
<?php endif; ?>
<?php else: ?>
<?php echo e(translate('Your ')); ?>
<?php endif; ?>
<?php echo e(translate('verification request has been '.$notification->data['status'])); ?>
<?php elseif($notification->type == 'App\Notifications\ShopProductNotification'): ?>
<?php
$product_id = $notification->data['id'];
$product_type = $notification->data['type'];
$product_name = $notification->data['name'];
$lang = env('DEFAULT_LANGUAGE');
$route = $user_type == 'admin'
? ( $product_type == 'physical'
? route('products.seller.edit', ['id'=>$product_id, 'lang'=>$lang])
: route('digitalproducts.edit', ['id'=>$product_id, 'lang'=>$lang] ))
: ( $product_type == 'physical'
? route('seller.products.edit', ['id'=>$product_id, 'lang'=>$lang])
: route('seller.digitalproducts.edit', ['id'=>$product_id, 'lang'=>$lang] ));
?>
<?php echo e(translate('Product : ')); ?>
<?php if($is_linkable): ?>
<a href="<?php echo e($route); ?>"><?php echo e($product_name); ?></a>
<?php else: ?>
<?php echo e($product_name); ?>
<?php endif; ?>
<?php echo e(translate(' is').' '.$notification->data['status']); ?>
<?php elseif($notification->type == 'App\Notifications\PayoutNotification'): ?>
<?php
$route = $user_type == 'admin'
? ( $notification->data['status'] == 'pending' ? route('withdraw_requests_all') : route('sellers.payment_histories'))
: ( $notification->data['status'] == 'pending' ? route('seller.money_withdraw_requests.index') : route('seller.payments.index'));
?>
<?php echo e($user_type == 'admin' ? $notification->data['name'].': ' : translate('Your')); ?>
<?php if($is_linkable ): ?>
<a href="<?php echo e($route); ?>"><?php echo e(translate('payment')); ?></a>
<?php else: ?>
<?php echo e(translate('payment')); ?>
<?php endif; ?>
<?php echo e(single_price($notification->data['payment_amount']).' '.translate('is').' '.translate($notification->data['status'])); ?>
<?php endif; ?>
</p>
<small class="text-muted">
<?php echo e(date('F j Y, g:i a', strtotime($notification->created_at))); ?>
</small>
</div>
</div>
</li>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
<li class="list-group-item">
<div class="py-4 text-center fs-16">
<?php echo e(translate('No notification found')); ?>
</div>
</li>
<?php endif; ?>
</div>
</div>
</div>
<div class="text-center border-top d-flex flex-column">
<a href="<?php echo e(route('seller.all-notification')); ?>" class="text-reset d-block py-2">
<?php echo e(translate('View All Notifications')); ?>
</a>
<a wire:click.prevent="markAllAsRead()" class="text-reset d-block py-2 c-pointer">
Marcar todas como leidas
</a>
</div>
</div>
</div>
<script>
const route = "<?php echo e(route('seller.orders.index')); ?>";
console.log(route)
document.addEventListener('livewire:load', function () {
Livewire.on('newNotification', (count, filteredData) => {
console.log(count, filteredData)
if (filteredData[0].data.status === 'confirmed') {
Swal.fire({
title: "¡Nueva Notificación!",
//text: "Tienes " + count + " Orden(es) sin verificar",
html: `Tienes <span style="color: #003b73; font-weight: bold;">${count}</span> Orden(es) sin verificar`,
type: "info",
showConfirmButton: true,
confirmButtonText: "Ver"
}).then((result) => {
console.log(1);
window.location.replace(route);
if (result.isConfirmed) {
console.log(2)
// Usamos replace para asegurar la redirección
window.location.replace(route);
}
});
}
});
});
</script>
</div>
<?php /**PATH /var/www/devs.lapieza.net/resources/views/livewire/seller-notifications.blade.php ENDPATH**/ ?> |