[194a359] | 1 | @extends('layouts.app')
|
---|
| 2 |
|
---|
[d795fa6] | 3 | @section("title", "SaveSpace - Departments")
|
---|
[194a359] | 4 |
|
---|
| 5 | @section('head')
|
---|
[169fcc8] | 6 |
|
---|
[194a359] | 7 | @endsection
|
---|
| 8 |
|
---|
| 9 | @section('content')
|
---|
| 10 |
|
---|
| 11 | <div class="page-header justify-content-between">
|
---|
| 12 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
| 13 | <ol class="breadcrumb">
|
---|
| 14 | <li class="breadcrumb-item">
|
---|
[c6b84df] | 15 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
[194a359] | 16 | </li>
|
---|
| 17 | <li class="breadcrumb-item active" aria-current="page">Departments</li>
|
---|
| 18 | </ol>
|
---|
| 19 | </nav>
|
---|
| 20 | <div class="dropdown">
|
---|
[0df7a93] | 21 | @if(auth()->user()->hasPermission('manage_all_departments'))
|
---|
[cbb901a] | 22 | <button data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
|
---|
[0208bbd] | 23 | <i class="fa fa-plus pr-1"></i> New
|
---|
[cbb901a] | 24 | </button>
|
---|
[0df7a93] | 25 | @endif
|
---|
| 26 |
|
---|
| 27 | @if(auth()->user()->hasPermission('download_data'))
|
---|
[c6b84df] | 28 | <a href="{{ route("dashboard.departments.downloadAll") }}" class="btn btn-danger text-white">
|
---|
[0208bbd] | 29 | <i class="fa fa-download pr-1"></i> Download
|
---|
[c6b84df] | 30 | </a>
|
---|
[0df7a93] | 31 | @endif
|
---|
| 32 | @if(auth()->user()->hasPermission('export_data'))
|
---|
[0208bbd] | 33 | <a href="{{ route('dashboard.departments.export') }}" class="btn btn-success text-white">
|
---|
| 34 | <i class="fa fa-table pr-1"></i> Export</a>
|
---|
[0df7a93] | 35 | @endif
|
---|
[194a359] | 36 | </div>
|
---|
| 37 | </div>
|
---|
| 38 |
|
---|
| 39 | <div class="row">
|
---|
| 40 | <div class="col-md-12">
|
---|
| 41 | <div class="card">
|
---|
| 42 | <div class="card-body">
|
---|
| 43 | <div class="table-responsive">
|
---|
| 44 | <table id="user-list" class="table table-lg">
|
---|
| 45 | <thead>
|
---|
| 46 | <tr>
|
---|
[24a616f] | 47 | <th>
|
---|
| 48 | </th>
|
---|
[194a359] | 49 | <th>ID</th>
|
---|
| 50 | <th>Name</th>
|
---|
| 51 | <th>Code</th>
|
---|
[c6b84df] | 52 | <th>Folders</th>
|
---|
[194a359] | 53 | <th>Created by</th>
|
---|
[24a616f] | 54 | <th>Created at</th>
|
---|
| 55 | <th>Updated at</th>
|
---|
| 56 | <th>Directory</th>
|
---|
[194a359] | 57 | <th>Actions</th>
|
---|
| 58 | </tr>
|
---|
| 59 | </thead>
|
---|
| 60 | <tbody>
|
---|
| 61 | @foreach($departments as $department)
|
---|
| 62 | <tr>
|
---|
[24a616f] | 63 | <td></td>
|
---|
[194a359] | 64 | <td>{{$department->id }}</td>
|
---|
[4b7e2d3] | 65 | <td><a href="{{ route("dashboard.folders.index", ['id' => $department->id]) }}" class="text-linkedin">{{ $department->name }}</a></td>
|
---|
[194a359] | 66 | <td>{{ $department->code }}</td>
|
---|
[4b7e2d3] | 67 | <td>{{ $department->no_of_folders }}</td>
|
---|
[194a359] | 68 | <td>{{ $department->getCreatedByName() }}</td>
|
---|
[24a616f] | 69 | <td>{{ date('d.m.Y - H:i', strtotime($department->created_at)) }}</td>
|
---|
| 70 | @if($department->updated_at==NULL)
|
---|
| 71 | <td>/</td>
|
---|
| 72 | @else
|
---|
| 73 | <td>{{ date('d.m.Y - H:i', strtotime($department->updated_at)) }}</td>
|
---|
| 74 | @endif
|
---|
| 75 | <!-- Trigger -->
|
---|
[c6b84df] | 76 | <td><button data-clipboard-text="{{$department->location}}" class="btn btn-sm btn-primary text-white" data-toggle="tooltip" data-placement="right" title="{{$department->location}}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
|
---|
[24a616f] | 77 | <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"/>
|
---|
| 78 | <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"/>
|
---|
| 79 | </svg></button>
|
---|
| 80 | </td>
|
---|
[0df7a93] | 81 | @if(auth()->user()->hasPermission('manage_all_departments'))
|
---|
[194a359] | 82 | <td>
|
---|
[ea7b12a] | 83 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$department->id}}" title="Edit">
|
---|
[194a359] | 84 | <i class="ti-pencil"></i>
|
---|
| 85 | </a>
|
---|
[0df7a93] | 86 | @if(auth()->user()->hasPermission('download_data'))
|
---|
| 87 | <a href="{{ route("dashboard.departments.downloadDepartment", ['id' => $department->id]) }}" class="text-danger ml-2"title="Download">
|
---|
[c6b84df] | 88 | <i class="ti-download"></i>
|
---|
| 89 | </a>
|
---|
[0df7a93] | 90 | @endif
|
---|
[d795fa6] | 91 | <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$department->id}}" title="Delete">
|
---|
[194a359] | 92 | <i class="ti-trash"></i>
|
---|
| 93 | </a>
|
---|
| 94 | </td>
|
---|
[0df7a93] | 95 | @else
|
---|
| 96 | <td></td>
|
---|
| 97 | @endif
|
---|
[194a359] | 98 | </tr>
|
---|
[d795fa6] | 99 | <div class="modal fade" id="deleteModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 100 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 101 | <div class="modal-content">
|
---|
| 102 | <div class="modal-header">
|
---|
| 103 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
| 104 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 105 | <i class="ti-close"></i>
|
---|
| 106 | </button>
|
---|
| 107 | </div>
|
---|
| 108 | <div class="modal-body">
|
---|
| 109 | <form action="{{ route("dashboard.departments.destroy", $department->id) }}" method="POST">
|
---|
| 110 | @csrf
|
---|
| 111 | @method('DELETE')
|
---|
| 112 | <p>Are you sure you want to delete department {{$department->name}} with code: {{$department->code}}?</p>
|
---|
[0df7a93] | 113 | <p>Number of folders associated: <a href="{{ route("dashboard.folders.index", ['id' => $department->id]) }}" class="text-linkedin">{{$department->folder()->count()}}</a></p>
|
---|
[d795fa6] | 114 | <div class="modal-footer">
|
---|
| 115 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 116 | </button>
|
---|
| 117 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 118 | </div>
|
---|
| 119 | </form>
|
---|
| 120 | </div>
|
---|
| 121 |
|
---|
| 122 | </div>
|
---|
| 123 | </div>
|
---|
| 124 | </div>
|
---|
[ea7b12a] | 125 |
|
---|
| 126 | <div class="modal fade" id="editModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 127 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 128 | <div class="modal-content">
|
---|
| 129 | <div class="modal-header">
|
---|
| 130 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit department</h5>
|
---|
| 131 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 132 | <i class="ti-close"></i>
|
---|
| 133 | </button>
|
---|
| 134 | </div>
|
---|
| 135 | <div class="modal-body">
|
---|
| 136 | <form action="{{ route("dashboard.departments.edit", ["id" =>$department->id]) }}" method="post" accept-charset="utf-8">
|
---|
| 137 | @method("patch")
|
---|
| 138 | @csrf
|
---|
| 139 | <div class="row">
|
---|
| 140 | <div class="col-md-6">
|
---|
| 141 | <div class="form-group">
|
---|
| 142 | <label class="form-label">Name</label>
|
---|
| 143 | <input type="text" name="name" value="{{ $department->name }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
| 144 | </div>
|
---|
| 145 | </div>
|
---|
| 146 | <div class="col-md-6">
|
---|
| 147 | <div class="form-group">
|
---|
| 148 | <label class="form-label">Code</label>
|
---|
[b39afb5] | 149 | <input type="number" name="code" value="{{ $department->code }}" minlength="1" class="form-control" placeholder="Code" required>
|
---|
[ea7b12a] | 150 | </div>
|
---|
| 151 | </div>
|
---|
| 152 | </div>
|
---|
[c6b84df] | 153 | <br/>
|
---|
| 154 | <div class="modal-footer">
|
---|
| 155 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 156 | </button>
|
---|
| 157 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 158 | </div>
|
---|
[ea7b12a] | 159 | </form>
|
---|
| 160 | </div>
|
---|
| 161 |
|
---|
| 162 | </div>
|
---|
| 163 | </div>
|
---|
| 164 | </div>
|
---|
[194a359] | 165 | @endforeach
|
---|
[ea7b12a] | 166 |
|
---|
| 167 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 168 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 169 | <div class="modal-content">
|
---|
| 170 | <div class="modal-header">
|
---|
| 171 | <h5 class="modal-title" id="exampleModalCenterTitle">Create department</h5>
|
---|
| 172 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 173 | <i class="ti-close"></i>
|
---|
| 174 | </button>
|
---|
| 175 | </div>
|
---|
| 176 | <div class="modal-body">
|
---|
| 177 | <form action="{{ route("dashboard.departments.store") }}" method="post" accept-charset="utf-8">
|
---|
| 178 | @csrf
|
---|
| 179 | <div class="row">
|
---|
| 180 | <div class="col-md-6">
|
---|
| 181 | <div class="form-group">
|
---|
| 182 | <label>Name</label>
|
---|
| 183 | <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
| 184 | </div>
|
---|
| 185 | </div>
|
---|
| 186 | <div class="col-md-6">
|
---|
| 187 | <div class="form-group">
|
---|
| 188 | <label>Code</label>
|
---|
[b39afb5] | 189 | <input type="number" name="code" value="{{ old('code') }}" minlength="1" class="form-control" placeholder="Code" required>
|
---|
[ea7b12a] | 190 | </div>
|
---|
| 191 | </div>
|
---|
| 192 | </div>
|
---|
[c6b84df] | 193 | <br/>
|
---|
| 194 | <div class="modal-footer">
|
---|
| 195 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 196 | </button>
|
---|
| 197 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 198 | </div>
|
---|
[ea7b12a] | 199 | </form>
|
---|
| 200 | </div>
|
---|
| 201 |
|
---|
| 202 | </div>
|
---|
| 203 | </div>
|
---|
| 204 | </div>
|
---|
| 205 |
|
---|
[194a359] | 206 | </tbody>
|
---|
| 207 | </table>
|
---|
| 208 | </div>
|
---|
| 209 | </div>
|
---|
| 210 | </div>
|
---|
| 211 | </div>
|
---|
| 212 | </div>
|
---|
| 213 |
|
---|
| 214 | @endsection
|
---|
| 215 |
|
---|
| 216 | @section('script')
|
---|
[c6b84df] | 217 |
|
---|
| 218 | @yield('script')
|
---|
| 219 |
|
---|
[120759b] | 220 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
[194a359] | 221 | @endsection
|
---|