update
This commit is contained in:
@@ -24,8 +24,14 @@ import invoiceService, { Invoice } from '../../features/payments/services/invoic
|
||||
import paymentService from '../../features/payments/services/paymentService';
|
||||
import type { Payment } from '../../features/payments/services/paymentService';
|
||||
import promotionService, { Promotion } from '../../features/loyalty/services/promotionService';
|
||||
import { getRoomTypes } from '../../features/rooms/services/roomService';
|
||||
import { formatDate } from '../../shared/utils/format';
|
||||
|
||||
interface RoomType {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
type BusinessTab = 'overview' | 'invoices' | 'payments' | 'promotions';
|
||||
|
||||
const BusinessDashboardPage: React.FC = () => {
|
||||
@@ -83,11 +89,26 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
discount_value: 0,
|
||||
min_booking_amount: 0,
|
||||
max_discount_amount: 0,
|
||||
min_stay_days: 0,
|
||||
max_stay_days: 0,
|
||||
advance_booking_days: 0,
|
||||
max_advance_booking_days: 0,
|
||||
allowed_check_in_days: [] as number[],
|
||||
allowed_check_out_days: [] as number[],
|
||||
allowed_room_type_ids: [] as number[],
|
||||
excluded_room_type_ids: [] as number[],
|
||||
min_guests: 0,
|
||||
max_guests: 0,
|
||||
first_time_customer_only: false,
|
||||
repeat_customer_only: false,
|
||||
blackout_dates: [] as string[],
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
usage_limit: 0,
|
||||
status: 'active' as 'active' | 'inactive' | 'expired',
|
||||
});
|
||||
|
||||
const [roomTypes, setRoomTypes] = useState<RoomType[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTab === 'invoices') {
|
||||
@@ -99,6 +120,21 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
}
|
||||
}, [activeTab, invoiceFilters, invoicesCurrentPage, paymentFilters, paymentsCurrentPage, promotionFilters, promotionsCurrentPage]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchRoomTypes();
|
||||
}, []);
|
||||
|
||||
const fetchRoomTypes = async () => {
|
||||
try {
|
||||
const response = await getRoomTypes();
|
||||
if (response.success && response.data.room_types) {
|
||||
setRoomTypes(response.data.room_types);
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error('Failed to fetch room types:', error);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTab === 'invoices') {
|
||||
setInvoicesCurrentPage(1);
|
||||
@@ -280,11 +316,30 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
const handlePromotionSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
// Prepare data, converting empty arrays to undefined and 0 values to undefined for optional fields
|
||||
const submitData: any = {
|
||||
...promotionFormData,
|
||||
min_stay_days: promotionFormData.min_stay_days || undefined,
|
||||
max_stay_days: promotionFormData.max_stay_days || undefined,
|
||||
advance_booking_days: promotionFormData.advance_booking_days || undefined,
|
||||
max_advance_booking_days: promotionFormData.max_advance_booking_days || undefined,
|
||||
min_guests: promotionFormData.min_guests || undefined,
|
||||
max_guests: promotionFormData.max_guests || undefined,
|
||||
allowed_check_in_days: promotionFormData.allowed_check_in_days?.length ? promotionFormData.allowed_check_in_days : undefined,
|
||||
allowed_check_out_days: promotionFormData.allowed_check_out_days?.length ? promotionFormData.allowed_check_out_days : undefined,
|
||||
allowed_room_type_ids: promotionFormData.allowed_room_type_ids?.length ? promotionFormData.allowed_room_type_ids : undefined,
|
||||
excluded_room_type_ids: promotionFormData.excluded_room_type_ids?.length ? promotionFormData.excluded_room_type_ids : undefined,
|
||||
blackout_dates: promotionFormData.blackout_dates?.length ? promotionFormData.blackout_dates : undefined,
|
||||
min_booking_amount: promotionFormData.min_booking_amount || undefined,
|
||||
max_discount_amount: promotionFormData.max_discount_amount || undefined,
|
||||
usage_limit: promotionFormData.usage_limit || undefined,
|
||||
};
|
||||
|
||||
if (editingPromotion) {
|
||||
await promotionService.updatePromotion(editingPromotion.id, promotionFormData);
|
||||
await promotionService.updatePromotion(editingPromotion.id, submitData);
|
||||
toast.success('Promotion updated successfully');
|
||||
} else {
|
||||
await promotionService.createPromotion(promotionFormData);
|
||||
await promotionService.createPromotion(submitData);
|
||||
toast.success('Promotion added successfully');
|
||||
}
|
||||
setShowPromotionModal(false);
|
||||
@@ -305,6 +360,19 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
discount_value: promotion.discount_value,
|
||||
min_booking_amount: promotion.min_booking_amount || 0,
|
||||
max_discount_amount: promotion.max_discount_amount || 0,
|
||||
min_stay_days: promotion.min_stay_days || 0,
|
||||
max_stay_days: promotion.max_stay_days || 0,
|
||||
advance_booking_days: promotion.advance_booking_days || 0,
|
||||
max_advance_booking_days: promotion.max_advance_booking_days || 0,
|
||||
allowed_check_in_days: promotion.allowed_check_in_days || [],
|
||||
allowed_check_out_days: promotion.allowed_check_out_days || [],
|
||||
allowed_room_type_ids: promotion.allowed_room_type_ids || [],
|
||||
excluded_room_type_ids: promotion.excluded_room_type_ids || [],
|
||||
min_guests: promotion.min_guests || 0,
|
||||
max_guests: promotion.max_guests || 0,
|
||||
first_time_customer_only: promotion.first_time_customer_only || false,
|
||||
repeat_customer_only: promotion.repeat_customer_only || false,
|
||||
blackout_dates: promotion.blackout_dates || [],
|
||||
start_date: promotion.start_date?.split('T')[0] || '',
|
||||
end_date: promotion.end_date?.split('T')[0] || '',
|
||||
usage_limit: promotion.usage_limit || 0,
|
||||
@@ -335,6 +403,19 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
discount_value: 0,
|
||||
min_booking_amount: 0,
|
||||
max_discount_amount: 0,
|
||||
min_stay_days: 0,
|
||||
max_stay_days: 0,
|
||||
advance_booking_days: 0,
|
||||
max_advance_booking_days: 0,
|
||||
allowed_check_in_days: [],
|
||||
allowed_check_out_days: [],
|
||||
allowed_room_type_ids: [],
|
||||
excluded_room_type_ids: [],
|
||||
min_guests: 0,
|
||||
max_guests: 0,
|
||||
first_time_customer_only: false,
|
||||
repeat_customer_only: false,
|
||||
blackout_dates: [],
|
||||
start_date: '',
|
||||
end_date: '',
|
||||
usage_limit: 0,
|
||||
@@ -1041,36 +1122,37 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{}
|
||||
{showPromotionModal && (
|
||||
<div className="fixed inset-0 bg-black/70 backdrop-blur-md z-50 overflow-y-auto p-4">
|
||||
<div className="min-h-full flex items-start justify-center py-8">
|
||||
<div className="bg-white rounded-3xl shadow-2xl w-full max-w-3xl my-8 max-h-[calc(100vh-4rem)] overflow-hidden border border-gray-200">
|
||||
{}
|
||||
<div className="bg-gradient-to-r from-slate-900 via-slate-800 to-slate-900 px-8 py-6 border-b border-slate-700">
|
||||
<div className="flex justify-between items-center">
|
||||
<div>
|
||||
<h2 className="text-3xl font-bold text-purple-100 mb-1">
|
||||
{editingPromotion ? 'Update Promotion' : 'Add New Promotion'}
|
||||
</h2>
|
||||
<p className="text-purple-200/80 text-sm font-light">
|
||||
{editingPromotion ? 'Modify promotion details' : 'Create a new promotion program'}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowPromotionModal(false)}
|
||||
className="w-10 h-10 flex items-center justify-center rounded-xl text-purple-100 hover:text-white hover:bg-slate-700/50 transition-all duration-200 border border-slate-600 hover:border-purple-400"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
{}
|
||||
{showPromotionModal && (
|
||||
<div className="fixed inset-0 bg-black/70 backdrop-blur-md z-50 overflow-y-auto p-3 sm:p-4">
|
||||
<div className="min-h-full flex items-center justify-center py-4">
|
||||
<div className="bg-white rounded-2xl sm:rounded-3xl shadow-2xl max-w-5xl w-full my-4 flex flex-col border border-gray-200" style={{ maxHeight: 'calc(100vh - 2rem)' }}>
|
||||
<div className="bg-gradient-to-r from-slate-900 via-slate-800 to-slate-900 px-4 sm:px-6 md:px-8 py-4 sm:py-5 md:py-6 border-b border-slate-700 flex-shrink-0">
|
||||
<div className="flex justify-between items-center">
|
||||
<div>
|
||||
<h2 className="text-xl sm:text-2xl md:text-3xl font-bold text-purple-100 mb-1">
|
||||
{editingPromotion ? 'Update Promotion' : 'Add New Promotion'}
|
||||
</h2>
|
||||
<p className="text-purple-200/80 text-xs sm:text-sm font-light">
|
||||
{editingPromotion ? 'Modify promotion details' : 'Create a new promotion program'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{}
|
||||
<div className="p-8 overflow-y-auto max-h-[calc(100vh-12rem)] custom-scrollbar">
|
||||
<form onSubmit={handlePromotionSubmit} className="space-y-6">
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<button
|
||||
onClick={() => setShowPromotionModal(false)}
|
||||
className="w-9 h-9 sm:w-10 sm:h-10 flex items-center justify-center rounded-xl text-purple-100 hover:text-white hover:bg-slate-700/50 transition-all duration-200 border border-slate-600 hover:border-purple-400"
|
||||
>
|
||||
<X className="w-5 h-5 sm:w-6 sm:h-6" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto min-h-0">
|
||||
<form onSubmit={handlePromotionSubmit} className="p-4 sm:p-6 md:p-8 space-y-4 sm:space-y-5 md:space-y-6">
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Code <span className="text-red-500">*</span>
|
||||
@@ -1169,6 +1251,258 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Enterprise Booking Conditions Section */}
|
||||
<div className="border-t-2 border-purple-200 pt-6 mt-6">
|
||||
<h3 className="text-lg font-bold text-gray-900 mb-4 flex items-center gap-2">
|
||||
<div className="h-1 w-8 bg-gradient-to-r from-purple-400 to-purple-600 rounded-full"></div>
|
||||
Enterprise Booking Conditions
|
||||
</h3>
|
||||
<p className="text-sm text-gray-600 mb-6">Configure advanced conditions for when this promotion applies</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Minimum Stay (nights)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.min_stay_days || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, min_stay_days: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="0"
|
||||
placeholder="0 = no minimum"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Minimum number of nights required for booking</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Advance Booking (days)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.advance_booking_days || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, advance_booking_days: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="0"
|
||||
placeholder="0 = no requirement"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Minimum days in advance the booking must be made</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Maximum Stay (nights)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.max_stay_days || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, max_stay_days: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="0"
|
||||
placeholder="0 = no maximum"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Maximum number of nights allowed for booking</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Max Advance Booking (days)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.max_advance_booking_days || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, max_advance_booking_days: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="0"
|
||||
placeholder="0 = no maximum"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Maximum days in advance the booking can be made</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Allowed Check-in Days
|
||||
</label>
|
||||
<div className="grid grid-cols-7 gap-2">
|
||||
{['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map((day, index) => (
|
||||
<label key={day} className="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={promotionFormData.allowed_check_in_days?.includes(index) || false}
|
||||
onChange={(e) => {
|
||||
const current = promotionFormData.allowed_check_in_days || [];
|
||||
if (e.target.checked) {
|
||||
setPromotionFormData({ ...promotionFormData, allowed_check_in_days: [...current, index] });
|
||||
} else {
|
||||
setPromotionFormData({ ...promotionFormData, allowed_check_in_days: current.filter(d => d !== index) });
|
||||
}
|
||||
}}
|
||||
className="w-4 h-4 text-purple-600 border-gray-300 rounded focus:ring-purple-500"
|
||||
/>
|
||||
<span className="text-xs text-gray-700">{day}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-1">Leave empty to allow all days</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Allowed Check-out Days
|
||||
</label>
|
||||
<div className="grid grid-cols-7 gap-2">
|
||||
{['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map((day, index) => (
|
||||
<label key={day} className="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={promotionFormData.allowed_check_out_days?.includes(index) || false}
|
||||
onChange={(e) => {
|
||||
const current = promotionFormData.allowed_check_out_days || [];
|
||||
if (e.target.checked) {
|
||||
setPromotionFormData({ ...promotionFormData, allowed_check_out_days: [...current, index] });
|
||||
} else {
|
||||
setPromotionFormData({ ...promotionFormData, allowed_check_out_days: current.filter(d => d !== index) });
|
||||
}
|
||||
}}
|
||||
className="w-4 h-4 text-purple-600 border-gray-300 rounded focus:ring-purple-500"
|
||||
/>
|
||||
<span className="text-xs text-gray-700">{day}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-1">Leave empty to allow all days</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Allowed Room Types
|
||||
</label>
|
||||
<select
|
||||
multiple
|
||||
value={promotionFormData.allowed_room_type_ids?.map(String) || []}
|
||||
onChange={(e) => {
|
||||
const selected = Array.from(e.target.selectedOptions, option => parseInt(option.value));
|
||||
setPromotionFormData({ ...promotionFormData, allowed_room_type_ids: selected });
|
||||
}}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
size={4}
|
||||
>
|
||||
{roomTypes.map(rt => (
|
||||
<option key={rt.id} value={rt.id}>{rt.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<p className="text-xs text-gray-500 mt-1">Hold Ctrl/Cmd to select multiple. Leave empty to allow all room types.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Excluded Room Types
|
||||
</label>
|
||||
<select
|
||||
multiple
|
||||
value={promotionFormData.excluded_room_type_ids?.map(String) || []}
|
||||
onChange={(e) => {
|
||||
const selected = Array.from(e.target.selectedOptions, option => parseInt(option.value));
|
||||
setPromotionFormData({ ...promotionFormData, excluded_room_type_ids: selected });
|
||||
}}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
size={4}
|
||||
>
|
||||
{roomTypes.map(rt => (
|
||||
<option key={rt.id} value={rt.id}>{rt.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<p className="text-xs text-gray-500 mt-1">Hold Ctrl/Cmd to select multiple. These room types cannot use this promotion.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Minimum Guests
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.min_guests || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, min_guests: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="1"
|
||||
placeholder="0 = no minimum"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Minimum number of guests required</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Maximum Guests
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={promotionFormData.max_guests || ''}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, max_guests: parseInt(e.target.value) || 0 })}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
min="1"
|
||||
placeholder="0 = no maximum"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Maximum number of guests allowed</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="flex items-center gap-3 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={promotionFormData.first_time_customer_only || false}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, first_time_customer_only: e.target.checked, repeat_customer_only: e.target.checked ? false : promotionFormData.repeat_customer_only })}
|
||||
className="w-5 h-5 text-purple-600 border-gray-300 rounded focus:ring-purple-500"
|
||||
/>
|
||||
<span className="text-sm font-semibold text-gray-700">First-Time Customer Only</span>
|
||||
</label>
|
||||
<p className="text-xs text-gray-500 mt-1 ml-8">Only available to first-time customers</p>
|
||||
</div>
|
||||
<div>
|
||||
<label className="flex items-center gap-3 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={promotionFormData.repeat_customer_only || false}
|
||||
onChange={(e) => setPromotionFormData({ ...promotionFormData, repeat_customer_only: e.target.checked, first_time_customer_only: e.target.checked ? false : promotionFormData.first_time_customer_only })}
|
||||
className="w-5 h-5 text-purple-600 border-gray-300 rounded focus:ring-purple-500"
|
||||
/>
|
||||
<span className="text-sm font-semibold text-gray-700">Repeat Customer Only</span>
|
||||
</label>
|
||||
<p className="text-xs text-gray-500 mt-1 ml-8">Only available to returning customers</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
Blackout Dates
|
||||
</label>
|
||||
<textarea
|
||||
value={promotionFormData.blackout_dates?.join('\n') || ''}
|
||||
onChange={(e) => {
|
||||
const dates = e.target.value.split('\n').filter(d => d.trim()).map(d => d.trim());
|
||||
setPromotionFormData({ ...promotionFormData, blackout_dates: dates });
|
||||
}}
|
||||
className="w-full px-4 py-3 bg-white border-2 border-gray-200 rounded-xl focus:border-purple-400 focus:ring-4 focus:ring-purple-100 transition-all duration-200 text-gray-700 font-medium shadow-sm"
|
||||
rows={3}
|
||||
placeholder="Enter dates (one per line) in YYYY-MM-DD format Example: 2024-12-25 2024-12-31 2025-01-01"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Dates when promotion doesn't apply. One date per line (YYYY-MM-DD format).</p>
|
||||
</div>
|
||||
|
||||
{/* Dates & Status Section */}
|
||||
<div className="border-t-2 border-purple-200 pt-6 mt-6">
|
||||
<h3 className="text-lg font-bold text-gray-900 mb-4 flex items-center gap-2">
|
||||
<div className="h-1 w-8 bg-gradient-to-r from-purple-400 to-purple-600 rounded-full"></div>
|
||||
Promotion Period & Status
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div>
|
||||
<label className="block text-xs font-semibold text-gray-600 uppercase tracking-wider mb-2">
|
||||
@@ -1224,7 +1558,7 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end gap-3 pt-6 border-t border-gray-200">
|
||||
<div className="sticky bottom-0 bg-white border-t border-gray-200 mt-8 -mx-4 sm:-mx-6 md:-mx-8 px-4 sm:px-6 md:px-8 py-4 flex justify-end gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowPromotionModal(false)}
|
||||
@@ -1239,15 +1573,12 @@ const BusinessDashboardPage: React.FC = () => {
|
||||
{editingPromotion ? 'Update' : 'Create'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user