@@ -54,7 +54,7 @@ class="mx-auto max-w-xl pt-2 text-base/relaxed text-gray-600 opacity-0 dark:text
5454
5555 {{-- Interval Toggle --}}
5656 <div
57- x-data =" { interval: @entangle (' interval' ) }"
57+ x-data =" { interval: @entangle (' interval' ), showUpgradeModal: false }"
5858 class =" mt-8 flex flex-col items-center gap-6"
5959 >
6060 <div
@@ -149,14 +149,29 @@ class="pt-1 text-sm text-emerald-600 dark:text-emerald-400"
149149
150150 {{-- CTA Button --}}
151151 @auth
152- <button
153- type =" button"
154- wire:click =" createCheckoutSession('max')"
155- class =" my-5 block w-full rounded-2xl bg-zinc-800 py-4 text-center text-sm font-medium text-white transition duration-200 ease-in-out hover:bg-zinc-700 dark:bg-white dark:text-black dark:hover:bg-zinc-200"
156- aria-label =" Get started with Ultra plan"
157- >
158- Get started
159- </button >
152+ @if ($isAlreadyUltra )
153+ <div class =" my-5 block w-full rounded-2xl bg-emerald-100 py-4 text-center text-sm font-medium text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-300" >
154+ You're on Ultra
155+ </div >
156+ @elseif ($hasExistingSubscription )
157+ <button
158+ type =" button"
159+ @click =" showUpgradeModal = true"
160+ class =" my-5 block w-full rounded-2xl bg-zinc-800 py-4 text-center text-sm font-medium text-white transition duration-200 ease-in-out hover:bg-zinc-700 dark:bg-white dark:text-black dark:hover:bg-zinc-200"
161+ aria-label =" Upgrade to Ultra plan"
162+ >
163+ Upgrade to Ultra
164+ </button >
165+ @else
166+ <button
167+ type =" button"
168+ wire:click =" createCheckoutSession('max')"
169+ class =" my-5 block w-full rounded-2xl bg-zinc-800 py-4 text-center text-sm font-medium text-white transition duration-200 ease-in-out hover:bg-zinc-700 dark:bg-white dark:text-black dark:hover:bg-zinc-200"
170+ aria-label =" Get started with Ultra plan"
171+ >
172+ Get started
173+ </button >
174+ @endif
160175 @else
161176 <button
162177 type =" button"
@@ -229,6 +244,101 @@ class="grid size-7 shrink-0 place-items-center rounded-xl bg-[#D4FD7D] dark:bg-[
229244 </div >
230245 </div >
231246 </div >
247+
248+ {{-- Upgrade Confirmation Modal --}}
249+ @auth
250+ @if ($hasExistingSubscription && ! $isAlreadyUltra )
251+ <template x-teleport =" body" >
252+ <div
253+ x-show =" showUpgradeModal"
254+ x-transition.opacity
255+ class =" fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"
256+ @keydown .escape.window =" showUpgradeModal = false"
257+ >
258+ <div
259+ x-show =" showUpgradeModal"
260+ x-transition
261+ @click .outside =" showUpgradeModal = false"
262+ class =" w-full max-w-md rounded-2xl bg-white p-6 shadow-xl dark:bg-zinc-900"
263+ >
264+ <h3 class =" text-lg font-semibold text-gray-900 dark:text-white" >Upgrade to Ultra</h3 >
265+ <p class =" mt-2 text-sm text-gray-600 dark:text-gray-400" >
266+ You're upgrading from <strong >{{ $currentPlanName } } </strong > to <strong >Ultra</strong >.
267+ You'll be charged the prorated difference immediately and your new billing cycle will begin.
268+ </p >
269+
270+ {{-- Interval Toggle --}}
271+ <div class =" mt-4" >
272+ <label class =" text-sm font-medium text-gray-700 dark:text-gray-300" >Billing interval</label >
273+ <div class =" mt-2 inline-flex items-center gap-1 rounded-full bg-gray-100 p-1 dark:bg-zinc-800" role =" radiogroup" aria-label =" Upgrade billing interval" >
274+ <button
275+ type =" button"
276+ @click =" interval = 'month'"
277+ :class =" interval === 'month'
278+ ? 'bg-white text-black shadow-sm dark:bg-zinc-600 dark:text-white'
279+ : 'text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300'"
280+ class =" rounded-full px-4 py-1.5 text-sm font-medium transition"
281+ role =" radio"
282+ :aria-checked =" interval === 'month'"
283+ >
284+ Monthly
285+ </button >
286+ <button
287+ type =" button"
288+ @click =" interval = 'year'"
289+ :class =" interval === 'year'
290+ ? 'bg-white text-black shadow-sm dark:bg-zinc-600 dark:text-white'
291+ : 'text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300'"
292+ class =" rounded-full px-4 py-1.5 text-sm font-medium transition"
293+ role =" radio"
294+ :aria-checked =" interval === 'year'"
295+ >
296+ Annual
297+ </button >
298+ </div >
299+ </div >
300+
301+ {{-- Price Preview --}}
302+ <div class =" mt-4 rounded-lg bg-gray-50 p-3 dark:bg-zinc-800" >
303+ <div class =" flex items-baseline justify-between" >
304+ <span class =" text-sm text-gray-600 dark:text-gray-400" >Ultra</span >
305+ <span class =" text-lg font-semibold text-gray-900 dark:text-white" >
306+ $<span x-text =" interval === 'month' ? '35' : '350'" ></span ><span class =" text-sm font-normal text-gray-500" >/<span x-text =" interval === 'month' ? 'mo' : 'yr'" ></span ></span >
307+ </span >
308+ </div >
309+ <div
310+ x-show =" interval === 'year'"
311+ x-transition
312+ class =" mt-1 text-xs text-emerald-600 dark:text-emerald-400"
313+ >
314+ Save $70/year vs monthly
315+ </div >
316+ </div >
317+
318+ {{-- Actions --}}
319+ <div class =" mt-6 flex gap-3" >
320+ <button
321+ type =" button"
322+ @click =" showUpgradeModal = false"
323+ class =" flex-1 rounded-xl border border-gray-300 px-4 py-2.5 text-sm font-medium text-gray-700 transition hover:bg-gray-50 dark:border-zinc-700 dark:text-gray-300 dark:hover:bg-zinc-800"
324+ >
325+ Cancel
326+ </button >
327+ <button
328+ type =" button"
329+ wire:click =" upgradeSubscription"
330+ wire:loading.attr =" disabled"
331+ class =" flex-1 rounded-xl bg-zinc-800 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-zinc-700 disabled:opacity-50 dark:bg-white dark:text-black dark:hover:bg-zinc-200"
332+ >
333+ <span wire:loading.remove wire:target =" upgradeSubscription" >Confirm upgrade</span >
334+ <span wire:loading wire:target =" upgradeSubscription" >Upgrading...</span >
335+ </button >
336+ </div >
337+ </div >
338+ </div >
339+ </template >
340+ @endif
341+ @endauth
232342 </div >
233343
234344 @guest
0 commit comments