This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const statusColors = { | |
| green: 'bg-green-50 text-green-600 border-green-200', | |
| yellow: 'bg-yellow-50 text-yellow-600 border-yellow-200', | |
| orange: 'bg-orange-50 text-orange-600 border-orange-200', | |
| red: 'bg-red-50 text-red-600 border-red-200', | |
| gray: 'bg-gray-50 text-gray-700 border-gray-200', | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private function getNextBillingDate($subscription): ?string | |
| { | |
| return cache()->remember( | |
| "stripe.next_billing.{$subscription->id}", | |
| now()->addHours(1), | |
| function () use ($subscription) { | |
| try { | |
| $stripe = $subscription->asStripeSubscription(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Route::get('/subscription', [SubscriptionController::class, 'show']) | |
| ->name('subscription.manage'); | |
| Route::post('/subscription/swap/{plan}', [SubscriptionController::class, 'swap']) | |
| ->name('subscription.swap') | |
| ->whereIn('plan', ['monthly', 'yearly']); | |
| Route::post('/subscription/cancel', [SubscriptionController::class, 'cancel']) | |
| ->name('subscription.cancel'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @if (auth()->user()->isOnYearlyPlan()) | |
| <p class="border-2 text-lg border-amber-500 rounded-lg text-amber-500 py-2 px-5 font-black">PRO Anual</p> | |
| @elseif (auth()->user()->isOnMonthlyPlan()) | |
| <p class="border-2 text-lg border-amber-500 rounded-lg text-amber-500 py-2 px-5 font-black">PRO Mensual</p> | |
| @else | |
| <a class="border-2 text-lg border-amber-500 rounded-lg text-amber-500 py-2 px-5 font-black" href="{{ route('plans') }}">Suscribirse a PRO</a> | |
| @endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @extends('layouts.app') | |
| @section('title') | |
| Error al Pagar | |
| @endsection | |
| @section('dashboard-contents') | |
| <div class="rounded-md bg-red-50 p-4 dark:bg-red-500/15 dark:outline dark:outline-red-500/25"> | |
| <div class="flex"> | |
| <div class="shrink-0"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { router } from '@inertiajs/react'; | |
| import { useState } from 'react'; | |
| import { route } from 'ziggy-js'; | |
| export default function PricingTable() { | |
| const [loading, setLoading] = useState<string | null>(null); | |
| const subscribe = (plan: 'monthly' | 'yearly') => { | |
| setLoading(plan); | |
| router.post(route('subscription.checkout', { plan })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| STRIPE_KEY= | |
| STRIPE_SECRET= | |
| STRIPE_WEBHOOK_SECRET= | |
| CASHIER_CURRENCY= | |
| CASHIER_CURRENCY_LOCALE= | |
| STRIPE_PRICE_AI_MONTHLY= | |
| STRIPE_PRICE_AI_YEARLY= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private function createExpenses(Budget $budget, string $store, string $category, array $items): array | |
| { | |
| $created = []; | |
| foreach ($items as $item) { | |
| $expense = Expense::create([ | |
| 'budget_id' => $budget->id, | |
| 'name' => $store . ' - ' . $item['name'], | |
| 'amount' => $item['amount'], | |
| 'category' => $budget->isGeneral() ? $category : null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function instructions(): string | |
| { | |
| return <<<'PROMPT' | |
| Eres un asistente que lee tickets de venta a partir de una imagen y extrae la información estructurada. | |
| Reglas: | |
| - Devuelve el nombre del negocio en "store". | |
| - La categoría debe ser EXACTAMENTE una de: food, transportation, health, entertainment, subscriptions, beauty, clothing, home, education, pets, other. | |
| - "items" debe contener cada producto con su nombre y precio numérico (sin símbolos de moneda). | |
| - No inventes productos que no estén claramente visibles en el ticket. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function handle(Request $request): Stringable|string | |
| { | |
| $name = $request['name'] ?? null; | |
| $amount = $request['amount'] ?? null; | |
| if (!$name || !$amount) { | |
| return '[EXPENSE_ERROR] Se necesita un nombre y un monto para agregar el gasto.'; | |
| } |