visa-section

et#14
Mahesh Sharma 2 years ago
parent 6cdd7bd5fb
commit 80deba7807
  1. 2
      app/Http/Controllers/Admin/PageController.php
  2. 85
      app/Http/Controllers/Admin/VisaServiceSectionController.php
  3. 18
      resources/views/admin/visa_service_section/create.blade.php
  4. 21
      resources/views/admin/visa_service_section/edit.blade.php

@ -78,7 +78,7 @@ class PageController extends Controller
]); ]);
if(\request('image')){ if(\request('banner_image')){
$this->validate(\request(),[ $this->validate(\request(),[
'banner_image' => 'file|mimes:jpeg,png,jpg' 'banner_image' => 'file|mimes:jpeg,png,jpg'
]); ]);

@ -64,7 +64,8 @@ class VisaServiceSectionController extends Controller
$this->validate(\request(),[ $this->validate(\request(),[
// 'title' => 'required',
'description' => 'required',
'status' => 'required', 'status' => 'required',
'order_by' => 'required' 'order_by' => 'required'
@ -167,7 +168,7 @@ class VisaServiceSectionController extends Controller
public function update(Request $request, $id, $secId) public function update(Request $request, $id, $secId)
{ {
$this->validate(\request(),[ $this->validate(\request(),[
'top_description' => 'required', 'description' => 'required',
'status' => 'required', 'status' => 'required',
'order_by' => 'required' 'order_by' => 'required'
]); ]);
@ -192,54 +193,54 @@ class VisaServiceSectionController extends Controller
// $service_section->image = $image_path; // $service_section->image = $image_path;
// } // }
if($service_section->update()){ if($service_section->update()){
// $points = $request->points; $points = $request->points;
// if($points[0] != null){ if($points[0] != null){
// if($request['point_ids'] !== null){ if($request['point_ids'] !== null){
// foreach($request['point_ids'] as $key => $pid){ foreach($request['point_ids'] as $key => $pid){
// $service_section_point = new VisaServiceSectionPoint(); $service_section_point = new VisaServiceSectionPoint();
// $service_section_point = $service_section_point->find($pid); $service_section_point = $service_section_point->find($pid);
// // $service_section_point = ServiceSectionPoint::find($id); // $service_section_point = ServiceSectionPoint::find($id);
// $service_section_point->point = $points[$key]; $service_section_point->point = $points[$key];
// $service_section_point->update(); $service_section_point->update();
// } }
// }else{ }else{
// foreach($points as $key => $point){ foreach($points as $key => $point){
// $service_section_point = new VisaServiceSectionPoint(); $service_section_point = new VisaServiceSectionPoint();
// $service_section_point->visa_service_section_id = $service_section->id; $service_section_point->visa_service_section_id = $service_section->id;
// $service_section_point->point = $point; $service_section_point->point = $point;
// $service_section_point->save(); $service_section_point->save();
// } }
// } }
// } }
// $service_point = $service_section->service_section_point(); $service_point = $service_section->service_section_point();
// $service_point->delete(); $service_point->delete();
// foreach($points as $key => $point){ foreach($points as $key => $point){
// $service_section_point = new ServiceSectionPoint(); $service_section_point = new ServiceSectionPoint();
// $service_section_point->service_section_id = $service_section->id; $service_section_point->service_section_id = $service_section->id;
// if(array_key_exists($key,$point_descriptions)){ if(array_key_exists($key,$point_descriptions)){
// $service_section_point->point_description = $point_descriptions[$key]; $service_section_point->point_description = $point_descriptions[$key];
// } }
// if(array_key_exists($key,$icons)){ if(array_key_exists($key,$icons)){
// $extension = $icons[$key]->getClientOriginalExtension(); $extension = $icons[$key]->getClientOriginalExtension();
// $image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder $image_folder_type = array_search('service',config('custom.image_folders')); //for image saved in folder
// $count = rand(100,999); $count = rand(100,999);
// $out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type); $out_put_path = User::save_image($icons[$key],$extension,$count,$image_folder_type);
// is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path; is_array($out_put_path) ? $service_section_point->icon = $out_put_path[0] : $service_section_point->icon = $out_put_path;
// // $service_section_point->icon = $points_descriptions[$key]; // $service_section_point->icon = $points_descriptions[$key];
// } }
// $service_section_point->point = $point; $service_section_point->point = $point;
// $service_section_point->update(); $service_section_point->update();
// } }
Session::flash('success','Visa Service Section has been successfully updated!'); Session::flash('success','Visa Service Section has been successfully updated!');
return redirect('admin/visa_services/'.$id.'/sections'); return redirect('admin/visa_services/'.$id.'/sections');

@ -82,6 +82,24 @@
</div> </div>
</br> </br>
<div class="row" id="point_dom">
<div class="col-md-6 rel-close" id="point_row_1">
<div class="dom-box">
<div class="add-points card">
<div class="form-group" id="point_g_1" >
<div id="point1" class="point1" >
<label> Section Points</label><br>
<input type="text" class="point" name="points[]" placeholder="Point"> <br>
<button class="close-point" onclick="deletePoint(1)" type="button"><i class="fa fa-trash" aria-hidden="true"></i></button>
</div>
</div>
<button type="button" class="add-point-btn btn btn-green" onclick="getPoint(1)">Add Points</button>
</div>
</div>
</div>
</div>

@ -87,6 +87,27 @@
</div> </div>
</div> </div>
</br> </br>
<div class="row" id="point_dom">
<div class="col-md-6 rel-close" id="point_row_1">
<div class="dom-box">
<div class="add-points card">
<div class="form-group" id="point_g_1" >
<label for="">Service Section Points <span style="color: red">*</span></label>
<br>
@foreach($service_section->visa_service_section_point as $section_point)
<input type = "hidden" name = "point_ids[]" value = "{{$section_point->id}}"/>
<div id="point_old{{$section_point->id}}" class="point1" >
<input type="text" class="point" name="points[]" value="{{$section_point->point}}" placeholder="points"> <br>
<button class="close-point" onclick="deletePointPermanently({{$section_point->id}})" type="button"><i class="fa fa-trash" aria-hidden="true"></i></button>
</div>
@endforeach
</div>
<button type="button" class="add-point-btn btn btn-green" onclick="getPoint(1)">Add Points</button>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save