diff --git a/app/Exports/BookingExport.php b/app/Exports/BookingExport.php new file mode 100644 index 0000000..b576562 --- /dev/null +++ b/app/Exports/BookingExport.php @@ -0,0 +1,32 @@ +startDate = $startDate; + $this->endDate = $endDate; + } + + public function collection() + { + return Booking::whereBetween('created_at', [$this->startDate, $this->endDate]) + ->select('created_at', 'name', 'category', 'service_name', 'total') + ->get(); + } + + public function headings(): array + { + return ['Date', 'User', 'Category', 'Service', 'Price']; + } +} diff --git a/app/Exports/Revenue.php b/app/Exports/Revenue.php index 07ec0d4..e69de29 100644 --- a/app/Exports/Revenue.php +++ b/app/Exports/Revenue.php @@ -1,22 +0,0 @@ -merge($orders); - - return $data; - } -} diff --git a/app/Exports/RevenueExport.php b/app/Exports/RevenueExport.php index 07ec0d4..d8aacaa 100644 --- a/app/Exports/RevenueExport.php +++ b/app/Exports/RevenueExport.php @@ -3,20 +3,96 @@ namespace App\Exports; use App\Models\Booking; -use App\Models\Order; use Maatwebsite\Excel\Concerns\FromCollection; +use Maatwebsite\Excel\Concerns\WithHeadings; +use Maatwebsite\Excel\Concerns\WithMapping; +use Maatwebsite\Excel\Concerns\WithEvents; +use Maatwebsite\Excel\Events\AfterSheet; -class RevenueExport implements FromCollection +class RevenueExport implements FromCollection, WithHeadings, WithMapping, WithEvents { + protected $startDate; + protected $endDate; + protected $totalRevenuePerService; + + public function __construct($startDate, $endDate) + { + $this->startDate = $startDate; + $this->endDate = $endDate; + $this->calculateTotalRevenuePerService(); + } + public function collection() { - // Retrieve data from Booking and Order models - $bookings = Booking::all(); - $orders = Order::all(); + return Booking::whereBetween('created_at', [$this->startDate, $this->endDate]) + ->select('created_at', 'name', 'category', 'service_name', 'total') + ->get(); + } - // Merge data from bookings and orders into one collection - $data = $bookings->merge($orders); + public function headings(): array + { + return ['Date', 'User', 'Category', 'Service', 'Price']; + } - return $data; + public function map($row): array + { + return [ + $row->created_at, + $row->name, + $row->category, + $row->service_name, + $row->total + ]; + } + + public function registerEvents(): array + { + return [ + AfterSheet::class => function (AfterSheet $event) { + $sheet = $event->sheet; + $highestRow = $sheet->getHighestRow(); + $row = $highestRow + 2; + + // Append total revenue per service headers + $sheet->insertNewRowBefore($row, 2); + $sheet->setCellValue("A{$row}", 'Total Revenue per Service'); + $sheet->setCellValue("A" . ($row + 1), 'Service'); + $sheet->setCellValue("B" . ($row + 1), 'Total Revenue'); + + // Append total revenue per service data + $currentRow = $row + 2; + foreach ($this->totalRevenuePerService as $service => $total) { + $sheet->insertNewRowBefore($currentRow, 1); + $sheet->setCellValue("A{$currentRow}", $service); + $sheet->setCellValue("B{$currentRow}", $total); + $currentRow++; + } + + // Mengatur format kolom angka + $sheet->getStyle("E2:E{$highestRow}") + ->getNumberFormat() + ->setFormatCode('#,##0'); // Format angka dengan ribuan pemisah dan tanpa desimal + + // Mengatur format untuk kolom Total Revenue + $sheet->getStyle("B{$row}:B{$currentRow}") + ->getNumberFormat() + ->setFormatCode('#,##0'); // Format angka dengan ribuan pemisah dan tanpa desimal + } + ]; + } + + private function calculateTotalRevenuePerService() + { + $bookings = Booking::whereBetween('created_at', [$this->startDate, $this->endDate])->get(); + $this->totalRevenuePerService = []; + + foreach ($bookings as $record) { + if (isset($record->service_name)) { + if (!isset($this->totalRevenuePerService[$record->service_name])) { + $this->totalRevenuePerService[$record->service_name] = 0; + } + $this->totalRevenuePerService[$record->service_name] += $record->total; + } + } } } diff --git a/app/Http/Controllers/API/CartController.php b/app/Http/Controllers/API/CartController.php index 443e777..74242a8 100644 --- a/app/Http/Controllers/API/CartController.php +++ b/app/Http/Controllers/API/CartController.php @@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Validator; use App\Http\Controllers\API\BaseController; use App\Http\Resources\Item as ItemResource; -use App\Models\Review; +//use App\Models\Review; use GuzzleHttp\Exception\GuzzleException; use PhpParser\Node\Stmt\TryCatch; diff --git a/app/Http/Controllers/API/ProductController.php b/app/Http/Controllers/API/ProductController.php index cffc253..b864be8 100644 --- a/app/Http/Controllers/API/ProductController.php +++ b/app/Http/Controllers/API/ProductController.php @@ -38,8 +38,8 @@ class ProductController extends BaseController public function show(Request $request){ $product = Product::with('media', 'category', 'tags') ->where('slug', $request->slug) - ->withCount('media','approvedReviews') - ->withAvg('approvedReviews', 'rating') + //->withCount('media','approvedReviews') + //->withAvg('approvedReviews', 'rating') ->active() ->hasQuantity() ->firstOrFail(); diff --git a/app/Http/Controllers/Admin/BookingController.php b/app/Http/Controllers/Admin/BookingController.php index 2c20365..662c13a 100644 --- a/app/Http/Controllers/Admin/BookingController.php +++ b/app/Http/Controllers/Admin/BookingController.php @@ -4,13 +4,47 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Booking; +use App\Models\Schedule; use Illuminate\Http\Request; class BookingController extends Controller { - public function index() + public function index(Request $request) { - $bookings = Booking::orderBy('id', 'DESC')->get(); + $search = $request->input('search'); + + $bookings = Booking::query() + ->where('name', 'LIKE', "%{$search}%") + ->orWhere('handphone', 'LIKE', "%{$search}%") + ->orWhere('service_name', 'LIKE', "%{$search}%") + ->orWhere('category', 'LIKE', "%{$search}%") + ->orWhere('status', 'LIKE', "%{$search}%") + ->orWhereHas('schedule', function ($query) use ($search) { + $query->withTrashed()->where('date', 'LIKE', "%{$search}%") + ->orWhere('start_time', 'LIKE', "%{$search}%") + ->orWhere('end_time', 'LIKE', "%{$search}%"); + }) + ->paginate(10); + return view('admin.booking.index', compact('bookings')); } + + public function view($id) + { + $booking = Booking::with(['schedule' => function($query) { + $query->withTrashed(); + }])->findOrFail($id); + + return view('admin.booking.view', compact('booking')); + } + + public function destroy($id) + { + $booking = Booking::findOrFail($id); + $booking->delete(); + + return redirect()->route('admin.booking.index')->with('message', 'Booking deleted successfully.'); + } + + } diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php index dc900cb..3203b2f 100644 --- a/app/Http/Controllers/Admin/CategoryController.php +++ b/app/Http/Controllers/Admin/CategoryController.php @@ -1,7 +1,7 @@ withCount('products')->latest()->paginate(5); - + $search = $request->input('search'); + $categories = Category::with('parent') + ->withCount('products') + ->when($search, function ($query) use ($search) { + $query->where('name', 'like', '%' . $search . '%'); + }) + ->latest() + ->paginate(5); return view('admin.categories.index', compact('categories')); } diff --git a/app/Http/Controllers/Admin/ObtainedController.php b/app/Http/Controllers/Admin/ObtainedController.php index ade5a13..75be24a 100644 --- a/app/Http/Controllers/Admin/ObtainedController.php +++ b/app/Http/Controllers/Admin/ObtainedController.php @@ -17,11 +17,15 @@ class ObtainedController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { - //abort_if(Gate::denies('obtained_access'), Response::HTTP_FORBIDDEN, '403 Forbidden'); - - $obtaineds = Obtained::paginate(5); + $search = $request->input('search'); + + $obtaineds = Obtained::query() + ->when($search, function ($query) use ($search) { + $query->where('name', 'like', '%' . $search . '%'); + }) + ->paginate(5); return view('admin.obtaineds.index', compact('obtaineds')); } diff --git a/app/Http/Controllers/Admin/OrderController.php b/app/Http/Controllers/Admin/OrderController.php index 757c3b0..17b89d4 100644 --- a/app/Http/Controllers/Admin/OrderController.php +++ b/app/Http/Controllers/Admin/OrderController.php @@ -60,7 +60,61 @@ class OrderController extends Controller { return view('admin.orders.show', compact('order')); } + public function savePayment(Request $request, $orderId) +{ + $order = Order::find($orderId); + if (!$order) { + return redirect()->back()->with([ + 'message' => 'Order not found!', + 'alert-type' => 'error' + ]); + } + + $order->update(['payment_status' => 'paid', 'total_paid' => $request->total_paid]); + $changeAmount = $request->total_paid - $order->base_total_price; + $order->change_amount = $changeAmount; + $order->save(); + + // Simpan total dibayarkan dalam session + session(['total_paid' => $request->total_paid]); + + return redirect()->route('admin.orders.show', $order)->with([ + 'message' => 'Payment status updated to paid!', + 'alert-type' => 'success', + 'total_paid' => $request->total_paid, + ]); +} + + public function markAsPaid(Request $request, $orderId) +{ + $order = Order::find($orderId); + + if (!$order) { + return redirect()->back()->with([ + 'message' => 'Order not found!', + 'alert-type' => 'error' + ]); + } + + $order->update(['payment_status' => 'paid', 'total_paid' => $request->total_paid]); + $changeAmount = $request->total_paid - $order->base_total_price; + $order->change_amount = $changeAmount; + $order->save(); + + // Simpan total dibayarkan dalam session + session(['total_paid' => $request->total_paid]); + + return redirect()->route('admin.orders.show', $order)->with([ + 'message' => 'Payment status updated to paid!', + 'alert-type' => 'success', + 'total_paid' => $request->total_paid, + ]); +} + + + // ... + /** * Remove the specified resource from storage. * @@ -70,15 +124,6 @@ class OrderController extends Controller public function destroy(Order $order) { - // \DB::transaction( - // function () use ($order) { - // OrderItem::where('order_id', $order->id)->delete(); - // $order->shipment->delete(); - // $order->forceDelete(); - - // return true; - // } - // ); OrderItem::where('order_id', $order->id)->delete(); $order->delete(); diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index 395e532..da76e4f 100644 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -19,11 +19,15 @@ class ProductController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { //abort_if(Gate::denies('product_access'), Response::HTTP_FORBIDDEN, '403 Forbidden'); - - $products = Product::with('category', 'tags', 'firstMedia')->latest()->paginate(5); + $search = $request->input('search'); + + $products = Product::query() + ->where('name', 'LIKE', "%{$search}%") + ->paginate(10); + //$products = Product::with('category', 'tags', 'firstMedia')->latest()->paginate(5); return view('admin.products.index', compact('products')); } diff --git a/app/Http/Controllers/Admin/ReportController.php b/app/Http/Controllers/Admin/ReportController.php index 335bc1e..bfa9330 100644 --- a/app/Http/Controllers/Admin/ReportController.php +++ b/app/Http/Controllers/Admin/ReportController.php @@ -2,29 +2,63 @@ namespace App\Http\Controllers\Admin; -use App\Models\Booking; +use Maatwebsite\Excel\Facades\Excel; use App\Models\Order; +use App\Models\Booking; use App\Exports\RevenueExport; use Illuminate\Http\Request; use App\Http\Controllers\Controller; -use Maatwebsite\Excel\Facades\Excel; -use PDF; +use Carbon\Carbon; class ReportController extends Controller { - public function export(Request $request) + + public function print(Request $request) { - $exportType = $request->input('export'); - - if ($exportType == 'pdf') { - $data = Booking::all()->merge(Order::all()); - $startDate = $data->min('created_at')->format('Y-m-d'); // Tanggal pertama - $endDate = $data->max('created_at')->format('Y-m-d'); - - $pdf = PDF::loadView('admin.reports.exports.revenue_pdf', compact('data', 'startDate', 'endDate')); - return $pdf->download('revenue_report.pdf'); - } elseif ($exportType == 'xlsx') { - return Excel::download(new RevenueExport(), 'revenue_report.xlsx'); + $startDate = Carbon::parse($request->input('start'))->startOfDay(); + $endDate = Carbon::parse($request->input('end'))->endOfDay(); + + $bookings = Booking::whereBetween('created_at', [$startDate, $endDate])->get(); + + $totalRevenuePerService = []; + foreach ($bookings as $record) { + if (isset($record->service_name)) { + if (!isset($totalRevenuePerService[$record->service_name])) { + $totalRevenuePerService[$record->service_name] = 0; + } + $totalRevenuePerService[$record->service_name] += $record->total; + } } + + return view('admin.reports.print', compact('bookings', 'startDate', 'endDate', 'totalRevenuePerService')); + } + + public function download(Request $request) + { + $startDate = Carbon::parse($request->input('start'))->startOfDay(); + $endDate = Carbon::parse($request->input('end'))->endOfDay(); + + return Excel::download(new RevenueExport($startDate, $endDate), 'revenue_report.xlsx'); + } + + public function revenue() + { + $bookings = Booking::all(); + return view('admin.reports.revenue', compact('bookings')); + } + public function totalRevenue(Request $request) + { + $bookings = Booking::all(); // Ganti sesuai logika bisnis Anda untuk mendapatkan bookings + return view('admin.reports.total-revenue', compact('bookings')); + } + + public function orderReport(Request $request) + { + $startDate = Carbon::parse($request->input('start'))->startOfDay(); + $endDate = Carbon::parse($request->input('end'))->endOfDay(); + + $orders = Order::whereBetween('created_at', [$startDate, $endDate])->get(); + + return view('admin.reports.orders', compact('orders', 'startDate', 'endDate')); } } diff --git a/app/Http/Controllers/Admin/ReviewController.php b/app/Http/Controllers/Admin/ReviewController.php deleted file mode 100644 index 10a2feb..0000000 --- a/app/Http/Controllers/Admin/ReviewController.php +++ /dev/null @@ -1,77 +0,0 @@ -latest()->paginate(5); - - return view('admin.reviews.index', compact('reviews')); - } - - /** - * Display the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function show(Review $review) - { - return view('admin.reviews.show', compact('review')); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function edit(Review $review) - { - return view('admin.reviews.edit', compact('review')); - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param int $id - * @return \Illuminate\Http\Response - */ - public function update(ReviewRequest $request,Review $review) - { - $review->update($request->validated()); - - return redirect()->route('admin.reviews.index')->with([ - 'message' => 'success updated !', - 'alert-type' => 'info' - ]); - } - - /** - * Remove the specified resource from storage. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function destroy(Review $review) - { - $review->delete(); - - return redirect()->route('admin.reviews.index')->with([ - 'message' => 'success deleted !', - 'alert-type' => 'danger' - ]); - } -} diff --git a/app/Http/Controllers/Admin/ServiceCategoryController.php b/app/Http/Controllers/Admin/ServiceCategoryController.php index f900c7d..fe8e6a6 100644 --- a/app/Http/Controllers/Admin/ServiceCategoryController.php +++ b/app/Http/Controllers/Admin/ServiceCategoryController.php @@ -16,10 +16,15 @@ class ServiceCategoryController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { - //abort_if(Gate::denies('category_access'), Response::HTTP_FORBIDDEN, '403 Forbidden'); - $serviceCategories = ServiceCategory::get(); + $search = $request->input('search'); + + $serviceCategories = ServiceCategory::query() + ->when($search, function ($query) use ($search) { + $query->where('name', 'like', '%' . $search . '%'); + }) + ->paginate(10); return view('admin.servicecategory.index', compact('serviceCategories')); } diff --git a/app/Http/Controllers/Admin/ServiceController.php b/app/Http/Controllers/Admin/ServiceController.php index 771035d..dc86fd5 100644 --- a/app/Http/Controllers/Admin/ServiceController.php +++ b/app/Http/Controllers/Admin/ServiceController.php @@ -19,9 +19,18 @@ class ServiceController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { - $services = Service::paginate(5); + $search = $request->input('search'); + + $services = Service::query() + ->when($search, function ($query) use ($search) { + $query->where('name', 'like', '%' . $search . '%') + ->orWhereHas('obtaineds', function ($query) use ($search) { + $query->where('name', 'like', '%' . $search . '%'); + }); + }) + ->paginate(5); return view('admin.services.index', compact('services')); } diff --git a/app/Http/Controllers/Admin/ShipmentController.php b/app/Http/Controllers/Admin/ShipmentController.php deleted file mode 100644 index 73c4862..0000000 --- a/app/Http/Controllers/Admin/ShipmentController.php +++ /dev/null @@ -1,74 +0,0 @@ -paginate(10); - - return view('admin.shipments.index', compact('shipments')); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function edit(Shipment $shipment) - { - $provinces = $this->getProvinces(); - $cities = isset($shipment->province_id) ? $this->getCities($shipment->province_id) : []; - - return view('admin.shipments.edit', compact('shipment', 'provinces', 'cities')); - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param int $id - * @return \Illuminate\Http\Response - */ - public function update(Request $request, Shipment $shipment) - { - $request->validate( - [ - 'track_number' => 'required|max:255', - ] - ); - - $order = \DB::transaction( - function () use ($shipment, $request) { - $shipment->track_number = $request->input('track_number'); - $shipment->status = Shipment::SHIPPED; - $shipment->shipped_at = now(); - $shipment->shipped_by = auth()->id(); - - if ($shipment->save()) { - $shipment->order->status = Order::DELIVERED; - $shipment->order->save(); - } - - return $shipment->order; - } - ); - - return redirect()->route('admin.orders.show', $order->id)->with([ - 'message' => 'success updated shipment !', - 'alert-type' => 'info' - ]); - } -} diff --git a/app/Http/Controllers/Admin/SlideController.php b/app/Http/Controllers/Admin/SlideController.php deleted file mode 100644 index 6148f8e..0000000 --- a/app/Http/Controllers/Admin/SlideController.php +++ /dev/null @@ -1,185 +0,0 @@ -paginate(5); - - return view('admin.slides.index', compact('slides')); - } - - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ - public function create() - { - return view('admin.slides.create'); - } - - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function store(SlideRequest $request) - { - $image = NULL; - if ($request->hasFile('cover')) { - $image = $this->uploadImage($request->title, $request->cover, 'slides', 500, 500); - } - - Slide::create([ - 'title' => $request->title, - 'url' => $request->url, - 'body' => $request->body, - 'cover' => $image, - 'position' => Slide::max('position') + 1 - ]); - - return redirect()->route('admin.slides.index')->with([ - 'message' => 'success created !', - 'alert-type' => 'success' - ]); - } - - /** - * Display the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function show(Slide $slide) - { - return view('admin.slides.show', compact('slide')); - } - - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function edit(Slide $slide) - { - return view('admin.slides.edit', compact('slide')); - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param int $id - * @return \Illuminate\Http\Response - */ - public function update(Request $request,Slide $slide) - { - $image = $slide->cover; - if ($request->has('cover')) { - if ($slide->cover != null && File::exists('storage/images/slides/'. $slide->cover)) { - unlink('storage/images/slides/'. $slide->cover); - } - $image = $this->uploadImage($request->title, $request->cover, 'slides', 450, 450); - } - - $slide->update([ - 'title' => $request->title, - 'url' => $request->url, - 'body' => $request->body, - 'cover' => $image, - ]); - - return redirect()->route('admin.slides.index')->with([ - 'message' => 'success updated !', - 'alert-type' => 'info' - ]); - } - - /** - * Remove the specified resource from storage. - * - * @param int $id - * @return \Illuminate\Http\Response - */ - public function destroy(Slide $slide) - { - if ($slide->cover) { - if (File::exists('storage/images/slides/'. $slide->cover)) { - unlink('storage/images/slides/'. $slide->cover); - } - } - - $slide->delete(); - - return redirect()->route('admin.slides.index')->with([ - 'message' => 'success deleted !', - 'alert-type' => 'danger' - ]); - } - - public function moveUp($slideId){ - $slide = Slide::findOrFail($slideId); - - if (!$slide->prevSlide()) { - return redirect()->route('admin.slides.index'); - } - - \DB::transaction( - function () use ($slide) { - $currentPosition = $slide->position; - $prevPosition = $slide->prevSlide()->position; - - $prevSlide = Slide::find($slide->prevSlide()->id); - $prevSlide->position = $currentPosition; - $prevSlide->save(); - - $slide->position = $prevPosition; - $slide->save(); - } - ); - - return redirect()->route('admin.slides.index'); - } - - public function moveDown($slideId){ - $slide = Slide::findOrFail($slideId); - - if (!$slide->nextSlide()) { - return redirect()->route('admin.slides.index'); - } - - \DB::transaction( - function () use ($slide) { - $currentPosition = $slide->position; - $prevPosition = $slide->nextSlide()->position; - - $prevSlide = Slide::find($slide->nextSlide()->id); - $prevSlide->position = $currentPosition; - $prevSlide->save(); - - $slide->position = $prevPosition; - $slide->save(); - } - ); - - return redirect()->route('admin.slides.index'); - } -} diff --git a/app/Http/Controllers/Admin/TagController.php b/app/Http/Controllers/Admin/TagController.php index 6502109..429c0b5 100644 --- a/app/Http/Controllers/Admin/TagController.php +++ b/app/Http/Controllers/Admin/TagController.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Gate; use App\Http\Requests\Admin\TagRequest; use Symfony\Component\HttpFoundation\Response; +use Illuminate\Http\Request; class TagController extends Controller { @@ -15,11 +16,16 @@ class TagController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { - //abort_if(Gate::denies('tag_access'), Response::HTTP_FORBIDDEN, '403 Forbidden'); - - $tags = Tag::withCount('products')->latest()->paginate(5); + $search = $request->input('search'); + + $tags = Tag::query() + ->when($search, function ($query) use ($search) { + $query->where('name', 'like', "%{$search}%"); + }) + ->withCount('products') // Menambahkan count relasi products + ->paginate(10); return view('admin.tags.index', compact('tags')); } diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 2a219f9..ebf77ef 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -1,77 +1,69 @@ input('search'); + $users = User::query() + ->where('username', 'LIKE', "%{$search}%") + ->orWhere('email', 'LIKE', "%{$search}%") + ->orWhere('phone', 'LIKE', "%{$search}%") + ->paginate(10); return view('admin.users.index', compact('users')); } + - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ public function create() { return view('admin.users.create'); } - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ public function store(StoreUserRequest $request) - { - $user = User::create($request->validated() + ['password' => bcrypt($request->password)]); +{ + $data = $request->validated(); + $data['password'] = bcrypt($data['password']); + User::create($data); + + return redirect()->route('admin.users.index')->with('message', "Successfully Created!"); +} - return redirect()->route('admin.users.index')->with('message', "Successfully Created !"); - } - /** - * Show the form for editing the specified resource. - * - * @param int $id - * @return \Illuminate\Http\Response - */ public function edit($id) { $user = User::findOrFail($id); - //$roles = Role::all(); // Ganti Role dengan model yang sesuai dengan role Anda - return view('admin.users.edit', compact('user')); + return view('admin.users.edit', compact('user')); } - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param int $id - * @return \Illuminate\Http\Response - */ public function update(UpdateUserRequest $request, $id) +{ + $user = User::findOrFail($id); + $data = $request->validated(); + + if ($request->filled('password')) { + $data['password'] = bcrypt($data['password']); + } else { + unset($data['password']); + } + + $user->update($data); + + return redirect()->route('admin.users.index')->with('message', "Successfully Updated!"); +} + + public function destroy($id) { $user = User::findOrFail($id); - $user->update($request->validated() + ['password' => bcrypt($request->password)]); + $user->delete(); - return redirect()->route('admin.users.index')->with('message', "Successfully Updated !"); + return redirect()->route('admin.users.index')->with('message', 'User successfully deleted.'); } - - // Methods for deleting users... } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 689600c..a1e9336 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -53,7 +53,7 @@ class RegisterController extends Controller 'username' => ['required', 'string', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], - //'phone' => ['required', 'string'], + 'phone' => ['required', 'string'], ]); } @@ -69,7 +69,7 @@ class RegisterController extends Controller 'username' => $data['username'], 'email' => $data['email'], 'password' => Hash::make($data['password']), - //'phone' => $data['phone'], + 'phone' => $data['phone'], //'role' => 2, // Menetapkan peran secara langsung ]); diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index 96d964d..d2c6668 100644 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -1,7 +1,7 @@ validate([ - 'name' => 'required', - 'handphone' => 'required|numeric', - 'category' => 'required', - 'schedule_id' => 'required|exists:schedules,id', - ]); +{ + $request->validate([ + 'name' => 'required', + 'handphone' => 'required|numeric', + 'category' => 'required', + 'schedule_id' => 'required|exists:schedules,id', + ]); - $schedule = Schedule::find($request->schedule_id); -$scheduleId = $schedule->id; - $currentBookings = Booking::where('schedule_id', $request->schedule_id)->count(); + $schedule = Schedule::find($request->schedule_id); + $scheduleId = $schedule->id; + $currentBookings = Booking::where('schedule_id', $request->schedule_id)->count(); - if ($currentBookings >= $schedule->max_slot) { - return redirect()->back()->with('error', 'Schedule is fully booked'); - } + if ($currentBookings >= $schedule->max_slot) { + return redirect()->back()->with('error', 'Schedule is fully booked'); + } + + $date = $schedule->date; + $time = $schedule->time; + + // Periksa apakah hanya satu metode pembayaran yang dipilih + if ($request->cash && $request->cashless) { + return redirect()->back()->with('error', 'Hanya pilih satu metode pembayaran'); + } + + // Set status berdasarkan metode pembayaran yang dipilih +$status = $request->cash ? 'Cash' : 'Cashless'; - $date = $schedule->date; -$time = $schedule->time; $booking = Booking::create([ 'service_name' => $request->service_name, 'name' => $request->name, @@ -63,48 +72,56 @@ $booking = Booking::create([ 'date' => $date, 'time' => $time, 'total' => $request->price, - 'status' => 'Unpaid', - 'schedule_id' => $request->schedule_id, // Assign schedule_id here + 'status' => $status === 'Cashless' ? 'Unpaid' : 'Paid', // Ubah status sesuai dengan metode pembayaran yang dipilih + 'schedule_id' => $request->schedule_id, + 'order_id' => Str::uuid(), ]); - if ($request['cash'] === "on" && $request['cashless'] === "on") { - return ''; - } +if ($currentBookings + 1 >= $schedule->max_slot) { + $schedule->status = 'not available'; + $schedule->save(); +} - if ($currentBookings + 1 >= $schedule->max_slot) { - $schedule->status = 'not available'; - $schedule->save(); - } - if ($request['cash'] === "on") { - $booking->update(['status' => 'Cash']); - // $scheduleData->update(['status' => 'booked']); - return view('frontend.booking.paycash', compact('booking')); - } +// Jika pembayaran dilakukan menggunakan cash, langsung tampilkan halaman pembayaran +if ($status === 'Cash') { + $booking->update(['status' => 'Cash']); + return view('frontend.booking.paycash', compact('booking')); +} - // Set your Merchant Server Key - \Midtrans\Config::$serverKey = config('midtrans.serverKey'); - // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction). - \Midtrans\Config::$isProduction = false; - // Set sanitization on (default) - \Midtrans\Config::$isSanitized = true; - // Set 3DS transaction for credit card to true - \Midtrans\Config::$is3ds = true; +// Jika pembayaran dilakukan menggunakan cashless, langsung ubah status menjadi Paid +if ($status === 'Cashless') { + $booking->update(['status' => 'Paid']); + // Lanjutkan dengan logika untuk pembayaran cashless +} - $params = array( - 'transaction_details' => array( - 'order_id' => Str::random(15), - 'gross_amount' => $request->price, - ), - 'customer_details' => array( - 'name' => $request->name, - 'handphone' => $request->handphone, - ), - ); - $snapToken = \Midtrans\Snap::getSnapToken($params); - return view('frontend.booking.detail', compact('snapToken', 'booking', 'scheduleId')); - } + // Set your Merchant Server Key + \Midtrans\Config::$serverKey = config('midtrans.serverKey'); + // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction). + \Midtrans\Config::$isProduction = false; + // Set sanitization on (default) + \Midtrans\Config::$isSanitized = true; + // Set 3DS transaction for credit card to true + \Midtrans\Config::$is3ds = true; + + $params = array( + 'transaction_details' => array( + 'order_id' => Str::random(15), + 'gross_amount' => $request->price, + ), + 'customer_details' => array( + 'name' => $request->name, + 'handphone' => $request->handphone, + ), + ); + + $snapToken = \Midtrans\Snap::getSnapToken($params); + + return view('frontend.booking.detail', compact('snapToken', 'booking', 'scheduleId')); +} + + /** * Display the specified resource. @@ -169,11 +186,23 @@ $booking = Booking::create([ public function payment_success($bookingId, $scheduleId) { $booking = Booking::findOrFail($bookingId); - $booking->update(['status' => 'Paid']); - + $booking->update(['status' => 'Paid']); // Update status pembayaran menjadi "Paid" + $schedule = Schedule::findOrFail($scheduleId); //$schedule->update(['status' => 'booked']); - - return redirect()->route('service.index'); + + return redirect()->route('booking.print', ['bookingId' => $booking->id]); // Redirect ke halaman struk pembayaran } + + public function showBooking($bookingId) + { + $booking = Booking::findOrFail($bookingId); + return view('frontend.booking.show', compact('booking')); + } + public function printBill($bookingId) +{ + $booking = Booking::findOrFail($bookingId); + return view('frontend.booking.show', compact('booking')); +} + } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 4d28e44..dbf70ad 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers; use App\Models\Category; use App\Models\Product; -use App\Models\Slide; +//use App\Models\Slide; use Illuminate\Http\Request; use phpDocumentor\Reflection\Types\Null_; @@ -20,8 +20,8 @@ class HomeController extends Controller { $products = Product::latest()->get(); $categories = Category::whereNull('category_id')->take(4)->get(); - $slides = Slide::latest()->get(); + //$slides = Slide::latest()->get(); - return view('frontend.homepage', compact('products', 'categories','slides')); + return view('frontend.homepage', compact('products', 'categories')); } } diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php index 12f0ae7..416487a 100644 --- a/app/Http/Controllers/OrderController.php +++ b/app/Http/Controllers/OrderController.php @@ -21,18 +21,8 @@ class OrderController extends Controller return redirect()->route('cart.index'); } - // \Cart::removeConditionsByType('shipping'); - $items = \Cart::getContent(); - // $totalWeight = 0; - // foreach ($items as $item) { - // $totalWeight += ($item->quantity * $item->associatedModel->weight); - // } - - // $provinces = $this->getProvinces(); - // $cities = isset(auth()->user()->city_id) ? $this->getCities(auth()->user()->province_id) : []; - return view('frontend.orders.checkout', compact('items')); } @@ -188,42 +178,14 @@ class OrderController extends Controller public function checkout(Request $request) { $token = $request->except('_token'); - + $order = \DB::transaction(function () use ($token) { - // $destination = isset($params['ship_to']) ? $params['shipping_city_id'] : $params['city_id']; - // $items = \Cart::getContent(); - - // $totalWeight = 0; - // foreach ($items as $item) { - // $totalWeight += ($item->quantity * $item->associatedModel->weight); - // } - - // $selectedShipping = $this->getSelectedShipping($destination, $totalWeight, $params['shipping_service']); - + $baseTotalPrice = \Cart::getSubTotal(); - // $shippingCost = $selectedShipping['cost']; - // $discountAmount = 0; - // $discountPercent = 0; - // $grandTotal = ($baseTotalPrice + $shippingCost) - $discountAmount; - + $orderDate = date('Y-m-d H:i:s'); $paymentDue = (new \DateTime($orderDate))->modify('+3 day')->format('Y-m-d H:i:s'); - - // $user_profile = [ - // 'username' => $params['username'], - // 'first_name' => $params['first_name'], - // 'last_name' => $params['last_name'], - // 'address1' => $params['address1'], - // 'address2' => $params['address2'], - // 'province_id' => $params['province_id'], - // 'city_id' => $params['city_id'], - // 'postcode' => $params['postcode'], - // 'phone' => $params['phone'], - // 'email' => $params['email'], - // ]; - - // auth()->user()->update($user_profile); - + $orderParams = [ 'user_id' => auth()->id(), 'code' => Order::generateCode(), @@ -232,37 +194,29 @@ class OrderController extends Controller 'payment_due' => $paymentDue, 'payment_status' => Order::UNPAID, 'base_total_price' => $baseTotalPrice, - // 'discount_amount' => $discountAmount, - // 'discount_percent' => $discountPercent, - // 'shipping_cost' => $shippingCost, - // 'grand_total' => $grandTotal, 'customer_first_name' => $token['username'], - // 'customer_last_name' => $params['last_name'], - // 'customer_address1' => $params['address1'], - // 'customer_address2' => $params['address2'], 'customer_phone' => $token['phone'], - // 'customer_email' => $params['email'], - // 'customer_city_id' => $params['city_id'], - // 'customer_province_id' => $params['province_id'], - // 'customer_postcode' => $params['postcode'], 'note' => $token['note'], - // 'shipping_courier' => $selectedShipping['courier'], - // 'shipping_service_name' => $selectedShipping['service'], ]; - + if (!empty($token['reseller']) && $token['reseller'] === 'on') { + $orderParams['customer_first_name'] = $token['customer_first_name']; // Simpan reseller name jika checkbox reseller dicentang + $orderParams['customer_phone'] = $token['customer_phone']; // Simpan reseller phone jika checkbox reseller dicentang + } + + $order = Order::create($orderParams); - + $cartItems = \Cart::getContent(); - + if ($order && $cartItems) { foreach ($cartItems as $item) { $itemDiscountAmount = 0; $itemDiscountPercent = 0; $itemBaseTotal = $item->quantity * $item->price; $itemSubTotal = $itemBaseTotal - $itemDiscountAmount; - + $product = $item->associatedModel; - + $orderItemParams = [ 'order_id' => $order->id, 'product_id' => $item->associatedModel->id, @@ -275,9 +229,9 @@ class OrderController extends Controller 'name' => $item->name, 'weight' => $item->associatedModel->weight, ]; - + $orderItem = OrderItem::create($orderItemParams); - + if ($orderItem) { $product = Product::findOrFail($product->id); $product->quantity -= $item->quantity; @@ -285,58 +239,26 @@ class OrderController extends Controller } } } - - - - // $shippingFirstName = isset($params['ship_to']) ? $params['shipping_first_name'] : $params['first_name']; - // $shippingLastName = isset($params['ship_to']) ? $params['shipping_last_name'] : $params['last_name']; - // $shippingAddress1 = isset($params['ship_to']) ? $params['shipping_address1'] : $params['address1']; - // $shippingAddress2 = isset($params['ship_to']) ? $params['shipping_address2'] : $params['address2']; - // $shippingPhone = isset($params['ship_to']) ? $params['shipping_phone'] : $params['phone']; - // $shippingEmail = isset($params['ship_to']) ? $params['shipping_email'] : $params['email']; - // $shippingCityId = isset($params['ship_to']) ? $params['shipping_city_id'] : $params['city_id']; - // $shippingProvinceId = isset($params['ship_to']) ? $params['shipping_province_id'] : $params['province_id']; - // $shippingPostcode = isset($params['ship_to']) ? $params['shipping_postcode'] : $params['postcode']; - - // $shipmentParams = [ - // 'user_id' => auth()->id(), - // 'order_id' => $order->id, - // 'status' => Shipment::PENDING, - // 'total_qty' => \Cart::getTotalQuantity(), - // 'total_weight' => $totalWeight, - // 'first_name' => $shippingFirstName, - // 'last_name' => $shippingLastName, - // 'address1' => $shippingAddress1, - // 'address2' => $shippingAddress2, - // 'phone' => $shippingPhone, - // 'email' => $shippingEmail, - // 'city_id' => $shippingCityId, - // 'province_id' => $shippingProvinceId, - // 'postcode' => $shippingPostcode, - // ]; - // Shipment::create($shipmentParams); - return $order; }); - + if (!isset($order)) { return redirect()->back()->with([ - 'message' => 'something went wrong !', + 'message' => 'something went wrong!', 'alert-type' => 'danger' ]); - // return redirect()->route('checkout.received', $order->id); } - + if ($request['cash'] === "on" && $request['cashless'] === "on") { return ''; } - + if ($request['cash'] === "on") { \Cart::clear(); - $order->update(['payment_status' => 'cash']); + $order->update(['payment_status' => 'unpaid']); return view('frontend.orders.cash', compact('order')); } - + // Set your Merchant Server Key \Midtrans\Config::$serverKey = config('midtrans.serverKey'); // Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction). @@ -345,58 +267,23 @@ class OrderController extends Controller \Midtrans\Config::$isSanitized = true; // Set 3DS transaction for credit card to true \Midtrans\Config::$is3ds = true; - - $params = array( - 'transaction_details' => array( + + $params = [ + 'transaction_details' => [ 'order_id' => Str::random(15), 'gross_amount' => $order->base_total_price, - ), - 'customer_details' => array( + ], + 'customer_details' => [ 'name' => $request->username, 'handphone' => $request->phone, - ), - ); - + ], + ]; + $snapToken = \Midtrans\Snap::getSnapToken($params); - + return view('frontend.orders.confirmation', compact('snapToken', 'order')); - - // $this->initPaymentGateway(); - - // $customerDetails = [ - // 'first_name' => $order->customer_first_name, - // 'last_name' => $order->customer_last_name, - // 'email' => $order->customer_email, - // 'phone' => $order->customer_phone, - // ]; - - // $transaction_details = [ - // 'enable_payments' => Payment::PAYMENT_CHANNELS, - // 'transaction_details' => [ - // 'order_id' => $order->code, - // 'gross_amount' => $order->grand_total, - // ], - // 'customer_details' => $customerDetails, - // 'expiry' => [ - // 'start_time' => date('Y-m-d H:i:s T'), - // 'unit' => Payment::EXPIRY_UNIT, - // 'duration' => Payment::EXPIRY_DURATION, - // ] - // ]; - - // try { - // $snap = Snap::createTransaction($transaction_details); - - // $order->payment_token = $snap->token; - // $order->payment_url = $snap->redirect_url; - // $order->save(); - - // header('Location: ' . $order->payment_url); - // exit; - // } catch (Exception $e) { - // echo $e->getMessage(); - // } } + public function order_success($orderId) { diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 3659709..088607c 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -11,8 +11,8 @@ class ProductController extends Controller { $product = Product::with('media', 'category', 'tags') ->where('slug', $slug) - ->withCount('media','approvedReviews') - ->withAvg('approvedReviews', 'rating') + ->withCount('media') + ->active() ->hasQuantity() ->firstOrFail(); diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index ac27f08..ca0543d 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -20,6 +20,7 @@ class ServiceController extends Controller $serviceCategories = ServiceCategory::get(); return view('frontend.service.index', compact('serviceCategories')); } + /** * Show the form for creating a new resource. diff --git a/app/Http/Livewire/Shop/SingleProductReviewComponent.php b/app/Http/Livewire/Shop/SingleProductReviewComponent.php deleted file mode 100644 index 49e2119..0000000 --- a/app/Http/Livewire/Shop/SingleProductReviewComponent.php +++ /dev/null @@ -1,110 +0,0 @@ - 'mount', - ]; - - public function mount() - { - $this->checkProduct = Order::whereHas('orderItems', function ($query) { - $query->where('product_id', $this->product->id); - })->where('user_id', auth()->id())->where('status', Order::COMPLETED)->first(); - - if ($this->checkProduct) { - $this->canRate = true; - } - - if(auth()->user()){ - $rating = Review::where('user_id', auth()->id())->where('product_id', $this->product->id)->first(); - - if (!empty($rating)) { - $this->rating = $rating->rating; - $this->content = $rating->content; - $this->currentRatingId = $rating->id; - } - } - } - - public function rules() - { - return [ - 'rating' => ['required'], - 'content' => ['required', 'string'] - ]; - } - - public function rate(Request $request) - { - if (!$this->checkProduct){ - $this->alert('error', 'You must buy this item first'); - return false; - } - - $rating = Review::where('user_id', auth()->id())->where('product_id', $this->product->id)->first(); - $this->validate(); - - if (empty($rating)) { - $rating = new Review(); - $rating->user_id = auth()->id(); - $rating->product_id = $this->product->id; - $rating->rating = $this->rating; - $rating->content = $this->content; - $rating->status = 1; - $rating->save(); - } else { - if ($rating->status == 'Inactive'){ - $this->alert('error', 'already rating this item'); - return false; - } - $rating->user_id = auth()->id(); - $rating->product_id = $this->product->id; - $rating->rating = $this->rating; - $rating->content = $this->content; - $rating->ip_address = $request->ip(); - $rating->status = 1; - $rating->update(); - } - - $this->showForm = false; - $this->emit('update_rating'); - } - - public function delete($id) - { - $rating = Review::where('id', $id)->first(); - if ($rating && ($rating->user_id == auth()->id())) { - $rating->delete(); - } - if ($this->currentRatingId) { - $this->currentRatingId = ''; - $this->rating = ''; - $this->content = ''; - } - $this->emit('update_rating'); - $this->showForm = true; - } - - - public function render() - { - return view('livewire.shop.single-product-review-component'); - } -} diff --git a/app/Http/Requests/Admin/ProductRequest.php b/app/Http/Requests/Admin/ProductRequest.php index 53eef68..044875f 100644 --- a/app/Http/Requests/Admin/ProductRequest.php +++ b/app/Http/Requests/Admin/ProductRequest.php @@ -35,7 +35,7 @@ class ProductRequest extends FormRequest 'status' => ['required'], 'weight' => ['required', 'numeric'], 'description' => ['required', 'max:1000'], - 'details' => ['required', 'max:10000'], + //'details' => ['required', 'max:10000'], 'images' => ['required'], 'images.*' => ['mimes:jpg,jpeg,png,gif', 'max:4000'] ]; @@ -50,8 +50,8 @@ class ProductRequest extends FormRequest 'quantity' => ['required', 'numeric'], 'category_id' => ['required'], 'tags.*' => ['required'], - 'details' => ['required', 'max:10000'], - 'review_able' => ['nullable'], + //'details' => ['required', 'max:10000'], + 'status' => ['required'], 'images' => ['nullable'], 'images.*' => ['mimes:jpg,jpeg,png,gif', 'max:4000'] diff --git a/app/Http/Requests/Admin/ReviewRequest.php b/app/Http/Requests/Admin/ReviewRequest.php deleted file mode 100644 index b2ce541..0000000 --- a/app/Http/Requests/Admin/ReviewRequest.php +++ /dev/null @@ -1,30 +0,0 @@ - ['required'], - ]; - } -} diff --git a/app/Http/Requests/Admin/SlideRequest.php b/app/Http/Requests/Admin/SlideRequest.php deleted file mode 100644 index dd1c875..0000000 --- a/app/Http/Requests/Admin/SlideRequest.php +++ /dev/null @@ -1,49 +0,0 @@ -method()) { - case 'POST': - { - return [ - 'title' => ['required', 'max:255'], - 'url' => ['required', 'max:255'], - 'body' => ['required', 'max:255'], - 'cover' => ['required','mimes:jpg,jpeg,png,gif', 'max:3000'] - ]; - } - case 'PUT': - case 'PATCH': - { - return [ - 'title' => ['required', 'max:255'], - 'url' => ['required', 'max:255'], - 'body' => ['required', 'max:255'], - 'cover' => ['mimes:jpg,jpeg,png,gif', 'max:3000'] - ]; - } - default: break; - } - } -} diff --git a/app/Http/Requests/Admin/StoreUserRequest.php b/app/Http/Requests/Admin/StoreUserRequest.php index 22237c1..8eca0af 100644 --- a/app/Http/Requests/Admin/StoreUserRequest.php +++ b/app/Http/Requests/Admin/StoreUserRequest.php @@ -24,10 +24,11 @@ class StoreUserRequest extends FormRequest public function rules() { return [ - 'username' => ['required'], - 'email' => ['required', 'unique:users',], - 'roles.*' => ['integer',], - 'roles' => ['required', 'array',], + 'username' => ['required', 'unique:users'], + 'email' => ['required', 'unique:users'], + 'phone' => ['required', 'unique:users'], + 'password' => ['required'], + 'role' => ['required', 'in:admin,user'], ]; } } diff --git a/app/Http/Requests/Admin/UpdateRoleRequest.php b/app/Http/Requests/Admin/UpdateRoleRequest.php deleted file mode 100644 index 2ec5dfd..0000000 --- a/app/Http/Requests/Admin/UpdateRoleRequest.php +++ /dev/null @@ -1,38 +0,0 @@ - 'required', - - 'permissions.*' => [ - 'integer', - ], - 'permissions' => [ - 'required', - 'array', - ], - ]; - } -} diff --git a/app/Http/Requests/Admin/UpdateUserRequest.php b/app/Http/Requests/Admin/UpdateUserRequest.php index 7f456a3..9a98bd4 100644 --- a/app/Http/Requests/Admin/UpdateUserRequest.php +++ b/app/Http/Requests/Admin/UpdateUserRequest.php @@ -3,6 +3,7 @@ namespace App\Http\Requests\Admin; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Validation\Rule; class UpdateUserRequest extends FormRequest { @@ -24,20 +25,11 @@ class UpdateUserRequest extends FormRequest public function rules() { return [ - 'username' => [ - 'required', - ], - 'email' => [ - 'required', - 'unique:users,email,' . request()->route('user')->id, - ], - 'roles.*' => [ - 'integer', - ], - 'roles' => [ - 'required', - 'array', - ], + 'username' => ['required', Rule::unique('users')->ignore($this->user)], + 'email' => ['required', Rule::unique('users')->ignore($this->user)], + 'phone' => ['required', Rule::unique('users')->ignore($this->user)], + 'password' => ['nullable'], + 'role' => ['required', 'in:admin,user'], ]; } } diff --git a/app/Http/Resources/Product.php b/app/Http/Resources/Product.php index 9e52d56..d82b8b0 100644 --- a/app/Http/Resources/Product.php +++ b/app/Http/Resources/Product.php @@ -21,7 +21,7 @@ class Product extends JsonResource 'price' => $this->price, 'quantity' => $this->quantity, 'description' => $this->description, - 'details' => $this->details, + //'details' => $this->details, 'image' => $image, ]; } diff --git a/app/Models/Booking.php b/app/Models/Booking.php index cc3b384..8892f3b 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -12,6 +12,6 @@ class Booking extends Model protected $guarded = ['id']; public function schedule() { - return $this->belongsTo(Schedule::class); + return $this->belongsTo(Schedule::class)->withTrashed(); } } diff --git a/app/Models/Product.php b/app/Models/Product.php index 8ba664c..bec8408 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -63,24 +63,11 @@ class Product extends Model ->orderBy('file_sort', 'asc'); } - public function reviews() - { - return $this->hasMany(Review::class); - } + - public function approvedReviews() - { - return $this->hasMany(Review::class)->whereStatus(1); - } + - public function ratings() - { - return $this->hasMany(Rating::class); - } - public function rate() - { - return $this->ratings->isNotEmpty() ? $this->ratings()->sum('value') / $this->ratings()->count() : 0; - } + } diff --git a/app/Models/Rating.php b/app/Models/Rating.php deleted file mode 100644 index c03fe39..0000000 --- a/app/Models/Rating.php +++ /dev/null @@ -1,11 +0,0 @@ -attributes['status'] == 0 ? 'Inactive' : 'Active'; - } - - public function user(){ - return $this->belongsTo(User::class); - } - - public function product() - { - return $this->belongsTo(Product::class); - } -} diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 93a4b6c..ae8e8a3 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -4,10 +4,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; class Schedule extends Model { - use HasFactory; + use HasFactory, SoftDeletes; protected $guarded = ['id']; diff --git a/app/Models/Shipment.php b/app/Models/Shipment.php deleted file mode 100644 index 98a140d..0000000 --- a/app/Models/Shipment.php +++ /dev/null @@ -1,26 +0,0 @@ -belongsTo(Order::class); - } -} diff --git a/app/Models/Slide.php b/app/Models/Slide.php deleted file mode 100644 index 3060452..0000000 --- a/app/Models/Slide.php +++ /dev/null @@ -1,27 +0,0 @@ -position) - ->orderBy('position', 'DESC') - ->first(); - } - - public function nextSlide() - { - return self::where('position', '>', $this->position) - ->orderBy('position', 'ASC') - ->first(); - } -} diff --git a/app/Models/User.php b/app/Models/User.php index a89819d..76ab802 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -21,9 +21,14 @@ class User extends Authenticatable 'username', 'email', 'password', - + 'phone', 'role', // Add the role attribute here ]; + public function assignRole($role) + { + $this->role = $role; // Anggaplah kolom peran pada tabel pengguna adalah 'role' + $this->save(); + } /** * The attributes that should be hidden for serialization. diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 80ab402..5a343f1 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,7 +4,7 @@ namespace App\Providers; use App\Models\Tag; use App\Models\Category; -use App\Models\Review; +//use App\Models\Review; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; @@ -32,7 +32,7 @@ class AppServiceProvider extends ServiceProvider View::composer('*', function ($view) { $view->with('categories_menu', Category::with('children')->whereNull('category_id')->get()); $view->with('tags_menu', Tag::withCount('products')->get()); - $view->with('recent_reviews', Review::with('product','user')->whereStatus(true)->latest()->limit(5)->get()); + //$view->with('recent_reviews', Review::with('product','user')->whereStatus(true)->latest()->limit(5)->get()); }); } } diff --git a/database/migrations/2022_02_16_030128_create_products_table.php b/database/migrations/2022_02_16_030128_create_products_table.php index 5280a6c..4cf9d97 100644 --- a/database/migrations/2022_02_16_030128_create_products_table.php +++ b/database/migrations/2022_02_16_030128_create_products_table.php @@ -20,7 +20,7 @@ class CreateProductsTable extends Migration $table->string('slug'); $table->integer('price'); $table->text('description'); - $table->longText('details'); + //$table->longText('details'); $table->integer('weight'); $table->integer('quantity')->default(0); $table->boolean('status')->default(false); diff --git a/database/migrations/2022_02_16_232808_create_slides_table.php b/database/migrations/2022_02_16_232808_create_slides_table.php deleted file mode 100644 index 18648f2..0000000 --- a/database/migrations/2022_02_16_232808_create_slides_table.php +++ /dev/null @@ -1,36 +0,0 @@ -id(); - $table->string('title'); - $table->string('url')->nullable(); - $table->integer('position')->default(0); - $table->text('body')->nullable(); - $table->text('cover'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('slides'); - } -} diff --git a/database/migrations/2022_02_22_012915_create_shipments_table.php b/database/migrations/2022_02_22_012915_create_shipments_table.php deleted file mode 100644 index e19269f..0000000 --- a/database/migrations/2022_02_22_012915_create_shipments_table.php +++ /dev/null @@ -1,53 +0,0 @@ -id(); - // $table->foreignId('user_id')->nullable()->constrained(); - //$table->foreignId('order_id')->nullable()->constrained(); - $table->string('track_number')->nullable(); - $table->string('status'); - $table->integer('total_qty'); - $table->integer('total_weight'); - $table->string('first_name'); - $table->string('last_name'); - $table->string('address1')->nullable(); - $table->string('address2')->nullable(); - $table->string('phone')->nullable(); - $table->string('email')->nullable(); - $table->string('city_id')->nullable(); - $table->string('province_id')->nullable(); - $table->integer('postcode')->nullable(); - $table->datetime('shipped_at')->nullable(); - $table->unsignedBigInteger('shipped_by')->nullable(); - - //$table->foreign('shipped_by')->references('id')->on('users'); - $table->index('track_number'); - - $table->softDeletes(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('shipments'); - } -} diff --git a/database/migrations/2022_02_25_024109_create_reviews_table.php b/database/migrations/2022_02_25_024109_create_reviews_table.php deleted file mode 100644 index a22ab9b..0000000 --- a/database/migrations/2022_02_25_024109_create_reviews_table.php +++ /dev/null @@ -1,37 +0,0 @@ -id(); - //$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete(); - $table->foreignId('product_id')->constrained()->cascadeOnDelete(); - $table->text('content'); - $table->boolean('status')->default(false); - $table->unsignedTinyInteger('rating'); - $table->string('ip_address')->nullable(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('reviews'); - } -} diff --git a/database/migrations/2024_05_16_155722_create_orders_table.php b/database/migrations/2024_05_16_155722_create_orders_table.php index 7772b90..283c224 100644 --- a/database/migrations/2024_05_16_155722_create_orders_table.php +++ b/database/migrations/2024_05_16_155722_create_orders_table.php @@ -15,7 +15,7 @@ class CreateOrdersTable extends Migration { Schema::create('orders', function (Blueprint $table) { $table->id(); - //$table->foreignId('user_id')->nullable()->constrained(); + $table->foreignId('user_id')->nullable()->constrained(); $table->string('code')->unique(); $table->string('status'); $table->datetime('order_date'); diff --git a/database/migrations/2022_03_19_002626_create_favorites_table.php b/database/migrations/2024_05_16_223417_create_favorites_table.php similarity index 85% rename from database/migrations/2022_03_19_002626_create_favorites_table.php rename to database/migrations/2024_05_16_223417_create_favorites_table.php index 589011a..08f6641 100644 --- a/database/migrations/2022_03_19_002626_create_favorites_table.php +++ b/database/migrations/2024_05_16_223417_create_favorites_table.php @@ -15,10 +15,10 @@ class CreateFavoritesTable extends Migration { Schema::create('favorites', function (Blueprint $table) { $table->id(); - //$table->foreignId('user_id')->constrained(); + $table->foreignId('user_id')->constrained(); $table->foreignId('product_id')->constrained(); $table->timestamps(); - //$table->index(['user_id', 'product_id']); + $table->index(['user_id', 'product_id']); }); } @@ -31,4 +31,4 @@ class CreateFavoritesTable extends Migration { Schema::dropIfExists('favorites'); } -} +} \ No newline at end of file diff --git a/database/migrations/2024_05_29_155635_add_deleted_at_to_schedules_table.php b/database/migrations/2024_05_29_155635_add_deleted_at_to_schedules_table.php new file mode 100644 index 0000000..69d7018 --- /dev/null +++ b/database/migrations/2024_05_29_155635_add_deleted_at_to_schedules_table.php @@ -0,0 +1,32 @@ +softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('schedules', function (Blueprint $table) { + $table->dropSoftDeletes(); + }); + } +} diff --git a/database/migrations/2024_06_05_130727_add_total_paid_and_change_amount_to_orders_table.php b/database/migrations/2024_06_05_130727_add_total_paid_and_change_amount_to_orders_table.php new file mode 100644 index 0000000..2a07bb1 --- /dev/null +++ b/database/migrations/2024_06_05_130727_add_total_paid_and_change_amount_to_orders_table.php @@ -0,0 +1,29 @@ +decimal('total_paid', 15, 2)->nullable(); + $table->decimal('change_amount', 15, 2)->nullable(); + }); + } + + public function down() + { + Schema::table('orders', function (Blueprint $table) { + $table->dropColumn('total_paid'); + $table->dropColumn('change_amount'); + }); + } +} diff --git a/database/migrations/2024_06_10_130528_add_phone_to_users_table.php b/database/migrations/2024_06_10_130528_add_phone_to_users_table.php new file mode 100644 index 0000000..d191cd4 --- /dev/null +++ b/database/migrations/2024_06_10_130528_add_phone_to_users_table.php @@ -0,0 +1,33 @@ +string('phone')->after('email'); + $table->string('phone')->nullable()->after('email'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('phone'); + }); + } +} diff --git a/public/frontend/assets/img/logo/logo.jpg b/public/frontend/assets/img/logo/logo.jpg new file mode 100644 index 0000000..5ed5645 Binary files /dev/null and b/public/frontend/assets/img/logo/logo.jpg differ diff --git a/resources/views/admin/booking/index.blade.php b/resources/views/admin/booking/index.blade.php index ff4eac2..e6e86a8 100644 --- a/resources/views/admin/booking/index.blade.php +++ b/resources/views/admin/booking/index.blade.php @@ -19,73 +19,84 @@ -
-
-
- - - - - - - - - - - - - {{-- --}} - - - - @forelse($bookings as $booking) - - - - - - - - - - - {{-- + + @empty + + + + @endforelse + +
NoPaymentDateTimeServiceCustomer NameContactAction
{{ $loop->iteration }} - @if ($booking->status === 'Cash') - {{ $booking->status }} - @else - @if ($booking->status === 'Paid') - Cashless - Paid - @elseif ($booking->status === 'Unpaid') - Cashless - Unpaid - @endif - @endif - {{ $booking->date }}{{ $booking->schedule->start_time }} - {{ $booking->schedule->end_time }}{{ $booking->category }} - {{ $booking->service_name }} ({{ number_format($booking->total, 0, '.', '.') }}){{ $booking->name }}{{ $booking->handphone }} - - +
+
+
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + {{-- --}} + + + + @forelse($bookings as $booking) + + + + + + + + + --}} - - @empty - - - - @endforelse - -
NoPaymentDateTimeServiceCustomer NameContactActionsAction
{{ $loop->iteration }} + @if ($booking->status === 'Cash') + {{ $booking->status }} + @else + @if ($booking->status === 'Paid') + Cashless - Paid + @elseif ($booking->status === 'Unpaid') + Cashless - Unpaid + @endif + @endif + {{ $booking->date }} + @if($booking->schedule) + {{ $booking->schedule->start_time }} - {{ $booking->schedule->end_time }} + @else + Schedule Deleted + @endif + {{ $booking->category }} - {{ $booking->service_name }} ({{ number_format($booking->total, 0, '.', '.') }}){{ $booking->name }}{{ $booking->handphone }} +
+ + -
+ @csrf - @method('delete') - + @method('DELETE') +
-
{{ __('Booking Data Empty') }}
+
+
{{ __('Booking Data Empty') }}
+
- {{-- --}}
- - +
@endsection diff --git a/resources/views/admin/booking/view.blade.php b/resources/views/admin/booking/view.blade.php new file mode 100644 index 0000000..42da38a --- /dev/null +++ b/resources/views/admin/booking/view.blade.php @@ -0,0 +1,65 @@ +@extends('layouts.admin') + +@section('content') +
+
+
+
+

Booking Detail

+ +
+
+
+

Date

+
+ {{ $booking->date }} +
+
+
+

Time

+
+ {{ $booking->schedule ? $booking->schedule->start_time . ' - ' . $booking->schedule->end_time : 'No Schedule' }} +
+
+
+

Service

+
+ {{ $booking->category }} - {{ $booking->service_name }} +
+
+
+
+
+

Customer Name

+
+ {{ $booking->name }} +
+
+
+

Contact

+
+ {{ $booking->handphone }} +
+
+
+

Status

+
+ {{ $booking->status }} +
+
+
+
+
+
    + {{-- You can add additional details here if needed --}} +
+
+
+
+
+
+ +@endsection diff --git a/resources/views/admin/categories/create.blade.php b/resources/views/admin/categories/create.blade.php index dddf5b4..591ed48 100644 --- a/resources/views/admin/categories/create.blade.php +++ b/resources/views/admin/categories/create.blade.php @@ -27,22 +27,7 @@ @error('name'){{ $message }}@enderror -
-
- - - @error('parent_id'){{ $message }}@enderror -
-
+
diff --git a/resources/views/admin/categories/edit.blade.php b/resources/views/admin/categories/edit.blade.php index aa09553..1ac68d9 100644 --- a/resources/views/admin/categories/edit.blade.php +++ b/resources/views/admin/categories/edit.blade.php @@ -28,22 +28,7 @@ @error('name'){{ $message }}@enderror
-
-
- - - @error('parent_id'){{ $message }}@enderror -
-
+
diff --git a/resources/views/admin/categories/index.blade.php b/resources/views/admin/categories/index.blade.php index a6b9ae1..8c9f719 100644 --- a/resources/views/admin/categories/index.blade.php +++ b/resources/views/admin/categories/index.blade.php @@ -27,6 +27,16 @@
+
+
+ +
+ +
+
+
@@ -34,7 +44,7 @@ - + @@ -55,7 +65,7 @@ - + - + - + diff --git a/resources/views/admin/obtaineds/index.blade.php b/resources/views/admin/obtaineds/index.blade.php index 50e65a8..0a038a5 100644 --- a/resources/views/admin/obtaineds/index.blade.php +++ b/resources/views/admin/obtaineds/index.blade.php @@ -22,6 +22,14 @@
+
+
+ +
+ +
+
+
Image Name Product countParentAction
{{ $category->products_count }}{{ $category->parent->name ?? '' }}
NameParentCreated at
{{ $category->name }}{{ $category->parent->name ?? '' }}{{ $category->created_at }}
diff --git a/resources/views/admin/orders/index.blade.php b/resources/views/admin/orders/index.blade.php index 5e9d112..6bf789b 100644 --- a/resources/views/admin/orders/index.blade.php +++ b/resources/views/admin/orders/index.blade.php @@ -16,6 +16,19 @@ {{ __('Orders') }} +
+
+
+ +
+ +
+
+ +
+
@@ -44,8 +57,11 @@ + + - - + + - @foreach($data as $record) + @foreach($bookings as $record) + @if(isset($record->service_name)) - - + + + @endif @endforeach
{{ $order->customer_phone }} - {{ $order->payment_status === 'cash' ? $order->payment_status : 'cashless(' . $order->payment_status . ')' }} + {{ $order->payment_status === 'unpaid' ? $order->payment_status : '' . $order->payment_status . '' }} +
diff --git a/resources/views/admin/orders/show.blade.php b/resources/views/admin/orders/show.blade.php index bfe48bb..820da6d 100644 --- a/resources/views/admin/orders/show.blade.php +++ b/resources/views/admin/orders/show.blade.php @@ -7,44 +7,39 @@

Billing Address

- {{ $order->customer_first_name }} {{ $order->customer_last_name }} + Name: {{ $order->customer_first_name }} {{ $order->customer_last_name }}
{{ $order->customer_address1 }}
{{ $order->customer_address2 }} -
Email: {{ $order->customer_email }} +
{{ $order->customer_email }}
Phone: {{ $order->customer_phone }} -
Postcode: {{ $order->customer_postcode }}
- {{--
-

Shipment Address

-
- {{ $order->shipment->first_name }} {{ $order->shipment->last_name }} -
{{ $order->shipment->address1 }} -
{{ $order->shipment->address2 }} -
Email: {{ $order->shipment->email }} -
Phone: {{ $order->shipment->phone }} -
Postcode: {{ $order->shipment->postcode }} -
-
--}}

Details

ID: #{{ $order->code }}
DATE: {{ $order->order_date }} -
- NOTE: {{ $order->note }} +
NOTE: {{ $order->note }}
Status: {{ $order->status }} {{ $order->cancelled_at }} -
Cancellation Note : {{ $order->cancellation_note}}
Payment Status: {{ $order->payment_status }} -
Shipped by: {{ $order->shipping_service_name }} + @if ($order->payment_status === 'unpaid') +
+ @csrf + + + +
+ @else +

Uang Pembeli: Rp.{{ number_format(session('total_paid'), 0, '.', '.') }}

+

Kembalian: Rp.{{ number_format($order->change_amount, 0, '.', '.') }}

+ @endif
@@ -77,46 +72,35 @@
    -
  • Subtotal - {{ $order->base_total_price }} +
  • Total Order + {{ number_format($order->base_total_price, 0, '.', '.') }}
  • - {{--
  • Tax(10%) - {{ $order->tax_amount }} + @if ($order->payment_status === 'unpaid') +
  • +
    + @csrf + + + +
  • -
  • Shipping Cost - {{ $order->shipping_cost }} + @endif +
  • Kembalian + {{ number_format($order->change_amount, 0, '.', '.') }}
  • -
  • Total - {{ $order->grand_total }} -
  • --}}
- {{-- @if ($order->isPaid() && $order->isConfirmed()) - Procced to Shipment - @endif - - @if (in_array($order->status, [\App\Models\Order::CREATED, \App\Models\Order::CONFIRMED])) - Cancel - @endif - @if ($order->isDelivered()) - -
- @csrf - -
- @endif --}} - - {{-- @if (!in_array($order->status, [\App\Models\Order::DELIVERED, \App\Models\Order::COMPLETED])) - Remove - -
- @csrf - @method('delete') -
- @endif --}}
+ @endsection diff --git a/resources/views/admin/products/create.blade.php b/resources/views/admin/products/create.blade.php index 02afa59..2550ec0 100644 --- a/resources/views/admin/products/create.blade.php +++ b/resources/views/admin/products/create.blade.php @@ -100,15 +100,7 @@ -
-
-
- - - @error('details'){{ $message }}@enderror -
-
-
+
diff --git a/resources/views/admin/products/edit.blade.php b/resources/views/admin/products/edit.blade.php index 2d78cc8..61f5b6e 100644 --- a/resources/views/admin/products/edit.blade.php +++ b/resources/views/admin/products/edit.blade.php @@ -98,15 +98,7 @@
-
-
-
- - - @error('details'){{ $message }}@enderror -
-
-
+
diff --git a/resources/views/admin/products/index.blade.php b/resources/views/admin/products/index.blade.php index b0263e3..b5e5716 100644 --- a/resources/views/admin/products/index.blade.php +++ b/resources/views/admin/products/index.blade.php @@ -11,89 +11,99 @@
@endif
-
-
- {{ __('Products') }} -
-
- @can('product_create') - - - - - {{ __('New product') }} - - @endcan -
-
-
- - - - - - - - - - - - - - - - - @forelse($products as $product) - - - - - - - - - - - - - @empty - - - - @endforelse - - - - - - -
NoImageNameQuantityPriceWeightTagsCategoryStatusAction
{{ $loop->iteration }} - @if($product->firstMedia) - {{ $product->name }} - @else - no image - @endif - {{ $product->name }}{{ $product->quantity }}Rp.{{ number_format($product->price) }}{{ $product->weight }} (gram) - {{ $product->tags->pluck('name')->join(', ') }} - {{ $product->category ? $product->category->name : NULL }}{{ $product->status }} -
- - - -
- @csrf - @method('DELETE') - -
-
-
No products found.
-
- {!! $products->appends(request()->all())->links() !!} -
-
+
+
+ {{ __('Data Produk') }} +
+
+
+
+ +
+ +
+
+
+ @can('product_create') + + + + + {{ __('New product') }} + + @endcan
+
+ + + + + + + + + + + + + + + + + @forelse($products as $product) + + + + + + + + + + + + + @empty + + + + @endforelse + + + + + + +
NoImageNameQuantityPriceWeightTagsCategoryStatusAction
{{ $loop->iteration }} + @if($product->firstMedia) + {{ $product->name }} + @else + no image + @endif + {{ $product->name }}{{ $product->quantity }}Rp.{{ number_format($product->price) }}{{ $product->weight }} (gram) + {{ $product->tags->pluck('name')->join(', ') }} + {{ $product->category ? $product->category->name : NULL }}{{ $product->status }} +
+ + + +
+ @csrf + @method('DELETE') + +
+
+
No products found.
+
+ {!! $products->appends(request()->all())->links() !!} +
+
+
+
@endsection diff --git a/resources/views/admin/reports/download.blade.php b/resources/views/admin/reports/download.blade.php new file mode 100644 index 0000000..4230737 --- /dev/null +++ b/resources/views/admin/reports/download.blade.php @@ -0,0 +1,113 @@ +@extends('layouts.admin') + +@section('content') +
+
+
+
+
+
+

Revenue Report

+
+
+
+ @csrf +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ + + + + + + + + + + @foreach($bookings as $record) + @if(isset($record->service_name)) + + + + + + + @endif + @endforeach + +
DateUserServicePrice
{{ $record->created_at }}{{ $record->name }}{{ $record->category }} - {{ $record->service_name }}{{ number_format($record->total, 0, '.', '.') }}
+
+ + +
+

Total Revenue per Service

+
+ + + + + + + + + @php + $totalRevenuePerService = []; + foreach($bookings as $record) { + if(isset($record->service_name)) { + if(!isset($totalRevenuePerService[$record->service_name])) { + $totalRevenuePerService[$record->service_name] = 0; + } + $totalRevenuePerService[$record->service_name] += $record->total; + } + } + @endphp + @foreach($totalRevenuePerService as $service => $total) + + + + + @endforeach + +
ServiceTotal Revenue
{{ $service }}{{ number_format($total, 0, '.', '.') }}
+
+
+ +
+
+
+
+
+
+@endsection + +@push('script-alt') + + +@endpush diff --git a/resources/views/admin/reports/exports/revenue-excel.blade.php b/resources/views/admin/reports/exports/revenue-excel.blade.php deleted file mode 100644 index 7b45563..0000000 --- a/resources/views/admin/reports/exports/revenue-excel.blade.php +++ /dev/null @@ -1,44 +0,0 @@ - - - - Revenue Report Excel - - -

Revenue Report

-
-

Period: {{ $startDate }} - {{ $endDate }}

- - - - - - - - - - - - @foreach($data as $record) - - - - - - - @endforeach - -
DateUserActivityPrice
{{ $record->created_at }}{{ $record->name }} - @if(isset($record->service_name)) - Booking: {{ $record->service_name }} - @elseif(isset($record->code)) - Order: {{ $record->code }} - @endif - - @if(isset($record->service_name)) - {{ $record->total }} - @elseif(isset($record->code)) - {{ $record->grand_total }} - @endif -
- - diff --git a/resources/views/admin/reports/exports/revenue_pdf.blade.php b/resources/views/admin/reports/exports/revenue_pdf.blade.php deleted file mode 100644 index f4f8a56..0000000 --- a/resources/views/admin/reports/exports/revenue_pdf.blade.php +++ /dev/null @@ -1,48 +0,0 @@ - - - - Revenue Report PDF - - - -

Revenue Report

-
-

Period: {{ $startDate }} - {{ $endDate }}

- - - - - - - - - - - - @foreach($data as $record) - - - - - - - @endforeach - -
DateUserActivityPrice
{{ $record->created_at }}{{ $record->name }} - @if(isset($record->service_name)) - Booking: {{ $record->service_name }} - @elseif(isset($record->code)) - Order: {{ $record->code }} - @endif - - @if(isset($record->service_name)) - {{ $record->total }} - @elseif(isset($record->code)) - {{ $record->grand_total }} - @endif -
- - diff --git a/resources/views/admin/reports/orders.blade.php b/resources/views/admin/reports/orders.blade.php new file mode 100644 index 0000000..983dc4c --- /dev/null +++ b/resources/views/admin/reports/orders.blade.php @@ -0,0 +1,131 @@ +@extends('layouts.admin') + +@section('content') +
+
+
+
+
+
+

Revenue Report

+
+
+
+ @csrf +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ + + + + + + + + + + + + @php + $totalQuantity = 0; + $totalPrice = 0; + @endphp + @foreach($orders as $order) + + + + + + + + + @php + $totalQuantity += $order->qty; + $totalPrice += $order->base_total_price; + @endphp + @endforeach + + + + + + + + + +
#DateUserOrder CodeQuantityPrice
{{ $loop->iteration }}{{ $order->created_at }}{{ $order->customer_first_name }}
{{ $order->customer_email }}
{{ $order->code }}{{ $order->qty }}Rp. {{ number_format($order->base_total_price, 0, '.', '.') }}
Total Quantity{{ $totalQuantity }}Rp. {{ number_format($totalPrice, 0, '.', '.') }}
+
+ + +
+

Total Revenue per Service

+
+ + + + + + + + + @php + $totalRevenuePerService = []; + foreach($orders as $order) { + if(isset($order->service_name)) { + if(!isset($totalRevenuePerService[$order->service_name])) { + $totalRevenuePerService[$order->service_name] = 0; + } + $totalRevenuePerService[$order->service_name] += $order->grand_total; + } + } + @endphp + @foreach($totalRevenuePerService as $service => $total) + + + + + @endforeach + +
ServiceTotal Revenue
{{ $service }}Rp.{{ number_format($total, 0, '.', '.') }}
+
+
+ +
+
+
+
+
+
+@endsection + +@push('script-alt') + + +@endpush diff --git a/resources/views/admin/reports/print.blade.php b/resources/views/admin/reports/print.blade.php new file mode 100644 index 0000000..0155aa4 --- /dev/null +++ b/resources/views/admin/reports/print.blade.php @@ -0,0 +1,73 @@ + + + + + + + + Print Revenue Report + + + +

Revenue Report

+ + + + + + + + + + + + @foreach($bookings as $record) + @if(isset($record->service_name)) + + + + + + + @endif + @endforeach + +
DateUserServicePrice
{{ $record->created_at }}{{ $record->name }}{{ $record->category }} - {{ $record->service_name }}{{ number_format($record->total, 0, '.', '.') }}
+ +

Total Revenue per Service

+ + + + + + + + + @foreach($totalRevenuePerService as $service => $total) + + + + + @endforeach + +
ServiceTotal Revenue
{{ $service }}{{ number_format($total, 0, '.', '.') }}
+ + diff --git a/resources/views/admin/reports/revenue.blade.php b/resources/views/admin/reports/revenue.blade.php index 9f97175..3167d75 100644 --- a/resources/views/admin/reports/revenue.blade.php +++ b/resources/views/admin/reports/revenue.blade.php @@ -7,33 +7,38 @@
-

Revenue Report

+

Data Laporan

-
+ @csrf
- +
+ +
+ +
+
- +
+ +
+ +
+
-
+
- -
-
-
-
- + +
@@ -45,34 +50,25 @@
Date UserActivityPriceServicePrice
{{ $record->created_at }} {{ $record->name }} - @if(isset($record->service_name)) - Booking: {{ $record->service_name }} - @elseif(isset($record->code)) - Order: {{ $record->code }} - @endif - - @if(isset($record->service_name)) - {{ $record->total }} - @elseif(isset($record->code)) - {{ $record->grand_total }} - @endif - {{ $record->category }} - {{ $record->service_name }}{{ number_format($record->total, 0, '.', '.') }}
+ diff --git a/resources/views/admin/reports/total-revenue.blade.php b/resources/views/admin/reports/total-revenue.blade.php new file mode 100644 index 0000000..145f8af --- /dev/null +++ b/resources/views/admin/reports/total-revenue.blade.php @@ -0,0 +1,53 @@ + +@extends('layouts.admin') + +@section('content') +
+
+
+
+
+
+

Data Rekap

+
+
+ + + +
+ + + + + + + + + @php + $totalRevenuePerService = []; + foreach($bookings as $record) { + if(isset($record->service_name)) { + if(!isset($totalRevenuePerService[$record->service_name])) { + $totalRevenuePerService[$record->service_name] = 0; + } + $totalRevenuePerService[$record->service_name] += $record->total; + } + } + @endphp + @foreach($totalRevenuePerService as $service => $total) + + + + + @endforeach + +
ServiceTotal Revenue
{{ $service }}{{ number_format($total, 0, '.', '.') }}
+
+ +
+
+
+
+
+
+@endsection diff --git a/resources/views/admin/reports/view.blade.php b/resources/views/admin/reports/view.blade.php new file mode 100644 index 0000000..4ba6b19 --- /dev/null +++ b/resources/views/admin/reports/view.blade.php @@ -0,0 +1,88 @@ +@extends('layouts.admin') + +@section('content') +
+
+
+
+
+
+

Revenue Report

+
+
+ + @csrf +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ + +
+ + + + + + + + + + + @foreach($bookings as $record) + @if(isset($record->service_name)) + + + + + + + @endif + @endforeach + +
DateUserServicePrice
{{ $record->created_at }}{{ $record->name }}{{ $record->category }} - {{ $record->service_name }}{{ number_format($record->total, 0, '.', '.') }}
+
+
+
+
+
+
+
+@endsection + +@push('script-alt') + + +@endpush diff --git a/resources/views/admin/servicecategory/index.blade.php b/resources/views/admin/servicecategory/index.blade.php index 9781935..a2d2153 100644 --- a/resources/views/admin/servicecategory/index.blade.php +++ b/resources/views/admin/servicecategory/index.blade.php @@ -21,6 +21,14 @@
+
+
+ +
+ +
+
+
diff --git a/resources/views/admin/services/index.blade.php b/resources/views/admin/services/index.blade.php index 04ba6c3..677a2f7 100644 --- a/resources/views/admin/services/index.blade.php +++ b/resources/views/admin/services/index.blade.php @@ -22,6 +22,14 @@
+
+
+ +
+ +
+
+
diff --git a/resources/views/admin/shipments/edit.blade.php b/resources/views/admin/shipments/edit.blade.php deleted file mode 100644 index 60fffcd..0000000 --- a/resources/views/admin/shipments/edit.blade.php +++ /dev/null @@ -1,164 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
-
-

Order Shipment #{{ $shipment->order->code }}

-
-
-
- @csrf - @method('put') -
-
- - -
-
- - -
-
-
- - -
-
- - -
-
- - -
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
- - -
- - -
-
-
-
-
-
-

Detail Order

-
-
-
-
-

Billing Address

-
- {{ $shipment->order->customer_company }} {{ $shipment->order->customer_last_name }} -
{{ $shipment->order->customer_address1 }} -
{{ $shipment->order->customer_address2 }} -
Email: {{ $shipment->order->customer_email }} -
Phone: {{ $shipment->order->customer_phone }} -
Postcode: {{ $shipment->order->customer_postcode }} -
-
-
-

Details

-
- ID: #{{ $shipment->order->code }} -
{{ $shipment->order->order_date }} -
Status: {{ $shipment->order->status }} -
Payment Status: {{ $shipment->order->payment_status }} -
Shipped by: {{ $shipment->order->shipping_service_name }} -
-
-
-
- - - - - - - - - - @forelse ($shipment->order->orderItems as $item) - - - - - - - @empty - - - - @endforelse - -
#ItemQtyTotal
{{ $item->sku }}{{ $item->name }}{{ $item->qty }}{{ $item->sub_total }}
Order item not found!
-
-
-
    -
  • Subtotal - {{ $shipment->order->base_total_price }} -
  • -
  • Tax(10%) - {{ $shipment->order->tax_amount }} -
  • -
  • Shipping Cost - {{ $shipment->order->shipping_cost }} -
  • -
  • Total - {{ $shipment->order->grand_total }} -
  • -
-
-
-
-
-
- - -@endsection \ No newline at end of file diff --git a/resources/views/admin/shipments/index.blade.php b/resources/views/admin/shipments/index.blade.php deleted file mode 100644 index 1000281..0000000 --- a/resources/views/admin/shipments/index.blade.php +++ /dev/null @@ -1,68 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
- {{ __('Shipments') }} -
-
-
- - - - - - - - - - - - - - @forelse($shipments as $shipment) - - - - - - - - - - @empty - - - - @endforelse - - - - - - -
NoOrder IDNameStatusTotal QtyTotal Weight (gram)Action
{{ $loop->iteration }} - {{ $shipment->order->code }}
- {{ $shipment->order->order_date }} -
{{ $shipment->order->customer_full_name }} - {{ $shipment->status }} -
- {{ $shipment->shipped_at }} -
{{ $shipment->total_qty }}{{ $shipment->total_weight }} -
- - - - -
-
No products found.
-
- {!! $shipments->appends(request()->all())->links() !!} -
-
-
-
-
-@endsection diff --git a/resources/views/admin/slides/create.blade.php b/resources/views/admin/slides/create.blade.php deleted file mode 100644 index f8ee60c..0000000 --- a/resources/views/admin/slides/create.blade.php +++ /dev/null @@ -1,98 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
- {{ __('Create slide') }} -
- -
-
-
- @csrf -
-
-
- - - @error('title'){{ $message }}@enderror -
-
-
-
- - - @error('url'){{ $message }}@enderror -
-
-
-
-
-
- - - @error('body'){{ $message }}@enderror -
-
-
-
-
- -
-
- - Image width should be 500px x 500px -
- @error('cover'){{ $message }}@enderror -
-
-
- -
-
-
-
-
-@endsection - -@push('script-alt') - -@endpush diff --git a/resources/views/admin/slides/edit.blade.php b/resources/views/admin/slides/edit.blade.php deleted file mode 100644 index 6aec8f0..0000000 --- a/resources/views/admin/slides/edit.blade.php +++ /dev/null @@ -1,107 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
- {{ __('Edit slide')}} -
- -
-
-
- @csrf - @method('put') -
-
-
- - - @error('title'){{ $message }}@enderror -
-
-
-
- - - @error('url'){{ $message }}@enderror -
-
-
-
-
-
- - - @error('body'){{ $message }}@enderror -
-
-
-
-
-
- @if($slide->cover) - {{ $slide->name }} - @else - No image - @endif -
-
- - Image width should be 500px x 500px -
- @error('cover'){{ $message }}@enderror -
-
-
- -
-
-
-
-
-@endsection - -@push('script-alt') - -@endpush \ No newline at end of file diff --git a/resources/views/admin/slides/index.blade.php b/resources/views/admin/slides/index.blade.php deleted file mode 100644 index 067eb83..0000000 --- a/resources/views/admin/slides/index.blade.php +++ /dev/null @@ -1,92 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
- {{ __('Slides') }} -
-
- @can('slide_create') - - - - - {{ __('New slide') }} - - @endcan -
-
-
- - - - - - - - - - - - - @forelse($slides as $slide) - - - - - - - - - @empty - - - - @endforelse - - - - - - -
NoTitleImagePositionSet PositionAction
{{ $loop->iteration }} - - {{ $slide->title }} - - - - {{ $slide->position }} - @if ($slide->prevSlide()) - up - @else - up - @endif - | - @if ($slide->nextSlide()) - down - @else - down - @endif - -
- - - -
- @csrf - @method('DELETE') - -
-
-
No tags found.
-
- {!! $slides->appends(request()->all())->links() !!} -
-
-
-
-
-@endsection diff --git a/resources/views/admin/slides/show.blade.php b/resources/views/admin/slides/show.blade.php deleted file mode 100644 index 78f03a1..0000000 --- a/resources/views/admin/slides/show.blade.php +++ /dev/null @@ -1,38 +0,0 @@ -@extends('layouts.admin') - -@section('content') -
-
-
-
- {{ $slide->title }} -
- -
-
- - - - - - - - - - - - - - - - - -
TitleUrlBodyCreated at
{{ $slide->title }}{{ $slide->url }}{{ $slide->body }}{{ $slide->created_at }}
-
-
-
-@endsection diff --git a/resources/views/admin/tags/index.blade.php b/resources/views/admin/tags/index.blade.php index f867de2..bc08d9b 100644 --- a/resources/views/admin/tags/index.blade.php +++ b/resources/views/admin/tags/index.blade.php @@ -11,11 +11,12 @@ @endif
-
-
- {{ __('Tags') }} -
-
+
+
+ {{ __('Tags') }} +
+
+
@can('tag_create') @@ -25,57 +26,62 @@ @endcan
+
+ + +
-
- - + +
+
+ + + + + + + + + + @forelse($tags as $tag) - - - - - - - - @forelse($tags as $tag) - - - + + + - - - - @empty - - - - @endforelse - - - - - - -
NoNameProduct countAction
NoNameProduct countAction
{{ $loop->iteration }} - {{ $tag->name }} + {{ $loop->iteration }} + {{ $tag->name }} + + {{ $tag->products_count }} +
+ + -
{{ $tag->products_count }} -
- - - -
+ @csrf @method('DELETE')
-
-
No tags found.
-
- {!! $tags->appends(request()->all())->links() !!} -
-
-
+
+ + + @empty + + No tags found. + + @endforelse + + + + +
+ {!! $tags->appends(request()->all())->links() !!} +
+ + + +
+
@endsection diff --git a/resources/views/admin/users/create.blade.php b/resources/views/admin/users/create.blade.php index 4ab7d2d..52b6d25 100644 --- a/resources/views/admin/users/create.blade.php +++ b/resources/views/admin/users/create.blade.php @@ -5,7 +5,7 @@
-

{{ __('create user') }}

+

{{ __('Create User') }}

{{ __('Go Back') }}
@@ -19,34 +19,38 @@ @endif - -
-
-
- @csrf -
- - -
-
- - -
-
- - -
-
- - -
- -
-
+ +
+
+
+ @csrf +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
- +
diff --git a/resources/views/admin/users/edit.blade.php b/resources/views/admin/users/edit.blade.php index f2c2b8f..8061c53 100644 --- a/resources/views/admin/users/edit.blade.php +++ b/resources/views/admin/users/edit.blade.php @@ -22,6 +22,11 @@
+ + +
+ +
diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index f9ce522..ca25bf0 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -15,56 +15,68 @@

{{ __('Users') }}

- {{ __('create new')}} + {{ __('create new')}} +
+ + +
+
+
+ +
+ +
-
-
-
- - - - - - - - - - - - @forelse($users as $user) - - - - - - - - @empty - - - - @endforelse - -
No{{ __('Name') }}{{ __('Email') }}{{ __('Roles') }}{{ __('Action') }}
{{ $loop->iteration }}{{ $user->username }}{{ $user->email }}{{ $user->role }} - - - -
- @csrf - @method('delete') - -
-
{{ __('Data Empty') }}
-
-
- diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index ea9ac94..e90467f 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -5,7 +5,9 @@
-
{{ __('Login') }}
+
+ Salon Logo +
@@ -39,29 +41,15 @@
-
-
-
- - - -
-
-
-
- - @if (Route::has('password.request')) - - {{ __('Forgot Your Password?') }} - - @endif + + + Belum punya akun? Register +
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index e65233a..64dfb5d 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -5,6 +5,9 @@
+
+ Salon Logo +
{{ __('Register') }}
@@ -12,10 +15,10 @@ @csrf
- +
- + @error('username') @@ -38,7 +41,19 @@ @enderror
+
+ +
+ + + @error('phone') + + {{ $message }} + + @enderror +
+
@@ -69,6 +84,13 @@
+
diff --git a/resources/views/frontend/booking/detail.blade.php b/resources/views/frontend/booking/detail.blade.php index 28b9362..b8f57b0 100644 --- a/resources/views/frontend/booking/detail.blade.php +++ b/resources/views/frontend/booking/detail.blade.php @@ -32,7 +32,7 @@ {{ $booking->handphone }} {{ $booking->total }} {{ $booking->date }} - {{ $booking->time }} + {{ $booking->schedule->start_time }} - {{ $booking->schedule->end_time }} @@ -44,31 +44,26 @@
@endsection @push('script') - + + @endpush diff --git a/resources/views/frontend/booking/index.blade.php b/resources/views/frontend/booking/index.blade.php index e13f698..c79be73 100644 --- a/resources/views/frontend/booking/index.blade.php +++ b/resources/views/frontend/booking/index.blade.php @@ -18,6 +18,16 @@
@csrf + + @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif
@@ -81,5 +91,20 @@
+ @endsection diff --git a/resources/views/frontend/booking/paycash.blade.php b/resources/views/frontend/booking/paycash.blade.php index 0f8faf8..7a473e6 100644 --- a/resources/views/frontend/booking/paycash.blade.php +++ b/resources/views/frontend/booking/paycash.blade.php @@ -8,12 +8,14 @@
-

Please come to the salon on the {{ $booking->date }} at {{ $booking->time }}.

+

Silahkan datang ke Aleea Salon pada tanggal {{ $booking->date }} pukul {{ $booking->schedule->start_time }} - {{ $booking->schedule->end_time }}.

- Back +
+ Lihat
+ @endsection diff --git a/resources/views/frontend/booking/show.blade.php b/resources/views/frontend/booking/show.blade.php new file mode 100644 index 0000000..97fcbb9 --- /dev/null +++ b/resources/views/frontend/booking/show.blade.php @@ -0,0 +1,156 @@ + + + + + + Print Bill Summary + + + +
+ +
+
+

Bill Summary

+
+
+
+

Booking ID #{{ $booking->id }}

+
+
+

Customer Details:

+ + + + + + + + + +
Name:{{ $booking->name }}
WhatsApp:{{ $booking->handphone }}
+
+
+

Service Details:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
Service:{{ $booking->service_name }}
Category:{{ $booking->category }}
Schedule:{{ $booking->date }}
Time:{{ $booking->schedule->start_time }} - {{ $booking->schedule->end_time }}
Price:IDR. {{ number_format($booking->total, 0, '.', '.') }}
Payment Status:{{ $booking->status }}
+
+
+ +
+
+ + + + + diff --git a/resources/views/frontend/homepage.blade.php b/resources/views/frontend/homepage.blade.php index 68ea9a4..8417f3d 100644 --- a/resources/views/frontend/homepage.blade.php +++ b/resources/views/frontend/homepage.blade.php @@ -31,41 +31,39 @@
-
-
-

Why Choose Us

+
+
+

Why Choose Us

+
+
+
+
+
+ +
+
+

Professional Services

+
-
-
-
-
- -
-
-

Good Service

-

Contrary to popular belief, Lorem Ipsum is random text.

-
+
+
+
-
-
- -
-
-

24/7 Support

-

Contrary to popular belief, Lorem Ipsum is random text.

-
+
+

24/7 Availability

-
-
- -
-
-

Secure Payments

-

Contrary to popular belief, Lorem Ipsum is random text.

-
+
+
+
+ +
+
+

Secure Payments

+
+ @endsection diff --git a/resources/views/frontend/orders/cash.blade.php b/resources/views/frontend/orders/cash.blade.php index 56c86cf..0a31a4e 100644 --- a/resources/views/frontend/orders/cash.blade.php +++ b/resources/views/frontend/orders/cash.blade.php @@ -2,13 +2,13 @@ @section('title', 'Services') @section('content')
-

Order with Cash payment Successful

+

Order with payment Cash

-

Please take the product you ordered and pay with a nominal amount of IDR. {{ number_format( $order->base_total_price, 0, '.', '.') }}.

+

Silakan ambil produk yang Anda pesan dan bayar dengan nominal IDR. {{ number_format( $order->base_total_price, 0, '.', '.') }}.

diff --git a/resources/views/frontend/orders/checkout.blade.php b/resources/views/frontend/orders/checkout.blade.php index 9af9a98..ce80aac 100644 --- a/resources/views/frontend/orders/checkout.blade.php +++ b/resources/views/frontend/orders/checkout.blade.php @@ -3,158 +3,129 @@ @section('title', 'Checkout Page') @section('content') - - - -
-
+ + + +
+
@csrf -
-
-
-

Billing Details

-
-
-
- - -
-
-
-
- - -
-
- -
-
- - -
-
-
-
-
-
-
-

Your order

-
- - - - - - - - - @forelse ($items as $item) - @php - $product = $item->associatedModel; - $image = !empty($product->firstMedia) ? asset('storage/images/products/'. $product->firstMedia->file_name) : asset('frontend/assets/img/cart/3.jpg') +
+
+
+

Billing Details

+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+
+
+
+

Your order

+
+
ProductTotal
+ + + + + + + + @forelse ($items as $item) + @php + $product = $item->associatedModel; + $image = !empty($product->firstMedia) ? asset('storage/images/products/'. $product->firstMedia->file_name) : asset('frontend/assets/img/cart/3.jpg'); + @endphp + + + + + @empty + + + + @endforelse + + + + + + + +
ProductTotal
+ {{ $item->name }} × {{ $item->quantity }} + + {{ number_format(\Cart::get($item->id)->getPriceSum()) }} +
The cart is empty!
Order Total{{ number_format(\Cart::getTotal()) }}
+
+
+
+

Payment

+
+

+ + +

+

+ + +

+
+
+
+ +
+
+
+
+
+ +
+
+ - @endphp - - - {{ $item->name }} × {{ $item->quantity }} - - - {{ number_format(\Cart::get($item->id)->getPriceSum()) }} - - - @empty - - The cart is empty! - - @endforelse - - - {{-- - Subtotal - {{ number_format(\Cart::getSubTotal()) }} - - - Tax - {{ number_format(\Cart::getSubTotal()) }} - --}} - {{-- - Shipping Cost ({{ $totalWeight }} gram) - - --}} - - Order Total - {{ number_format(\Cart::getTotal()) }} - - - - -
-
-
-
- {{--
- -
-
-

Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order won’t be shipped until the funds have cleared in our account.

-
-
-
--}} - {{--
- -
-
-

Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order won’t be shipped until the funds have cleared in our account.

-
-
-
--}} - {{--
-
-
-
-
-
-

Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order won’t be shipped until the funds have cleared in our account.

-
-
-
--}} -

Payment

-
-

- - -

-

- - -

-
-
-
- -
-
-
-
-
-
- -
-
- + @endsection diff --git a/resources/views/frontend/orders/index.blade.php b/resources/views/frontend/orders/index.blade.php index b301056..5801d6e 100644 --- a/resources/views/frontend/orders/index.blade.php +++ b/resources/views/frontend/orders/index.blade.php @@ -43,7 +43,7 @@ {{ $order->code }}
{{ $order->order_date }} - {{ number_format($order->grand_total) }} + {{ number_format($order->base_total_price, 0, '.', '.') }} {{ $order->status }} {{ $order->payment_status }} diff --git a/resources/views/frontend/orders/show.blade.php b/resources/views/frontend/orders/show.blade.php index c49940d..9c6d8ae 100644 --- a/resources/views/frontend/orders/show.blade.php +++ b/resources/views/frontend/orders/show.blade.php @@ -33,40 +33,12 @@

Billing Address

- {{ $order->customer_first_name }} {{ $order->customer_last_name }} -
{{ $order->customer_address1 }} -
{{ $order->customer_address2 }} -
Email: {{ $order->customer_email }} +
Name: {{ $order->customer_first_name }} {{ $order->customer_last_name }}
Phone: {{ $order->customer_phone }} -
Postcode: {{ $order->customer_postcode }} -
-
- @if ($order->shipment) -
-

Shipment Address

-
- {{ $order->shipment->first_name }} {{ $order->shipment->last_name }} -
{{ $order->shipment->address1 }} -
{{ $order->shipment->address2 }} -
Email: {{ $order->shipment->email }} -
Phone: {{ $order->shipment->phone }} -
Postcode: {{ $order->shipment->postcode }} -
-
- @endif -
-

Details

-
- ID: #{{ $order->code }} -
{{ $order->order_date }} -
Status: {{ $order->status }} {{ $order->isCancelled() ? '('. $order->cancelled_at .')' : null}} - @if ($order->isCancelled()) -
Cancellation Note : {{ $order->cancellation_note}} - @endif -
Payment Status: {{ $order->payment_status }} -
Shipped by: {{ $order->shipping_service_name }}
+ +
diff --git a/resources/views/frontend/product/show.blade.php b/resources/views/frontend/product/show.blade.php index a9a994e..c9f7076 100644 --- a/resources/views/frontend/product/show.blade.php +++ b/resources/views/frontend/product/show.blade.php @@ -2,19 +2,18 @@ @section('title', $product->name) @section('content')
- - @if(session()->has('message')) - - @endif + @if(session()->has('message')) + + @endif
-
+
@if($product->media_count) @@ -24,17 +23,17 @@ href="#pro-details{{ $loop->index }}" data-toggle="tab" role="tab" aria-selected="true"> {{ $product->name }} + alt="{{ $product->name }}" class="img-fluid"> @endforeach
@else - {{ $product->name }} + {{ $product->name }} @endif
-
+

{{ $product->name }}

@@ -43,12 +42,12 @@

{!! $product->description !!}

- @csrf + @csrf
- +
@@ -59,7 +58,7 @@
- +
  • Categories :
  • @@ -80,27 +79,11 @@
- -
-
-
-
-
-
-
-
- -
-
-

{!! $product->details !!}

+ @endsection diff --git a/resources/views/frontend/service/index.blade.php b/resources/views/frontend/service/index.blade.php index cb95dd9..133c7bd 100644 --- a/resources/views/frontend/service/index.blade.php +++ b/resources/views/frontend/service/index.blade.php @@ -6,6 +6,7 @@
+
@foreach ($serviceCategories as $serviceCategory)
@@ -13,7 +14,8 @@

{{ $serviceCategory->name }}

... - Detail + Detail +
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 842960a..5704534 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -23,9 +23,7 @@