Changeset 249bf91
- Timestamp:
- 06/05/24 13:35:43 (5 months ago)
- Branches:
- main
- Children:
- 768f473
- Parents:
- f7acd52
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/CrimeCaseController.php
rf7acd52 r249bf91 28 28 ]); 29 29 30 } 31 function register_statement(){ 32 return view('register-statement'); 33 } 34 function register_statement_post() 35 { 36 //TODO: so kiki i bojan vodete se po logikata na add policeman 37 } 38 function finished_cases(){ 39 40 if(Session::get('is_policeman')){ 41 $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=> Session::get('p_id')]); 42 } else { 43 $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=> Session::get('pe_id')]); 44 } 45 46 $cases = DB::select('select * from crime_case where p_id=:p_id and c_status=\'Z\';', ['p_id' => $police_station[0]->p_id]); 47 48 return view('archive', [ 49 'cases' => $cases, 50 'p_address'=>$police_station[0]->p_address 51 ]); 30 52 } 31 53 function case($wildcard){ -
app/Http/Controllers/OfficerController.php
rf7acd52 r249bf91 31 31 } 32 32 33 function show($id){ 34 if(Session::get('is_policeman')){ 35 $police_station = DB::select('select * from police_station where p_id=:p_id;',['p_id'=> Session::get('p_id')]); 36 } else { 37 $police_station = DB::select('select * from police_station where pe_id=:pe_id;',['pe_id'=> Session::get('pe_id')]); 38 } 39 $result = DB::select('select * from policeman join people on policeman.pe_id = people.pe_id where p_id=:p_id and people.pe_id=:pe_id;',['p_id'=> $police_station[0]->p_id, 'pe_id' => $id]); 40 $cases = DB::select('select * from statements where pe_id=:pe_id;',['pe_id' => $id]); 41 42 return view('employee', [ 43 'employee' => $result[0], 44 'p_address'=>$police_station[0]->p_address, 45 'cases' => $cases 46 ]); 47 } 48 33 49 function register() 34 50 { -
app/Http/Controllers/SessionsController.php
rf7acd52 r249bf91 42 42 Session::put('is_policeman', $policeman); 43 43 if($policeman){ 44 Session::put('p _id', $exists[0]->p_id);44 Session::put('pe_id', $exists[0]->p_id); 45 45 } else { 46 46 Session::put('pe_id', $exists[0]->pe_id); -
resources/views/case.blade.php
rf7acd52 r249bf91 71 71 @if (Session::get('is_policeman')) 72 72 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 73 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 74 <i class="fas fa-plus mr-3"></i> <a href="/register-statement">Додади изјава</a> 75 </button> 73 76 @else 74 77 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> … … 104 107 class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 105 108 <i class="fas fa-arrow-circle-up mr-3"></i> 106 Поставки за профил 109 107 110 </a> 108 111 </aside> … … 115 118 <button @click="isOpen = !isOpen" 116 119 class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 117 <img src="https://source.unsplash.com/uJ8LNVCBjFQ/400x400"> 120 @php 121 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 122 123 if (!empty($person)) { 124 $image = $person[0]->picture; 125 } else { 126 $image = null; 127 } 128 @endphp 129 130 <img src="{{ $image }}"> 131 118 132 </button> 119 133 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> -
resources/views/cases.blade.php
rf7acd52 r249bf91 31 31 @if (Session::get('is_policeman')) 32 32 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 33 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 34 <i class="fas fa-plus mr-3"></i> <a href="/register-statement">Додади изјава</a> 35 </button> 33 36 @else 34 37 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> … … 62 65 <a href="#" class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 63 66 <i class="fas fa-arrow-circle-up mr-3"></i> 64 Поставки за профил 67 65 68 </a> 66 69 </aside> … … 72 75 <div x-data="{ isOpen: false }" class="relative w-1/2 flex justify-end"> 73 76 <button @click="isOpen = !isOpen" class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 74 <img src="https://source.unsplash.com/uJ8LNVCBjFQ/400x400"> 77 @php 78 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 79 80 if (!empty($person)) { 81 $image = $person[0]->picture; 82 } else { 83 $image = null; 84 } 85 @endphp 86 87 <img src="{{ $image }}"> 88 75 89 </button> 76 90 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> -
resources/views/employees.blade.php
rf7acd52 r249bf91 46 46 background: #3d68ff; 47 47 } 48 /* styles.css */ 49 #clickableTable tr { 50 cursor: pointer; 51 transition: background-color 0.2s ease; 52 } 53 54 #clickableTable tr:hover { 55 background-color: #d7d4d4; 56 } 57 48 58 </style> 49 59 <script src="https://cdn.tailwindcss.com"></script> … … 55 65 @if (Session::get('is_policeman')) 56 66 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 67 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 68 <i class="fas fa-plus mr-3"></i> <a href="/register-statement">Додади изјава</a> 69 </button> 57 70 @else 58 71 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> … … 87 100 class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 88 101 <i class="fas fa-arrow-circle-up mr-3"></i> 89 Поставки за профил 102 90 103 </a> 91 104 </aside> … … 98 111 <button @click="isOpen = !isOpen" 99 112 class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 100 <img src="https://source.unsplash.com/uJ8LNVCBjFQ/400x400"> 113 @php 114 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 115 116 if (!empty($person)) { 117 $image = $person[0]->picture; 118 } else { 119 $image = null; 120 } 121 @endphp 122 123 <img src="{{ $image }}"> 124 101 125 </button> 102 126 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> … … 173 197 </p> 174 198 <div class="bg-white overflow-auto"> 175 <table class="min-w-full bg-white" >199 <table class="min-w-full bg-white" id="clickableTable"> 176 200 <thead class="bg-gray-800 text-white"> 177 201 <tr> … … 185 209 186 210 @foreach($employees as $employee) 187 <tr >211 <tr data-id="{{$employee->pe_id}}"> 188 212 <td class="w-1/3 text-left py-3 px-4">{{$employee->first_name}}</td> 189 213 <td class="w-1/3 text-left py-3 px-4">{{$employee->last_name}}</td> … … 217 241 <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js" 218 242 integrity="sha256-R4pqcOYV8lt7snxMQO/HSbVCFRPMdrhAFMH+vr9giYI=" crossorigin="anonymous"></script> 243 <script> 244 245 document.addEventListener('DOMContentLoaded', function() { 246 const rows = document.querySelectorAll('#clickableTable tr'); 247 248 rows.forEach(row => { 249 row.addEventListener('click', function() { 250 const id = this.getAttribute('data-id'); 251 if (id) { 252 window.location.href = `http://127.0.0.1:8000/employees/${id}`; 253 } 254 }); 255 }); 256 }); 257 258 </script> 219 259 220 260 </body> -
resources/views/filter.blade.php
rf7acd52 r249bf91 111 111 @if (Session::get('is_policeman')) 112 112 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 113 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 114 <i class="fas fa-plus mr-3"></i> <a href="/register-statement">Додади изјава</a> 115 </button> 113 116 @else 114 117 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> … … 142 145 <a href="#" class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 143 146 <i class="fas fa-arrow-circle-up mr-3"></i> 144 Поставки за профил145 147 </a> 146 148 </aside> … … 152 154 <div x-data="{ isOpen: false }" class="relative w-1/2 flex justify-end"> 153 155 <button @click="isOpen = !isOpen" class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 154 <img src="https://source.unsplash.com/uJ8LNVCBjFQ/400x400"> 156 @php 157 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 158 159 if (!empty($person)) { 160 $image = $person[0]->picture; 161 } else { 162 $image = null; 163 } 164 @endphp 165 166 <img src="{{ $image }}"> 167 155 168 </button> 156 169 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> -
resources/views/register-policeman.blade.php
rf7acd52 r249bf91 165 165 <a href="#" class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 166 166 <i class="fas fa-arrow-circle-up mr-3"></i> 167 Поставки за профил 167 168 168 </a> 169 169 </aside> … … 175 175 <div x-data="{ isOpen: false }" class="relative w-1/2 flex justify-end"> 176 176 <button @click="isOpen = !isOpen" class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 177 <img src="https://source.unsplash.com/uJ8LNVCBjFQ/400x400"> 177 @php 178 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 179 180 if (!empty($person)) { 181 $image = $person[0]->picture; 182 } else { 183 $image = null; 184 } 185 @endphp 186 187 <img src="{{ $image }}"> 188 178 189 </button> 179 190 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> -
resources/views/welcome.blade.php
rf7acd52 r249bf91 31 31 @if (Session::get('is_policeman')) 32 32 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Полицаец</a> 33 <button class="w-full bg-white cta-btn font-semibold py-2 mt-5 rounded-br-lg rounded-bl-lg rounded-tr-lg shadow-lg hover:shadow-xl hover:bg-gray-300 flex items-center justify-center"> 34 <i class="fas fa-plus mr-3"></i> <a href="/register-statement">Додади изјава</a> 35 </button> 33 36 @else 34 37 <a href="#" class="text-white text-3xl font-semibold uppercase hover:text-gray-300">Началник</a> … … 62 65 <a href="#" class="absolute w-full upgrade-btn bottom-0 active-nav-link text-white flex items-center justify-center py-4"> 63 66 <i class="fas fa-arrow-circle-up mr-3"></i> 64 Поставки за профил 67 65 68 </a> 66 69 </aside> … … 72 75 <div x-data="{ isOpen: false }" class="relative w-1/2 flex justify-end"> 73 76 <button @click="isOpen = !isOpen" class="realtive z-10 w-12 h-12 rounded-full overflow-hidden border-4 border-gray-400 hover:border-gray-300 focus:border-gray-300 focus:outline-none"> 74 <img src="https://ui-avatars.com/api/?name={{ Session::get('badge_no') }}"> 77 @php 78 $person = DB::select('select * from people where pe_id=:pe_id;', ['pe_id' => Session::get('pe_id')]); 79 80 if (!empty($person)) { 81 $image = $person[0]->picture; 82 } else { 83 $image = null; 84 } 85 @endphp 86 87 <img src="{{ $image }}"> 75 88 </button> 76 89 <button x-show="isOpen" @click="isOpen = false" class="h-full w-full fixed inset-0 cursor-default"></button> -
routes/web.php
rf7acd52 r249bf91 35 35 36 36 Route::get('employees', [OfficerController::class, 'employees'])->middleware('guest'); 37 Route::get('/employees/{id}', [OfficerController::class, 'show']); 38 37 39 Route::get('filter', [PeopleController::class, 'filter'])->middleware('guest'); 38 40 Route::post('filter', [PeopleController::class, 'filter_post'])->middleware('guest'); 39 41 40 42 Route::get('cases', [CrimeCaseController::class, 'cases'])->middleware('guest'); 43 Route::get('register-statement', [CrimeCaseController::class, 'register_statement'])->middleware('guest'); 44 41 45 Route::get('case/{wildcard}', [CrimeCaseController::class, 'case'])->middleware('guest'); 42 46 43 Route::get('finished_cases', [CrimeCaseController::class, ' index'])->middleware('guest');47 Route::get('finished_cases', [CrimeCaseController::class, 'finished_cases'])->middleware('guest'); 44 48 45 49
Note:
See TracChangeset
for help on using the changeset viewer.