Index: app/Http/Controllers/Dashboard/DocumentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DocumentsController.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ app/Http/Controllers/Dashboard/DocumentsController.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -5,9 +5,13 @@
 use App\Helpers\Alert;
 use App\Http\Requests\Dashboard\DocumentRequest;
+use App\Http\Requests\Dashboard\FileRequest;
+use App\Http\Requests\Dashboard\PasswordSettingsRequest;
 use App\Models\Department;
 use App\Models\Document;
 use App\Models\File;
 use App\Services\UploadService;
+use Carbon\Carbon;
 use Illuminate\Http\Request;
+use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Storage;
 use App\Http\Controllers\Controller;
@@ -115,5 +119,5 @@
         $document->description = $request->description;
 
-        $location = DIRECTORY_SEPARATOR . 'Departments' . DIRECTORY_SEPARATOR . $document->department->name . DIRECTORY_SEPARATOR . $request->name;
+        $location = 'Departments' . DIRECTORY_SEPARATOR . $document->department->code . DIRECTORY_SEPARATOR . $request->name;
 
         if (!Storage::disk('local')->has($location)) {
@@ -121,13 +125,16 @@
         }
 
-        foreach ($request->file_item as $file) {
-            $file->storeAs($location . DIRECTORY_SEPARATOR, $file->getClientOriginalName());
-            $newFile = new File();
-            $newFile->link = $location . DIRECTORY_SEPARATOR . $file->getClientOriginalName();
-            $newFile->document()->associate($document);
-            $newFile->save();
-        }
-
         $document->save();
+
+        if ($request->has('file_item')) {
+            foreach ($request->file_item as $file) {
+                $file->storeAs($location . DIRECTORY_SEPARATOR, $file->getClientOriginalName());
+                $newFile = new File();
+                $newFile->name = $file->getClientOriginalName();
+                $newFile->location = $location . DIRECTORY_SEPARATOR . $file->getClientOriginalName();
+                $newFile->document()->associate($document);
+                $newFile->save();
+            }
+        }
 
         Alert::flash("New document created successfully");
@@ -140,5 +147,6 @@
         return view("dashboard.documents.edit")->with([
             "document" => Document::findOrFail($id),
-            "departments" => Department::all()
+            "departments" => Department::all(),
+            "files" => File::where('document_id', $id)->get()
         ]);
     }
@@ -147,8 +155,11 @@
     {
         $document = Document::findOrFail($id);
+        $files = File::where('document_id', $id)->get();
 
         $department = Department::find($request->department);
 
         $document->department()->associate($department);
+
+        $oldLocation = 'Departments' . DIRECTORY_SEPARATOR . $document->department->code . DIRECTORY_SEPARATOR . $document->name;
 
         $document->name = $request->name;
@@ -156,39 +167,51 @@
         $document->description = $request->description;
 
-        $oldLocation = DIRECTORY_SEPARATOR . 'Departments' . DIRECTORY_SEPARATOR . $document->department->name . DIRECTORY_SEPARATOR . $document->name;
-        $location = DIRECTORY_SEPARATOR . 'Departments' . DIRECTORY_SEPARATOR . $document->department->name . DIRECTORY_SEPARATOR . $request->name;
+        $location = 'Departments' . DIRECTORY_SEPARATOR . $document->department->code . DIRECTORY_SEPARATOR . $request->name;
 
         if ($document->isDirty('name')) {
             if (!Storage::disk('local')->has($location)) {
                 Storage::disk('local')->move($oldLocation, $location);
-            }
-        }
-
-        $hasFileError = false;
+                foreach($files as $file){
+                    $file->location = "test";
+                }
+            }
+        }
+
         if ($request->has('file_item')) {
             foreach ($request->file_item as $file) {
                 $fileName = $file->getClientOriginalName();
-                if(Storage::disk('local')->has($location . DIRECTORY_SEPARATOR . $fileName)) {
-                    $hasFileError = true;
-                    break;
+                if (Storage::disk('local')->has($location . DIRECTORY_SEPARATOR . $fileName)) {
+                    // $hasFileError = true;
+                    // break;
+                    $NewFileName = time() . $fileName;
+                    $file->storeAs($location . DIRECTORY_SEPARATOR, $NewFileName);
+                    $newFile = new File();
+                    $newFile->name = rand() . $fileName;
+                    $newFile->location = $location . DIRECTORY_SEPARATOR . $NewFileName;
+                    $newFile->document()->associate($document);
+                    $newFile->save();
+                } else {
+                    $file->storeAs($location . DIRECTORY_SEPARATOR, $fileName);
+                    $newFile = new File();
+                    $newFile->name = $fileName;
+                    $newFile->location = $location . DIRECTORY_SEPARATOR . $fileName;
+                    $newFile->document()->associate($document);
+                    $newFile->save();
                 }
-                $file->storeAs($location . DIRECTORY_SEPARATOR, $fileName);
-                $newFile = new File();
-                $newFile->link = $location . DIRECTORY_SEPARATOR . $fileName;
-                $newFile->document()->associate($document);
-                $newFile->save();
-            }
-        }
-
-        if($hasFileError) {
-            Alert::flash('Document with the same name exists', 'error');
-            return redirect()->route("dashboard.documents.edit", ['id' => $document->id]);
+            }
         }
 
         $document->save();
 
+//        if($hasFileError) {
+//            Alert::flash('Document with the same name exists', 'error');
+//            return redirect()->route("dashboard.documents.edit", ['id' => $document->id]);
+//        }
+
+
+
         Alert::flash("Document edited successfully");
 
-        return redirect()->route("dashboard.documents.index");
+        return redirect()->back();
     }
 
@@ -230,9 +253,57 @@
     {
         $document = Document::find($id);
+        $files = File::where('document_id', $id)->get();
         if (auth()->user()->hasPermission("delete_all_documents")) {
+           // @dd($files);
+            foreach ($files as $file) {
+                $file->delete();
+            }
             $document->delete();
+            $location = 'Departments' . DIRECTORY_SEPARATOR . $document->department->code . DIRECTORY_SEPARATOR . $document->name;
+            Storage::disk('local')->deleteDirectory($location);
             Alert::flash($document->name . " deleted successfully");
         }
         return redirect()->route("dashboard.documents.index");
     }
+
+    public function deleteFile($id)
+    {
+        $file = File::find($id);
+        $file->delete();
+        Storage::disk('local')->delete($file->location);
+
+        Alert::flash($file->name . " deleted successfully");
+
+        return redirect()->back();
+    }
+
+    public function downloadFile($id)
+    {
+        $file = File::find($id);
+        return Storage::download($file->location);
+    }
+
+    public function renameFile(FileRequest $request, $id)
+    {
+        $file = File::find($id);
+        $fileExtension = explode('.', $file->name)[1];
+
+        $file->name = $request->name . '.' . $fileExtension;
+        $newLocation = 'Departments' . DIRECTORY_SEPARATOR . explode(DIRECTORY_SEPARATOR, $file->location)[1] . DIRECTORY_SEPARATOR . explode(DIRECTORY_SEPARATOR, $file->location)[2] . DIRECTORY_SEPARATOR . $file->name;
+
+        if(Storage::disk('local')->has($newLocation)) {
+            Alert::flash("A file with the same name already exists", "error");
+            return redirect()->back();
+        }
+        else {
+            Storage::disk('local')->copy($file->location, $newLocation);
+            Storage::disk('local')->delete($file->location);
+
+        $file->location = $newLocation;
+        $file->save();
+
+        Alert::flash($file->name . " updated successfully");
+        return redirect()->back();
+        }
+    }
 }
Index: app/Http/Requests/Dashboard/DocumentRequest.php
===================================================================
--- app/Http/Requests/Dashboard/DocumentRequest.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ app/Http/Requests/Dashboard/DocumentRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -5,5 +5,4 @@
 use App\Models\Department;
 use App\Models\Document;
-use App\Models\FileType;
 use Illuminate\Foundation\Http\FormRequest;
 
@@ -32,5 +31,4 @@
     public function rules()
     {
-
         $rules = [
             "arch_id" => [
@@ -57,9 +55,9 @@
         if ($this->isMethod("patch")) {
             $fileRules = [
-                "file_item.*" => "mimes:jpg,jpeg,png|max:4096"
+                "file_item.*" => "mimes:jpg,jpeg,png,pdf|max:4096"
             ];
         } else {
             $fileRules = [
-                "file_item.*" => "mimes:jpg,jpeg,png|max:4096"
+                "file_item.*" => "mimes:jpg,jpeg,png,pdf|max:4096"
             ];
         }
Index: app/Http/Requests/Dashboard/FileRequest.php
===================================================================
--- app/Http/Requests/Dashboard/FileRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
+++ app/Http/Requests/Dashboard/FileRequest.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Requests\Dashboard;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class FileRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            "name" => "required|max:255|regex:/^[^.]+$/",
+        ];
+    }
+}
Index: app/Models/Document.php
===================================================================
--- app/Models/Document.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ app/Models/Document.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -22,8 +22,4 @@
     }
 
-    public function ago() {
-        return Carbon::parse($this->created_at)->diffForHumans();
-    }
-
     public function files()
     {
Index: app/Models/File.php
===================================================================
--- app/Models/File.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ app/Models/File.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -4,9 +4,10 @@
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Storage;
 
 class File extends Model
 {
     protected $table = "files";
-    protected $fillable = ["link", "document_id"];
+    protected $fillable = ["name", "location", "document_id"];
 
     public function document()
@@ -14,3 +15,10 @@
         return $this->belongsTo(Document::class);
     }
+
+    public function getSize($location)
+    {
+        $fileSize = Storage::disk('local')->size($location) / 1024 / 1024;
+        $fileSize = round($fileSize, 2);
+        return $fileSize;
+    }
 }
Index: p/Models/FileType.php
===================================================================
--- app/Models/FileType.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ 	(revision )
@@ -1,26 +1,0 @@
-<?php
-
-namespace App\Models;
-
-use App\Rules\ValidationRuleSyntaxChecker;
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Database\Eloquent\Model;
-
-class FileType extends Model
-{
-    use HasFactory;
-
-    protected $table = "file_types";
-
-    protected $fillable = [
-        'name',
-        'file_validations',
-        'file_maxsize',
-        "user_id"
-    ];
-
-    public function getCreatedByName()
-    {
-        return User::where('id', $this->user_id)->pluck('username')->first();
-    }
-}
Index: database/factories/DepartmentFactory.php
===================================================================
--- database/factories/DepartmentFactory.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/factories/DepartmentFactory.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -24,5 +24,5 @@
     public function definition()
     {
-        $location = $this->faker->randomNumber('1', '1');
+        $location = $this->faker->unique()->numberBetween('1', '9');
         Storage::disk('local')->makeDirectory('Departments/' . $location);
         return [
Index: database/factories/DocumentFactory.php
===================================================================
--- database/factories/DocumentFactory.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/factories/DocumentFactory.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -26,5 +26,5 @@
     {
 
-        $deptID = "1";
+        $deptID = "5";
         $name = $this->faker->unique()->firstName();
         Storage::disk('local')->makeDirectory('Departments' . DIRECTORY_SEPARATOR . $deptID . DIRECTORY_SEPARATOR . $name);
Index: database/migrations/2021_10_10_103309_create_files_table.php
===================================================================
--- database/migrations/2021_10_10_103309_create_files_table.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/migrations/2021_10_10_103309_create_files_table.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -16,6 +16,7 @@
         Schema::create('files', function (Blueprint $table) {
             $table->bigIncrements('id');
-            $table->bigInteger('document_id')->unsigned()->nullable();
-            $table->string("link");
+            $table->bigInteger('document_id')->unsigned();
+            $table->string("name");
+            $table->string("location");
             $table->foreign("document_id")->references("id")->on("documents");
             $table->timestamps();
Index: database/seeders/DatabaseSeeder.php
===================================================================
--- database/seeders/DatabaseSeeder.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/seeders/DatabaseSeeder.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -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 b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/seeders/DepartmentsTableSeeder.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -16,5 +16,5 @@
     public function run()
     {
-        Department::factory()->count(10)->create();
+        Department::factory()->count(8)->create();
     }
 }
Index: database/seeders/DocumentsTableSeeder.php
===================================================================
--- database/seeders/DocumentsTableSeeder.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ database/seeders/DocumentsTableSeeder.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -106,5 +106,5 @@
 //            ],
 //        ]);
-        Document::factory()->count(300)->create();
+        Document::factory()->count(10)->create();
     }
 }
Index: public/assets/js/examples/pages/user-list.js
===================================================================
--- public/assets/js/examples/pages/user-list.js	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ public/assets/js/examples/pages/user-list.js	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -14,5 +14,5 @@
             {
                 "orderable": false,
-                "targets": [0, 8]
+                "targets": [0, 6]
             }
         ],
Index: sources/views/dashboard/departments/create.blade.php
===================================================================
--- resources/views/dashboard/departments/create.blade.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ 	(revision )
@@ -1,63 +1,0 @@
-@extends('layouts.app')
-
-@section("title", "Departments - Create department")
-
-@section('pageTitle', 'Create department')
-
-@section('content')
-
-    <div class="page-header">
-        <nav aria-label="breadcrumb" class="d-flex align-items-start">
-            <ol class="breadcrumb">
-                <li class="breadcrumb-item">
-                    <a href="{{ url('dashboard/departments') }}">Departments</a>
-                </li>
-                <li class="breadcrumb-item active" aria-current="page">New department</li>
-            </ol>
-        </nav>
-    </div>
-
-    <div class="row">
-        <div class="col-md-12">
-
-            <div class="row">
-                <div class="col-lg-12 col-md-12">
-                    <div class="tab-content" id="v-pills-tabContent">
-                        <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
-                            <div class="card">
-                                <div class="card-body">
-                                    <h6 class="card-title">New department</h6>
-                                    <form action="{{ route("dashboard.departments.store") }}" method="post" accept-charset="utf-8" class="needs-validation" novalidate>
-                                        @csrf
-                                        <div class="row">
-                                            <div class="col-md-6">
-                                                <div class="form-group">
-                                                    <label>Name</label>
-                                                    <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
-                                                    <div class="invalid-feedback">
-                                                        Please enter characters with length between [2, 30]
-                                                    </div>
-                                                </div>
-                                            </div>
-                                            <div class="col-md-6">
-                                                <div class="form-group">
-                                                    <label>Code</label>
-                                                    <input type="text" name="code" value="{{ old('code') }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
-                                                    <div class="invalid-feedback">
-                                                        Please enter characters with length between [2, 30]
-                                                    </div>
-                                                </div>
-                                            </div>
-                                        </div>
-                                        <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
-                                    </form>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-
-@endsection
Index: sources/views/dashboard/departments/edit.blade.php
===================================================================
--- resources/views/dashboard/departments/edit.blade.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ 	(revision )
@@ -1,64 +1,0 @@
-@extends('layouts.app')
-
-@section("title", "Departments - Edit department")
-
-@section('pageTitle', 'Edit department')
-
-@section('content')
-
-    <div class="page-header">
-        <nav aria-label="breadcrumb" class="d-flex align-items-start">
-            <ol class="breadcrumb">
-                <li class="breadcrumb-item">
-                    <a href="{{ url('dashboard/departments') }}">Departments</a>
-                </li>
-                <li class="breadcrumb-item active" aria-current="page">Edit department</li>
-            </ol>
-        </nav>
-    </div>
-
-    <div class="row">
-        <div class="col-md-12">
-
-            <div class="row">
-                <div class="col-lg-12 col-md-12">
-                    <div class="tab-content" id="v-pills-tabContent">
-                        <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
-                            <div class="card">
-                                <div class="card-body">
-                                    <h6 class="card-title">Departmnets</h6>
-                                    <form action="{{ route("dashboard.departments.edit", ["id" =>$department->id]) }}" method="post" accept-charset="utf-8" class="needs-validation" novalidate>
-                                        @method("patch")
-                                        @csrf
-                                        <div class="row">
-                                            <div class="col-md-6">
-                                                <div class="form-group">
-                                                    <label class="form-label">Name</label>
-                                                    <input type="text" name="name" value="{{ $department->name }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
-                                                    <div class="invalid-feedback">
-                                                        Please enter characters with length between [2, 30]
-                                                    </div>
-                                                </div>
-                                            </div>
-                                            <div class="col-md-6">
-                                                <div class="form-group">
-                                                    <label class="form-label">Code</label>
-                                                    <input type="text" name="code" value="{{ $department->code }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
-                                                    <div class="invalid-feedback">
-                                                        Please enter characters with length between [2, 30]
-                                                    </div>
-                                                </div>
-                                            </div>
-                                        </div>
-                                        <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
-                                    </form>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-
-@endsection
Index: resources/views/dashboard/departments/index.blade.php
===================================================================
--- resources/views/dashboard/departments/index.blade.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ resources/views/dashboard/departments/index.blade.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -22,5 +22,5 @@
         </nav>
         <div class="dropdown">
-            <a href="{{ route("dashboard.departments.create") }}" class="btn btn-primary text-white">
+            <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
                 Add department
             </a>
@@ -37,8 +37,4 @@
                             <tr>
                                 <th>
-                                    {{--                                    <div class="custom-control custom-checkbox">--}}
-                                    {{--                                        <input type="checkbox" class="custom-control-input" id="user-list-select-all">--}}
-                                    {{--                                        <label class="custom-control-label" for="user-list-select-all"></label>--}}
-                                    {{--                                    </div>--}}
                                 </th>
                                 <th>ID</th>
@@ -75,5 +71,5 @@
                                     </td>
                                     <td>
-                                        <a href="{{ route("dashboard.departments.edit", ["id" => $department->id]) }}" class="text-secondary" data-toggle="tooltip" title="Edit">
+                                        <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$department->id}}" title="Edit">
                                             <i class="ti-pencil"></i>
                                         </a>
@@ -109,5 +105,75 @@
                                     </div>
                                 </div>
+
+                                <div class="modal fade" id="editModal_{{$department->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">Edit department</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.departments.edit", ["id" =>$department->id]) }}" method="post" accept-charset="utf-8">
+                                                    @method("patch")
+                                                    @csrf
+                                                    <div class="row">
+                                                        <div class="col-md-6">
+                                                            <div class="form-group">
+                                                                <label class="form-label">Name</label>
+                                                                <input type="text" name="name" value="{{ $department->name }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
+                                                            </div>
+                                                        </div>
+                                                        <div class="col-md-6">
+                                                            <div class="form-group">
+                                                                <label class="form-label">Code</label>
+                                                                <input type="text" name="code" value="{{ $department->code }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                    <input type="submit" value="Save changes" class="btn btn-primary pull-right m-10">
+                                                </form>
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
                             @endforeach
+
+                            <div class="modal fade" id="createModal" 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">Create department</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.departments.store") }}" method="post" accept-charset="utf-8">
+                                                @csrf
+                                                <div class="row">
+                                                    <div class="col-md-6">
+                                                        <div class="form-group">
+                                                            <label>Name</label>
+                                                            <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
+                                                        </div>
+                                                    </div>
+                                                    <div class="col-md-6">
+                                                        <div class="form-group">
+                                                            <label>Code</label>
+                                                            <input type="text" name="code" value="{{ old('code') }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
+                                            </form>
+                                        </div>
+
+                                    </div>
+                                </div>
+                            </div>
+
                             </tbody>
                         </table>
@@ -124,13 +190,3 @@
     <!-- Datatable -->
     <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
-
-    <script>
-        $('#deleteModal').on('show.bs.modal', function (event) {
-            var button = $(event.relatedTarget)
-            var dep_id = button.data('deptId')
-            var modal = $(this)
-
-            modal.find('.modal-body #dept_id').val(dep_id);
-        });
-    </script>
 @endsection
Index: resources/views/dashboard/documents/edit.blade.php
===================================================================
--- resources/views/dashboard/documents/edit.blade.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ resources/views/dashboard/documents/edit.blade.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -4,4 +4,9 @@
 
 @section('pageTitle', 'Edit document')
+
+@section('head')
+    <!-- Datatable -->
+    <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">
+@endsection
 
 @section('content')
@@ -79,6 +84,153 @@
                 </div>
             </div>
+
+        </div>
+
+        <div class="col-md-12">
+            <div class="card">
+                <div class="card-body">
+                    <div class="table-responsive">
+                        <table id="user-list" class="table table-lg">
+                            <thead>
+                            <tr>
+                                <th></th>
+                                <th>ID</th>
+                                <th>Size</th>
+                                <th>Name</th>
+                                <th>Created at</th>
+                                <th>Location</th>
+                                <th>Actions</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+                            @foreach($files as $file)
+                                <tr>
+                                    <td></td>
+                                    <td>{{ $file->id }}</td>
+                                    <td>{{ $file->getSize($file->location) }} MB</td>
+                                    <td>{{ $file->name }}</td>
+                                    <td>{{ date('d.m.Y - H:i', strtotime($file->created_at)) }}</td>
+                                <!-- Trigger -->
+                                    <td> <span id="copy_{{$department->id}}"></span>
+                                        <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>
+                                    </td>
+                                    <td>
+                                        <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit">
+                                            <i class="ti-pencil"></i>
+                                        </a>
+                                        <a href="{{ route("dashboard.documents.downloadFile", $file->id) }}" class="text-secondary" title="Edit">
+                                            <i class="ti-download"></i>
+                                        </a>
+                                        <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$file->id}}" title="Delete">
+                                            <i class="ti-trash"></i>
+                                        </a>
+                                    </td>
+                                </tr>
+                                <div class="modal fade" id="deleteModal_{{$file->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.deleteFile", $file->id) }}" method="POST">
+                                                    @csrf
+                                                    @method('DELETE')
+                                                    <p>Are you sure you want to delete file {{$file->name}}?</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>
+
+                                <div class="modal fade" id="editModal_{{$file->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">Edit department</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.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">
+                                                    @method("patch")
+                                                    @csrf
+                                                    <div class="row">
+                                                        <div class="col-md-6">
+                                                            <div class="form-group">
+                                                                <label class="form-label">Name</label>
+                                                                <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
+                                                            </div>
+                                                        </div>
+                                                    </div>
+                                                    <input type="submit" value="Save changes" class="btn btn-primary pull-right m-10">
+                                                </form>
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
+                            @endforeach
+
+                            <div class="modal fade" id="createModal" 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">Create department</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.departments.store") }}" method="post" accept-charset="utf-8">
+                                                @csrf
+                                                <div class="row">
+                                                    <div class="col-md-6">
+                                                        <div class="form-group">
+                                                            <label>Name</label>
+                                                            <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
+                                                        </div>
+                                                    </div>
+                                                    <div class="col-md-6">
+                                                        <div class="form-group">
+                                                            <label>Code</label>
+                                                            <input type="text" name="code" value="{{ old('code') }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                                <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
+                                            </form>
+                                        </div>
+
+                                    </div>
+                                </div>
+                            </div>
+
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
         </div>
     </div>
 
 @endsection
+
+@section('script')
+    <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
+    <!-- Datatable -->
+    <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
+@endsection
Index: resources/views/dashboard/users/index.blade.php
===================================================================
--- resources/views/dashboard/users/index.blade.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ resources/views/dashboard/users/index.blade.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -75,5 +75,5 @@
                                     <td>{{$user->phone_number}}</td>
                                     <td>{{ $user->getCreatedByName() }}</td>
-                                    <td>{{ date('d.m.Y', strtotime($user->created_at)) }}</td>
+                                    <td>{{ date('d.m.Y - H:i', strtotime($user->created_at)) }}</td>
                                     @if($user->updated_at==NULL)
                                         <td>/</td>
Index: routes/web.php
===================================================================
--- routes/web.php	(revision b9c4a92282ce0d7aa095082d7109f6d3d7b68dad)
+++ routes/web.php	(revision ea7b12a15d1afa472a54d5b8c75c55917907862e)
@@ -94,3 +94,6 @@
     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");
+    Route::delete("documents/{id}/deleteFile", "Dashboard\DocumentsController@deleteFile")->name("dashboard.documents.deleteFile");
+    Route::get("documents/{id}/downloadFile", "Dashboard\DocumentsController@downloadFile")->name("dashboard.documents.downloadFile");
+    Route::patch("documents/{id}/renameFile", "Dashboard\DocumentsController@renameFile")->name("dashboard.documents.renameFile");
 });
