@extends('layouts.app') @php $prefilledServiceId = (string) old('service_id', (string) request()->query('service_id', '')); $prefilledPlanId = (string) old('service_plan_id', (string) request()->query('service_plan_id', '')); $prefilledTitle = (string) old('title', (string) request()->query('title', '')); $prefilledTotalSlots = (string) old('total_slots', (string) request()->query('total_slots', '')); $prefilledAvailableSlots = (string) old('available_slots', (string) request()->query('available_slots', '')); $prefilledTotalPrice = (string) old('total_price', (string) request()->query('total_price', '')); $prefilledPricePerSlot = (string) old('price_per_slot', (string) request()->query('price_per_slot', '')); $selectedService = filled($prefilledServiceId) ? $services->firstWhere('id', (int) $prefilledServiceId) : null; if (! $selectedService && filled($prefilledPlanId)) { $selectedService = $services->first(fn ($service) => $service->plans->contains('id', (int) $prefilledPlanId)); } $selectedPlan = $selectedService?->plans->firstWhere('id', (int) $prefilledPlanId); $hasLockedSelection = filled($selectedService?->id) && filled($selectedPlan?->id); $servicesPayload = $services ->map(function ($service) { return [ 'id' => (int) $service->id, 'name' => (string) $service->name, 'category' => (string) ($service->category?->name ?? 'Other'), 'plans' => $service->plans ->map(function ($plan) use ($service) { $monthlyPrice = (float) (($service->price ?? 0) > 0 ? $service->price : ($plan->price ?? 0)); $adminFee = (float) ($plan->admin_fee ?? 0); return [ 'id' => (int) $plan->id, 'name' => (string) $plan->name, 'monthly_price' => $monthlyPrice, 'admin_fee' => $adminFee, 'price' => round($monthlyPrice + $adminFee, 2), 'currency' => (string) ($plan->currency ?: 'USD'), 'max_slots' => max((int) ($plan->max_slots ?? 1), 1), ]; }) ->values() ->all(), ]; }) ->values(); @endphp @push('style') @endpush @section('content')
Service, plan, title, aur package price admin setup se aate hain. Aap yahan sirf apni sharing listing complete karte ho.