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