Skip to content

Commit

Permalink
fix: service page
Browse files Browse the repository at this point in the history
  • Loading branch information
itsemon245 committed Apr 5, 2024
1 parent d3118ba commit 133a874
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
19 changes: 14 additions & 5 deletions app/Http/Controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,20 @@ public function edit(Service $service)
/**
* Update the specified resource in storage.
*/
public function update(UpdateServiceRequest $request, Service $service)
public function update(UpdateServiceRequest $request, Service $id)
{
$service->update([
'image' => updateFile($request->image, $service->image, 'sections/service'),
]);
$service = $id;
$service->title = $request->title;
$service->intro = $request->intro;
$service->description = $request->description;
$service->price = $request->price;
$service->price_description = $request->price_description;
$service->discount = $request->discount;
$service->is_discount_fixed = $request->discount_type;
$service->delivery_date = $request->delivery_date;
$service->rating = $request->ratting;
$service->reviews = $request->reviews;
$service->update();
$this->setSections($request, $service, 'Service');
$notification = [
'message' => 'Service Updated',
Expand Down Expand Up @@ -138,4 +147,4 @@ public function setSections($request, $model, string $modelName)
}
}
}
}
}
10 changes: 5 additions & 5 deletions resources/views/backend/service/editService.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</div>
<div class="col-md-6">
<x-backend.form.text-input label="Delivery Date" type="date" name="delivery_date"
value="{{ $service->delivery_date }}">
value="{{ \Carbon\Carbon::parse($service->delivery_date)->format('Y-m-d')}}">
</x-backend.form.text-input>
</div>
<div class="col-md-6">
Expand All @@ -78,7 +78,7 @@
</div>
<div class="mt-3">
<button type="submit"
class="btn btn-primary waves-effect waves-light profile-button">Update
class="btn btn-primary waves-effect waves-light profile-button">Update
Service</button>
</div>

Expand Down Expand Up @@ -114,19 +114,19 @@ class="btn btn-primary waves-effect waves-light profile-button">Update
<div class="mt-1">
<label for="section-editor-${itemCount}" class="form-label">Section Description ${itemCount}</label>
<textarea id="section-editor-${itemCount}" name="sections_descriptions[]" placeholder="Section Description">
</textarea>
</div>
</div>
<div class="col-md-6">
<div class="col-md-6">
<label for="section-image-${itemCount}">
<p>Section Image ${itemCount}</p>
<input id="section-image-${itemCount}" class="custom-input" data-index="${itemCount}" type="file" name="sections_images[]" hidden>
<img loading="lazy" class="w-100 border border-2 border-primary" id="live-${itemCount}"
src="{{ asset('images/Placeholder_view_vector.svg.png') }}">
</label>
<p class="mt-2" id="note-${itemCount}">
<span class="text-danger" style="font-weight: 500;">*</span>Accepted files : <span class="text-success" style="font-weight: 500;">jpg, png, svg, webp up to 5 MB</span>
<span class="text-danger" style="font-weight: 500;">*</span>Accepted files : <span class="text-success" style="font-weight: 500;">jpg, png, svg, webp up to 5 MB</span>
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/pages/taxCalculator.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class="apply btn btn-success waves-effect waves-light profile-button m-2">Submit
$(".apply").each(function(i, btn) {
$(btn).click((e)=>{
e.preventDefault()
let url = "{{ route('tax.calculate', true) }}";
let url = "{{ route('tax.calculate').'?apply=true' }}";
let form = $("#" + $(btn).data('form'));
form.attr('action', url)
form.submit()
Expand Down

0 comments on commit 133a874

Please sign in to comment.