Merge branch 'main' of https://github.com/Ritikeshyadav/my-freeu into megha
This commit is contained in:
@@ -34,8 +34,7 @@ class DashboardController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
$check = checkSidebarAccess('dashboard');
|
||||
if(!$check)
|
||||
{
|
||||
if (!$check) {
|
||||
abort(404);
|
||||
}
|
||||
// dd(123);
|
||||
@@ -85,7 +84,7 @@ class DashboardController extends Controller
|
||||
$meetings = LeadTasksMeeting::where('host', auth()->user()->id)->meetings()->get();
|
||||
$users = User::admins()->get();
|
||||
// dd($leads);
|
||||
return view('Admin.general-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings','users','userCount','investingUserCount','totalProductCount'));
|
||||
return view('Admin.general-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings', 'users', 'userCount', 'investingUserCount', 'totalProductCount'));
|
||||
}
|
||||
|
||||
public function getCommissionData(Request $request)
|
||||
@@ -147,10 +146,10 @@ class DashboardController extends Controller
|
||||
return '₹ ' . $result;
|
||||
}
|
||||
|
||||
public function personalDashboard(Request $request){
|
||||
public function personalDashboard(Request $request)
|
||||
{
|
||||
$check = checkSidebarAccess('personal-dashboard');
|
||||
if(!$check)
|
||||
{
|
||||
if (!$check) {
|
||||
abort(404);
|
||||
}
|
||||
// dd(123);
|
||||
@@ -203,7 +202,7 @@ class DashboardController extends Controller
|
||||
$meetings = LeadTasksMeeting::where('host', (string)auth()->user()->id)->meetings()->get();
|
||||
// dd($meetings);
|
||||
$users = User::admins()->get();
|
||||
return view('Admin.personal-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings','users','userCount','investingUserCount','totalProductCount'));
|
||||
return view('Admin.personal-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings', 'users', 'userCount', 'investingUserCount', 'totalProductCount'));
|
||||
}
|
||||
|
||||
public function editTask(Request $request)
|
||||
@@ -224,7 +223,7 @@ class DashboardController extends Controller
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$leadNotes = LeadTasksMeeting::where('id',$request->task_id)->update([
|
||||
$leadNotes = LeadTasksMeeting::where('id', $request->task_id)->update([
|
||||
'subject' => $request->subject,
|
||||
'due_date' => $request->due_date,
|
||||
'priority' => $request->priority,
|
||||
@@ -241,7 +240,8 @@ class DashboardController extends Controller
|
||||
};
|
||||
}
|
||||
|
||||
public function editMeeting(Request $request){
|
||||
public function editMeeting(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->post(), [
|
||||
'meeting_id' => 'required',
|
||||
'location' => 'required',
|
||||
@@ -260,7 +260,7 @@ class DashboardController extends Controller
|
||||
return response()->json(['status' => 400, 'message' => $validationMessage]);
|
||||
}
|
||||
|
||||
$leadMeeting = LeadTasksMeeting::where('id',$request->meeting_id)->update([
|
||||
$leadMeeting = LeadTasksMeeting::where('id', $request->meeting_id)->update([
|
||||
'location' => $request->location,
|
||||
'from' => $request->from,
|
||||
'to' => $request->to,
|
||||
@@ -277,7 +277,6 @@ class DashboardController extends Controller
|
||||
} else {
|
||||
return response()->json(['status' => 400, 'message' => 'Error Creating Lead Meeting!']);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public function deleteTask(Request $request)
|
||||
@@ -319,7 +318,8 @@ class DashboardController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function updateSingleAdminNotification(Request $request){
|
||||
public function updateSingleAdminNotification(Request $request)
|
||||
{
|
||||
$user = User::find(auth()->user()->id);
|
||||
$user->notifications->where('id', $request->not_id)->markAsRead();
|
||||
return response()->json(['status' => 200, 'message' => 'Notification mark as read']);
|
||||
@@ -336,11 +336,12 @@ class DashboardController extends Controller
|
||||
return $messages;
|
||||
}
|
||||
}
|
||||
|
||||
public function readSpecificNotification(Request $request){
|
||||
|
||||
public function readSpecificNotification(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$id = $request->id;
|
||||
if($id){
|
||||
if ($id) {
|
||||
$notification = auth()->user()->unreadNotifications->where('id', $id)->markAsRead();
|
||||
// if(!$notification){
|
||||
$newUser = '';
|
||||
@@ -349,37 +350,42 @@ class DashboardController extends Controller
|
||||
$buyerForm = '';
|
||||
$contactUs = '';
|
||||
$leadAssigned = '';
|
||||
foreach(getAllAdminNotifications() as $data){
|
||||
$message = $data->data['message'] ;
|
||||
foreach (getAllAdminNotifications() as $data) {
|
||||
$message = $data->data['message'];
|
||||
$created_at = $data->created_at->diffForHumans();
|
||||
$id = $data->id;
|
||||
if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'New Users')
|
||||
{
|
||||
$newUser .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Submitted KYC'){
|
||||
$submittedKyc .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Seller Form'){
|
||||
$sellerForm .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Buyer Form'){
|
||||
$buyerForm .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Contact Us'){
|
||||
$contactUs .=$this->notificationData($message, $created_at, $id);
|
||||
}else if(array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Leads Assigned'){
|
||||
$leadAssigned .=$this->notificationData($message, $created_at, $id);
|
||||
|
||||
$read_at = $data->read_at;
|
||||
if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'New Users') {
|
||||
$newUser .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
} else if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Submitted KYC') {
|
||||
$submittedKyc .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
} else if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Seller Form') {
|
||||
$sellerForm .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
} else if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Buyer Form') {
|
||||
$buyerForm .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
} else if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Contact Us') {
|
||||
$contactUs .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
} else if (array_key_exists('notification_type', $data->data) && $data->data['notification_type'] == 'Leads Assigned') {
|
||||
$leadAssigned .= $this->notificationData($message, $created_at, $id, $read_at);
|
||||
}
|
||||
}
|
||||
$notificationStatus = array('newUser'=>$newUser,'submittedKyc'=>$submittedKyc,'sellerForm'=>$sellerForm,'buyerForm'=>$buyerForm,'contactUs'=>$contactUs,'leadAssigned'=>$leadAssigned);
|
||||
return response()->json(['status'=>200,'message'=>"marked as read",'data'=>$notificationStatus]);
|
||||
// }
|
||||
$notificationStatus = array('newUser' => $newUser, 'submittedKyc' => $submittedKyc, 'sellerForm' => $sellerForm, 'buyerForm' => $buyerForm, 'contactUs' => $contactUs, 'leadAssigned' => $leadAssigned);
|
||||
return response()->json(['status' => 200, 'message' => "marked as read", 'data' => $notificationStatus]);
|
||||
// }
|
||||
}
|
||||
return response()->json(['status'=>201,'message'=>"something error"]);
|
||||
return response()->json(['status' => 201, 'message' => "something error"]);
|
||||
}
|
||||
|
||||
public function notificationData($message, $created_at, $id){
|
||||
$data = ' <div class="d-flex align-items-start">
|
||||
|
||||
public function notificationData($message, $created_at, $id, $read_at)
|
||||
{
|
||||
$color = $read_at ? '#808080' : 'black';
|
||||
$font_weight = $read_at ? '300' : '600';
|
||||
$icon_color_light = $read_at ? 'bg-light-warning' : '';
|
||||
$icon_color_dark = $read_at ? '' : 'style="background-color: #c18948;"';
|
||||
$data = ' <a class="notify_id" data-notify-id="'.$id.'">
|
||||
<div class="d-flex align-items-start mb-2" style="color:' . $color . '">
|
||||
<div class="symbol symbol-35px me-4">
|
||||
<span class="symbol-label bg-light-warning">
|
||||
<span class="symbol-label '.$icon_color_light.'" '.$icon_color_dark.'>
|
||||
<span class="svg-icon svg-icon-2 svg-icon-warning">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path opacity="0.3" d="M20 15H4C2.9 15 2 14.1 2 13V7C2 6.4 2.4 6 3 6H21C21.6 6 22 6.4 22 7V13C22 14.1 21.1 15 20 15ZM13 12H11C10.5 12 10 12.4 10 13V16C10 16.5 10.4 17 11 17H13C13.6 17 14 16.6 14 16V13C14 12.4 13.6 12 13 12Z" fill="currentColor"/>
|
||||
@@ -389,11 +395,11 @@ class DashboardController extends Controller
|
||||
</span>
|
||||
</div>
|
||||
<div class="mb-0 me-2">
|
||||
<div class="text-gray-400 fs-7">'.$message.'</div>
|
||||
<div class="fs-7" style="font-weight: ' . $font_weight . ';">' . $message . '</div>
|
||||
</div>
|
||||
<span class="badge badge-light fs-8 me-2">'.$created_at.'</span>
|
||||
<a class="badge badge-light fs-8 notify_id" data-notify-id="'.$id.'"><i class="fa fa-trash" aria-hidden="true"></i></a>
|
||||
</div>';
|
||||
<span class="badge badge-light fs-8 me-2">' . $created_at . '</span>
|
||||
</div> </a>';
|
||||
// <a class="badge badge-light fs-8 notify_id" data-notify-id="'.$id.'"><i class="fa fa-trash" aria-hidden="true"></i></a>
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user