Index: app/Http/Controllers/Dashboard/DepartmentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DepartmentsController.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Http/Controllers/Dashboard/DepartmentsController.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -36,4 +36,6 @@
         $department->code = $request->code;
 
+        $len = Storage::disk('local')->path('');
+
         if(!Storage::disk('local')->has('Departments/' . $request->code)){
             Storage::disk('local')->makeDirectory('Departments/' . $request->code);
@@ -41,5 +43,5 @@
 
         $department->user_id = auth()->id();
-        $department->location = '/Departments/' . $request->code;
+        $department->location =  Storage::disk('local')->path('') . 'Departments/' . $request->code;
 
         $department->save();
@@ -65,8 +67,6 @@
         $department->name = $request->name;
         $department->code = $request->code;
-        $department->updated_at = Carbon::now();;
 
-        $path = '/Departments/' . $request->code;
-        $department->location = $path;
+        $department->location =  Storage::disk('local')->path('') . 'Departments/' . $request->code;
 
         $files = Storage::allFiles($oldDepartmentCode);
Index: app/Http/Controllers/Dashboard/DocumentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DocumentsController.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Http/Controllers/Dashboard/DocumentsController.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -17,11 +17,69 @@
     public function index(Request $request)
     {
+        $queries = explode(" ", $request->search);
+        $result = collect();
+
+        foreach ($queries as $query) {
+            $result->push(Document::where("arch_id", "like", "%{$query}%")->orWhere("name", "like", "%{$query}%")->get());
+        }
+
+        $result = $result->flatten();
+
+
         if ($request->query('id')) {
-            $documents = Document::where('department_id', $request->query('id'))->get();
-        } else {
-            $documents = Document::all();
+
+            $documentsInDeptSort = Document::with('department')->when($request->has('id'), function($query) use ($request) {
+                $query->where('department_id', $request->query('id'));
+            });
+
+            if($request->query('sort') == 'newest') {
+                $documents = $documentsInDeptSort->orderBy('created_at', 'desc')->paginate(20);
+            }
+            else if($request->query('sort') == 'name') {
+                $documents = $documentsInDeptSort->orderBy('name', 'asc')->paginate(20);
+            }
+            else{
+                $documents = Document::where('department_id', $request->query('id'))->paginate(20);
+            }
+        }
+        else {
+            if($request->query('sort') == 'newest') {
+                $documents = Document::orderBy('created_at', 'desc')->paginate(20);
+            }
+            else if($request->query('sort') == 'name') {
+                $documents = Document::orderBy('name', 'asc')->paginate(20);
+            }
+            else if($request->query('sort') == 'important'){
+                $documents = Document::where('is_important', true)->paginate(20);
+            }
+            else if($request->query('sort') == 'recent') {
+               $documents = Document::orderBy('created_at', 'desc')->paginate(20);
+            }
+            else if($request->query('search')){
+                $result = collect();
+
+                foreach ($queries as $query) {
+                    $result->push(Document::where("arch_id", "like", "%{$query}%")->orWhere("name", "like", "%{$query}%")->get());
+                }
+                $result = $result->flatten();
+                $documents = $result;
+            }
+            else
+            {
+                $documents = Document::paginate(20);
+            }
         }
 
         $departments = Department::all();
+
+        $diskTotal = disk_total_space('/');
+        $diskTotalSize = $diskTotal / 1073741824;
+
+        $diskFree  = disk_free_space('/');
+        $used = $diskTotal - $diskFree;
+
+        $diskUsedSize = $used / 1073741824;
+        $diskUse1 = round(100 - (($diskUsedSize / $diskTotalSize) * 100));
+        $diskUse = round(100 - ($diskUse1)) . '%';
 
         return view("dashboard.documents.index")->with([
@@ -30,5 +88,11 @@
             "departments" => $departments,
             "docsCount" => Department::withCount('document')->get(),
-            'totalDocs' => Document::all()->count()
+            "totalDocs" => Document::all()->count(),
+            "countImportant" => Document::where('is_important', true)->get()->count(),
+            "diskTotal" => $diskTotal,
+            "diskTotalSize" => $diskTotalSize,
+            "diskUse" => $diskUse,
+            "diskUsedSize" => $diskUsedSize
+
         ]);
 
@@ -40,4 +104,38 @@
             "departments" => Department::all()
         ]);
+    }
+
+    public function store(DocumentRequest $request, UploadService $uploadService)
+    {
+        $document = new Document();
+        $user = auth()->user();
+        $department = Department::find($request->department);
+
+        $document->user()->associate($user);
+        $document->department()->associate($department);
+
+        $document->arch_id = $request->arch_id;
+        $document->name = $request->name;
+        $document->description = $request->description;
+
+        if (!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)) {
+            Storage::disk('local')->makeDirectory($document->department()->pluck('location')->join("") . '/' . $request->arch_id);
+        }
+
+        $documentFile = $uploadService->upload(File::class, [
+            "file_item" => $request->file_item,
+        ], "link", true);
+
+        $document->save();
+
+        foreach ($documentFile as $df) {
+            $file = File::find($df);
+            $file->document()->associate($document);
+            $file->save();
+        }
+
+        Alert::flash("New document created successfully");
+
+        return redirect()->route("dashboard.documents.index");
     }
 
@@ -73,37 +171,46 @@
     }
 
-    public function store(DocumentRequest $request, UploadService $uploadService)
-    {
-        $document = new Document();
-        $user = auth()->user();
-        $department = Department::find($request->department);
-
-        $document->user()->associate($user);
-        $document->department()->associate($department);
-
-        $document->arch_id = $request->arch_id;
-        $document->name = $request->name;
-        $document->description = $request->description;
-
-        if (!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)) {
-            Storage::disk('local')->makeDirectory($document->department()->pluck('location')->join("") . '/' . $request->arch_id);
-        }
-
-        $documentFile = $uploadService->upload(File::class, [
-            "file_item" => $request->file_item,
-        ], "link", true);
-
+    public function toggleImportant($id)
+    {
+        $document = Document::find($id);
+        $document->is_important = !$document->is_important;
         $document->save();
 
-        foreach ($documentFile as $df) {
-            $file = File::find($df);
-            $file->document()->associate($document);
-            $file->save();
-        }
-
-        Alert::flash("New document created successfully");
-
+        if($document->is_important==true)
+        Alert::flash("Document marked as important successfully");
+        else
+            Alert::flash("Document marked as not important successfully");
+
+        return redirect()->back();
+    }
+
+    public function search(Request $request)
+    {
+        $queries = explode(" ", $request->q);
+        $result = collect();
+
+        foreach ($queries as $query) {
+            $result->push(Document::where("arch_id", "like", "%{$query}%")->orWhere("name", "like", "%{$query}%")->get());
+        }
+
+        $result = $result->flatten();
+
+        $departments = Department::all();
+
+        return view("dashboard.documents.search")
+            ->with("searchQuery", $request->q)
+            ->with("results", $result)
+            ->with("departments", $departments)
+            ->with("countImportant", Document::where('is_important', true)->get()->count());
+    }
+
+    public function destroy($id)
+    {
+        $document = Document::find($id);
+        if (auth()->user()->hasPermission("delete_all_posts")) {
+            $document->delete();
+            Alert::flash($document->name . " deleted successfully");
+        }
         return redirect()->route("dashboard.documents.index");
     }
-
 }
Index: app/Http/Controllers/Dashboard/SettingsController.php
===================================================================
--- app/Http/Controllers/Dashboard/SettingsController.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Http/Controllers/Dashboard/SettingsController.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -3,4 +3,5 @@
 namespace App\Http\Controllers\Dashboard;
 
+use App\Helpers\Alert;
 use App\Http\Requests\Dashboard\EmailSettingsRequest;
 use App\Http\Requests\Dashboard\PasswordSettingsRequest;
@@ -10,4 +11,7 @@
 use App\Notifications\VerifyNewEmail;
 use Carbon\Carbon;
+use Illuminate\Contracts\Validation\Validator;
+use Illuminate\Http\Request;
+use Illuminate\Validation\ValidationException;
 
 class SettingsController extends Controller
@@ -17,5 +21,5 @@
         return view("dashboard.settings.index")->with([
             "user" => auth()->user(),
-            "adminAndEditors" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),
+            "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),
             "active_tab" => "account"
         ]);
@@ -24,5 +28,4 @@
     public function updateUsername(UsernameSettingsRequest $request)
     {
-        if ($request->validated()) {
             $user = auth()->user();
             $user->username = $request->username;
@@ -33,21 +36,16 @@
 
             return redirect()->route("auth.loginShow");
-        } else {
-            return back()->with(['active_tab' => 'security']);
-        }
-
-        dd('no');
     }
 
-    public function updatePassword(PasswordSettingsRequest $request)
+    public function updatePassword(UsernameSettingsRequest $request)
     {
-        $user = auth()->user();
-        $user->password = bcrypt($request->password);
-        $user->save();
+            $user = auth()->user();
+            $user->password = bcrypt($request->password);
+            $user->save();
 
-        auth()->logout();
-        session()->flush();
+            auth()->logout();
+            session()->flush();
 
-        return redirect()->route("auth.loginShow");
+            return redirect()->route("auth.loginShow");
     }
 
Index: app/Http/Requests/Dashboard/DocumentRequest.php
===================================================================
--- app/Http/Requests/Dashboard/DocumentRequest.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Http/Requests/Dashboard/DocumentRequest.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -3,4 +3,5 @@
 namespace App\Http\Requests\Dashboard;
 
+use App\Models\Department;
 use App\Models\Document;
 use App\Models\FileType;
@@ -38,6 +39,6 @@
                     $arch_id = $this->request->get('arch_id');
                     $deptId = explode('/', $arch_id)[0];
-                    if ($deptId !== $this->request->get('department')) {
-                        $fail("Dept id error");
+                    if ($deptId !== Department::find($this->request->get('department'))->code) {
+                        $fail("Document Archive ID field format is invalid");
                     }
                 }
Index: app/Http/Requests/Dashboard/UsernameSettingsRequest.php
===================================================================
--- app/Http/Requests/Dashboard/UsernameSettingsRequest.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Http/Requests/Dashboard/UsernameSettingsRequest.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -35,8 +35,8 @@
         $response = redirect()
             ->route('dashboard.settings.index')
-            ->with(['active_tab' => 'security'])
+            ->withInput(['active_tab' => 'security'])
             ->withErrors($validator);
 
-        throw (new ValidationException($validator, $response))
+        throw (new ValidationException($validator))
             ->errorBag($this->errorBag)
             ->redirectTo($this->getRedirectUrl());
Index: app/Models/Document.php
===================================================================
--- app/Models/Document.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ app/Models/Document.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -8,7 +8,9 @@
 class Document extends Model
 {
+    use HasFactory;
     protected $table = "documents";
 
-    protected $fillable = ["arch_id", "name", "description", "user_id", "department_id"];
+    protected $fillable = ["arch_id", "name", "description", "user_id", "department_id", "is_important"];
+
 
     public function user() {
Index: database/factories/DepartmentFactory.php
===================================================================
--- database/factories/DepartmentFactory.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ database/factories/DepartmentFactory.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -24,11 +24,10 @@
     public function definition()
     {
-        $location = $this->faker->unique()->numberBetween(1, 99);
+        $location = $this->faker->unique()->numberBetween(1, 25);
         Storage::disk('local')->makeDirectory('Departments/' . $location);
         return [
-            'id' => $this->faker->unique()->randomNumber(),
-            'name' => $this->faker->name(),
+            'name' => $this->faker->firstName() . " department",
             'code' => $location,
-            'location' => 'Departments/' . $location,
+            'location' => Storage::disk('local')->path('') . 'Departments/' . $location,
             'user_id' => $this->faker->numberBetween('1', '2'),
             'created_at' => Carbon::now()
Index: database/factories/DocumentFactory.php
===================================================================
--- database/factories/DocumentFactory.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
+++ database/factories/DocumentFactory.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -0,0 +1,41 @@
+<?php
+
+namespace Database\Factories;
+
+use App\Models\Department;
+use App\Models\Document;
+use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Factories\Factory;
+use Illuminate\Support\Facades\Storage;
+
+class DocumentFactory extends Factory
+{
+    /**
+     * The name of the factory's corresponding model.
+     *
+     * @var string
+     */
+    protected $model = Document::class;
+
+    /**
+     * Define the model's default state.
+     *
+     * @return array
+     */
+    public function definition()
+    {
+
+        $deptID = $this->faker->numberBetween('1', '25');
+
+        return [
+            'arch_id' => $deptID . "/" . $this->faker->unique()->randomNumber(),
+            'name' => $this->faker->unique()->firstName(),
+            'description' => $this->faker->realText(),
+            'user_id' => $this->faker->numberBetween('1', '2'),
+            'department_id' => $deptID,
+            'is_important' => $this->faker->boolean,
+            'created_at' => $this->faker->dateTime()
+        ];
+
+    }
+}
Index: database/migrations/2021_10_06_103305_create_documents_table.php
===================================================================
--- database/migrations/2021_10_06_103305_create_documents_table.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ database/migrations/2021_10_06_103305_create_documents_table.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -19,7 +19,7 @@
             $table->string("name");
             $table->text("description");
-            $table->boolean("is_active")->default(false);
             $table->integer("user_id")->unsigned();
             $table->integer("department_id")->unsigned();
+            $table->boolean("is_important")->default(true);
             $table->timestamps();
 
Index: database/seeders/DatabaseSeeder.php
===================================================================
--- database/seeders/DatabaseSeeder.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ database/seeders/DatabaseSeeder.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -19,5 +19,5 @@
         $this->call(UsersTableSeeder::class);
         $this->call(DepartmentsTableSeeder::class);
-        //$this->call(DocumentsTableSeeder::class);
+        $this->call(DocumentsTableSeeder::class);
     }
 }
Index: database/seeders/DepartmentsTableSeeder.php
===================================================================
--- database/seeders/DepartmentsTableSeeder.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ database/seeders/DepartmentsTableSeeder.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -16,5 +16,5 @@
     public function run()
     {
-        Department::factory()->count(99)->create();
+        Department::factory()->count(25)->create();
     }
 }
Index: database/seeders/DocumentsTableSeeder.php
===================================================================
--- database/seeders/DocumentsTableSeeder.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ database/seeders/DocumentsTableSeeder.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -3,4 +3,5 @@
 namespace Database\Seeders;
 
+use App\Models\Document;
 use Carbon\Carbon;
 use Illuminate\Database\Seeder;
@@ -15,105 +16,95 @@
     public function run()
     {
-        \DB::table('documents')->insert([
-            [
-                "name" => "Document test",
-                "arch_id" => "HR150",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document tests",
-                "arch_id" => "HR1505",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "2",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR15033",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document testasd",
-                "arch_id" => "HR150124",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "3",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR1501421",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR150213",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR150ad",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "2",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR150234",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "3",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR15012321",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR15021312",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-            [
-                "name" => "Document test",
-                "arch_id" => "HR15312430",
-                "description" => "hahahah ah aha hshdash dhawud hwa",
-                "user_id" => "1",
-                "department_id" => "1",
-                "is_active" => "1",
-                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
-            ],
-        ]);
+//        \DB::table('documents')->insert([
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR150",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document tests",
+//                "arch_id" => "HR1505",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "2",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR15033",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document testasd",
+//                "arch_id" => "HR150124",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "3",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR1501421",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR150213",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR150ad",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "2",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR150234",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "3",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR15012321",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR15021312",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//            [
+//                "name" => "Document test",
+//                "arch_id" => "HR15312430",
+//                "description" => "hahahah ah aha hshdash dhawud hwa",
+//                "user_id" => "1",
+//                "department_id" => "1",
+//                "created_at" => Carbon::now()->format('Y-m-d H:i:s'),
+//            ],
+//        ]);
+        Document::factory()->count(300)->create();
     }
 }
Index: public/assets/js/app.js
===================================================================
--- public/assets/js/app.js	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ public/assets/js/app.js	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -916,13 +916,10 @@
     $(".edit_document_deparment").change(function() {
         var archId = $("input[name='arch_id']");
-        var currentArchId = archId.val();
-        var currentText = currentArchId.split("/")[1];
-        var selectedId = $(this).find('option:selected').val();
-
-        if(currentText.length) {
+        var currentText = archId.val().split("/")[1];
+        var selectedId = $(this).find('option:selected').data('dept-code');
+        if(currentText)
             archId.val(selectedId + "/" + currentText);
-        } else {
+        else
             archId.val(selectedId + "/");
-        }
     });
 
Index: resources/assets/js/custom.js
===================================================================
--- resources/assets/js/custom.js	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/assets/js/custom.js	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -9,13 +9,10 @@
     $(".edit_document_deparment").change(function() {
         var archId = $("input[name='arch_id']");
-        var currentArchId = archId.val();
-        var currentText = currentArchId.split("/")[1];
-        var selectedId = $(this).find('option:selected').val();
-
-        if(currentText.length) {
+        var currentText = archId.val().split("/")[1];
+        var selectedId = $(this).find('option:selected').data('dept-code');
+        if(currentText)
             archId.val(selectedId + "/" + currentText);
-        } else {
+        else
             archId.val(selectedId + "/");
-        }
     });
 
Index: resources/views/dashboard/departments/index.blade.php
===================================================================
--- resources/views/dashboard/departments/index.blade.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/views/dashboard/departments/index.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -67,9 +67,10 @@
                                     @endif
                                     <!-- Trigger -->
-                                    <td id="copy_{{ $department->id }}" value="{{$department->location}}">{{$department->location}}
+                                    <td>{!! Str::substr($department->location , strlen(Storage::disk('local')->path(''))) !!}
                                             <button class="btn btn-sm btn-primary text-white" data-clipboard-target="#copy_{{ $department->id }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
                                                     <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
                                                     <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
                                                 </svg></button>
+                                        <span type="hidden" id="copy_{{$department->id}}"></span>
                                     </td>
                                     <td>
Index: resources/views/dashboard/documents/create.blade.php
===================================================================
--- resources/views/dashboard/documents/create.blade.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/views/dashboard/documents/create.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -35,8 +35,7 @@
                                                 <label for="exampleFormControlSelect1">Department</label>
                                                 @if($departments->count())
-                                                <select class="form-control" name="department" required>
-                                                    <option></option>
+                                                <select class="form-control edit_document_deparment" name="department" required>
                                                     @foreach ($departments as $department)
-                                                        <option value="{{ $department->id }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>
+                                                        <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>
                                                     @endforeach
                                                         @else
@@ -49,5 +48,5 @@
                                                 <div class="form-group">
                                                     <label>Archive ID</label>
-                                                    <input type="text" name="arch_id" value="{{ old('arch_id') }}" class="form-control" placeholder="Archive ID" required>
+                                                    <input type="text" name="arch_id" value="{{ old("arch_id") }}" class="form-control" placeholder="Archive ID" required>
                                                 </div>
                                             </div>
Index: resources/views/dashboard/documents/edit.blade.php
===================================================================
--- resources/views/dashboard/documents/edit.blade.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/views/dashboard/documents/edit.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -37,5 +37,5 @@
                                                         <select class="form-control edit_document_deparment" name="department" required>
                                                             @foreach ($departments as $department)
-                                                                <option value="{{ $department->id }}" {{ old("department", $document->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>
+                                                                <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $document->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>
                                                             @endforeach
                                                         </select>
Index: resources/views/dashboard/documents/index.blade.php
===================================================================
--- resources/views/dashboard/documents/index.blade.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/views/dashboard/documents/index.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -32,16 +32,12 @@
                             </a>
                         @endforeach
-                        <a href="" class="list-group-item">
+                        <a href="{{ URL::current()."?sort=recent" }}" class="list-group-item">
                             <i data-feather="upload-cloud" class="width-15 height-15 mr-2"></i>
                             Recents
                         </a>
-                        <a href="" class="list-group-item d-flex align-items-center">
+                        <a href="{{ URL::current()."?sort=important" }}" class="list-group-item d-flex align-items-center">
                             <i data-feather="star" class="width-15 height-15 mr-2"></i>
                             Important
-                            <span class="small ml-auto">10</span>
-                        </a>
-                        <a href="" class="list-group-item">
-                            <i data-feather="trash" class="width-15 height-15 mr-2"></i>
-                            Deleted Files
+                            <span class="small ml-auto">{{ $countImportant }}</span>
                         </a>
                     </div>
@@ -55,8 +51,10 @@
                                 <div class="progress" style="height: 10px">
                                     <div class="progress-bar progress-bar-striped" role="progressbar"
-                                         style="width: 40%" aria-valuenow="10" aria-valuemin="0"
+                                         style="width: {{$diskUse}}" aria-valuenow="10" aria-valuemin="0"
                                          aria-valuemax="100"></div>
-                                </div>
-                                <div class="line-height-12 small text-muted mt-2">19.5GB used of 25GB</div>
+                                        <span class="sr-only">{{$diskUse}}</span>
+                                </div>
+                                <div class="line-height-12 small text-muted mt-2">{{round($diskUsedSize,2)}} GB /
+                                    {{round($diskTotalSize,2)}} GB ({{$diskUse}})</div>
                             </div>
                         </div>
@@ -98,7 +96,13 @@
                             </a>
                             <div class="dropdown-menu">
-                                <a class="dropdown-item" href="#">Date</a>
-                                <a class="dropdown-item" href="#">Name</a>
-                                <a class="dropdown-item" href="#">Size</a>
+                                @if(Request::get('id'))
+                                    <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=newest" }}">Date</a>
+                                    <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=name" }}">Name</a>
+                                    <a class="dropdown-item" href="#">Size</a>
+                                @else
+                                    <a class="dropdown-item" href="{{ URL::current()."?sort=newest" }}">Date</a>
+                                    <a class="dropdown-item" href="{{ URL::current()."?sort=name" }}">Name</a>
+                                    <a class="dropdown-item" href="#">Size - not done</a>
+                                @endif
                             </div>
                         </li>
@@ -106,13 +110,10 @@
                 </div>
                 <div class="action-right">
-                    <form class="d-flex mr-3">
-                        <a href="#" class="app-sidebar-menu-button btn btn-outline-light">
-                            <i data-feather="menu"></i>
-                        </a>
+                    <form action="{{ route("dashboard.documents.index") }}" method="get" class="d-flex mr-3">
                         <div class="input-group">
-                            <input type="text" class="form-control" placeholder="Search file"
-                                   aria-describedby="button-addon1">
+                            <input type="text" name="search" class="form-control" placeholder="Search file"
+                                   aria-describedby="button-addon1" required>
                             <div class="input-group-append">
-                                <button class="btn btn-outline-light" type="button" id="button-addon1">
+                                <button class="btn btn-outline-light searchSubmitBtn" type="submit" value="Search">
                                     <i data-feather="search"></i>
                                 </button>
@@ -122,6 +123,4 @@
                 </div>
             </div>
-
-
             <p>Documents</p>
             <div class="row">
@@ -139,11 +138,23 @@
                                         <a href="#" class="dropdown-item">Share</a>
                                         <a href="#" class="dropdown-item">Download</a>
-                                        <a href="#" class="dropdown-item">Move to</a>
-                                        <a href="#" class="dropdown-item">Delete</a>
+                                        <button class="dropdown-item action-dropdown-item"
+                                           href="javascript:void(0)" onclick="toggleImportant({{$document->id}})">
+                                            @if($document->is_important)
+                                                Mark as not important
+                                            @else
+                                                Mark as important
+                                            @endif
+                                        </button>
+                                        <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$document->id}}">Delete</a>
                                     </div>
                                 </div>
                             </div>
                             <div class="p-2 small">
-                                <div>{{$document->name}} - {{$document->arch_id}}</div>
+                                @if($document->is_important)
+                                    <div>{{$document->name}} - {{$document->arch_id}} <i class="fa fa-star" style="color:orange"></i></div>
+                                @else
+                                    <div>{{$document->name}} - {{$document->arch_id}} </div>
+                                @endif
+                                <div>{{$document->created_at}}</div>
                                 <div class="text-muted">{{$document->description}}</div>
                                 <div class="text-muted">1.2MB</div>
@@ -151,9 +162,43 @@
                         </div>
                     </div>
+                    <form id="toggleImportant_{{ $document->id }}"
+                          action="{{ route("dashboard.documents.toggleImportant", ["id" => $document->id]) }}"
+                          method="post">
+                        @csrf
+                        @method("patch")
+                    </form>
+                    <div class="modal fade" id="deleteModal_{{$document->id}}" tabindex="-1" role="dialog" aria-hidden="true">
+                        <div class="modal-dialog modal-dialog-centered" role="document">
+                            <div class="modal-content">
+                                <div class="modal-header">
+                                    <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
+                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                                        <i class="ti-close"></i>
+                                    </button>
+                                </div>
+                                <div class="modal-body">
+                                    <form action="{{ route("dashboard.documents.destroy", $document->id) }}" method="POST">
+                                        @csrf
+                                        @method('DELETE')
+                                        <p>Are you sure you want to delete document {{$document->name}} with Archive ID: {{ $document->arch_id }}?</p>
+                                        <div class="modal-footer">
+                                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
+                                            </button>
+                                            <button type="submit" class="btn btn-primary">Save changes</button>
+                                        </div>
+                                    </form>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
                 @empty
-                    <div>No items found</div>
+                    <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>
                 @endforelse
 
             </div>
+             @if(!Request::query('search'))
+             {{$documents->appends($_GET)->links('layouts.pagination') }}
+                 @endif
     </div>
 
@@ -162,5 +207,9 @@
 @section('script')
 
-
+<script>
+    function toggleImportant(id) {
+        document.getElementById('toggleImportant_' + id).submit();
+    }
+</script>
 
 @endsection
Index: resources/views/dashboard/documents/search.blade.php
===================================================================
--- resources/views/dashboard/documents/search.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
+++ resources/views/dashboard/documents/search.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -0,0 +1,166 @@
+{{--@extends('layouts.app')--}}
+
+{{--@section("title", "SaveSpace - Documents")--}}
+
+{{--@section('pageTitle', 'SaveSpace - Documents')--}}
+
+{{--@section('content')--}}
+
+{{--    <div class="row app-block mb-4">--}}
+{{--        <div class="col-md-3 app-sidebar">--}}
+{{--            <div class="card">--}}
+{{--                <div class="card-body">--}}
+{{--                    <a href="{{ route("dashboard.documents.create") }}" class="btn btn-secondary btn-block file-upload-btn text-white" data-action="{{ route("dashboard.documents.create") }}">--}}
+{{--                        Add document--}}
+{{--                    </a>--}}
+{{--                    <form class="d-none" id="file-upload">--}}
+{{--                        <input type="file" multiple>--}}
+{{--                    </form>--}}
+{{--                </div>--}}
+{{--                <div class="app-sidebar-menu">--}}
+{{--                    <div class="list-group list-group-flush">--}}
+{{--                        <a href="{{route("dashboard.documents.index")}}" class="list-group-item d-flex align-items-center">--}}
+{{--                            <i data-feather="folder" class="width-15 height-15 mr-2"></i>--}}
+{{--                            Documents--}}
+{{--                        </a>--}}
+{{--                        @foreach($departments as $department)--}}
+{{--                            <a href="{{ route("dashboard.documents.index", ["id" => $department->id]) }}" class="list-group-item d-flex align-items-center">--}}
+{{--                                <i data-feather="folder" class="width-15 height-15 mr-2"></i>--}}
+{{--                                {{$department->name}}--}}
+{{--                                <span class="small ml-auto">{{$department->document->count()}}</span>--}}
+{{--                            </a>--}}
+{{--                        @endforeach--}}
+{{--                        <a href="" class="list-group-item">--}}
+{{--                            <i data-feather="upload-cloud" class="width-15 height-15 mr-2"></i>--}}
+{{--                            Recents--}}
+{{--                        </a>--}}
+{{--                        <a href="{{ URL::current()."?sort=important" }}" class="list-group-item d-flex align-items-center">--}}
+{{--                            <i data-feather="star" class="width-15 height-15 mr-2"></i>--}}
+{{--                            Important--}}
+{{--                            <span class="small ml-auto">{{ $countImportant }}</span>--}}
+{{--                        </a>--}}
+{{--                        <a href="" class="list-group-item">--}}
+{{--                            <i data-feather="trash" class="width-15 height-15 mr-2"></i>--}}
+{{--                            Deleted Files--}}
+{{--                        </a>--}}
+{{--                    </div>--}}
+{{--                    <div class="card-body">--}}
+{{--                        <h6 class="mb-4">Storage Status</h6>--}}
+{{--                        <div class="d-flex align-items-center">--}}
+{{--                            <div class="mr-3">--}}
+{{--                                <i data-feather="database" class="width-30 height-30"></i>--}}
+{{--                            </div>--}}
+{{--                            <div class="flex-grow-1">--}}
+{{--                                <div class="progress" style="height: 10px">--}}
+{{--                                    <div class="progress-bar progress-bar-striped" role="progressbar"--}}
+{{--                                         style="width: 40%" aria-valuenow="10" aria-valuemin="0"--}}
+{{--                                         aria-valuemax="100"></div>--}}
+{{--                                </div>--}}
+{{--                                <div class="line-height-12 small text-muted mt-2">19.5GB used of 25GB</div>--}}
+{{--                            </div>--}}
+{{--                        </div>--}}
+{{--                    </div>--}}
+{{--                </div>--}}
+{{--            </div>--}}
+{{--        </div>--}}
+
+{{--        <div class="col-md-9 app-content">--}}
+{{--            <div class="app-content-overlay"></div>--}}
+{{--            <div class="app-action">--}}
+{{--                <div class="action-left">--}}
+{{--                    <ul class="list-inline">--}}
+{{--                        <li class="list-inline-item mb-0">--}}
+{{--                            <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">--}}
+{{--                                <i data-feather="plus" class="mr-1"></i>--}}
+{{--                                Add--}}
+{{--                            </a>--}}
+{{--                            <div class="dropdown-menu">--}}
+{{--                                <a class="dropdown-item" href="{{route("dashboard.departments.create")}}">Department</a>--}}
+{{--                                <a class="dropdown-item" href="{{route("dashboard.documents.create")}}">Document</a>--}}
+{{--                            </div>--}}
+{{--                        </li>--}}
+{{--                        <li class="list-inline-item mb-0">--}}
+{{--                            <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">Departments</a>--}}
+{{--                            <div class="dropdown-menu">--}}
+{{--                                @foreach($departments as $department)--}}
+{{--                                    <a class="dropdown-item d-flex justify-content-between m-5" href="{{ route("dashboard.documents.index", ["id" => $department->id]) }}">--}}
+{{--                                        {{$department->name}}--}}
+{{--                                        <span class="text-muted">{{$department->document->count()}}</span>--}}
+{{--                                    </a>--}}
+{{--                                @endforeach--}}
+{{--                            </div>--}}
+{{--                        </li>--}}
+{{--                    </ul>--}}
+{{--                </div>--}}
+{{--                <div class="action-right">--}}
+{{--                    <form action="{{ route("dashboard.documents.search") }}" method="get" class="d-flex mr-3">--}}
+{{--                        <div class="input-group">--}}
+{{--                            <input type="text" name="q" class="form-control" placeholder="Search file"--}}
+{{--                                   aria-describedby="button-addon1" name="q" required>--}}
+{{--                            <div class="input-group-append">--}}
+{{--                                <button class="btn btn-outline-light searchSubmitBtn" type="submit" value="Search">--}}
+{{--                                    <i data-feather="search"></i>--}}
+{{--                                </button>--}}
+{{--                            </div>--}}
+{{--                        </div>--}}
+{{--                    </form>--}}
+{{--                </div>--}}
+{{--            </div>--}}
+{{--            <p>Search results</p>--}}
+
+{{--            <div class="row">--}}
+{{--                @forelse($results as $document)--}}
+{{--                    <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">--}}
+{{--                        <div class="card app-file-list">--}}
+{{--                            <div class="app-file-icon">--}}
+{{--                                <i class="fa fa-file-text-o text-primary"></i>--}}
+{{--                                <div class="dropdown position-absolute top-0 right-0 mr-3">--}}
+{{--                                    <a href="#" class="btn btn-outline-light btn-sm" data-toggle="dropdown">--}}
+{{--                                        <i class="fa fa-ellipsis-h"></i>--}}
+{{--                                    </a>--}}
+{{--                                    <div class="dropdown-menu dropdown-menu-right">--}}
+{{--                                        <a href="{{ route("dashboard.documents.edit", ["id" => $document->id]) }}" class="dropdown-item">View Details</a>--}}
+{{--                                        <a href="#" class="dropdown-item">Share</a>--}}
+{{--                                        <a href="#" class="dropdown-item">Download</a>--}}
+{{--                                        <button class="dropdown-item action-dropdown-item"--}}
+{{--                                                href="javascript:void(0)" onclick="toggleImportant({{$document->id}})">--}}
+{{--                                            @if($document->is_important)--}}
+{{--                                                Mark as not important--}}
+{{--                                            @else--}}
+{{--                                                Mark as important--}}
+{{--                                            @endif--}}
+{{--                                        </button>--}}
+{{--                                        <a href="#" class="dropdown-item">Delete</a>--}}
+{{--                                    </div>--}}
+{{--                                </div>--}}
+{{--                            </div>--}}
+{{--                            <div class="p-2 small">--}}
+{{--                                @if($document->is_important)--}}
+{{--                                    <div>{{$document->name}} - {{$document->arch_id}} <i class="fa fa-star" style="color:orange"></i></div>--}}
+{{--                                @else--}}
+{{--                                    <div>{{$document->name}} - {{$document->arch_id}} </div>--}}
+{{--                                @endif--}}
+{{--                                <div>{{$document->created_at}}</div>--}}
+{{--                                <div class="text-muted">{{$document->description}}</div>--}}
+{{--                                <div class="text-muted">1.2MB</div>--}}
+{{--                            </div>--}}
+{{--                        </div>--}}
+{{--                    </div>--}}
+{{--                    <form id="toggleImportant_{{ $document->id }}"--}}
+{{--                          action="{{ route("dashboard.documents.toggleImportant", ["id" => $document->id]) }}"--}}
+{{--                          method="post">--}}
+{{--                        @csrf--}}
+{{--                        @method("patch")--}}
+{{--                    </form>--}}
+{{--                @empty--}}
+{{--                    <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>--}}
+{{--                @endforelse--}}
+
+{{--            </div>--}}
+{{--        </div>--}}
+
+{{--@endsection--}}
+
+{{--@section('script')--}}
+
+{{--@endsection--}}
Index: resources/views/dashboard/settings/index.blade.php
===================================================================
--- resources/views/dashboard/settings/index.blade.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ resources/views/dashboard/settings/index.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -23,13 +23,13 @@
             <div class="row">
                 <div class="col-lg-3 col-md-12 mb-3">
-                    <div class="nav flex-lg-column flex-sm-row nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
-                        <a class="nav-link {{ $active_tab == 'account' ? 'active' : '' }}" id="account-tab" data-toggle="pill" href="#account" role="tab" aria-controls="account" aria-selected="true">Account</a>
-                        <a class="nav-link {{ $active_tab == 'security' ? 'active' : '' }}" id="security-tab" data-toggle="pill" href="#security" role="tab" aria-controls="security" aria-selected="false">Security</a>
-                        <a class="nav-link " id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Social</a>
+                    <div class="nav flex-lg-column flex-sm-row nav-pills" id="#tabMenu" role="tablist" aria-orientation="vertical">
+                        <a class="nav-link {{$active_tab == 'account' ? 'active' : ""}}" id="account-tab" data-toggle="pill" href="#account" role="tab" aria-controls="account" aria-selected="true">Account</a>
+                        <a class="nav-link {{$active_tab == 'security' ? 'active' : ""}}" id="security-tab" data-toggle="pill" href="#security" role="tab" aria-controls="security" aria-selected="false">Security</a>
+                        <a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Social</a>
                     </div>
                 </div>
                 <div class="col-lg-9 col-md-12">
                     <div class="tab-content" id="v-pills-tabContent">
-                        <div class="tab-pane fade show {{ $active_tab == 'account' ? 'active' : '' }}" id="account" role="tabpanel" aria-labelledby="account-tab">
+                        <div class="tab-pane {{$active_tab == 'account' ? 'active' : ""}}" id="account" role="tabpanel" aria-labelledby="account-tab">
                             <div class="card">
                                 <div class="card-body">
@@ -80,5 +80,5 @@
                             </div>
                         </div>
-                        <div class="tab-pane {{ $active_tab == 'security' ? 'active' : '' }}" id="security" role="tabpanel" aria-labelledby="security-tab">
+                        <div class="tab-pane {{$active_tab == 'security' ? 'active' : ""}}" id="security" role="tabpanel" aria-labelledby="security-tab">
                             <div class="card">
                                 <div class="card-body">
@@ -239,2 +239,13 @@
 
 @endsection
+
+@section('script')
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha512-uto9mlQzrs59VwILcLiRYeLKPPbS/bT71da/OEBYEwcdNUk8jYIy+D176RYoop1Da+f9mvkYrmj5MCLZWEtQuA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+    <script>
+        //redirect to specific tab
+        $(document).ready(function () {
+            $('#tabMenu a[href="#{{ old('tab') }}"]').tabs('show')
+        });
+    </script>
+@endsection
Index: resources/views/layouts/pagination.blade.php
===================================================================
--- resources/views/layouts/pagination.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
+++ resources/views/layouts/pagination.blade.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -0,0 +1,47 @@
+@if ($paginator->hasPages())
+
+
+    <nav aria-label="...">
+        <ul class="pagination justify-content-center">
+
+        @if ($paginator->onFirstPage())
+                <li class="page-item disabled"><a class="page-link" href="{{ \Request::url() }}" rel="prev" aria-label="@lang('pagination.first')">&laquo;</a>
+                </li>
+            <li class="page-item disabled"><a class="page-link" href="#">Previous <span class="sr-only"></span></a></li>
+        @else
+                <li class="page-item"><a class="page-link" href="{{ \Request::url() }}" rel="prev" aria-label="@lang('pagination.first')">&laquo;</a>
+                </li>
+            <li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">Previous</a></li>
+        @endif
+
+        @foreach ($elements as $element)
+
+            @if (is_string($element))
+                <li class="page-item disabled"><span>{{ $element }}</span></li>
+            @endif
+
+            @if (is_array($element))
+                @foreach ($element as $page => $url)
+                    @if ($page == $paginator->currentPage())
+                        <li class="page-item active"><a class="page-link" href="#">{{ $page }} <span class="sr-only"></span></a></li>
+                    @else
+                        <li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
+                    @endif
+                @endforeach
+            @endif
+        @endforeach
+
+        @if ($paginator->hasMorePages())
+            <li><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">Next</a></li>
+                <li class="page-item">
+                    <a class="page-link" href="{{ \Request::url().'?page='.$paginator->lastPage() }}" rel="last" aria-label="@lang('pagination.last')">&raquo;</a>
+                </li>
+        @else
+            <li class="page-item disabled"><a class="page-link" href="#">Next <span class="sr-only"></span></a></li>
+                <li class="page-item disabled">
+                    <a class="page-link" href="{{ \Request::url().'?page='.$paginator->lastPage() }}" rel="last" aria-label="@lang('pagination.last')">&raquo;</a>
+                </li>
+            @endif
+    </ul>
+    </nav>
+@endif
Index: routes/web.php
===================================================================
--- routes/web.php	(revision bd9e8e32f60b76ec300f4c312ea24835f0a7608d)
+++ routes/web.php	(revision e6c1f87d9981de7492736e12f9cc56fc273c8e2a)
@@ -93,4 +93,5 @@
     Route::patch("/documents/{id}/confirm", "Dashboard\DocumentsController@confirm")->name("dashboard.documents.confirm");
     Route::delete("/documents/{id}/destroy", "Dashboard\DocumentsController@destroy")->name("dashboard.documents.destroy");
+    Route::patch('/documents/toggle-important/{id}', "Dashboard\DocumentsController@toggleImportant")->name("dashboard.documents.toggleImportant");
 
 });
