Changeset e78295c
- Timestamp:
- 10/31/21 21:28:46 (3 years ago)
- Branches:
- master
- Children:
- 4521f25
- Parents:
- a55bb54
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Exports/FoldersExport.php
ra55bb54 re78295c 29 29 $row->user_id . ' - ' . User::find($row->user_id)->username, 30 30 $row->Department::find($row->department_id)->name . ' - ' . Department::find($row->department_id)->code, 31 $row->is_important,32 31 $row->created_at, 33 32 $row->updated_at -
app/Http/Controllers/Dashboard/FilesController.php
ra55bb54 re78295c 54 54 if ($request->has('file_item')) { 55 55 foreach ($request->file_item as $file) { 56 $fileName = $folder->name . '-' . uniqid() . '.' . $file->getClientOriginalExtension(); 56 $fileName = $file->getClientOriginalName(); 57 58 if(File::where(['folder_id' => $folder->id, 'name' => $fileName])->count() > 0) { 59 Alert::flash("The uploaded file already exists", "error"); 60 61 return redirect()->back(); 62 } 63 57 64 $file->storeAs($location . DIRECTORY_SEPARATOR, $fileName); 58 65 $newFile = new File(); … … 63 70 $newFile->save(); 64 71 } 65 Notification::send($users, new NewFileCreated("New files added"));66 72 67 73 Alert::flash("New files added successfully"); … … 81 87 return Storage::download($file->location); 82 88 } 83 84 public function renameFile(FileNameRequest $request, $id)85 {86 $file = File::find($id);87 $fileExtension = explode('.', $file->name)[1];88 89 $file->name = $request->name . '.' . $fileExtension;90 $newLocation = 'Departments' . DIRECTORY_SEPARATOR . explode(DIRECTORY_SEPARATOR, $file->location)[1] . DIRECTORY_SEPARATOR . explode(DIRECTORY_SEPARATOR, $file->location)[2] . DIRECTORY_SEPARATOR . $file->name;91 92 if(Storage::disk('uploads')->has($newLocation)) {93 Alert::flash("A file with the same name already exists", "error");94 return redirect()->back();95 }96 else {97 Storage::disk('uploads')->move($file->location, $newLocation);98 99 $file->location = $newLocation;100 $file->updated_at = Carbon::now();101 $file->save();102 103 Alert::flash($file->name . " updated successfully");104 return redirect()->back();105 }106 }107 89 } -
app/Http/Controllers/Dashboard/FoldersController.php
ra55bb54 re78295c 18 18 use Illuminate\Support\Facades\Storage; 19 19 use App\Http\Controllers\Controller; 20 use function Sodium\increment; 20 21 21 22 class FoldersController extends Controller … … 58 59 else if ($request->query('sort') == 'no_of_files') { 59 60 $folders = Folder::orderBy('no_of_files', 'desc')->paginate(12); 60 }61 else if ($request->query('sort') == 'important') {62 $folders = Folder::where('is_important', true)->paginate(12);63 61 } 64 62 else if ($request->query('sort') == 'recent') { … … 96 94 "docsCount" => Department::withCount('folder')->get(), 97 95 "totalDocs" => Folder::all()->count(), 98 "countImportant" => Folder::where('is_important', true)->get()->count(),99 96 "diskTotal" => $diskTotal, 100 97 "diskTotalSize" => $diskTotalSize, … … 118 115 { 119 116 $folder = new Folder(); 117 118 $existingFolder = Folder::where(['department_id' => $request->department, 'name' => $request->name, 'arch_id' => $request->arch_id])->count(); 119 120 $existingFolderName = Folder::where(['department_id' => $request->department, 'name' => $request->name])->count(); 121 $existingFolderArchId = Folder::where(['department_id' => $request->department, 'arch_id' => $request->arch_id])->count(); 122 123 if($existingFolder > 0) { 124 $folder->version = $existingFolder + 1; 125 } 126 127 if(($existingFolderName > 0 && $existingFolderArchId <= 0) || ($existingFolderName <= 0 && $existingFolderArchId > 0)) { 128 Alert::flash("Can't create another version since folder name or archive ID is different", "error"); 129 130 return redirect()->route("dashboard.folders.index"); 131 } 132 133 $department = Department::find($request->department); 134 120 135 $user = auth()->user(); 121 $department = Department::find($request->department);122 136 123 137 $folder->user()->associate($user); … … 128 142 $folder->name = $request->name; 129 143 $folder->note = $request->note; 130 131 if($request->has('is_important')){132 $folder->is_important = true;133 }else{134 $folder->is_important = false;135 }136 144 137 145 $location = $folder->department->location . DIRECTORY_SEPARATOR . $request->name; … … 178 186 } 179 187 180 public function edit(FolderRequest $request, $id) 181 { 182 $folder = Folder::findOrFail($id); 188 public function destroy($id) 189 { 190 $folder = Folder::find($id); 191 192 $existingFolders = Folder::where(['department_id' => $folder->department->id, 'name' => $folder->name, 'arch_id' => $folder->arch_id])->count(); 193 194 if($existingFolders > 1 && $folder->version == 1) { 195 Alert::flash($folder->name . " has versions", "error"); 196 return redirect()->back(); 197 } 198 183 199 $files = File::where('folder_id', $id)->get(); 184 200 185 $department = Department::find($request->department); 186 187 $folder->department()->increment('no_of_folders'); 188 189 $oldLocation = $folder->location; 190 191 $folder->name = $request->name; 192 $folder->arch_id = $request->arch_id; 193 $folder->note = $request->note; 194 $folder->updated_at = Carbon::now(); 195 196 $newLocation = Department::find($request->department)->location . DIRECTORY_SEPARATOR . $request->name; 197 198 if($folder->department_id != $request->department){ 199 $folder->department()->decrement('no_of_folders'); 200 if (!Storage::disk('uploads')->has($newLocation)) { 201 Storage::disk('uploads')->move($oldLocation, $newLocation); 202 foreach($files as $file) { 203 $file->location = $newLocation . DIRECTORY_SEPARATOR . $file->name; 204 $file->save(); 205 } 206 } 207 } 208 if($folder->isDirty('name')) { 209 if (!Storage::disk('uploads')->has($newLocation)) { 210 Storage::disk('uploads')->move($oldLocation, $newLocation); 211 foreach($files as $file) { 212 $file->location = $newLocation . DIRECTORY_SEPARATOR . $file->name; 213 $file->save(); 214 } 215 } 216 } 217 218 $folder->department()->associate($department); 219 220 $folder->location = $newLocation; 221 222 if ($request->has('file_item')) { 223 foreach ($request->file_item as $file) { 224 $fileName = $folder->name . '-' . uniqid() . '.' . $file->getClientOriginalExtension(); 225 $file->storeAs($newLocation . DIRECTORY_SEPARATOR, $fileName); 226 $newFile = new File(); 227 $newFile->name = $fileName; 228 $newFile->location = $newLocation . DIRECTORY_SEPARATOR . $fileName; 229 $newFile->folder()->associate($folder); 230 $newFile->folder()->increment('no_of_files'); 231 $newFile->save(); 232 } 233 } 234 235 $folder->save(); 236 237 Alert::flash("Folder edited successfully"); 238 239 return redirect()->back(); 240 } 241 242 public function toggleImportant($id) 243 { 244 $folder = Folder::find($id); 245 $folder->is_important = !$folder->is_important; 246 $folder->save(); 247 248 if ($folder->is_important == true) 249 Alert::flash("Folder marked as important successfully"); 250 else 251 Alert::flash("Folder marked as not important successfully"); 252 253 return redirect()->back(); 254 } 255 256 public function destroy($id) 257 { 258 $folder = Folder::find($id); 259 $files = File::where('folder_id', $id)->get(); 260 if (auth()->user()->hasPermission("delete_all_folders") && !$folder->is_important) { 201 if($files->count() > 0) { 202 Alert::flash($folder->name . " contains files", "error"); 203 return redirect()->back(); 204 } 205 206 if (auth()->user()->hasPermission("delete_all_folders")) { 261 207 262 208 foreach ($files as $file) { 263 209 $file->delete(); 264 210 } 211 265 212 $folder->delete(); 266 213 $location = $folder->department->location . DIRECTORY_SEPARATOR . $folder->name; … … 270 217 return redirect()->back(); 271 218 } 272 Alert::flash($folder->name . " is important", "error");219 Alert::flash($folder->name . " cannot be deleted", "error"); 273 220 return redirect()->back(); 274 221 } … … 337 284 "imageExt" => array("png", "jpg", "jpeg"), 338 285 "folders" => $folders, 339 "fileTypes" => '.' . implode(',.', explode(',', FileType::find('1')->mimes)) 286 "fileTypes" => '.' . implode(',.', explode(',', FileType::find('1')->mimes)), 340 287 ]); 341 288 } -
app/Http/Requests/Dashboard/FolderRequest.php
ra55bb54 re78295c 35 35 "arch_id" => [ 36 36 "required", 37 "unique:folders,arch_id,$this->id,id",38 37 function ($attribute, $value, $fail) { 39 38 -
app/Models/Folder.php
ra55bb54 re78295c 11 11 protected $table = "folders"; 12 12 13 protected $fillable = ["arch_id", "name", "description", "location", "user_id", "department_id", " is_important"];13 protected $fillable = ["arch_id", "name", "description", "location", "user_id", "department_id", "version"]; 14 14 15 15 -
database/factories/FolderFactory.php
ra55bb54 re78295c 27 27 public function definition() 28 28 { 29 //$inputArray = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95];30 //$deptId = Arr::random($inputArray);29 $inputArray = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]; 30 $deptId = Arr::random($inputArray); 31 31 32 $deptId = $this->faker->numberBetween(1, 10);32 //$deptId = $this->faker->numberBetween(1, 10); 33 33 34 34 $deptCode = Department::find($deptId)->code; … … 46 46 'user_id' => 1, 47 47 'department_id' => $deptId, 48 ' is_important' => $this->faker->boolean,48 'version' => 1, 49 49 'created_at' => now() 50 50 ]; -
database/migrations/2021_10_06_103305_create_folders_table.php
ra55bb54 re78295c 16 16 Schema::create('folders', function (Blueprint $table) { 17 17 $table->bigIncrements('id')->startingValue(1); 18 $table->string("arch_id") ->unique();18 $table->string("arch_id"); 19 19 $table->string("name"); 20 20 $table->text("note")->nullable(); … … 23 23 $table->integer("user_id")->unsigned(); 24 24 $table->integer("department_id")->unsigned(); 25 $table-> boolean("is_important")->default(false);25 $table->integer("version")->default(1); 26 26 $table->timestamps(); 27 27 -
database/seeders/FoldersTableSeeder.php
ra55bb54 re78295c 17 17 public function run() 18 18 { 19 Folder::factory()->count( 900)->create();19 Folder::factory()->count(15)->create(); 20 20 $folders = Folder::all(); 21 21 -
resources/views/dashboard/files/index.blade.php
ra55bb54 re78295c 107 107 @if(auth()->user()->hasPermission('manage_all_files')) 108 108 <td> 109 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit">110 <i class="ti-pencil"></i>111 </a>112 109 <a href="{{ route("dashboard.files.downloadFile", ['id' => $file->id]) }}" class="text-danger ml-2"title="Download"> 113 110 <i class="ti-download"></i> … … 148 145 </div> 149 146 150 <div class="modal fade" id="editModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">151 <div class="modal-dialog modal-dialog-centered" role="document">152 <div class="modal-content">153 <div class="modal-header">154 <h5 class="modal-title" id="exampleModalCenterTitle">Rename file</h5>155 <button type="button" class="close" data-dismiss="modal" aria-label="Close">156 <i class="ti-close"></i>157 </button>158 </div>159 <div class="modal-body">160 <form action="{{ route("dashboard.files.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">161 @method("patch")162 @csrf163 <div class="row">164 <div class="col-md-12">165 <div class="form-group">166 <label class="form-label">Current name: {{$file->name}}</label>167 <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" maxlength="255" title="Don't include: '\/.|'" pattern="^[^.\/|]+$" class="form-control" required>168 </div>169 </div>170 </div>171 <br/>172 <div class="modal-footer">173 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close174 </button>175 <button type="submit" class="btn btn-primary">Save changes</button>176 </div>177 </form>178 </div>179 180 </div>181 </div>182 </div>183 147 @endforeach 184 148 -
resources/views/dashboard/folders/files.blade.php
ra55bb54 re78295c 8 8 <div class="col-md-3 app-sidebar"> 9 9 <div class="card"> 10 <div class="card-body">11 @if(auth()->user()->hasPermission('manage_all_folders'))12 <a class="btn btn-secondary btn-block text-white" href="javascript:void(0)" data-target="#createModal{{$folder->id}}" data-toggle="modal">13 Edit folder14 </a>15 @endif16 </div>17 10 <div class="app-sidebar-menu"> 18 11 <div class="list-group list-group-flush"> … … 37 30 <div class="action-left"> 38 31 <ul class="list-inline"> 39 @if(auth()->user()->hasPermission('manage_all_folders'))40 <li class="list-inline-item mb-0">41 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">42 Actions43 </a>44 <div class="dropdown-menu">45 <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#editModal_{{$folder->id}}">46 Edit folder47 </a>48 </div>49 </li>50 @endif51 32 <li class="list-inline-item mb-0"> 52 33 @if(auth()->user()->hasPermission('download_data')) … … 108 89 </a> 109 90 <div class="dropdown-menu dropdown-menu-right"> 110 @if(auth()->user()->hasPermission('manage_all_files'))111 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editFileModal_{{$file->id}}">112 Rename113 </a>114 @endif115 91 @if(auth()->user()->hasPermission('download_data')) 116 92 <a href="{{ route("dashboard.files.downloadFile", $file->id) }}" class="dropdown-item"> … … 158 134 </div> 159 135 160 <div class="modal fade" id="editFileModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">161 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">162 <div class="modal-content">163 <div class="modal-header">164 <h5 class="modal-title" id="exampleModalCenterTitle">Edit file name</h5>165 <button type="button" class="close" data-dismiss="modal" aria-label="Close">166 <i class="ti-close"></i>167 </button>168 </div>169 <div class="modal-body">170 <form action="{{ route("dashboard.files.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">171 @method("patch")172 @csrf173 <div class="row">174 <div class="col-md-12">175 <div class="form-group">176 <label class="form-label">Current name: {{$file->name}}</label>177 <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" maxlength="255" title="Don't include: '\/.|'" pattern="^[^.\/|]+$" class="form-control" required>178 </div>179 </div>180 </div>181 <br/>182 <div class="modal-footer">183 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close184 </button>185 <button type="submit" class="btn btn-primary">Save changes</button>186 </div>187 </form>188 </div>189 </div>190 </div>191 </div>192 136 @empty 193 137 <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div> 194 138 @endforelse 195 139 196 <div class="modal fade" id="editModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">197 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">198 <div class="modal-content">199 <div class="modal-header">200 <h5 class="modal-title" id="exampleModalCenterTitle">Edit folder</h5>201 <button type="button" class="close" data-dismiss="modal" aria-label="Close">202 <i class="ti-close"></i>203 </button>204 </div>205 <div class="modal-body">206 <form action="{{ route("dashboard.folders.edit", ["id" => $folder->id]) }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">207 @method("patch")208 @csrf209 <div class="row">210 <div class="col-md-6">211 <div class="form-group">212 <label>Department</label>213 <select class="form-control edit_folder_deparment" name="department" required>214 @foreach ($departments as $department)215 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $folder->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>216 @endforeach217 </select>218 </div>219 </div>220 <div class="col-md-6">221 <div class="form-group">222 <label>Archive ID</label>223 <input type="text" name="arch_id" value="{{ old("arch_id", $folder->arch_id) }}" class="form-control" placeholder="Archive ID" required>224 </div>225 </div>226 </div>227 <div class="row">228 <div class="col-md-6">229 <div class="form-group">230 <label>Name</label>231 <input type="text" name="name" value="{{ old("name", $folder->name) }}" class="form-control" placeholder="Name" minlength="2" maxlength="30" required>232 </div>233 </div>234 <div class="col-md-6">235 <div class="form-group">236 <label>Note</label>237 <textarea class="form-control" name="note" maxlength="80">238 {{ old("note", $folder->note) }}239 </textarea>240 </div>241 </div>242 </div>243 <div class="row">244 <div class="col-md-6">245 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>246 </div>247 </div>248 <br/>249 <div class="modal-footer">250 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close251 </button>252 <button type="submit" class="btn btn-primary">Save changes</button>253 </div>254 </form>255 </div>256 257 </div>258 </div>259 </div>260 261 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">262 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">263 <div class="modal-content">264 <div class="modal-header">265 <h5 class="modal-title" id="exampleModalCenterTitle">Create folder</h5>266 <button type="button" class="close" data-dismiss="modal" aria-label="Close">267 <i class="ti-close"></i>268 </button>269 </div>270 <div class="modal-body">271 <form action="{{ route("dashboard.folders.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">272 @csrf273 <div class="row">274 <div class="col-md-6">275 <div class="form-group">276 <label for="exampleFormControlSelect1">Department</label>277 @if($departments->count())278 <select class="form-control new_folder_deparment" name="department" required>279 @foreach ($departments as $department)280 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>281 @endforeach282 @else283 <p>You haven't created any departments yet. <a class="text-primary" href="{{ route("dashboard.departments.create") }}">Create now.</a></p>284 @endif285 </select>286 </div>287 </div>288 <div class="col-md-6">289 <div class="form-group">290 <label>Archive ID</label>291 <input type="text" name="arch_id" value="" class="form-control" placeholder="Archive ID" required>292 </div>293 </div>294 </div>295 <div class="row">296 <div class="col-md-6">297 <div class="form-group">298 <label>Name</label>299 <input type="text" name="name" value="{{ old("name") }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>300 </div>301 </div>302 <div class="col-md-6">303 <div class="form-group">304 <label>Note</label>305 <textarea class="form-control" name="note" maxlength="80"> {{old("note")}} </textarea>306 </div>307 </div>308 </div>309 <div class="row">310 <div class="col-md-6">311 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>312 </div>313 <div class="col-md-6">314 <div class="form-group">315 <div class="form-check">316 <input class="form-check-input" type="checkbox" value="{{old("is_important")}}" id="is_important" name="is_important">317 <label class="form-check-label">318 Mark as important319 </label>320 </div>321 </div>322 </div>323 </div>324 <br/>325 <div class="modal-footer">326 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close327 </button>328 <button type="submit" class="btn btn-primary">Save changes</button>329 </div>330 </form>331 </div>332 333 </div>334 </div>335 </div>336 140 </div> 337 141 -
resources/views/dashboard/folders/index.blade.php
ra55bb54 re78295c 31 31 <i data-feather="upload-cloud" class="width-15 height-15 mr-2"></i> 32 32 Recents 33 </a>34 <a href="{{ URL::current()."?sort=important" }}" class="list-group-item d-flex align-items-center">35 <i data-feather="star" class="width-15 height-15 mr-2"></i>36 Important37 <span class="small ml-auto">{{ $countImportant }}</span>38 33 </a> 39 34 </div> … … 133 128 <div class="card"> 134 129 <div class="card-body"> 135 <i class="fa fa-folder fa-2x pr-2" aria-hidden="true"> 136 </i><span class="card-title" style="font-size: 1.5rem;">{{$folder->name}}</span> 137 @if($folder->is_important) 138 <i class="fa fa-star" style="color:orange;"></i> 139 @endif 130 <i class="fa fa-folder fa-2x pr-2" aria-hidden="true"></i> 131 <span class="card-title" style="font-size: 1.5rem;">{{$folder->name}}</span> 132 140 133 <div class="d-flex align-items-center"> 141 134 <div class="dropdown ml-auto"> … … 144 137 </a> 145 138 <div class="dropdown-menu dropdown-menu-right"> 146 <a href="{{ route("dashboard.folders.files", ["id" => $folder->id]) }}" class="dropdown-item">View Files</a> 147 @if(auth()->user()->hasPermission('manage_all_folders')) 148 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editModal_{{$folder->id}}">Edit</a> 149 @endif 139 <a href="{{ route("dashboard.folders.files", ["id" => $folder->id]) }}" class="dropdown-item">View files</a> 150 140 @if(auth()->user()->hasPermission('download_data')) 151 141 <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="dropdown-item">Download</a> 152 142 @endif 153 143 @if(auth()->user()->hasPermission('manage_all_folders')) 154 <button class="dropdown-item action-dropdown-item"155 href="javascript:void(0)" onclick="toggleImportant({{$folder->id}})">156 @if($folder->is_important)157 Mark as not important158 @else159 Mark as important160 @endif161 </button>162 @endif163 @if(auth()->user()->hasPermission('manage_all_folders'))164 144 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$folder->id}}">Delete</a> 165 145 @endif … … 168 148 </div> 169 149 <div class="text-muted small mt-1 mb-3">Number of files: {{$folder->files->count()}}</div> 170 <p class="badge bg-success-bright text-success">{{$folder->arch_id}}</p> 150 <p class="badge bg-success-bright text-success">Version: {{$folder->version}}</p> 151 <p>Archive ID: {{$folder->arch_id}}</p> 171 152 <p>Note: {{$folder->note}}</p> 172 153 <div class="row"> … … 179 160 <div class="card-footer"> 180 161 <small class="text-muted">Last updated: {{ date('d.m.Y H:i', strtotime($folder->updated_at)) }}</small> 181 </div> 182 </div> 183 </div> 184 185 <form id="toggleImportant_{{ $folder->id }}" 186 action="{{ route("dashboard.folders.toggleImportant", ["id" => $folder->id]) }}" 187 method="post"> 188 @csrf 189 @method("patch") 190 </form> 191 192 <div class="modal fade" id="editModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true"> 193 <div class="modal-dialog modal-dialog-centered modal-lg" role="document"> 194 <div class="modal-content"> 195 <div class="modal-header"> 196 <h5 class="modal-title" id="exampleModalCenterTitle">Edit folder</h5> 197 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 198 <i class="ti-close"></i> 199 </button> 200 </div> 201 <div class="modal-body"> 202 <form action="{{ route("dashboard.folders.edit", ["id" => $folder->id]) }}" method="post" accept-charset="utf-8" enctype="multipart/form-data"> 203 @method("patch") 204 @csrf 205 <div class="row"> 206 <div class="col-md-6"> 207 <div class="form-group"> 208 <label>Folder</label> 209 <select class="form-control edit_folder_deparment" name="department" required> 210 @foreach ($departments as $department) 211 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $folder->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option> 212 @endforeach 213 </select> 214 </div> 215 </div> 216 <div class="col-md-6"> 217 <div class="form-group"> 218 <label>Archive ID</label> 219 <input type="text" name="arch_id" value="{{ old("arch_id", $folder->arch_id) }}" class="form-control" placeholder="Archive ID" required> 220 </div> 221 </div> 222 </div> 223 <div class="row"> 224 <div class="col-md-6"> 225 <div class="form-group"> 226 <label>Name</label> 227 <input type="text" name="name" value="{{ old("name", $folder->name) }}" class="form-control" placeholder="Name" minlength="2" maxlength="30" required> 228 </div> 229 </div> 230 <div class="col-md-6"> 231 <div class="form-group"> 232 <label>Note</label> 233 <textarea class="form-control" name="note" maxlength="80"> 234 {{ old("note", $folder->note) }} 235 </textarea> 236 </div> 237 </div> 238 </div> 239 <div class="row"> 240 <div class="col-md-6"> 241 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple> 242 </div> 243 </div> 244 <br/> 245 <div class="modal-footer"> 246 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close 247 </button> 248 <button type="submit" class="btn btn-primary">Save changes</button> 249 </div> 250 </form> 251 </div> 162 252 163 </div> 253 164 </div> … … 334 245 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple> 335 246 </div> 336 <div class="col-md-6">337 <div class="form-group">338 <div class="form-check">339 <input class="form-check-input" type="checkbox" value=" {{ old('is_important') }} " id="is_important" name="is_important">340 <label class="form-check-label">341 Mark as important342 </label>343 </div>344 </div>345 </div>346 247 </div> 347 248 <br/> … … 370 271 @yield('script') 371 272 372 <script>373 function toggleImportant(id) {374 document.getElementById('toggleImportant_' + id).submit();375 }376 </script>377 378 273 @endsection
Note:
See TracChangeset
for help on using the changeset viewer.