fixed user access for company
This commit is contained in:
parent
fe3a69e9f7
commit
521e3b084c
|
|
@ -30,6 +30,8 @@ function get_current_company_tickets($args = []){
|
|||
|
||||
$tickets = Ticket::where('to_email', $company->email);
|
||||
|
||||
$tickets->orderBy('created_at','desc');
|
||||
|
||||
if(isset($args['type'])){
|
||||
$tickets->where('type',$args['type']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use App\Services\MailgunService;
|
||||
use App\Http\Controllers\Mailgun\MailgunController;
|
||||
use App\Models\CompanyUser;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
|
|
@ -61,6 +62,18 @@ public function storeLogin(Request $request)
|
|||
]);
|
||||
|
||||
if (Auth::attempt($credentials)) {
|
||||
// dd(Auth::user());
|
||||
if(Auth::user()->role_id == 3){
|
||||
$company = CompanyUser::where('user_id',Auth::id())->first();
|
||||
|
||||
if($company){
|
||||
|
||||
Session::put('selected_company', $company->company_id);
|
||||
return redirect('/dashboard');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if(!Auth::user()->Company) {
|
||||
return redirect('/company-info');
|
||||
} else {
|
||||
|
|
@ -68,7 +81,6 @@ public function storeLogin(Request $request)
|
|||
$domain = $company->domain;
|
||||
|
||||
$mailgunDomain = $this->mailgunService->getDomain($domain);
|
||||
// dd($mailgunDomain);
|
||||
|
||||
if($mailgunDomain){
|
||||
|
||||
|
|
@ -92,6 +104,10 @@ public function storeLogin(Request $request)
|
|||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return redirect()->back()->with('error', 'Invalid Credentials');
|
||||
|
|
|
|||
|
|
@ -8,26 +8,25 @@
|
|||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function dashboard()
|
||||
{
|
||||
|
||||
$tickets = get_current_company_tickets(['type' => 'inbox']);
|
||||
return view('index', ['tickets' => $tickets]);
|
||||
}
|
||||
|
||||
public function waiting()
|
||||
{
|
||||
|
||||
$tickets = get_current_company_tickets(['status' => 'waiting']);
|
||||
return view('waiting', ['tickets' => $tickets]);
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
$users = User::where('role_id', '!=', 1)->where('id', '!=', Auth::id())->get();
|
||||
$company = getSelectedCompany();
|
||||
$users = $users = User::where('role_id', '!=', 1)
|
||||
//->where('id', '!=', Auth::id())
|
||||
->join('company_users', 'users.id', '=', 'company_users.user_id')
|
||||
->where('company_users.company_id', $company)
|
||||
->select('users.*')
|
||||
->get();
|
||||
return view('profile', ['users' => $users]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,30 +6,37 @@
|
|||
use App\Models\Timezone;
|
||||
use App\Models\User;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\Comment;
|
||||
use App\Models\Response;
|
||||
use App\Models\Language;
|
||||
use App\Models\CompanyMeta;
|
||||
use App\Models\CompanyUser;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class InboxController extends Controller
|
||||
|
||||
{
|
||||
public function get_canned_responses(){
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
return CompanyMeta::where('company_id', $companyId)->where('key', 'canned_responses')->get();
|
||||
}
|
||||
|
||||
|
||||
public function inboxSetting()
|
||||
{
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
$timezones = Timezone::all();
|
||||
$languages = Language::all();
|
||||
$basic_setting = CompanyMeta::where('company_id', $companyId)->where('type', 'Basic Setting')->get();
|
||||
$canned_response = $this->get_canned_responses();
|
||||
$spam_handling = CompanyMeta::where('company_id', $companyId)->where('type', 'Spam Handling')->first();
|
||||
$email_signature = CompanyMeta::where('company_id', $companyId)->where('type', 'Email Signature')->first();
|
||||
|
||||
|
||||
return view('inbox-setting', ['timezones' => $timezones, 'basic_setting' => $basic_setting, 'spam_handling' => $spam_handling,
|
||||
'email_signature' => $email_signature, 'canned_response' => $canned_response, 'languages' => $languages]);
|
||||
'email_signature' => $email_signature, 'canned_response' => $canned_response, 'languages' => $languages, 'company' => get_company('id',$companyId)]);
|
||||
}
|
||||
|
||||
public function basicSetting(Request $request)
|
||||
|
|
@ -43,7 +50,7 @@ public function basicSetting(Request $request)
|
|||
'timezone' => ['required'],
|
||||
]);
|
||||
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
|
||||
//Update Company Meta
|
||||
$basic_data = [
|
||||
|
|
@ -75,7 +82,7 @@ public function emailSignature(Request $request)
|
|||
'email_signature' => 'required'
|
||||
]);
|
||||
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
CompanyMeta::updateOrCreate([
|
||||
'key' => 'email_signature',
|
||||
'value' => $request->email_signature
|
||||
|
|
@ -91,7 +98,7 @@ public function emailSignature(Request $request)
|
|||
|
||||
public function responseTime(Request $request)
|
||||
{
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
//Update Company Meta
|
||||
$response_data = [
|
||||
'monday_start_time' => $request->monday_start_time,
|
||||
|
|
@ -144,7 +151,7 @@ public function cannedResponse(Request $request)
|
|||
'text' => 'required'
|
||||
]);
|
||||
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
|
||||
// Collect data into an array
|
||||
$canned_data =
|
||||
|
|
@ -183,7 +190,7 @@ public function cannedResponse(Request $request)
|
|||
|
||||
public function deleteCannedResponse($index)
|
||||
{
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
|
||||
CompanyMeta::where('company_id', $companyId)
|
||||
->where('key', 'canned_responses')
|
||||
|
|
@ -210,7 +217,7 @@ public function deleteCannedResponse($index)
|
|||
|
||||
public function acknowledgementReceipt(Request $request)
|
||||
{
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
//Update Company Meta
|
||||
$acknowledgement_data = [
|
||||
'automatic_reply_subject' => $request->automatic_reply_subject,
|
||||
|
|
@ -245,7 +252,7 @@ public function spamHandling(Request $request)
|
|||
'spam_email' => 'required|email'
|
||||
]);
|
||||
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
|
||||
// Collect data into an array
|
||||
$canned_data = [
|
||||
|
|
@ -286,7 +293,7 @@ public function spamHandling(Request $request)
|
|||
|
||||
public function deleteSpamHandling($index)
|
||||
{
|
||||
$companyId = Auth::user()->company->id;
|
||||
$companyId = getSelectedCompany();
|
||||
|
||||
// Retrieve the existing canned responses
|
||||
$spamMeta = CompanyMeta::where('company_id', $companyId)
|
||||
|
|
@ -339,8 +346,87 @@ public function fetchChatMessages($ticketId)
|
|||
|
||||
public function fetchActionBox($ticketId)
|
||||
{
|
||||
$selectedCompany = getSelectedCompany();
|
||||
$ticket = Ticket::where('id', $ticketId)->with('comments')->first();
|
||||
$companyUsers = CompanyUser::where('company_id', $selectedCompany)->with('user')->get();
|
||||
|
||||
return view('partials.action-box', compact('ticket'))->render();
|
||||
return view('partials.action-box', compact('ticket','companyUsers'))->render();
|
||||
}
|
||||
|
||||
public function storeResponse(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'message' => 'required' ,
|
||||
'ticket_id' => 'required' ,
|
||||
]);
|
||||
|
||||
$ticket_id = $request->ticket_id;
|
||||
|
||||
// Load the HTML content into DOMDocument
|
||||
$dom = new \DOMDocument();
|
||||
libxml_use_internal_errors(true); // Prevents HTML errors from being thrown as exceptions
|
||||
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $request->message);
|
||||
libxml_clear_errors();
|
||||
|
||||
// Get all <p> tags
|
||||
$paragraphs = $dom->getElementsByTagName('p');
|
||||
|
||||
// Add classes to each <p> tag
|
||||
foreach ($paragraphs as $paragraph) {
|
||||
$existingClasses = $paragraph->getAttribute('class');
|
||||
$paragraph->setAttribute('class', trim($existingClasses . ' user-message bg-light-green-color color-light'));
|
||||
}
|
||||
|
||||
// Save the modified HTML
|
||||
$messageWithClasses = $dom->saveHTML($dom->documentElement);
|
||||
|
||||
// create response
|
||||
$response = createResponse($ticket_id,$messageWithClasses,1);
|
||||
|
||||
$ticket = Ticket::find($ticket_id);
|
||||
$companyId = Session::get('selected_company');
|
||||
$company = get_company('id',$companyId);
|
||||
//Send mail to mailgun
|
||||
|
||||
$domain = $company->domain;
|
||||
$from = $company->email;
|
||||
$to = $ticket->from_email;
|
||||
$subject = $ticket->subject;
|
||||
$html = $request->message;
|
||||
|
||||
sendEmailViaMailgun($domain, $from, $to, $subject, $html);
|
||||
|
||||
// Return the updated response and time
|
||||
return response()->json([
|
||||
'message' => strip_tags($response->message), // Stripping HTML tags
|
||||
'created_at' => $response->created_at->format('h:i A') // Formatting time
|
||||
]);
|
||||
}
|
||||
|
||||
public function storeComment(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'comment' => 'required|string',
|
||||
]);
|
||||
|
||||
// Assuming authenticated user
|
||||
$user_id = auth()->id();
|
||||
|
||||
$comment = new Comment();
|
||||
$comment->author = $user_id;
|
||||
$comment->ticket_id = $request->ticket_id;
|
||||
$comment->comment = $request->comment;
|
||||
$comment->save();
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
public function deleteComment($commentId)
|
||||
{
|
||||
$comment = Comment::findOrFail($commentId);
|
||||
$comment->delete();
|
||||
|
||||
return response()->json(['message' => 'Comment Deleted Successfully']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,65 +7,50 @@
|
|||
use App\Models\Comment;
|
||||
use App\Models\Response;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyMeta;
|
||||
use App\Models\Tag;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class TicketController extends Controller
|
||||
{
|
||||
public function get_canned_responses(){
|
||||
$companyId = getSelectedCompany();;
|
||||
return CompanyMeta::where('company_id', $companyId)->where('key', 'canned_responses')->get();
|
||||
}
|
||||
|
||||
public function allTickets()
|
||||
{
|
||||
$tickets = get_current_company_tickets();
|
||||
return view('all-tickets', ['tickets' => $tickets]);
|
||||
}
|
||||
|
||||
public function storeResponse(Request $request)
|
||||
public function waiting()
|
||||
{
|
||||
$this->validate($request, [
|
||||
'message' => 'required' ,
|
||||
'ticket_id' => 'required' ,
|
||||
]);
|
||||
|
||||
$ticket_id = $request->ticket_id;
|
||||
$tickets = get_current_company_tickets(['status' => 'waiting']);
|
||||
return view('waiting', ['tickets' => $tickets]);
|
||||
}
|
||||
|
||||
// Load the HTML content into DOMDocument
|
||||
$dom = new \DOMDocument();
|
||||
libxml_use_internal_errors(true); // Prevents HTML errors from being thrown as exceptions
|
||||
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $request->message);
|
||||
libxml_clear_errors();
|
||||
public function showTicket($id)
|
||||
{
|
||||
$tickets = get_current_company_tickets([
|
||||
|
||||
// Get all <p> tags
|
||||
$paragraphs = $dom->getElementsByTagName('p');
|
||||
'type' => 'inbox',
|
||||
'orderby' => 'id',
|
||||
'order' => 'desc',
|
||||
'with' => 'lastResponse'
|
||||
|
||||
// Add classes to each <p> tag
|
||||
foreach ($paragraphs as $paragraph) {
|
||||
$existingClasses = $paragraph->getAttribute('class');
|
||||
$paragraph->setAttribute('class', trim($existingClasses . ' user-message bg-light-green-color color-light'));
|
||||
}
|
||||
]);
|
||||
|
||||
// Save the modified HTML
|
||||
$messageWithClasses = $dom->saveHTML($dom->documentElement);
|
||||
$single_ticket = Ticket::find($id);
|
||||
|
||||
// create response
|
||||
$response = createResponse($ticket_id,$messageWithClasses,1);
|
||||
|
||||
$ticket = Ticket::find($ticket_id);
|
||||
$companyId = Session::get('selected_company');
|
||||
$company = get_company('id',$companyId);
|
||||
//Send mail to mailgun
|
||||
$messages = [];
|
||||
$canned_response = $this->get_canned_responses();
|
||||
|
||||
$domain = $company->domain;
|
||||
$from = $company->email;
|
||||
$to = $ticket->from_email;
|
||||
$subject = $ticket->subject;
|
||||
$html = $request->message;
|
||||
|
||||
sendEmailViaMailgun($domain, $from, $to, $subject, $html);
|
||||
|
||||
// Return the updated response and time
|
||||
return response()->json([
|
||||
'message' => strip_tags($response->message), // Stripping HTML tags
|
||||
'created_at' => $response->created_at->format('h:i A') // Formatting time
|
||||
]);
|
||||
return view('show-ticket', ['tickets' => $tickets, 'single_ticket' => $single_ticket, 'messages' => $messages, 'canned_response' => $canned_response]);
|
||||
}
|
||||
|
||||
public function updateStatus(Request $request, $ticketId)
|
||||
|
|
@ -82,30 +67,49 @@ public function updateStatus(Request $request, $ticketId)
|
|||
return response()->json(['message' => 'Ticket status updated successfully']);
|
||||
}
|
||||
|
||||
public function storeComment(Request $request)
|
||||
public function updateTicket(Request $request, $ticketId)
|
||||
{
|
||||
$request->validate([
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'comment' => 'required|string',
|
||||
]);
|
||||
$ticket = Ticket::find($ticketId);
|
||||
//Update Ticket
|
||||
if(isset($request->priority)) {
|
||||
$ticket->priority = $request->priority;
|
||||
}
|
||||
if(isset($request->user_assigned)) {
|
||||
$ticket->user_assigned = $request->user_assigned;
|
||||
}
|
||||
$ticket->save();
|
||||
|
||||
// Assuming authenticated user
|
||||
$user_id = auth()->id();
|
||||
|
||||
$comment = new Comment();
|
||||
$comment->author = $user_id;
|
||||
$comment->ticket_id = $request->ticket_id;
|
||||
$comment->comment = $request->comment;
|
||||
$comment->save();
|
||||
|
||||
return $comment;
|
||||
return response()->json(['success' => true, 'message' => 'Ticket Updated successfully!']);
|
||||
}
|
||||
|
||||
public function deleteComment($commentId)
|
||||
public function storeTags(Request $request)
|
||||
{
|
||||
$comment = Comment::findOrFail($commentId);
|
||||
$comment->delete();
|
||||
$company = getSelectedCompany();
|
||||
$tags = json_decode($request->tags);
|
||||
foreach($tags as $tag)
|
||||
{
|
||||
//Update Tags Table
|
||||
Tag::updateOrCreate([
|
||||
'company_id' => $company,
|
||||
'name' => $tag->value
|
||||
],[
|
||||
'company_id' => $company,
|
||||
'name' => $tag->value,
|
||||
'type' => 'inbox'
|
||||
]);
|
||||
|
||||
return response()->json(['message' => 'Comment Deleted Successfully']);
|
||||
//Update Company Meta Table
|
||||
CompanyMeta::updateOrCreate([
|
||||
'company_id' => $company,
|
||||
'value' => $tag->value
|
||||
],[
|
||||
'company_id' => $company,
|
||||
'value' => $tag->value,
|
||||
'key' => 'tag',
|
||||
'type' => 'tags'
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json(['success' => true, 'message' => 'Tags Added Successfully']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\User;
|
||||
use App\Models\CompanyUser;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserController extends Controller
|
||||
|
|
@ -16,6 +17,8 @@ public function addUser(Request $request)
|
|||
'password' => ['required', 'string', 'min:8'],
|
||||
]);
|
||||
|
||||
$company = getSelectedCompany();
|
||||
|
||||
$user = new User;
|
||||
$user->role_id = 3;
|
||||
$user->name = $request->name;
|
||||
|
|
@ -23,6 +26,15 @@ public function addUser(Request $request)
|
|||
$user->password = Hash::make($request->password);
|
||||
$user->save();
|
||||
|
||||
//Update Company User
|
||||
CompanyUser::updateOrCreate([
|
||||
'user_id' => $user->id
|
||||
],[
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company,
|
||||
'access' => json_encode($request->access)
|
||||
]);
|
||||
|
||||
return redirect()->back()->with('success', 'User Added Successfully');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CompanyUser extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('company_users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
|
||||
$table->foreignId('company_id')->constrained('companies')->onDelete('cascade');
|
||||
$table->text('access')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('company_users');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->constrained('companies')->onDelete('cascade');
|
||||
$table->string('name');
|
||||
$table->string('type');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tags');
|
||||
}
|
||||
};
|
||||
|
|
@ -35,3 +35,6 @@
|
|||
[28-Jun-2024 06:04:34 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
[28-Jun-2024 06:18:54 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
[28-Jun-2024 06:20:52 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
[30-Jun-2024 03:59:52 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
[30-Jun-2024 04:00:06 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
[30-Jun-2024 04:30:35 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.side-bar-links a').removeClass('bg-light-color');
|
||||
$('.aw-a-all').addClass('bg-light-color');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<div class="ui card chat-card">
|
||||
<div class="content chat-card-header d-flex align-items-center justify-content-between">
|
||||
|
|
@ -26,7 +35,7 @@
|
|||
<ul class="chat-details">
|
||||
@foreach($tickets as $ticket)
|
||||
<li>
|
||||
<a href="{{ route('inbox') }}" class="chat-detail-item d-flex align-items-center">
|
||||
<a href="{{ route('show.ticket', $ticket->id) }}" class="chat-detail-item d-flex align-items-center">
|
||||
<div class="chat-user-img all-tickets position-relative">
|
||||
<img src="{{ asset('images/Avatar.png') }}" alt="User">
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -4,14 +4,21 @@
|
|||
<img src="{{ asset('images/logo-white.png') }}" alt="Site Logo">
|
||||
<div class="dev-toggle-sidebar dev-close"><img src="{{ asset('images/icons/close-icon.svg') }}" alt=""></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.side-bar-links ul li .bg-light-color .color-light{
|
||||
color: #383f33 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="side-bar-links">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route('index') }}"
|
||||
class="side-bar-link bg-light-color d-flex align-items-center justify-content-between">
|
||||
class="side-bar-link bg-light-color d-flex align-items-center justify-content-between aw-a-inbox">
|
||||
<div class="link-left-content align-items-center d-flex">
|
||||
<img src="{{ asset('images/icons/Message.png') }}" alt="Message">
|
||||
<h6 class="color-dark-green">Inbox</h6>
|
||||
<h6 class="color-light">Inbox</h6>
|
||||
</div>
|
||||
<div class="link-right-content">
|
||||
<img src="{{ asset('images/icons/chevron-right-dark.png') }}" alt="chevron right">
|
||||
|
|
@ -20,7 +27,7 @@ class="side-bar-link bg-light-color d-flex align-items-center justify-content-be
|
|||
</li>
|
||||
<li>
|
||||
<a href="{{ route('waiting') }}"
|
||||
class="side-bar-link d-flex align-items-center justify-content-between">
|
||||
class="side-bar-link d-flex align-items-center justify-content-between aw-a-waiting">
|
||||
<div class="link-left-content align-items-center d-flex">
|
||||
<img src="{{ asset('images/icons/Time_light.png') }}" alt="Message">
|
||||
<h6 class="color-light">Waiting</h6>
|
||||
|
|
@ -32,7 +39,7 @@ class="side-bar-link d-flex align-items-center justify-content-between">
|
|||
</li>
|
||||
<li>
|
||||
<a href="{{ route('all.tickets') }}"
|
||||
class="side-bar-link d-flex align-items-center justify-content-between">
|
||||
class="side-bar-link d-flex align-items-center justify-content-between aw-a-all">
|
||||
<div class="link-left-content align-items-center d-flex">
|
||||
<img src="{{ asset('images/Ticket_use.svg') }}" alt="Message">
|
||||
<h6 class="color-light">All Tickets</h6>
|
||||
|
|
@ -43,7 +50,7 @@ class="side-bar-link d-flex align-items-center justify-content-between">
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="side-bar-link d-flex align-items-center justify-content-between">
|
||||
<a href="#" class="side-bar-link d-flex align-items-center justify-content-between aw-a-stats">
|
||||
<div class="link-left-content align-items-center d-flex">
|
||||
<img src="{{ asset('images/chart-square.svg') }}" alt="Message">
|
||||
<h6 class="color-light">Statistics</h6>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<div class="col col-left">
|
||||
<div class="dev-input-group dev-input-group-input-info">
|
||||
<label>Receiving email address </label>
|
||||
<input name="company_email" type="email" value="{{ Auth::user()->company->email }}" placeholder="support@kundesone.no" readonly required>
|
||||
<input name="company_email" type="email" value="{{ $company->email }}" placeholder="support@kundesone.no" readonly required>
|
||||
<div class="dev-input-info">
|
||||
<img src="{{ asset('images/info.svg') }}" alt="info">
|
||||
<span>E.g. support@yourcompany.com</span>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
<div class="dev-input-group dev-input-group-input-info">
|
||||
<label>Email address on Kundo</label>
|
||||
<input name="kundo_email" readonly type="email" value="{{ Auth::user()->company->internal_email }}" placeholder="kundo.limonmedia.no@mailgun.kundesone.no" required>
|
||||
<input name="kundo_email" readonly type="email" value="{{ $company->internal_email }}" placeholder="kundo.limonmedia.no@mailgun.kundesone.no" required>
|
||||
<div class="dev-input-info">
|
||||
<img src="{{ asset('images/info.svg') }}" alt="info">
|
||||
<span>Your kundesone internal email address.</span>
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
<h2>Common email signature</h2>
|
||||
</div>
|
||||
<div class="dev-content-inner">
|
||||
<form method="POST" action="{{ route('inbox.email.signature') }}">
|
||||
<form method="POST" action="{{ route('inbox.email.signature') }}" onsubmit="return validateSignatureForm()">
|
||||
@csrf
|
||||
<div class="dev-input-group dev-input-group-input-info">
|
||||
<div class="input-box-row">
|
||||
|
|
@ -191,6 +191,16 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function validateSignatureForm() {
|
||||
var textarea = document.getElementById('editor1');
|
||||
if (textarea.value === '') {
|
||||
toastr.error('Please enter a message in the textarea.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>
|
||||
<script>
|
||||
CKEDITOR.replace('editor1');
|
||||
|
|
@ -216,7 +226,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<h3>Monday</h3>
|
||||
<div class="schedule-box">
|
||||
@php
|
||||
$monday_start_time = getResponse(Auth::user()->company->id, 'monday_start_time', 'Response Time');
|
||||
$monday_start_time = getResponse($company->id, 'monday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<input id="monday_start_time" name="monday_start_time" type="time" @if(isset($monday_start_time) && !is_null($monday_start_time)) value="{{$monday_start_time->value}}" @endif placeholder="08:00">
|
||||
<!-- <img src="{{ asset('images/downn.svg') }}" alt=""> -->
|
||||
|
|
@ -224,14 +234,14 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<span class="line"></span>
|
||||
<div class="schedule-box">
|
||||
@php
|
||||
$monday_end_time = getResponse(Auth::user()->company->id, 'monday_end_time', 'Response Time');
|
||||
$monday_end_time = getResponse($company->id, 'monday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<input id="monday_end_time" name="monday_end_time" type="time" @if(isset($monday_end_time) && !is_null($monday_end_time)) value="{{$monday_end_time->value}}" @endif placeholder="16:00">
|
||||
<!-- <img src="{{ asset('images/downn.svg') }}" alt=""> -->
|
||||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$monday_closed = getResponse(Auth::user()->company->id, 'monday_closed', 'Response Time');
|
||||
$monday_closed = getResponse($company->id, 'monday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="monday_closed" name="monday_closed" @if(isset($monday_closed) && !is_null($monday_closed)) checked @endif type="checkbox" onclick="toggleClosed('monday')">
|
||||
|
|
@ -242,7 +252,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Tuesday</h3>
|
||||
@php
|
||||
$tuesday_start_time = getResponse(Auth::user()->company->id, 'tuesday_start_time', 'Response Time');
|
||||
$tuesday_start_time = getResponse($company->id, 'tuesday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="tuesday_start_time" name="tuesday_start_time" type="time" @if(isset($tuesday_start_time) && !is_null($tuesday_start_time)) value="{{$tuesday_start_time->value}}" @endif placeholder="08:00">
|
||||
|
|
@ -250,7 +260,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$tuesday_end_time = getResponse(Auth::user()->company->id, 'tuesday_end_time', 'Response Time');
|
||||
$tuesday_end_time = getResponse($company->id, 'tuesday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="tuesday_end_time" name="tuesday_end_time" type="time" @if(isset($tuesday_end_time) && !is_null($tuesday_end_time)) value="{{$tuesday_end_time->value}}" @endif placeholder="16:00">
|
||||
|
|
@ -258,7 +268,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$tuesday_closed = getResponse(Auth::user()->company->id, 'tuesday_closed', 'Response Time');
|
||||
$tuesday_closed = getResponse($company->id, 'tuesday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="tuesday_closed" name="tuesday_closed" @if(isset($tuesday_closed) && !is_null($tuesday_closed)) checked @endif type="checkbox" onclick="toggleClosed('tuesday')">
|
||||
|
|
@ -269,7 +279,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Wednesday</h3>
|
||||
@php
|
||||
$wednesday_start_time = getResponse(Auth::user()->company->id, 'wednesday_start_time', 'Response Time');
|
||||
$wednesday_start_time = getResponse($company->id, 'wednesday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="wednesday_start_time" name="wednesday_start_time" @if(isset($wednesday_start_time) && !is_null($wednesday_start_time)) value="{{$wednesday_start_time->value}}" @endif type="time" placeholder="08:00">
|
||||
|
|
@ -277,7 +287,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$wednesday_end_time = getResponse(Auth::user()->company->id, 'wednesday_end_time', 'Response Time');
|
||||
$wednesday_end_time = getResponse($company->id, 'wednesday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="wednesday_end_time" name="wednesday_end_time" @if(isset($wednesday_end_time) && !is_null($wednesday_end_time)) value="{{$wednesday_end_time->value}}" @endif type="time" placeholder="16:00">
|
||||
|
|
@ -285,7 +295,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$wednesday_closed = getResponse(Auth::user()->company->id, 'wednesday_closed', 'Response Time');
|
||||
$wednesday_closed = getResponse($company->id, 'wednesday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="wednesday_closed" name="wednesday_closed" @if(isset($wednesday_closed) && !is_null($wednesday_closed)) checked @endif type="checkbox" onclick="toggleClosed('wednesday')">
|
||||
|
|
@ -296,7 +306,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Thursday</h3>
|
||||
@php
|
||||
$thursday_start_time = getResponse(Auth::user()->company->id, 'thursday_start_time', 'Response Time');
|
||||
$thursday_start_time = getResponse($company->id, 'thursday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="thursday_start_time" name="thursday_start_time" @if(isset($thursday_start_time) && !is_null($thursday_start_time)) value="{{$thursday_start_time->value}}" @endif type="time" placeholder="08:00">
|
||||
|
|
@ -304,7 +314,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$thursday_end_time = getResponse(Auth::user()->company->id, 'thursday_end_time', 'Response Time');
|
||||
$thursday_end_time = getResponse($company->id, 'thursday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="thursday_end_time" name="thursday_end_time" @if(isset($thursday_end_time) && !is_null($thursday_end_time)) value="{{$thursday_end_time->value}}" @endif type="time" placeholder="16:00">
|
||||
|
|
@ -312,7 +322,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$thursday_closed = getResponse(Auth::user()->company->id, 'thursday_closed', 'Response Time');
|
||||
$thursday_closed = getResponse($company->id, 'thursday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="thursday_closed" name="thursday_closed" @if(isset($thursday_closed) && !is_null($thursday_closed)) checked @endif type="checkbox" onclick="toggleClosed('thursday')">
|
||||
|
|
@ -323,7 +333,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Friday</h3>
|
||||
@php
|
||||
$friday_start_time = getResponse(Auth::user()->company->id, 'friday_start_time', 'Response Time');
|
||||
$friday_start_time = getResponse($company->id, 'friday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="friday_start_time" name="friday_start_time" @if(isset($friday_start_time) && !is_null($friday_start_time)) value="{{$friday_start_time->value}}" @endif type="time" placeholder="08:00">
|
||||
|
|
@ -331,7 +341,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$friday_end_time = getResponse(Auth::user()->company->id, 'friday_end_time', 'Response Time');
|
||||
$friday_end_time = getResponse($company->id, 'friday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="friday_end_time" name="friday_end_time" @if(isset($friday_end_time) && !is_null($friday_end_time)) value="{{$friday_end_time->value}}" @endif type="time" placeholder="16:00">
|
||||
|
|
@ -339,7 +349,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$friday_closed = getResponse(Auth::user()->company->id, 'friday_closed', 'Response Time');
|
||||
$friday_closed = getResponse($company->id, 'friday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="friday_closed" name="friday_closed" @if(isset($friday_closed) && !is_null($friday_closed)) checked @endif type="checkbox" onclick="toggleClosed('friday')">
|
||||
|
|
@ -350,7 +360,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Saturday</h3>
|
||||
@php
|
||||
$saturday_start_time = getResponse(Auth::user()->company->id, 'saturday_start_time', 'Response Time');
|
||||
$saturday_start_time = getResponse($company->id, 'saturday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="saturday_start_time" name="saturday_start_time" @if(isset($saturday_start_time) && !is_null($saturday_start_time)) value="{{$saturday_start_time->value}}" @endif type="time" placeholder="08:00">
|
||||
|
|
@ -358,7 +368,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$saturday_end_time = getResponse(Auth::user()->company->id, 'saturday_end_time', 'Response Time');
|
||||
$saturday_end_time = getResponse($company->id, 'saturday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="saturday_end_time" name="saturday_end_time" @if(isset($saturday_end_time) && !is_null($saturday_end_time)) value="{{$saturday_end_time->value}}" @endif type="time" placeholder="16:00">
|
||||
|
|
@ -366,7 +376,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$satureday_closed = getResponse(Auth::user()->company->id, 'satureday_closed', 'Response Time');
|
||||
$satureday_closed = getResponse($company->id, 'satureday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="saturday_closed" name="saturday_closed" @if(isset($saturday_closed) && !is_null($saturday_closed)) checked @endif type="checkbox" onclick="toggleClosed('saturday')">
|
||||
|
|
@ -377,7 +387,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-content-schedule">
|
||||
<h3>Sunday</h3>
|
||||
@php
|
||||
$sunday_start_time = getResponse(Auth::user()->company->id, 'sunday_start_time', 'Response Time');
|
||||
$sunday_start_time = getResponse($company->id, 'sunday_start_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="sunday_start_time" name="sunday_start_time" @if(isset($sunday_start_time) && !is_null($sunday_start_time)) value="{{$sunday_start_time->value}}" @endif type="time" placeholder="08:00">
|
||||
|
|
@ -385,7 +395,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<span class="line"></span>
|
||||
@php
|
||||
$sunday_end_time = getResponse(Auth::user()->company->id, 'sunday_end_time', 'Response Time');
|
||||
$sunday_end_time = getResponse($company->id, 'sunday_end_time', 'Response Time');
|
||||
@endphp
|
||||
<div class="schedule-box">
|
||||
<input id="sunday_end_time" name="sunday_end_time" @if(isset($sunday_end_time) && !is_null($sunday_end_time)) value="{{$sunday_end_time->value}}" @endif type="time" placeholder="16:00">
|
||||
|
|
@ -393,7 +403,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$sunday_closed = getResponse(Auth::user()->company->id, 'sunday_closed', 'Response Time');
|
||||
$sunday_closed = getResponse($company->id, 'sunday_closed', 'Response Time');
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Closed
|
||||
<input id="sunday_closed" name="sunday_closed" @if(isset($sunday_closed) && !is_null($sunday_closed)) checked @endif type="checkbox" onclick="toggleClosed('sunday')">
|
||||
|
|
@ -407,7 +417,7 @@ class="form-control input-reply-textarea" required>{!! $email_signature->value ?
|
|||
<div class="dev-input-group dev-input-group-input-info">
|
||||
<label>Expected response time, in hours</label>
|
||||
@php
|
||||
$expected_response = getResponse(Auth::user()->company->id, 'expected_response', 'Response Time');
|
||||
$expected_response = getResponse($company->id, 'expected_response', 'Response Time');
|
||||
@endphp
|
||||
<input name="expected_response" type="text" @if(isset($expected_response) && !is_null($expected_response)) value="{{ $expected_response->value }}" @endif placeholder="8">
|
||||
<div class="dev-input-info">
|
||||
|
|
@ -523,7 +533,7 @@ function toggleClosed(day) {
|
|||
@csrf
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$activate_delivery_confirmation = getResponse(Auth::user()->company->id, 'activate_delivery_confirmation', 'Acknowledgement of Receipt')
|
||||
$activate_delivery_confirmation = getResponse($company->id, 'activate_delivery_confirmation', 'Acknowledgement of Receipt')
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Activate delivery confirmation
|
||||
<input name="activate_delivery_confirmation" @if(isset($activate_delivery_confirmation) && !is_null($activate_delivery_confirmation)) checked @endif type="checkbox">
|
||||
|
|
@ -533,7 +543,7 @@ function toggleClosed(day) {
|
|||
<div class="dev-form-inner">
|
||||
<div class="dev-input-group dev-input-group-input-info">
|
||||
@php
|
||||
$automatic_reply_subject = getResponse(Auth::user()->company->id, 'automatic_reply_subject', 'Acknowledgement of Receipt')
|
||||
$automatic_reply_subject = getResponse($company->id, 'automatic_reply_subject', 'Acknowledgement of Receipt')
|
||||
@endphp
|
||||
<label>Subject of the automatic reply</label>
|
||||
<input name="automatic_reply_subject" type="text" @if(isset($automatic_reply_subject) && !is_null($automatic_reply_subject)) value="{{ $automatic_reply_subject->value }}" @endif placeholder="Type here">
|
||||
|
|
@ -561,7 +571,7 @@ function toggleClosed(day) {
|
|||
<h3>Text in the automatic reply</h3>
|
||||
<div class="input-box-row">
|
||||
@php
|
||||
$automatic_reply_text = getResponse(Auth::user()->company->id, 'automatic_reply_text', 'Acknowledgement of Receipt')
|
||||
$automatic_reply_text = getResponse($company->id, 'automatic_reply_text', 'Acknowledgement of Receipt')
|
||||
@endphp
|
||||
<div class="ui card inbox-send-message-card w-100">
|
||||
<div class="content input-options bg-dark-green-color">
|
||||
|
|
@ -599,7 +609,7 @@ class="form-control input-reply-textarea">{!! $automatic_reply_text->value ?? ''
|
|||
</div>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$confirmation_receipt = getResponse(Auth::user()->company->id, 'confirmation_receipt', 'Acknowledgement of Receipt')
|
||||
$confirmation_receipt = getResponse($company->id, 'confirmation_receipt', 'Acknowledgement of Receipt')
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Only send confirmation of receipt outside
|
||||
of business hours
|
||||
|
|
@ -615,7 +625,7 @@ class="form-control input-reply-textarea">{!! $automatic_reply_text->value ?? ''
|
|||
</p>
|
||||
<div class="dev-input-group">
|
||||
@php
|
||||
$activate_ticket_number = getResponse(Auth::user()->company->id, 'activate_ticket_number', 'Acknowledgement of Receipt')
|
||||
$activate_ticket_number = getResponse($company->id, 'activate_ticket_number', 'Acknowledgement of Receipt')
|
||||
@endphp
|
||||
<label class="dev-checkbox-wrapper">Activate ticket numbers
|
||||
<input name="activate_ticket_number" @if(isset($activate_ticket_number) && !is_null($activate_ticket_number)) checked @endif type="checkbox">
|
||||
|
|
|
|||
|
|
@ -336,7 +336,7 @@ function loadActionBox(ticketId) {
|
|||
$('.saveReply').on('click', function(){
|
||||
var message = CKEDITOR.instances.editor1.getData();
|
||||
if(message.trim() === '') {
|
||||
alert('Message cannot be empty');
|
||||
toastr.error('Message cannot be empty');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.side-bar-links a').removeClass('bg-light-color');
|
||||
$('.aw-a-inbox').addClass('bg-light-color');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<div class="ui card chat-card">
|
||||
<div class="content chat-card-header d-flex align-items-center justify-content-between">
|
||||
|
|
@ -32,7 +41,7 @@
|
|||
<ul class="chat-details">
|
||||
@foreach($tickets as $ticket)
|
||||
<li>
|
||||
<a href="{{ route('inbox') }}" class="chat-detail-item d-flex align-items-center">
|
||||
<a href="{{ route('show.ticket', $ticket->id) }}" class="chat-detail-item d-flex align-items-center">
|
||||
<div class="chat-user-img">
|
||||
<img src="{{ asset('images/Avatar.png') }}" alt="User">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,3 @@
|
|||
|
||||
</html>
|
||||
|
||||
<script>
|
||||
|
||||
alert();
|
||||
</script>
|
||||
|
|
@ -97,93 +97,8 @@ class="side-bar-link bg-light-color d-flex align-items-center justify-content-be
|
|||
<div class="content-area position-relative bg-light-color">
|
||||
|
||||
<!-- Header -->
|
||||
<header class="position-relative">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 user-name-nav-area d-flex align-content-center">
|
||||
<div class="dev-toggle-sidebar">
|
||||
<img src="{{ asset('images/icons/blocks-icon.svg') }}">
|
||||
</div>
|
||||
<h2 class="d-flex align-items-center">Hello {{auth()->user()->name}} <span>👋🏼</span>,</h2>
|
||||
</div>
|
||||
<div class="col-sm-8 d-flex justify-content-end align-items-center">
|
||||
<div class="search-box d-flex align-items-center">
|
||||
<img src="{{ asset('images/icons/search 1.png') }}" alt="">
|
||||
<input type="text" class="color-dark-green" placeholder="Search...">
|
||||
</div>
|
||||
<div class="nav-links d-flex align-items-center">
|
||||
<form method="POST" action="{{route('logout')}}">
|
||||
@csrf
|
||||
<button class="nav-btn bg-dark-green-color">
|
||||
<img height="25" width="50" src="{{ asset('images/logout.png') }}" alt="">
|
||||
</button>
|
||||
</form>
|
||||
<a href="{{ route('chat.setting') }}" class="nav-btn bg-dark-green-color">
|
||||
<img src="{{ asset('images/icons/Message_alt_fill.png') }}" alt="">
|
||||
</a>
|
||||
<a href="{{ route('inbox.setting') }}" class="nav-btn bell-btn bg-dark-green-color">
|
||||
<img src="{{ asset('images/icons/notification.svg') }}" alt="">
|
||||
</a>
|
||||
<div class="ui dropdown custom-dropdown options-widget-wrapper">
|
||||
<div class="text">
|
||||
<button class="nav-btn bg-dark-green-color">
|
||||
<img src="{{ asset('images/icons/Group 32.png') }}" alt="">
|
||||
</button>
|
||||
</div>
|
||||
<div class="menu nav-bar-menu mt-2">
|
||||
<div class="item">
|
||||
<p class="action-heading-paragraph text-center align-content-center">
|
||||
<img src="{{ asset('images/icons/Vector (3).png') }}" alt="">
|
||||
<span class="action-label text-white">Inbox</span>
|
||||
</p>
|
||||
<div class="chat-settings-btn-row text-center">
|
||||
<a class="ui secondary basic button tag-btn shadow-none">Tags</a>
|
||||
<a
|
||||
href="{{ route('inbox.setting') }}" class="ui secondary basic button shadow-none setting-btn text-white align-content-center">Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<p class="action-heading-paragraph text-center align-content-center">
|
||||
<img src="{{ asset('images/icons/chat-round-white.svg') }}" alt="">
|
||||
<span class="action-label text-white">Chats</span>
|
||||
</p>
|
||||
<div class="chat-settings-btn-row text-center">
|
||||
<a class="ui secondary basic button tag-btn shadow-none">Tags</a>
|
||||
<a
|
||||
href="{{ route('chat.setting') }}" class="ui secondary basic button shadow-none setting-btn text-white align-content-center">Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<p class="action-heading-paragraph text-center align-content-center">
|
||||
<img src="{{ asset('images/icons/Group 133630.svg') }}" alt="">
|
||||
<span class="action-label text-white">Help Center</span>
|
||||
</p>
|
||||
<div class="chat-settings-btn-row text-center">
|
||||
<i class="external link square alternate icon color-dark-green"></i>
|
||||
<a class="ui secondary basic button tag-btn shadow-none">Tags</a>
|
||||
<a
|
||||
class="ui secondary basic button shadow-none setting-btn text-white align-content-center">Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<p class="action-heading-paragraph text-center align-content-center">
|
||||
<img src="{{ asset('images/icons/question-square-svgrepo-com 2.svg') }}" alt="">
|
||||
<span class="action-label text-white">Forum</span>
|
||||
</p>
|
||||
<div class="chat-settings-btn-row text-center d-flex justify-content-center align-items-center">
|
||||
<i class="external link square alternate icon color-dark-green"></i>
|
||||
<a class="ui secondary basic button tag-btn shadow-none">Tags</a>
|
||||
<a
|
||||
class="ui secondary basic button shadow-none setting-btn text-white align-content-center">Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<!-- End -->
|
||||
<x-header />
|
||||
<!-- End -->
|
||||
|
||||
<!-- Main Content Area -->
|
||||
@yield('content')
|
||||
|
|
|
|||
|
|
@ -13,54 +13,170 @@
|
|||
<button class="action-btn status-btn @if($ticket->status == 'done') active @endif" data-status="done">Done</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body-area">
|
||||
<ul class="inbox-chat-options">
|
||||
<li class="single-option d-flex justify-content-between">
|
||||
<p><b>Assign:</b></p>
|
||||
<p class="dev-custom-select">
|
||||
<select class="aw-select">
|
||||
<select class="aw-select" name="user_assigned">
|
||||
<option>(Assign)</option>
|
||||
<option>test</option>
|
||||
<option>test</option>
|
||||
@foreach($companyUsers as $companyUser)
|
||||
<option value="{{$companyUser->user_id}}" @if($ticket->user_assigned == $companyUser->user_id) selected @endif>{{$companyUser->user->name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</p>
|
||||
<p class="aw-done bg-light-green-color"><i class="fas fa-check"></i></p>
|
||||
<p class="aw-done bg-light-green-color" id="save-ticket" data-ticket_id="{{$ticket->id}}"><i class="fas fa-check"></i></p>
|
||||
</li>
|
||||
<li class="single-option d-flex justify-content-between">
|
||||
<p><b>Priority:</b></span></p>
|
||||
|
||||
<p class="dev-custom-select">
|
||||
<select class="aw-select">
|
||||
<select class="aw-select" name="priority">
|
||||
<option>(Choose Priority)</option>
|
||||
<option>test</option>
|
||||
<option>test</option>
|
||||
<option value="low" @if($ticket->priority == 'low') selected @endif>Low</option>
|
||||
<option value="medium" @if($ticket->priority == 'medium') selected @endif>Medium</option>
|
||||
<option value="high" @if($ticket->priority == 'high') selected @endif>High</option>
|
||||
</select>
|
||||
</p>
|
||||
<p class="aw-done bg-light-green-color"><i class="fas fa-check"></i></p>
|
||||
<p class="aw-done bg-light-green-color" id="save-priority" data-ticket_id="{{$ticket->id}}"><i class="fas fa-check"></i></p>
|
||||
<!--<p><img src="{{ asset('images/icons/Frame (1).png') }}" alt="Chevron Right"></p>-->
|
||||
</li>
|
||||
<li class="single-option">
|
||||
<p>Tags <span>(Choose Tags)</span></p>
|
||||
|
||||
<!--save user assigned-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#save-ticket').on('click', function() {
|
||||
var userAssigned = $('select[name="user_assigned"]').val();
|
||||
var ticketId = $(this).data('ticket_id');
|
||||
|
||||
// Check if a user is selected
|
||||
if (userAssigned === '(Assign)') {
|
||||
toastr.error("Please select a user to assign.");
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX request to save the ticket assignment
|
||||
$.ajax({
|
||||
url: '/update-ticket/' + ticketId,
|
||||
type: 'POST',
|
||||
data: {
|
||||
user_assigned: userAssigned,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle the response from the server
|
||||
if (response.success) {
|
||||
toastr.success('Ticket Assigned Successfully');
|
||||
} else {
|
||||
alert('Error: ' + response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle any errors that occurred during the request
|
||||
console.error('AJAX Error:', status, error);
|
||||
toastr.error("An error occurred while assigning the ticket.");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--save priority-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#save-priority').on('click', function() {
|
||||
var priority = $('select[name="priority"]').val();
|
||||
var ticketId = $(this).data('ticket_id');
|
||||
|
||||
// Check if a user is selected
|
||||
if (priority === '(Choose Priority)') {
|
||||
toastr.error("Please select a priority.");
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX request to save the ticket assignment
|
||||
$.ajax({
|
||||
url: '/update-ticket/' + ticketId,
|
||||
type: 'POST',
|
||||
data: {
|
||||
priority: priority,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle the response from the server
|
||||
if (response.success) {
|
||||
toastr.success('Priority Updated Successfully');
|
||||
} else {
|
||||
toastr.error('Error: ' + response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle any errors that occurred during the request
|
||||
console.error('AJAX Error:', status, error);
|
||||
toastr.error('An error occurred while updating the priority.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Assuming you have a DOM element with the ID 'tags'
|
||||
var input = document.getElementById('tags');
|
||||
new Tagify(input);
|
||||
</script>
|
||||
|
||||
|
||||
<input type="text" name="tags" id="tags" placeholder="Type and press Enter"
|
||||
class="form-control input-reply-textarea input-comment-textarea"/>
|
||||
<input type="text" name="tags" id="tags" placeholder="Type and press Enter"
|
||||
class="form-control input-reply-textarea input-comment-textarea" required/>
|
||||
|
||||
|
||||
<button class="ui button bg-light-green-color mt-4 color-light">
|
||||
Save
|
||||
</button>
|
||||
<button class="ui button bg-light-green-color mt-4 color-light" id="save-tags">
|
||||
Save
|
||||
</button>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#save-tags').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var tags = $('#tags').val();
|
||||
|
||||
// Check if the input field is not empty
|
||||
if (tags === '') {
|
||||
toastr.error('Please enter some tags.');
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX request to save the tags
|
||||
$.ajax({
|
||||
url: '/store-tags',
|
||||
type: 'POST',
|
||||
data: {
|
||||
tags: tags,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle the response from the server
|
||||
if (response.success) {
|
||||
toastr.success('Tags Added successfully!');
|
||||
} else {
|
||||
toastr.error('Error: ' + response.message);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle any errors that occurred during the request
|
||||
console.error('AJAX Error:', status, error);
|
||||
toastr.error('An error occurred while saving the tags.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<!--<p><img src="{{ asset('images/icons/+.png') }}" alt="Chevron Right"></p>-->
|
||||
</li>
|
||||
</form>
|
||||
<li class="single-option d-flex justify-content-between">
|
||||
<div class="accordion w-100 border-0" id="accordionExample">
|
||||
<div class="accordion-item custom-accordion">
|
||||
|
|
@ -76,7 +192,7 @@ class="form-control input-reply-textarea input-comment-textarea"/>
|
|||
<div class="accordion-body accordion-body--custom">
|
||||
<div class="body-content">
|
||||
<textarea rows="7" placeholder="Your Message"
|
||||
class="form-control input-reply-textarea input-comment-textarea"></textarea>
|
||||
class="form-control input-reply-textarea input-comment-textarea" id="add-comment"></textarea>
|
||||
<button class="ui button bg-light-green-color mt-4 add-comment-btn color-light">
|
||||
Add Your Comment
|
||||
</button>
|
||||
|
|
@ -191,11 +307,11 @@ class="ui button comment--btn bg-light-green-color color-light comment-delete-bt
|
|||
$(document).ready(function() {
|
||||
$('.add-comment-btn').on('click', function() {
|
||||
var ticketId = $('.chat-detail-item.active').data('ticket-id');
|
||||
var comment = $('.input-comment-textarea').val();
|
||||
var comment = $('#add-comment').val();
|
||||
|
||||
if (comment === '') {
|
||||
alert('Comment cannot be empty');
|
||||
return;
|
||||
toastr.error('Comment cannot be empty');
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
|
|
@ -208,7 +324,7 @@ class="ui button comment--btn bg-light-green-color color-light comment-delete-bt
|
|||
},
|
||||
success: function(response) {
|
||||
toastr.success("Comment Added Successfully");
|
||||
$('.input-comment-textarea').val('');
|
||||
$('#add-comment').val('');
|
||||
$.ajax({
|
||||
url: '/fetch-action-box/' + ticketId,
|
||||
method: 'GET',
|
||||
|
|
@ -241,7 +357,7 @@ class="ui button comment--btn bg-light-green-color color-light comment-delete-bt
|
|||
|
||||
function updateTicketStatus(newStatus) {
|
||||
$.ajax({
|
||||
url: 'update-ticket-status/{{ $ticket->id }}',
|
||||
url: '/update-ticket-status/{{ $ticket->id }}',
|
||||
method: 'POST',
|
||||
data: {
|
||||
status: newStatus,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<div class="dev-title-row">
|
||||
<h2>Add a new user</h2>
|
||||
</div>
|
||||
<form method="POST" action="{{ route('inbox.add.user') }}">
|
||||
<form method="POST" action="{{ route('inbox.add.user') }}" id="accessForm" onsubmit="return validateCheckboxes()">
|
||||
@csrf
|
||||
<div class="dev-input-group">
|
||||
<label for="name">Name</label>
|
||||
|
|
@ -25,6 +25,17 @@
|
|||
<label for="email">Email</label>
|
||||
<input name="email" type="email" placeholder="Enter your email" required>
|
||||
</div>
|
||||
<div class="dev-input-group">
|
||||
<label for="email">Access</label>
|
||||
<label class="dev-checkbox-wrapper">Inbox Module
|
||||
<input name="access[]" type="checkbox" value="inbox">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
<label class="dev-checkbox-wrapper">Inbox Module
|
||||
<input name="access[]" type="checkbox" value="chat">
|
||||
<span class="checkmark"></span>
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit">Send Activation Email</button>
|
||||
</form>
|
||||
<div class="dev-title-row">
|
||||
|
|
@ -79,6 +90,23 @@
|
|||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function validateCheckboxes() {
|
||||
const checkboxes = document.querySelectorAll('input[name="access[]"]');
|
||||
let checked = false;
|
||||
checkboxes.forEach((checkbox) => {
|
||||
if (checkbox.checked) {
|
||||
checked = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!checked) {
|
||||
alert('Please select at least one checkbox.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,407 @@
|
|||
@extends('layouts.setting')
|
||||
|
||||
<title>Inbox</title>
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="inbox-content-wrapper w-100 ">
|
||||
<div class="inbox-inner-wrapper w-100 d-flex">
|
||||
|
||||
<!-- User Box -->
|
||||
<div class="box user-box">
|
||||
<ul>
|
||||
@foreach($tickets as $key => $ticket)
|
||||
<li style="cursor:pointer;" class="chat-detail-item @if($single_ticket->id == $ticket->id) active @endif inbox-user-box d-flex" data-ticket-id="{{ $ticket->id }}">
|
||||
<div class="chat-user-img inbox position-relative">
|
||||
<img src="{{ asset('images/Avatar.png') }}" alt="User">
|
||||
<div class="chat-status-icon rounded-circle text-center align-content-center position-absolute">
|
||||
<img src="{{ asset('images/icons/chat-round.svg') }}" alt="Chat Round">
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-message-info d-flex align-self-baseline">
|
||||
|
||||
<div class="chat-ticket-row align-items-center d-flex justify-content-between">
|
||||
<div class="ticket-status d-flex flex-column">
|
||||
<p class="color-dark-green receiver-name">{{$ticket->sender_name}}</p>
|
||||
<p class="receiver-message">{!! strip_tags($ticket?->lastResponse?->message) ?? '' !!}</p>
|
||||
</div>
|
||||
<p class=" bold message-time">{{\Carbon\Carbon::parse($ticket?->lastResponse?->created_at)->format('h:i A') ?? ''}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Chat Box -->
|
||||
<div class="chat-inbox chat-box">
|
||||
<div class="chat-content-wrapper">
|
||||
</div>
|
||||
<!-- Send Message Input -->
|
||||
<div class="message-input-box">
|
||||
<!--<div class="select-user-row mt-2">-->
|
||||
<!-- <p>To:</p>-->
|
||||
|
||||
<!-- <select name="skills" multiple="" class="ui fluid dropdown user-select-dropdown">-->
|
||||
<!-- <option value="">Select User</option>-->
|
||||
<!-- <option value="angular">Angular</option>-->
|
||||
<!-- <option value="css">CSS</option>-->
|
||||
<!-- </select>-->
|
||||
<!--</div>-->
|
||||
<div class="input-box-row">
|
||||
<div class="ui card inbox-send-message-card w-100">
|
||||
<!--<div class="content input-options bg-dark-green-color">-->
|
||||
<!-- <div class="input-option-row ">-->
|
||||
<!-- <img src="{{ asset('images/icons/B.png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/I.png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/Vector (5).png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/Vector (6).png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/Vector (8).png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/drive.png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/Vector (5).png') }}" alt="">-->
|
||||
<!-- <img src="{{ asset('images/icons/Vector (6).png') }}" alt="">-->
|
||||
<!-- </div>-->
|
||||
<!--</div>-->
|
||||
<div class="content d-flex align-items-end flex-column message-writing-content-area">
|
||||
<textarea rows="7" placeholder="Your Message"
|
||||
class="form-control input-reply-textarea" id="editor1" required></textarea>
|
||||
<button class="ui button bg-light-green-color mt-4 color-light saveReply">
|
||||
Reply
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--wysywyg editor-->
|
||||
<script src="https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>
|
||||
|
||||
|
||||
<!-- Canned Response Modal -->
|
||||
<!-- Canned Response Modal -->
|
||||
<div id="cannedResponseModal" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close-button">×</span>
|
||||
<h2>Canned Responses</h2>
|
||||
<ul>
|
||||
|
||||
@if(count($canned_response) > 0)
|
||||
@foreach($canned_response as $index => $value)
|
||||
|
||||
@php
|
||||
|
||||
$result = json_decode($value->value);
|
||||
|
||||
@endphp
|
||||
|
||||
<li><button class="canned-response" data-response="{{$result->text}}">{{$result->name}}</button></li>
|
||||
@endforeach
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
//CKEDITOR.replace('editor1');
|
||||
|
||||
CKEDITOR.plugins.add('addcannedresponse', {
|
||||
init: function(editor) {
|
||||
editor.addCommand('addCannedResponseCmd', {
|
||||
exec: function(editor) {
|
||||
document.getElementById('cannedResponseModal').style.display = 'block';
|
||||
}
|
||||
});
|
||||
editor.ui.addButton('AddCannedResponse', {
|
||||
label: 'Insert Canned Response',
|
||||
command: 'addCannedResponseCmd',
|
||||
icon: 'https://kundesone.no/images/canned.png', // Use an accessible icon URL or local path
|
||||
toolbar: 'insert,0'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
CKEDITOR.replace('editor1', {
|
||||
extraPlugins: 'addcannedresponse', // Ensure your plugin is added to extraPlugins
|
||||
// Optionally customize your toolbar further, or use the default configuration
|
||||
toolbarGroups: [
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
|
||||
{ name: 'links' },
|
||||
{ name: 'insert' },
|
||||
{ name: 'forms' },
|
||||
{ name: 'tools' },
|
||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
|
||||
{ name: 'others' },
|
||||
'/',
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
|
||||
{ name: 'styles' },
|
||||
{ name: 'colors' },
|
||||
{ name: 'about' }
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// Get the modal
|
||||
var modal = document.getElementById("cannedResponseModal");
|
||||
|
||||
// Get the button that opens the modal
|
||||
var btn = document.getElementsByClassName("canned-response");
|
||||
|
||||
// Get the <span> element that closes the modal
|
||||
var span = document.getElementsByClassName("close-button")[0];
|
||||
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
span.onclick = function() {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function(event) {
|
||||
if (event.target == modal) {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Add event listeners to canned response buttons
|
||||
Array.from(btn).forEach(function(element) {
|
||||
element.addEventListener('click', function() {
|
||||
var response = this.getAttribute('data-response');
|
||||
CKEDITOR.instances.editor1.insertHtml(response);
|
||||
modal.style.display = "none";
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Action Box -->
|
||||
<div class="action-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tagify CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.css" rel="stylesheet">
|
||||
|
||||
<!-- Tagify JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/@yaireo/tagify/dist/tagify.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
#cke_editor1{
|
||||
width:100%!important;
|
||||
}
|
||||
|
||||
div.chat-inbox.chat-box{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #fefefe;
|
||||
margin: 15% auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
color: #aaa;
|
||||
float: right;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
background:;#748c62 !important
|
||||
}
|
||||
|
||||
.close-button:hover,
|
||||
.close-button:focus {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
#cannedResponseModal ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#cannedResponseModal li {
|
||||
padding: 8px 0; /* Spacing between buttons */
|
||||
}
|
||||
|
||||
.canned-response {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s, box-shadow 0.3s;
|
||||
}
|
||||
|
||||
.canned-response:hover {
|
||||
background-color: #45a049;
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.24);
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--Script Tag-->
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var activeTicketId = $('.chat-detail-item.active').data('ticket-id');
|
||||
|
||||
// Load chat messages for the active ticket on page load
|
||||
loadChatMessages(activeTicketId);
|
||||
loadActionBox(activeTicketId);
|
||||
|
||||
// Click event to switch between tickets
|
||||
$('.chat-detail-item').on('click', function() {
|
||||
$('.chat-detail-item').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
activeTicketId = $(this).data('ticket-id');
|
||||
loadChatMessages(activeTicketId);
|
||||
loadActionBox(activeTicketId);
|
||||
});
|
||||
|
||||
// Function to load chat messages for a specific ticket
|
||||
function loadChatMessages(ticketId) {
|
||||
$.ajax({
|
||||
url: '/fetch-chat-messages/' + ticketId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
// Update chat box with fetched messages
|
||||
$('.chat-content-wrapper').html(response);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('Error loading messages:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
// Function to load action box for a specific ticket
|
||||
function loadActionBox(ticketId) {
|
||||
$.ajax({
|
||||
url: '/fetch-action-box/' + ticketId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
// Update action box with fetched content
|
||||
$('.action-box').html(response);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('Error fetching action box content:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Save reply
|
||||
$('.saveReply').on('click', function(){
|
||||
var message = CKEDITOR.instances.editor1.getData();
|
||||
if(message.trim() === '') {
|
||||
toastr.error('Message cannot be empty');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: '/store/response',
|
||||
method: 'POST',
|
||||
data: {
|
||||
ticket_id: activeTicketId,
|
||||
message: message,
|
||||
_token: '{{ csrf_token() }}'
|
||||
},
|
||||
success: function(response) {
|
||||
// Reload chat messages for the active ticket
|
||||
loadChatMessages(activeTicketId);
|
||||
loadActionBox(activeTicketId);
|
||||
// Update the last response in the ticket list
|
||||
var ticketElement = $('.chat-detail-item[data-ticket-id="' + activeTicketId + '"]');
|
||||
ticketElement.find('.receiver-message').text(response.message);
|
||||
ticketElement.find('.message-time').text(response.created_at);
|
||||
// Clear the editor
|
||||
CKEDITOR.instances.editor1.setData('');
|
||||
|
||||
// window.location.reload();
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('Error creating a response:', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('.chat-detail-item').on('click', function(){
|
||||
$('.chat-detail-item').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
var ticketId = $(this).data('ticket-id');
|
||||
fetchChatMessages(ticketId);
|
||||
updateActionBox(ticketId);
|
||||
});
|
||||
|
||||
// Function to fetch and display chat messages for a ticket
|
||||
function fetchChatMessages(ticketId) {
|
||||
$.ajax({
|
||||
url: '/fetch-chat-messages/' + ticketId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
// Update chat box with fetched messages
|
||||
$('.chat-content-wrapper').html(response);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('Error fetching chat messages:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Function to update the action box for a ticket
|
||||
function updateActionBox(ticketId) {
|
||||
$.ajax({
|
||||
url: '/fetch-action-box/' + ticketId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
// Update action box with fetched content
|
||||
$('.action-box').html(response);
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('Error fetching action box content:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@endsection
|
||||
|
|
@ -4,6 +4,15 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.side-bar-links a').removeClass('bg-light-color');
|
||||
$('.aw-a-waiting').addClass('bg-light-color');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<div class="ui card chat-card waiting-chat-card">
|
||||
<div class="content chat-card-header d-flex align-items-center justify-content-between">
|
||||
|
|
@ -26,7 +35,7 @@
|
|||
<ul class="chat-details">
|
||||
@foreach($tickets as $ticket)
|
||||
<li>
|
||||
<a href="{{ route('inbox') }}" class="chat-detail-item d-flex align-items-center">
|
||||
<a href="{{ route('show.ticket', $ticket->id) }}" class="chat-detail-item d-flex align-items-center">
|
||||
<div class="chat-user-img">
|
||||
<img src="{{ asset('images/Avatar.png') }}" alt="User">
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,16 +40,19 @@
|
|||
Route::get('/dashboard', [DashboardController::class, 'dashboard'])->name('index');
|
||||
Route::get('/profile', [DashboardController::class, 'profile'])->name('profile');
|
||||
Route::get('company-info', [CompanyController::class, 'getCompanyInfo'])->name('get.company.info');
|
||||
Route::get('/waiting', [DashboardController::class, 'waiting'])->name('waiting');
|
||||
Route::get('/waiting', [TicketController::class, 'waiting'])->name('waiting');
|
||||
Route::get('/all-tickets', [TicketController::class, 'allTickets'])->name('all.tickets');
|
||||
Route::get('/show-ticket/{ticketId}', [TicketController::class, 'showTicket'])->name('show.ticket');
|
||||
Route::post('update-ticket-status/{ticketId}', [TicketController::class, 'updateStatus']);
|
||||
Route::post('update-ticket/{ticketId}', [TicketController::class, 'updateTicket'])->name('update.ticket');
|
||||
Route::post('store-tags', [TicketController::class, 'storeTags'])->name('store.tags');
|
||||
Route::get('inbox', [InboxController::class, 'inbox'])->name('inbox');
|
||||
Route::get('fetch-chat-messages/{ticketId}', [InboxController::class, 'fetchChatMessages']);
|
||||
Route::get('fetch-action-box/{ticketId}', [InboxController::class, 'fetchActionBox']);
|
||||
Route::get('/inbox-setting', [InboxController::class, 'inboxSetting'])->name('inbox.setting');
|
||||
Route::post('update-ticket-status/{ticketId}', [TicketController::class, 'updateStatus']);
|
||||
Route::post('store-comment', [TicketController::class, 'storeComment']);
|
||||
Route::get('delete-comment/{commentId}', [TicketController::class, 'deleteComment']);
|
||||
Route::post('store/response', [TicketController::class, 'storeResponse'])->name('store.response');
|
||||
Route::post('store-comment', [InboxController::class, 'storeComment']);
|
||||
Route::get('delete-comment/{commentId}', [InboxController::class, 'deleteComment']);
|
||||
Route::post('store/response', [InboxController::class, 'storeResponse'])->name('store.response');
|
||||
//Basic Setting Route
|
||||
Route::post('inbox/basic-setting', [InboxController::class, 'basicSetting'])->name('inbox.basic.setting');
|
||||
//User Routes
|
||||
|
|
|
|||
Loading…
Reference in New Issue