Changeset d25ba66
- Timestamp:
- 02/24/21 17:04:35 (4 years ago)
- Branches:
- master
- Children:
- 0c07a90
- Parents:
- 1f059b0
- Files:
-
- 8 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Auth/CreatePasswordController.php
r1f059b0 rd25ba66 36 36 $user->save(); 37 37 38 session()->flash("password_created", "You have created a password successfully!"); 39 38 40 return redirect()->route("auth.loginShow"); 39 41 } -
app/Http/Controllers/Dashboard/PostsController.php
r1f059b0 rd25ba66 5 5 use App\Helpers\Alert; 6 6 use App\Http\Requests\Dashboard\PostRequest; 7 use App\Models\Review; 7 8 use App\Models\Tag; 8 9 use App\Models\Post; 9 10 use App\Models\User; 10 11 use App\Models\Category; 12 use Illuminate\Support\Facades\DB; 11 13 use Illuminate\Support\Str; 12 14 use Illuminate\Http\Request; … … 91 93 public function store(PostRequest $request) 92 94 { 93 $post = new Post(); 94 $user = auth()->user(); 95 $category = Category::find($request->category); 96 97 $post->user()->associate($user); 98 $post->category()->associate($category); 99 100 $post->title = $request->title; 101 102 $image = $request->file("image"); 103 $extension = $image->getClientOriginalExtension(); 104 $imageName = $this->createImageName($extension); 105 Storage::disk('uploads')->put($imageName, File::get($image)); 106 107 $post->image_link = $imageName; 108 $post->content = Purifier::clean($request->post_content, 'youtube'); 109 110 $post->slug = $post->createSlug(); 111 112 if ($post->user->hasPermission("publish_post")) { 113 $post->confirmed_by = $post->user->id; 114 $post->is_active = 1; 115 $post->is_confirmed = true; 116 } 117 118 $post->save(); 119 $this->checkNewAndSaveTags($post, $request->tags); 120 121 if ($post->user->hasPermission("publish_post")) { 122 Alert::flash("New posts published successfully"); 123 } else { 124 Alert::flash("New posts submitted for review successfully"); 125 $adminsAndEditors = User::where("role_id", 1)->orWhere("role_id", 2)->get(); 126 Notification::send($adminsAndEditors, new NewPostCreated("Have new post for review")); 127 } 95 DB::transaction(function () use ($request) { 96 $post = new Post(); 97 $user = auth()->user(); 98 $category = Category::find($request->category); 99 100 $post->user()->associate($user); 101 $post->category()->associate($category); 102 103 $post->title = $request->title; 104 105 $image = $request->file("image"); 106 $extension = $image->getClientOriginalExtension(); 107 $imageName = $this->createImageName($extension); 108 Storage::disk('uploads')->put($imageName, File::get($image)); 109 110 $post->image_link = $imageName; 111 $post->content = Purifier::clean($request->post_content, 'youtube'); 112 113 $post->slug = $post->createSlug(); 114 115 $needReview = $post->needReview(); 116 117 if (is_null($needReview)) { 118 $post->confirmed_by = $post->user->id; 119 $post->is_active = 1; 120 $post->is_confirmed = true; 121 } 122 123 $post->save(); 124 $this->checkNewAndSaveTags($post, $request->tags); 125 126 if ($needReview) { 127 128 $review = new Review(); 129 $review->post()->associate($post); 130 $review->postSecurity()->associate($needReview); 131 $review->current_phase = $review->postSecurity->phases()->first()->id; 132 $review->save(); 133 134 Alert::flash("New posts submitted for review successfully"); 135 136 Notification::send( 137 User::whereRoleId($review->postSecurity->role->id)->get(), 138 new NewPostCreated("Have new post for review") 139 ); 140 } else { 141 Alert::flash("New posts published successfully"); 142 } 143 }); 144 145 // if ($post->user->hasPermission("publish_post")) { 146 // Alert::flash("New posts published successfully"); 147 // } else { 148 // Alert::flash("New posts submitted for review successfully"); 149 // $adminsAndEditors = User::where("role_id", 1)->orWhere("role_id", 2)->get(); 150 // Notification::send($adminsAndEditors, new NewPostCreated("Have new post for review")); 151 // } 128 152 129 153 return redirect()->route("dashboard.posts.create"); … … 135 159 $flag = false; 136 160 137 if (auth()->user()->hasPermission("confirm_post")) { 138 $flag = true; 139 } 140 141 if ($flag) { 142 143 $post->is_confirmed = true; 144 $post->confirmed_by = auth()->user()->id; 145 146 $post->save(); 147 148 Alert::flash("Post confirmed successfully"); 149 150 $post->user->notify(new PostConfirmed("Your post has been confirmed")); 151 } 161 // if (auth()->user()->hasPermission("confirm_post")) { 162 // $flag = true; 163 // } 164 165 if (!$post->review->canReview()) { 166 Alert::flash("Post need to be confirmed by " . $post->review->getCurrentReviewer()->name, "error"); 167 return redirect()->back(); 168 } 169 170 DB::transaction(function () use ($post) { 171 172 $post->review->increment("current_phase"); 173 $post->review->save(); 174 175 if (is_null($post->review->getPhase())) { 176 177 $post->review->is_passed_all_phases = true; 178 $post->review->save(); 179 180 $post->is_confirmed = true; 181 $post->confirmed_by = auth()->user()->id; 182 $post->save(); 183 $post->user->notify(new PostConfirmed("Your post has been confirmed")); 184 } 185 }); 186 187 Alert::flash("Post confirmed successfully"); 152 188 153 189 return redirect()->route("dashboard.posts.index"); -
app/Http/Controllers/Dashboard/SettingsController.php
r1f059b0 rd25ba66 6 6 use App\Http\Requests\Dashboard\EmailSettingsRequest; 7 7 use App\Http\Requests\Dashboard\PasswordSettingsRequest; 8 use App\Http\Requests\Dashboard\PhaseRequest; 8 9 use App\Http\Requests\Dashboard\PhotosSettingsRequest; 10 use App\Http\Requests\Dashboard\PostSecurityRequest; 9 11 use App\Http\Requests\Dashboard\SocialLinksSettingsRequest; 10 12 use App\Http\Requests\Dashboard\UsernameSettingsRequest; 11 13 use App\Http\Requests\Dashboard\UserProfileSettingsRequest; 14 use App\Models\Phase; 12 15 use App\Models\Post; 16 use App\Models\PostSecurity; 17 use App\Models\Role; 13 18 use App\Models\User; 14 19 use App\Models\UserProfile; … … 30 35 "userProfile" => auth()->user()->userProfile, 31 36 "countries" => Country::all(), 32 "adminAndEditors" => User::where("role_id", 1)->orWhere("role_id", 2)->get() 37 "adminAndEditors" => User::where("role_id", 1)->orWhere("role_id", 2)->get(), 38 "userRoles" => Role::all(), 39 "phases" => Phase::all(), 40 "postSecurities" => PostSecurity::all() 33 41 ]); 34 42 } … … 179 187 } 180 188 189 public function phaseStore(PhaseRequest $request) 190 { 191 if ($request->has("phase_id") && !is_null($request->phase_id)) { 192 $phase = Phase::findOrFail($request->phase_id); 193 } else { 194 $phase = new Phase(); 195 } 196 197 $phase->name = $request->name; 198 $phase->reviewer()->associate(Role::find($request->reviewer_role_id)); 199 $phase->user()->associate(auth()->user()); 200 $phase->save(); 201 202 if ($request->has("phase_id") && !is_null($request->phase_id)) { 203 Alert::flash($phase->name . " updated successfully"); 204 } else { 205 Alert::flash($phase->name . " created successfully"); 206 } 207 208 return redirect()->route("dashboard.settings.index"); 209 } 210 211 public function phaseDestroy($id) 212 { 213 $phase = Phase::findOrFail($id); 214 $phaseName = $phase->name; 215 $phase->delete(); 216 217 Alert::flash($phaseName . " deleted successfully"); 218 219 return redirect()->route("dashboard.settings.index"); 220 } 221 222 public function postSecurityStore(PostSecurityRequest $request) 223 { 224 if ($request->has("post_security_id") && !is_null($request->post_security_id)) { 225 $postSecurity = PostSecurity::findOrFail($request->post_security_id); 226 } else { 227 $postSecurity = new PostSecurity(); 228 } 229 230 $postSecurity->role()->associate(Role::find($request->role_id_to_be_reviewed)); 231 $postSecurity->phase_ids = $request->phase_ids; 232 233 $postSecurity->save(); 234 235 if ($request->has("post_security_id") && !is_null($request->post_security_id)) { 236 Alert::flash("Post security updated successfully"); 237 } else { 238 Alert::flash("Post security created successfully"); 239 } 240 241 return redirect()->route("dashboard.settings.index"); 242 } 243 244 public function postSecurityDestroy($id) 245 { 246 PostSecurity::findOrFail($id)->delete(); 247 Alert::flash("Post security deleted successfully"); 248 return redirect()->route("dashboard.settings.index"); 249 } 250 181 251 private function updatePhotosHelper(Request $request, UserProfile $userProfile) 182 252 { -
app/Http/Controllers/Dashboard/UsersController.php
r1f059b0 rd25ba66 10 10 use App\Notifications\WelcomeUser; 11 11 use App\Http\Controllers\Controller; 12 use Illuminate\Support\Facades\DB; 12 13 use Illuminate\Support\Facades\Storage; 13 14 use Propaganistas\LaravelPhone\PhoneNumber; … … 32 33 public function store(NewUserRequest $request) 33 34 { 34 $user = new User();35 DB::transaction(function () use ($request) { 35 36 36 $user->name = $request->name; 37 $user->surname = $request->surname; 38 $user->email = $request->email; 39 $user->country_code = $request->mobile_number_country; 40 $user->mobile_number = PhoneNumber::make($request->mobile_number, $request->mobile_number_country)->formatInternational(); 41 $user->username = $request->username; 42 $user->password = $user->generateTemporaryPassword(); 43 $user->security_code = $user->generateSecurityCode(); 44 $user->verify_token = $user->generateVerifyToken(); 37 $user = new User(); 45 38 46 $user->role_id = $request->userRole; 39 $user->name = $request->name; 40 $user->surname = $request->surname; 41 $user->email = $request->email; 42 $user->country_code = $request->mobile_number_country; 43 $user->mobile_number = PhoneNumber::make($request->mobile_number, $request->mobile_number_country)->formatInternational(); 44 $user->username = $request->username; 45 $user->password = $user->generateTemporaryPassword(); 46 $user->security_code = $user->generateSecurityCode(); 47 $user->verify_token = $user->generateVerifyToken(); 47 48 48 $user->save();49 $user->role_id = $request->userRole; 49 50 50 $user->userProfile()->create([ 51 "profile_link" => $user->generateProfileLink($request->name, $request->surname), 52 "technoblog_email" => $user->generateTechnoblogEmail($request->name, $request->surname) 53 ]); 51 $user->save(); 54 52 55 $user->notify(new WelcomeUser($user)); 53 $user->userProfile()->create([ 54 "profile_link" => $user->generateProfileLink($request->name, $request->surname), 55 "technoblog_email" => $user->generateTechnoblogEmail($request->name, $request->surname) 56 ]); 56 57 57 Alert::flash("New user added successfully"); 58 $user->notify(new WelcomeUser($user)); 59 60 Alert::flash("New user added successfully"); 61 62 }); 58 63 59 64 return redirect()->route("dashboard.users.create"); -
app/Http/Requests/Dashboard/NewUserRequest.php
r1f059b0 rd25ba66 38 38 protected function getValidatorInstance() 39 39 { 40 if($this->request->has("mobile_number") && $this->request->has("mobile_number_country")) { 41 $this->request->set("mobile_number", PhoneNumber::make( 42 $this->request->get("mobile_number"), 43 $this->request->get("mobile_number_country") 44 )->formatInternational()); 45 } 40 try { 41 if($this->request->has("mobile_number") && $this->request->has("mobile_number_country")) { 42 $this->request->set("mobile_number", PhoneNumber::make( 43 $this->request->get("mobile_number"), 44 $this->request->get("mobile_number_country") 45 )->formatInternational()); 46 } 47 } catch (\Exception $e) {} 46 48 47 49 return parent::getValidatorInstance(); -
app/Models/Post.php
r1f059b0 rd25ba66 16 16 return $this->belongsTo(User::class); 17 17 } 18 19 public function review() { 20 return $this->hasOne(Review::class); 21 } 22 23 public function needReview() 24 { 25 return PostSecurity::whereRoleId($this->user->role->id)->first(); 26 } 18 27 19 28 public function category() { -
database/seeds/PermissionsTableSeeder.php
r1f059b0 rd25ba66 13 13 { 14 14 DB::table('permissions')->insert([ 15 ["name" => "create_user"], // Create new user 16 ["name" => "access_all_users"], // Access to all users to manage 17 ["name" => "create_post"], // Create new post 18 ["name" => "confirm_post"], // Confirm new post 19 ["name" => "access_all_posts"], // Access to all posts to manage 20 ["name" => "publish_all_posts"], // Publish and review all posts 21 ["name" => "publish_post"], // Publish your posts only 22 ["name" => "edit_all_posts"], // Edit all posts 23 ["name" => "edit_post"], // Edit your posts only 24 ["name" => "delete_all_posts"], // Delete all posts 25 ["name" => "delete_post"], // Delete your posts only 26 ["name" => "approve_all_comments"], // Approve comments of your posts and other users posts 27 ["name" => "approve_comment"], // Approve your post comments 28 ["name" => "access_all_categories"], // Access to all categories to manage 15 ["name" => "create_user"], // Create new user 16 ["name" => "access_all_users"], // Access to all users to manage 17 ["name" => "create_post"], // Create new post 18 ["name" => "confirm_post"], // Confirm new post 19 ["name" => "access_all_posts"], // Access to all posts to manage 20 ["name" => "publish_all_posts"], // Publish and review all posts 21 ["name" => "publish_post"], // Publish your posts only 22 ["name" => "edit_all_posts"], // Edit all posts 23 ["name" => "edit_post"], // Edit your posts only 24 ["name" => "delete_all_posts"], // Delete all posts 25 ["name" => "delete_post"], // Delete your posts only 26 ["name" => "approve_all_comments"], // Approve comments of your posts and other users posts 27 ["name" => "approve_comment"], // Approve your post comments 28 ["name" => "access_all_categories"], // Access to all categories to manage 29 ["name" => "access_all_phases"], // Access to all phases 30 ["name" => "create_phase"], // Create new phase 31 ["name" => "edit_phase"], // Edit phase 32 ["name" => "delete_phase"], // Delete phase 33 ["name" => "access_all_post_securities"], // Access to all post securities 34 ["name" => "create_post_securities"], // Create new post security 35 ["name" => "edit_post_securities"], // Edit post security 36 ["name" => "delete_post_securities"], // Delete post security 29 37 ]); 30 38 } -
database/seeds/RolesPermissionsTableSeeder.php
r1f059b0 rd25ba66 28 28 ["role_id" => 1, "permission_id" => 13], 29 29 ["role_id" => 1, "permission_id" => 14], 30 30 ["role_id" => 1, "permission_id" => 15], 31 ["role_id" => 1, "permission_id" => 16], 32 ["role_id" => 1, "permission_id" => 17], 33 ["role_id" => 1, "permission_id" => 18], 34 ["role_id" => 1, "permission_id" => 19], 35 ["role_id" => 1, "permission_id" => 20], 36 ["role_id" => 1, "permission_id" => 21], 37 ["role_id" => 1, "permission_id" => 22], 38 31 39 // Editor 32 40 ["role_id" => 2, "permission_id" => 3], -
public/assets/js/dash_app.js
r1f059b0 rd25ba66 25 25 }) 26 26 27 $(".triggerPhaseModal").click(function() { 28 29 if($(this).data("phase-id")) { 30 $(".phaseModal").find("input[name='phase_id']").val($(this).data("phase-id")); 31 $(".phaseModal").find("input[name='name']").val($(this).data("phase-name")); 32 $(".phaseModal").find("select[name='reviewer_role_id']")[0].selectize.setValue($(this).data("phase-reviewer")); 33 } else { 34 $(".phaseModal").find("form")[0].reset(); 35 $(".phaseModal").find("select")[0].selectize.clear(); 36 } 37 38 $(".phaseModal").modal("show"); 39 }) 40 41 $(".triggerPostSecurityModal").click(function() { 42 if($(this).data("post-security-id")) { 43 var phaseIds = $(this).data("post-security-phase-ids"); 44 phaseIds = typeof phaseIds == "string" ? phaseIds.split(",") : phaseIds; 45 $(".postSecurityModal").find("input[name='post_security_id']").val($(this).data("post-security-id")); 46 $(".postSecurityModal").find("select[name='role_id_to_be_reviewed']")[0].selectize.setValue($(this).data("post-security-role")); 47 $(".postSecurityModal").find(".phasesSelect")[0].selectize.setValue(phaseIds); 48 } else { 49 $(".postSecurityModal").find("select").each(function(i, item) { 50 $(item)[0].selectize.clear(); 51 }); 52 } 53 54 $(".postSecurityModal").modal("show"); 55 }); 56 57 if ($(".phasesSelect").length) { 58 $('#phasesSelect').selectize({ 59 persist: false, 60 maxItems: null, 61 }); 62 } 63 64 $(".postSecurityStore").submit(function() { 65 var selectedPhases = $(".phasesSelect")[0].selectize.items; 66 $(this).find("input[name='phase_ids']").val(selectedPhases); 67 }) 68 27 69 var selectedCountry = [null]; 28 70 … … 138 180 }); 139 181 140 $("#dttable ").DataTable({182 $("#dttable, .dttable").DataTable({ 141 183 "processing": true, 142 184 "language": { -
resources/views/auth/login.blade.php
r1f059b0 rd25ba66 22 22 <div class="alert alert-danger alert-dismissible fade show" role="alert"> 23 23 <strong> {{ Session::get('isActiveError') }} </strong> 24 <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button> 25 </div> 26 @endif 27 28 @if(Session::has('password_created')) 29 <div class="alert alert-success alert-dismissible fade show" role="alert"> 30 <strong> {{ Session::get('password_created') }} </strong> 24 31 <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button> 25 32 </div> -
resources/views/dashboard/posts/edit.blade.php
r1f059b0 rd25ba66 12 12 13 13 <div class="col-sm-12"> 14 15 @if(!$post->review->is_passed_all_phases) 16 <p class="text-center" style="font-size: 17px;"> 17 Current phase: {{ $post->review->getPhase()->name }} 18 @if($post->review->canReview()) 19 <button class="btn btn-primary">Approve</button> 20 @endif 21 </p> 22 @endif 14 23 15 24 <div class="card"> -
resources/views/dashboard/settings/index.blade.php
r1f059b0 rd25ba66 25 25 <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" 26 26 aria-orientation="vertical"> 27 <a class="nav-link activept-2 pb-2" id="v-pills-home-tab" data-toggle="pill"27 <a class="nav-link pt-2 pb-2" id="v-pills-home-tab" data-toggle="pill" 28 28 href="#v-pills-home" role="tab" aria-controls="v-pills-home" 29 aria-selected="true">Profile Settings</a>29 aria-selected="true">Profile</a> 30 30 <a class="nav-link pt-2 pb-2" id="v-pills-profile-tab" data-toggle="pill" 31 31 href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" 32 aria-selected="false">Account Settings</a> 32 aria-selected="false">Account</a> 33 @if(auth()->user()->hasPermission("access_all_phases")) 34 <a class="nav-link pt-2 pb-2" id="v-pills-phases-tab" data-toggle="pill" 35 href="#v-pills-phases" role="tab" aria-controls="v-pills-phases" 36 aria-selected="false">Phases</a> 37 @endif 38 39 @if(auth()->user()->hasPermission("access_all_post_securities")) 40 <a class="nav-link active pt-2 pb-2" id="v-pills-post-security-tab" data-toggle="pill" 41 href="#v-pills-post-security" role="tab" aria-controls="v-pills-post-security" 42 aria-selected="false">Post Security</a> 43 @endif 33 44 </div> 34 45 </div> … … 36 47 <div class="col-md-8"> 37 48 <div class="tab-content" id="v-pills-tabContent"> 38 <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel"49 <div class="tab-pane fade" id="v-pills-home" role="tabpanel" 39 50 aria-labelledby="v-pills-home-tab"> 40 51 … … 488 499 </div> 489 500 </div> 501 502 @if (auth()->user()->hasPermission("access_all_phases")) 503 <div class="tab-pane fade" id="v-pills-phases" role="tabpanel" 504 aria-labelledby="v-pills-phases-tab"> 505 506 <fieldset class="form-fieldset"> 507 508 <h4 class="font-weight-normal border-bottom pb-4"> 509 Phases 510 <span class="triggerPhaseModal float-right mb-2 d-inline-block btn btn-sm btn-primary">Create New</span> 511 </h4> 512 513 <div class="modal fade phaseModal" tabindex="-1" role="dialog" aria-hidden="true"> 514 515 <div class="modal-dialog modal-dialog-centered" role="document"> 516 517 <div class="modal-content"> 518 519 <div class="modal-header"> 520 <h5 class="modal-title" id="exampleModalLabel">Create new phase</h5> 521 <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button> 522 </div> 523 524 <div class="modal-body"> 525 526 <form action="{{ route("dashboard.settings.phase.store") }}" 527 method="post"> 528 @csrf 529 530 <input type="hidden" name="phase_id"> 531 532 <label class="form-label">Name</label> 533 <input type="text" class="form-control" 534 name="name" autocomplete="off" required> 535 536 <label class="form-label mt-2">User role to review</label> 537 <select class="selectData" name="reviewer_role_id"> 538 <option value=""></option> 539 @foreach ($userRoles as $userRole) 540 <option 541 value="{{ $userRole->id }}" 542 {{ (old("reviewer_role_id") == $userRole->id) ? "selected" : "" }} 543 > 544 {{ ucfirst($userRole->name) }} 545 </option> 546 @endforeach 547 </select> 548 549 <div class="modal-footer pb-0"> 550 <button type="button" class="btn btn-secondary" 551 data-dismiss="modal">Close 552 </button> 553 <input type="submit" class="btn btn-primary" 554 value="Submit"> 555 </div> 556 557 </form> 558 559 </div> 560 561 </div> 562 563 </div> 564 565 </div> 566 567 <table id="dttable" class="table table-hover table-outline table-vcenter text-nowrap card-table"> 568 <thead> 569 <tr> 570 <th>Name</th> 571 <th>Reviewer</th> 572 <th>Actions</th> 573 </tr> 574 </thead> 575 <tbody> 576 @foreach($phases as $phase) 577 <tr> 578 <td>{{ $phase->name }}</td> 579 <td>{{ ucfirst($phase->reviewer->name) }}</td> 580 <td class="text-center"> 581 <div class="item-action dropdown"> 582 <a href="javascript:void(0)" data-toggle="dropdown" class="icon" aria-expanded="false"><i class="fe fe-more-vertical"></i></a> 583 <div class="dropdown-menu dropdown-menu-right" x-placement="bottom-end" style="position: absolute; transform: translate3d(15px, 20px, 0px); top: 0px; left: 0px; will-change: transform;"> 584 <a href="javascript:void(0)" data-phase-id="{{ $phase->id }}" data-phase-name="{{ $phase->name }}" data-phase-reviewer="{{ $phase->reviewer->id }}" class="triggerPhaseModal dropdown-item"><i class="dropdown-icon fe fe-edit"></i> Edit</a> 585 <a href="javascript:void(0)" class="actionLink dropdown-item" style="cursor: pointer;" data-action="{{ route("dashboard.settings.phase.destroy", ["id" => $phase->id]) }}" data-method="delete"><i class="dropdown-icon fe fe-trash-2 text-danger"></i> Delete </a> 586 </div> 587 </div> 588 </td> 589 </tr> 590 @endforeach 591 </tbody> 592 </table> 593 594 </fieldset> 595 </div> 596 @endif 597 598 @if(auth()->user()->hasPermission("access_all_post_securities")) 599 <div class="tab-pane fade show active" id="v-pills-post-security" role="tabpanel" 600 aria-labelledby="v-pills-post-security-tab"> 601 <fieldset class="form-fieldset"> 602 603 <h4 class="font-weight-normal border-bottom pb-4"> 604 Post security 605 <span class="triggerPostSecurityModal float-right mb-2 d-inline-block btn btn-sm btn-primary">Create New</span> 606 </h4> 607 608 <div class="modal fade postSecurityModal" tabindex="-1" role="dialog" aria-hidden="true"> 609 610 <div class="modal-dialog modal-dialog-centered" role="document"> 611 612 <div class="modal-content"> 613 614 <div class="modal-header"> 615 <h5 class="modal-title" id="exampleModalLabel">Create new post security</h5> 616 <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button> 617 </div> 618 619 <div class="modal-body"> 620 621 <form class="postSecurityStore" 622 action="{{ route("dashboard.settings.post-security.store") }}" 623 method="post"> 624 @csrf 625 626 <input type="hidden" name="post_security_id"> 627 628 <label class="form-label">User role to be reviewed</label> 629 <select class="selectData" name="role_id_to_be_reviewed"> 630 <option value=""></option> 631 @foreach ($userRoles as $userRole) 632 <option 633 value="{{ $userRole->id }}" 634 {{ (old("role_id_to_be_reviewed") == $userRole->id) ? "selected" : "" }} 635 > 636 {{ ucfirst($userRole->name) }} 637 </option> 638 @endforeach 639 </select> 640 641 <label class="form-label mt-2">Select phases</label> 642 <select class="phasesSelect" multiple> 643 <option value=""></option> 644 @foreach ($phases as $phase) 645 <option 646 value="{{ $phase->id }}"> 647 {{ $phase->name }} 648 </option> 649 @endforeach 650 </select> 651 <input type="hidden" name="phase_ids"> 652 653 <div class="modal-footer pb-0"> 654 <button type="button" class="btn btn-secondary" 655 data-dismiss="modal">Close 656 </button> 657 <input type="submit" class="btn btn-primary" 658 value="Submit"> 659 </div> 660 661 </form> 662 663 </div> 664 665 </div> 666 667 </div> 668 669 </div> 670 671 <table id="dttable" class="dttable table table-hover table-outline table-vcenter text-nowrap card-table"> 672 <thead> 673 <tr> 674 <th>To be reviewed</th> 675 <th>Phases</th> 676 <th>Actions</th> 677 </tr> 678 </thead> 679 <tbody> 680 @foreach($postSecurities as $postSecurity) 681 <tr> 682 <td>{{ ucfirst($postSecurity->role->name) }}</td> 683 <td>{{ $postSecurity->phase_names }}</td> 684 <td class="text-center"> 685 <div class="item-action dropdown"> 686 <a href="javascript:void(0)" data-toggle="dropdown" class="icon" aria-expanded="false"><i class="fe fe-more-vertical"></i></a> 687 <div class="dropdown-menu dropdown-menu-right" x-placement="bottom-end" style="position: absolute; transform: translate3d(15px, 20px, 0px); top: 0px; left: 0px; will-change: transform;"> 688 <a href="javascript:void(0)" data-post-security-id="{{ $postSecurity->id }}" data-post-security-role="{{ $postSecurity->role->id }}" data-post-security-phase-ids="{{ $postSecurity->phase_ids }}" class="triggerPostSecurityModal dropdown-item"><i class="dropdown-icon fe fe-edit"></i> Edit</a> 689 <a href="javascript:void(0)" class="actionLink dropdown-item" style="cursor: pointer;" data-action="{{ route("dashboard.settings.post-security.destroy", ["id" => $phase->id]) }}" data-method="delete"><i class="dropdown-icon fe fe-trash-2 text-danger"></i> Delete </a> 690 </div> 691 </div> 692 </td> 693 </tr> 694 @endforeach 695 </tbody> 696 </table> 697 698 </fieldset> 699 </div> 700 @endif 490 701 </div> 491 702 </div> -
routes/web.php
r1f059b0 rd25ba66 56 56 Route::get("/", "Dashboard\IndexController@index")->name("dashboard.index"); 57 57 58 // Settings 58 59 Route::get("/settings", "Dashboard\SettingsController@settings")->name("dashboard.settings.index"); 59 60 Route::patch("/settings/personal", "Dashboard\SettingsController@updatePersonalInformation")->name("dashboard.settings.personal"); … … 64 65 Route::patch("/settings/email", "Dashboard\SettingsController@updateEmail")->name("dashboard.settings.email"); 65 66 Route::post("/settings/transfer/", "Dashboard\SettingsController@transferPostsAndDeleteUser")->name("dashboard.settings.transfer"); 67 68 // Settings => Phases 69 Route::post("/settings/phase/store", "Dashboard\SettingsController@phaseStore")->name("dashboard.settings.phase.store"); 70 Route::delete("/settings/phase/{id}", "Dashboard\SettingsController@phaseDestroy") 71 ->name("dashboard.settings.phase.destroy") 72 ->middleware("permission:delete_phase"); 73 74 // Settings => Post Security 75 Route::post("/settings/post-security/store", "Dashboard\SettingsController@postSecurityStore")->name("dashboard.settings.post-security.store"); 76 Route::delete("/settings/post-security/{id}", "Dashboard\SettingsController@postSecurityDestroy") 77 ->name("dashboard.settings.post-security.destroy") 78 ->middleware("permission:delete_post_securities"); 66 79 67 80 // Users
Note:
See TracChangeset
for help on using the changeset viewer.