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="javascript:void(0)" data-toggle="modal" data-target="#createModal" 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 | </th>
|
---|
40 | <th>ID</th>
|
---|
41 | <th>Name</th>
|
---|
42 | <th>Code</th>
|
---|
43 | <th>Created by</th>
|
---|
44 | <th>Created at</th>
|
---|
45 | <th>Updated at</th>
|
---|
46 | <th>Directory</th>
|
---|
47 | <th>Actions</th>
|
---|
48 | </tr>
|
---|
49 | </thead>
|
---|
50 | <tbody>
|
---|
51 | @foreach($departments as $department)
|
---|
52 | <tr>
|
---|
53 | <td></td>
|
---|
54 | <td>{{$department->id }}</td>
|
---|
55 | <td>{{ $department->name }}</td>
|
---|
56 | <td>{{ $department->code }}</td>
|
---|
57 | <td>{{ $department->getCreatedByName() }}</td>
|
---|
58 | <td>{{ date('d.m.Y - H:i', strtotime($department->created_at)) }}</td>
|
---|
59 | @if($department->updated_at==NULL)
|
---|
60 | <td>/</td>
|
---|
61 | @else
|
---|
62 | <td>{{ date('d.m.Y - H:i', strtotime($department->updated_at)) }}</td>
|
---|
63 | @endif
|
---|
64 | <!-- Trigger -->
|
---|
65 | <td>{{ $department->location }}
|
---|
66 | <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">
|
---|
67 | <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"/>
|
---|
68 | <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"/>
|
---|
69 | </svg></button>
|
---|
70 | <span type="hidden" id="copy_{{$department->id}}"></span>
|
---|
71 | </td>
|
---|
72 | <td>
|
---|
73 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$department->id}}" title="Edit">
|
---|
74 | <i class="ti-pencil"></i>
|
---|
75 | </a>
|
---|
76 | <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$department->id}}" title="Delete">
|
---|
77 | <i class="ti-trash"></i>
|
---|
78 | </a>
|
---|
79 | </td>
|
---|
80 | </tr>
|
---|
81 | <div class="modal fade" id="deleteModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
82 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
83 | <div class="modal-content">
|
---|
84 | <div class="modal-header">
|
---|
85 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
86 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
87 | <i class="ti-close"></i>
|
---|
88 | </button>
|
---|
89 | </div>
|
---|
90 | <div class="modal-body">
|
---|
91 | <form action="{{ route("dashboard.departments.destroy", $department->id) }}" method="POST">
|
---|
92 | @csrf
|
---|
93 | @method('DELETE')
|
---|
94 | <p>Are you sure you want to delete department {{$department->name}} with code: {{$department->code}}?</p>
|
---|
95 | <p>Number of documents associated: {{$department->document()->count()}}</p>
|
---|
96 | <div class="modal-footer">
|
---|
97 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
98 | </button>
|
---|
99 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
100 | </div>
|
---|
101 | </form>
|
---|
102 | </div>
|
---|
103 |
|
---|
104 | </div>
|
---|
105 | </div>
|
---|
106 | </div>
|
---|
107 |
|
---|
108 | <div class="modal fade" id="editModal_{{$department->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
109 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
110 | <div class="modal-content">
|
---|
111 | <div class="modal-header">
|
---|
112 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit department</h5>
|
---|
113 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
114 | <i class="ti-close"></i>
|
---|
115 | </button>
|
---|
116 | </div>
|
---|
117 | <div class="modal-body">
|
---|
118 | <form action="{{ route("dashboard.departments.edit", ["id" =>$department->id]) }}" method="post" accept-charset="utf-8">
|
---|
119 | @method("patch")
|
---|
120 | @csrf
|
---|
121 | <div class="row">
|
---|
122 | <div class="col-md-6">
|
---|
123 | <div class="form-group">
|
---|
124 | <label class="form-label">Name</label>
|
---|
125 | <input type="text" name="name" value="{{ $department->name }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
126 | </div>
|
---|
127 | </div>
|
---|
128 | <div class="col-md-6">
|
---|
129 | <div class="form-group">
|
---|
130 | <label class="form-label">Code</label>
|
---|
131 | <input type="text" name="code" value="{{ $department->code }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
|
---|
132 | </div>
|
---|
133 | </div>
|
---|
134 | </div>
|
---|
135 | <input type="submit" value="Save changes" class="btn btn-primary pull-right m-10">
|
---|
136 | </form>
|
---|
137 | </div>
|
---|
138 |
|
---|
139 | </div>
|
---|
140 | </div>
|
---|
141 | </div>
|
---|
142 | @endforeach
|
---|
143 |
|
---|
144 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
145 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
146 | <div class="modal-content">
|
---|
147 | <div class="modal-header">
|
---|
148 | <h5 class="modal-title" id="exampleModalCenterTitle">Create department</h5>
|
---|
149 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
150 | <i class="ti-close"></i>
|
---|
151 | </button>
|
---|
152 | </div>
|
---|
153 | <div class="modal-body">
|
---|
154 | <form action="{{ route("dashboard.departments.store") }}" method="post" accept-charset="utf-8">
|
---|
155 | @csrf
|
---|
156 | <div class="row">
|
---|
157 | <div class="col-md-6">
|
---|
158 | <div class="form-group">
|
---|
159 | <label>Name</label>
|
---|
160 | <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
161 | </div>
|
---|
162 | </div>
|
---|
163 | <div class="col-md-6">
|
---|
164 | <div class="form-group">
|
---|
165 | <label>Code</label>
|
---|
166 | <input type="text" name="code" value="{{ old('code') }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
|
---|
167 | </div>
|
---|
168 | </div>
|
---|
169 | </div>
|
---|
170 | <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
|
---|
171 | </form>
|
---|
172 | </div>
|
---|
173 |
|
---|
174 | </div>
|
---|
175 | </div>
|
---|
176 | </div>
|
---|
177 |
|
---|
178 | </tbody>
|
---|
179 | </table>
|
---|
180 | </div>
|
---|
181 | </div>
|
---|
182 | </div>
|
---|
183 | </div>
|
---|
184 | </div>
|
---|
185 |
|
---|
186 | @endsection
|
---|
187 |
|
---|
188 | @section('script')
|
---|
189 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
190 | <!-- Datatable -->
|
---|
191 | <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
|
---|
192 | @endsection
|
---|