1 | @extends('layouts.app')
|
---|
2 |
|
---|
3 | @section("title", "SaveSpace - Departments")
|
---|
4 |
|
---|
5 | @section('pageTitle', 'Departments')
|
---|
6 |
|
---|
7 | @section('head')
|
---|
8 | <!-- Datatable -->
|
---|
9 | <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">
|
---|
10 | @endsection
|
---|
11 |
|
---|
12 | @section('content')
|
---|
13 |
|
---|
14 | <div class="page-header justify-content-between">
|
---|
15 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
16 | <ol class="breadcrumb">
|
---|
17 | <li class="breadcrumb-item">
|
---|
18 | <a href="{{ url('dashboard/departments') }}">Departments</a>
|
---|
19 | </li>
|
---|
20 | <li class="breadcrumb-item active" aria-current="page">Departments</li>
|
---|
21 | </ol>
|
---|
22 | </nav>
|
---|
23 | <div class="dropdown">
|
---|
24 | <a href="{{ route("dashboard.departments.create") }}" class="btn btn-primary text-white">
|
---|
25 | Add department
|
---|
26 | </a>
|
---|
27 | </div>
|
---|
28 | </div>
|
---|
29 |
|
---|
30 | <div class="row">
|
---|
31 | <div class="col-md-12">
|
---|
32 | <div class="card">
|
---|
33 | <div class="card-body">
|
---|
34 | <div class="table-responsive">
|
---|
35 | <table id="user-list" class="table table-lg">
|
---|
36 | <thead>
|
---|
37 | <tr>
|
---|
38 | <th>
|
---|
39 | {{-- <div class="custom-control custom-checkbox">--}}
|
---|
40 | {{-- <input type="checkbox" class="custom-control-input" id="user-list-select-all">--}}
|
---|
41 | {{-- <label class="custom-control-label" for="user-list-select-all"></label>--}}
|
---|
42 | {{-- </div>--}}
|
---|
43 | </th>
|
---|
44 | <th>ID</th>
|
---|
45 | <th>Name</th>
|
---|
46 | <th>Code</th>
|
---|
47 | <th>Created by</th>
|
---|
48 | <th>Created at</th>
|
---|
49 | <th>Updated at</th>
|
---|
50 | <th>Directory</th>
|
---|
51 | <th>Actions</th>
|
---|
52 | </tr>
|
---|
53 | </thead>
|
---|
54 | <tbody>
|
---|
55 | @foreach($departments as $department)
|
---|
56 | <tr>
|
---|
57 | <td></td>
|
---|
58 | <td>{{$department->id }}</td>
|
---|
59 | <td>{{ $department->name }}</td>
|
---|
60 | <td>{{ $department->code }}</td>
|
---|
61 | <td>{{ $department->getCreatedByName() }}</td>
|
---|
62 | <td>{{ date('d.m.Y - H:i', strtotime($department->created_at)) }}</td>
|
---|
63 | @if($department->updated_at==NULL)
|
---|
64 | <td>/</td>
|
---|
65 | @else
|
---|
66 | <td>{{ date('d.m.Y - H:i', strtotime($department->updated_at)) }}</td>
|
---|
67 | @endif
|
---|
68 | <!-- Trigger -->
|
---|
69 | <td>{!! Str::substr($department->location , strlen(Storage::disk('local')->path(''))) !!}
|
---|
70 | <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">
|
---|
71 | <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"/>
|
---|
72 | <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"/>
|
---|
73 | </svg></button>
|
---|
74 | <span type="hidden" id="copy_{{$department->id}}"></span>
|
---|
75 | </td>
|
---|
76 | <td>
|
---|
77 | <a href="{{ route("dashboard.departments.edit", ["id" => $department->id]) }}" class="text-secondary" data-toggle="tooltip" title="Edit">
|
---|
78 | <i class="ti-pencil"></i>
|
---|
79 | </a>
|
---|
80 | <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$department->id}}" title="Delete">
|
---|
81 | <i class="ti-trash"></i>
|
---|
82 | </a>
|
---|
83 | </td>
|
---|
84 | </tr>
|
---|
85 | <div class="modal fade" id="deleteModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
86 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
87 | <div class="modal-content">
|
---|
88 | <div class="modal-header">
|
---|
89 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
90 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
91 | <i class="ti-close"></i>
|
---|
92 | </button>
|
---|
93 | </div>
|
---|
94 | <div class="modal-body">
|
---|
95 | <form action="{{ route("dashboard.departments.destroy", $department->id) }}" method="POST">
|
---|
96 | @csrf
|
---|
97 | @method('DELETE')
|
---|
98 | <p>Are you sure you want to delete department {{$department->name}} with code: {{$department->code}}?</p>
|
---|
99 | <p>Number of documents associated: {{$department->document()->count()}}</p>
|
---|
100 | <div class="modal-footer">
|
---|
101 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
102 | </button>
|
---|
103 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
104 | </div>
|
---|
105 | </form>
|
---|
106 | </div>
|
---|
107 |
|
---|
108 | </div>
|
---|
109 | </div>
|
---|
110 | </div>
|
---|
111 | @endforeach
|
---|
112 | </tbody>
|
---|
113 | </table>
|
---|
114 |
|
---|
115 |
|
---|
116 |
|
---|
117 | </div>
|
---|
118 | </div>
|
---|
119 | </div>
|
---|
120 | </div>
|
---|
121 | </div>
|
---|
122 |
|
---|
123 | @endsection
|
---|
124 |
|
---|
125 | @section('script')
|
---|
126 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
127 | <!-- Datatable -->
|
---|
128 | <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
|
---|
129 |
|
---|
130 | <script>
|
---|
131 | $('#deleteModal').on('show.bs.modal', function (event) {
|
---|
132 | var button = $(event.relatedTarget)
|
---|
133 | var dep_id = button.data('deptId')
|
---|
134 | var modal = $(this)
|
---|
135 |
|
---|
136 | modal.find('.modal-body #dept_id').val(dep_id);
|
---|
137 | });
|
---|
138 | </script>
|
---|
139 | @endsection
|
---|