updates
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Search, FileText, DollarSign, CreditCard, Printer, CheckCircle } from 'lucide-react';
|
||||
import { Search, FileText, CreditCard, Printer, CheckCircle } from 'lucide-react';
|
||||
import { bookingService, Booking } from '../../services/api';
|
||||
import { toast } from 'react-toastify';
|
||||
import Loading from '../../components/common/Loading';
|
||||
import CurrencyIcon from '../../components/common/CurrencyIcon';
|
||||
import { useFormatCurrency } from '../../hooks/useFormatCurrency';
|
||||
|
||||
interface ServiceItem {
|
||||
service_name: string;
|
||||
@@ -12,12 +14,13 @@ interface ServiceItem {
|
||||
}
|
||||
|
||||
const CheckOutPage: React.FC = () => {
|
||||
const { formatCurrency } = useFormatCurrency();
|
||||
const [bookingNumber, setBookingNumber] = useState('');
|
||||
const [booking, setBooking] = useState<Booking | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [searching, setSearching] = useState(false);
|
||||
const [services, setServices] = useState<ServiceItem[]>([]);
|
||||
const [paymentMethod, setPaymentMethod] = useState<'cash' | 'bank_transfer' | 'credit_card'>('cash');
|
||||
const [paymentMethod, setPaymentMethod] = useState<'cash' | 'stripe'>('cash');
|
||||
const [discount, setDiscount] = useState(0);
|
||||
const [showInvoice, setShowInvoice] = useState(false);
|
||||
|
||||
@@ -88,9 +91,6 @@ const CheckOutPage: React.FC = () => {
|
||||
return calculateTotal() - calculateDeposit();
|
||||
};
|
||||
|
||||
const formatCurrency = (amount: number) => {
|
||||
return new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(amount);
|
||||
};
|
||||
|
||||
const handleCheckOut = async () => {
|
||||
if (!booking) return;
|
||||
@@ -323,30 +323,19 @@ const CheckOutPage: React.FC = () => {
|
||||
: 'border-gray-300 hover:border-gray-400'
|
||||
}`}
|
||||
>
|
||||
<DollarSign className="w-8 h-8 mx-auto mb-2" />
|
||||
<CurrencyIcon className="mx-auto mb-2" size={32} />
|
||||
<div className="font-medium">Cash</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setPaymentMethod('bank_transfer')}
|
||||
onClick={() => setPaymentMethod('stripe')}
|
||||
className={`p-4 border-2 rounded-lg text-center transition-all ${
|
||||
paymentMethod === 'bank_transfer'
|
||||
? 'border-blue-600 bg-blue-50 text-blue-600'
|
||||
paymentMethod === 'stripe'
|
||||
? 'border-indigo-600 bg-indigo-50 text-indigo-600'
|
||||
: 'border-gray-300 hover:border-gray-400'
|
||||
}`}
|
||||
>
|
||||
<CreditCard className="w-8 h-8 mx-auto mb-2" />
|
||||
<div className="font-medium">Bank transfer</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setPaymentMethod('credit_card')}
|
||||
className={`p-4 border-2 rounded-lg text-center transition-all ${
|
||||
paymentMethod === 'credit_card'
|
||||
? 'border-blue-600 bg-blue-50 text-blue-600'
|
||||
: 'border-gray-300 hover:border-gray-400'
|
||||
}`}
|
||||
>
|
||||
<CreditCard className="w-8 h-8 mx-auto mb-2" />
|
||||
<div className="font-medium">Credit card</div>
|
||||
<div className="font-medium">Stripe</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -398,7 +387,7 @@ const CheckOutPage: React.FC = () => {
|
||||
<div>
|
||||
<p className="text-sm text-gray-600">Payment method:</p>
|
||||
<p className="font-semibold">
|
||||
{paymentMethod === 'cash' ? 'Cash' : paymentMethod === 'bank_transfer' ? 'Bank transfer' : 'Credit card'}
|
||||
{paymentMethod === 'cash' ? 'Cash' : 'Stripe'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user