Merge branch 'dev' of https://git.profit-planet.partners/Seazn/profit-planet-frontend into dev
This commit is contained in:
commit
9999e45c1d
@ -121,7 +121,8 @@ export default function AffiliateManagementPage() {
|
||||
<PageTransitionEffect>
|
||||
<div className="min-h-screen flex flex-col bg-gradient-to-tr from-blue-50 via-white to-blue-100">
|
||||
<Header />
|
||||
<main className="flex-1 py-8 px-4 sm:px-6 lg:px-8">
|
||||
{/* tighter padding on mobile */}
|
||||
<main className="flex-1 py-6 md:py-8 px-4 sm:px-6 lg:px-8">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
{/* Error State */}
|
||||
{error && (
|
||||
@ -139,15 +140,19 @@ export default function AffiliateManagementPage() {
|
||||
)}
|
||||
|
||||
{/* Header */}
|
||||
<header className="bg-white/90 backdrop-blur border-b border-blue-100 py-10 px-8 rounded-2xl shadow-lg mb-8">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 className="text-4xl font-extrabold text-blue-900 tracking-tight">Affiliate Management</h1>
|
||||
<p className="text-lg text-blue-700 mt-2">Manage your affiliate partners and tracking links</p>
|
||||
<header className="bg-white/90 backdrop-blur border-b border-blue-100 py-6 md:py-10 px-4 md:px-8 rounded-2xl shadow-lg mb-6 md:mb-8">
|
||||
<div className="flex flex-col md:flex-row md:items-center md:justify-between gap-4 md:gap-6 mb-4 md:mb-6">
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-2xl md:text-4xl font-extrabold text-blue-900 tracking-tight">
|
||||
Affiliate Management
|
||||
</h1>
|
||||
<p className="text-sm md:text-lg text-blue-700 mt-1 md:mt-2">
|
||||
Manage your affiliate partners and tracking links
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowCreateModal(true)}
|
||||
className="inline-flex items-center gap-2 rounded-lg bg-blue-900 hover:bg-blue-800 text-blue-50 px-5 py-3 text-sm font-semibold shadow transition"
|
||||
className="w-full md:w-auto inline-flex items-center justify-center gap-2 rounded-lg bg-blue-900 hover:bg-blue-800 text-blue-50 px-5 py-3 text-sm font-semibold shadow transition"
|
||||
>
|
||||
<PlusIcon className="h-5 w-5" />
|
||||
Add Affiliate
|
||||
@ -155,7 +160,7 @@ export default function AffiliateManagementPage() {
|
||||
</div>
|
||||
|
||||
{/* Search and Filter */}
|
||||
<div className="flex flex-col sm:flex-row gap-4">
|
||||
<div className="flex flex-col sm:flex-row gap-3 md:gap-4">
|
||||
<div className="flex-1 relative">
|
||||
<MagnifyingGlassIcon className="absolute left-3 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400" />
|
||||
<input
|
||||
@ -169,7 +174,7 @@ export default function AffiliateManagementPage() {
|
||||
<select
|
||||
value={categoryFilter}
|
||||
onChange={e => setCategoryFilter(e.target.value)}
|
||||
className="px-4 py-2.5 rounded-lg border border-gray-300 bg-white text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
className="w-full sm:w-auto px-4 py-2.5 rounded-lg border border-gray-300 bg-white text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
>
|
||||
{categories.map(cat => (
|
||||
<option key={cat} value={cat}>
|
||||
@ -181,7 +186,7 @@ export default function AffiliateManagementPage() {
|
||||
</header>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-6 mb-8">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4 md:gap-6 mb-6 md:mb-8">
|
||||
<div className="bg-white rounded-2xl border border-gray-100 shadow-lg p-6">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="rounded-lg bg-blue-50 p-3">
|
||||
@ -222,7 +227,7 @@ export default function AffiliateManagementPage() {
|
||||
</div>
|
||||
|
||||
{/* Affiliates Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 md:gap-6">
|
||||
{loading && (
|
||||
<div className="col-span-full text-center py-12">
|
||||
<div className="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-blue-600 border-r-transparent"></div>
|
||||
@ -544,155 +549,155 @@ function CreateAffiliateModal({ onClose, onCreate }: { onClose: () => void; onCr
|
||||
onCropComplete={handleCropComplete}
|
||||
/>
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
|
||||
<div className="relative w-full max-w-2xl mx-4 bg-white rounded-2xl shadow-2xl max-h-[90vh] overflow-y-auto">
|
||||
<div className="sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between rounded-t-2xl">
|
||||
<h2 className="text-2xl font-bold text-blue-900">Add New Affiliate</h2>
|
||||
<button onClick={onClose} className="text-gray-500 hover:text-gray-700 transition">
|
||||
<XMarkIcon className="h-6 w-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="p-6 space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Partner Name *</label>
|
||||
<input
|
||||
required
|
||||
value={name}
|
||||
onChange={e => setName(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="e.g., Coffee Equipment Co."
|
||||
/>
|
||||
<div className="relative w-full max-w-2xl mx-0 sm:mx-4 bg-white rounded-none sm:rounded-2xl shadow-2xl max-h-[100vh] sm:max-h-[90vh] overflow-y-auto">
|
||||
<div className="sticky top-0 bg-white border-b border-gray-200 px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between rounded-none sm:rounded-t-2xl">
|
||||
<h2 className="text-xl sm:text-2xl font-bold text-blue-900">Add New Affiliate</h2>
|
||||
<button onClick={onClose} className="text-gray-500 hover:text-gray-700 transition">
|
||||
<XMarkIcon className="h-6 w-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Description *</label>
|
||||
<textarea
|
||||
required
|
||||
value={description}
|
||||
onChange={e => setDescription(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="Brief description of the affiliate partner..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Affiliate URL *</label>
|
||||
<input
|
||||
required
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="https://example.com/affiliate-link"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Logo Image</label>
|
||||
<div
|
||||
className="relative flex justify-center items-center rounded-lg border-2 border-dashed border-gray-300 bg-gray-50 cursor-pointer overflow-hidden transition hover:border-blue-400 hover:bg-blue-100"
|
||||
style={{ minHeight: '200px' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
const input = document.getElementById('create-logo-upload') as HTMLInputElement
|
||||
if (input) input.click()
|
||||
}}
|
||||
>
|
||||
{!previewUrl && (
|
||||
<div className="text-center w-full px-6 py-10">
|
||||
<PhotoIcon aria-hidden="true" className="mx-auto h-12 w-12 text-gray-400" />
|
||||
<div className="mt-4 text-sm font-medium text-gray-700">
|
||||
<span>Click to upload logo</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-2">PNG, JPG, WebP, SVG up to 5MB</p>
|
||||
</div>
|
||||
)}
|
||||
{previewUrl && (
|
||||
<div className="relative w-full h-full min-h-[200px] flex items-center justify-center bg-white p-4">
|
||||
<img
|
||||
src={previewUrl}
|
||||
alt="Logo preview"
|
||||
className="max-h-[180px] max-w-full object-contain"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleRemoveLogo()
|
||||
}}
|
||||
className="absolute top-2 right-2 bg-red-50 hover:bg-red-100 text-red-700 px-3 py-1.5 rounded-lg text-sm font-medium shadow transition"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input
|
||||
id="create-logo-upload"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={handleLogoChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<form onSubmit={handleSubmit} className="p-4 sm:p-6 space-y-5 sm:space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Category *</label>
|
||||
<select
|
||||
value={category}
|
||||
onChange={e => setCategory(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
>
|
||||
{AFFILIATE_CATEGORIES.map(cat => (
|
||||
<option key={cat} value={cat}>{cat}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Commission Rate</label>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Partner Name *</label>
|
||||
<input
|
||||
value={commissionRate}
|
||||
onChange={e => setCommissionRate(e.target.value)}
|
||||
required
|
||||
value={name}
|
||||
onChange={e => setName(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="e.g., 10%"
|
||||
placeholder="e.g., Coffee Equipment Co."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
id="isActive"
|
||||
type="checkbox"
|
||||
checked={isActive}
|
||||
onChange={e => setIsActive(e.target.checked)}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-900 focus:ring-blue-900"
|
||||
/>
|
||||
<label htmlFor="isActive" className="text-sm font-medium text-gray-700">
|
||||
Active (visible to users)
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Description *</label>
|
||||
<textarea
|
||||
required
|
||||
value={description}
|
||||
onChange={e => setDescription(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="Brief description of the affiliate partner..."
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="px-5 py-2.5 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-5 py-2.5 text-sm font-semibold text-white bg-blue-900 rounded-lg hover:bg-blue-800 shadow transition"
|
||||
>
|
||||
Add Affiliate
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Affiliate URL *</label>
|
||||
<input
|
||||
required
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="https://example.com/affiliate-link"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Logo Image</label>
|
||||
<div
|
||||
className="relative flex justify-center items-center rounded-lg border-2 border-dashed border-gray-300 bg-gray-50 cursor-pointer overflow-hidden transition hover:border-blue-400 hover:bg-blue-100"
|
||||
style={{ minHeight: '200px' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
const input = document.getElementById('create-logo-upload') as HTMLInputElement
|
||||
if (input) input.click()
|
||||
}}
|
||||
>
|
||||
{!previewUrl && (
|
||||
<div className="text-center w-full px-6 py-10">
|
||||
<PhotoIcon aria-hidden="true" className="mx-auto h-12 w-12 text-gray-400" />
|
||||
<div className="mt-4 text-sm font-medium text-gray-700">
|
||||
<span>Click to upload logo</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-2">PNG, JPG, WebP, SVG up to 5MB</p>
|
||||
</div>
|
||||
)}
|
||||
{previewUrl && (
|
||||
<div className="relative w-full h-full min-h-[200px] flex items-center justify-center bg-white p-4">
|
||||
<img
|
||||
src={previewUrl}
|
||||
alt="Logo preview"
|
||||
className="max-h-[180px] max-w-full object-contain"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleRemoveLogo()
|
||||
}}
|
||||
className="absolute top-2 right-2 bg-red-50 hover:bg-red-100 text-red-700 px-3 py-1.5 rounded-lg text-sm font-medium shadow transition"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input
|
||||
id="create-logo-upload"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={handleLogoChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Category *</label>
|
||||
<select
|
||||
value={category}
|
||||
onChange={e => setCategory(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
>
|
||||
{AFFILIATE_CATEGORIES.map(cat => (
|
||||
<option key={cat} value={cat}>{cat}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Commission Rate</label>
|
||||
<input
|
||||
value={commissionRate}
|
||||
onChange={e => setCommissionRate(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
placeholder="e.g., 10%"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
id="isActive"
|
||||
type="checkbox"
|
||||
checked={isActive}
|
||||
onChange={e => setIsActive(e.target.checked)}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-900 focus:ring-blue-900"
|
||||
/>
|
||||
<label htmlFor="isActive" className="text-sm font-medium text-gray-700">
|
||||
Active (visible to users)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="px-5 py-2.5 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-5 py-2.5 text-sm font-semibold text-white bg-blue-900 rounded-lg hover:bg-blue-800 shadow transition"
|
||||
>
|
||||
Add Affiliate
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -808,154 +813,154 @@ function EditAffiliateModal({ affiliate, onClose, onUpdate }: {
|
||||
onCropComplete={handleCropComplete}
|
||||
/>
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
|
||||
<div className="relative w-full max-w-2xl mx-4 bg-white rounded-2xl shadow-2xl max-h-[90vh] overflow-y-auto">
|
||||
<div className="sticky top-0 bg-white border-b border-gray-200 px-6 py-4 flex items-center justify-between rounded-t-2xl">
|
||||
<h2 className="text-2xl font-bold text-blue-900">Edit Affiliate</h2>
|
||||
<button onClick={onClose} className="text-gray-500 hover:text-gray-700 transition">
|
||||
<XMarkIcon className="h-6 w-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="p-6 space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Partner Name *</label>
|
||||
<input
|
||||
required
|
||||
value={name}
|
||||
onChange={e => setName(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
<div className="relative w-full max-w-2xl mx-0 sm:mx-4 bg-white rounded-none sm:rounded-2xl shadow-2xl max-h-[100vh] sm:max-h-[90vh] overflow-y-auto">
|
||||
<div className="sticky top-0 bg-white border-b border-gray-200 px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between rounded-none sm:rounded-t-2xl">
|
||||
<h2 className="text-xl sm:text-2xl font-bold text-blue-900">Edit Affiliate</h2>
|
||||
<button onClick={onClose} className="text-gray-500 hover:text-gray-700 transition">
|
||||
<XMarkIcon className="h-6 w-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Description *</label>
|
||||
<textarea
|
||||
required
|
||||
value={description}
|
||||
onChange={e => setDescription(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Affiliate URL *</label>
|
||||
<input
|
||||
required
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Logo Image</label>
|
||||
<div
|
||||
className="relative flex justify-center items-center rounded-lg border-2 border-dashed border-gray-300 bg-gray-50 cursor-pointer overflow-hidden transition hover:border-blue-400 hover:bg-blue-100"
|
||||
style={{ minHeight: '200px' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
const input = document.getElementById('edit-logo-upload') as HTMLInputElement
|
||||
if (input) input.click()
|
||||
}}
|
||||
>
|
||||
{!displayLogoUrl && (
|
||||
<div className="text-center w-full px-6 py-10">
|
||||
<PhotoIcon aria-hidden="true" className="mx-auto h-12 w-12 text-gray-400" />
|
||||
<div className="mt-4 text-sm font-medium text-gray-700">
|
||||
<span>Click to upload logo</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-2">PNG, JPG, WebP, SVG up to 5MB</p>
|
||||
</div>
|
||||
)}
|
||||
{displayLogoUrl && (
|
||||
<div className="relative w-full h-full min-h-[200px] flex flex-col items-center justify-center bg-white p-4">
|
||||
<img
|
||||
src={displayLogoUrl}
|
||||
alt="Logo"
|
||||
className="max-h-[180px] max-w-full object-contain"
|
||||
/>
|
||||
<p className="mt-2 text-xs text-gray-600">
|
||||
{logoFile ? '🆕 New logo selected' : '📷 Current logo'}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleRemoveLogo()
|
||||
}}
|
||||
className="absolute top-2 right-2 bg-red-50 hover:bg-red-100 text-red-700 px-3 py-1.5 rounded-lg text-sm font-medium shadow transition"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input
|
||||
id="edit-logo-upload"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={handleLogoChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<form onSubmit={handleSubmit} className="p-4 sm:p-6 space-y-5 sm:space-y-6">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Category *</label>
|
||||
<select
|
||||
value={category}
|
||||
onChange={e => setCategory(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
>
|
||||
{AFFILIATE_CATEGORIES.map(cat => (
|
||||
<option key={cat} value={cat}>{cat}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Commission Rate</label>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Partner Name *</label>
|
||||
<input
|
||||
value={commissionRate}
|
||||
onChange={e => setCommissionRate(e.target.value)}
|
||||
required
|
||||
value={name}
|
||||
onChange={e => setName(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
id="editIsActive"
|
||||
type="checkbox"
|
||||
checked={isActive}
|
||||
onChange={e => setIsActive(e.target.checked)}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-900 focus:ring-blue-900"
|
||||
/>
|
||||
<label htmlFor="editIsActive" className="text-sm font-medium text-gray-700">
|
||||
Active (visible to users)
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Description *</label>
|
||||
<textarea
|
||||
required
|
||||
value={description}
|
||||
onChange={e => setDescription(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="px-5 py-2.5 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-5 py-2.5 text-sm font-semibold text-white bg-blue-900 rounded-lg hover:bg-blue-800 shadow transition"
|
||||
>
|
||||
Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Affiliate URL *</label>
|
||||
<input
|
||||
required
|
||||
type="url"
|
||||
value={url}
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Logo Image</label>
|
||||
<div
|
||||
className="relative flex justify-center items-center rounded-lg border-2 border-dashed border-gray-300 bg-gray-50 cursor-pointer overflow-hidden transition hover:border-blue-400 hover:bg-blue-100"
|
||||
style={{ minHeight: '200px' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
const input = document.getElementById('edit-logo-upload') as HTMLInputElement
|
||||
if (input) input.click()
|
||||
}}
|
||||
>
|
||||
{!displayLogoUrl && (
|
||||
<div className="text-center w-full px-6 py-10">
|
||||
<PhotoIcon aria-hidden="true" className="mx-auto h-12 w-12 text-gray-400" />
|
||||
<div className="mt-4 text-sm font-medium text-gray-700">
|
||||
<span>Click to upload logo</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-2">PNG, JPG, WebP, SVG up to 5MB</p>
|
||||
</div>
|
||||
)}
|
||||
{displayLogoUrl && (
|
||||
<div className="relative w-full h-full min-h-[200px] flex flex-col items-center justify-center bg-white p-4">
|
||||
<img
|
||||
src={displayLogoUrl}
|
||||
alt="Logo"
|
||||
className="max-h-[180px] max-w-full object-contain"
|
||||
/>
|
||||
<p className="mt-2 text-xs text-gray-600">
|
||||
{logoFile ? '🆕 New logo selected' : '📷 Current logo'}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
handleRemoveLogo()
|
||||
}}
|
||||
className="absolute top-2 right-2 bg-red-50 hover:bg-red-100 text-red-700 px-3 py-1.5 rounded-lg text-sm font-medium shadow transition"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input
|
||||
id="edit-logo-upload"
|
||||
type="file"
|
||||
accept="image/*"
|
||||
onChange={handleLogoChange}
|
||||
className="hidden"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Category *</label>
|
||||
<select
|
||||
value={category}
|
||||
onChange={e => setCategory(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
>
|
||||
{AFFILIATE_CATEGORIES.map(cat => (
|
||||
<option key={cat} value={cat}>{cat}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-blue-900 mb-2">Commission Rate</label>
|
||||
<input
|
||||
value={commissionRate}
|
||||
onChange={e => setCommissionRate(e.target.value)}
|
||||
className="w-full rounded-lg border border-gray-300 px-4 py-3 text-gray-900 focus:ring-2 focus:ring-blue-900 focus:border-transparent"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<input
|
||||
id="editIsActive"
|
||||
type="checkbox"
|
||||
checked={isActive}
|
||||
onChange={e => setIsActive(e.target.checked)}
|
||||
className="h-4 w-4 rounded border-gray-300 text-blue-900 focus:ring-blue-900"
|
||||
/>
|
||||
<label htmlFor="editIsActive" className="text-sm font-medium text-gray-700">
|
||||
Active (visible to users)
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-end gap-3 pt-4 border-t border-gray-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
className="px-5 py-2.5 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-5 py-2.5 text-sm font-semibold text-white bg-blue-900 rounded-lg hover:bg-blue-800 shadow transition"
|
||||
>
|
||||
Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -969,7 +974,7 @@ function DeleteConfirmModal({ affiliateName, onClose, onConfirm, isDeleting }: {
|
||||
}) {
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm">
|
||||
<div className="relative w-full max-w-md mx-4 bg-white rounded-2xl shadow-2xl p-6">
|
||||
<div className="relative w-full max-w-md mx-0 sm:mx-4 bg-white rounded-none sm:rounded-2xl shadow-2xl p-4 sm:p-6">
|
||||
<div className="mb-4">
|
||||
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-red-100">
|
||||
<TrashIcon className="h-6 w-6 text-red-600" />
|
||||
@ -980,7 +985,7 @@ function DeleteConfirmModal({ affiliateName, onClose, onConfirm, isDeleting }: {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex flex-col sm:flex-row items-stretch sm:items-center gap-3">
|
||||
<button
|
||||
onClick={onClose}
|
||||
disabled={isDeleting}
|
||||
|
||||
@ -48,36 +48,40 @@ export default function ContractManagementPage() {
|
||||
return (
|
||||
<PageLayout>
|
||||
<div className="bg-gradient-to-tr from-blue-50 via-white to-blue-100 min-h-screen">
|
||||
<div className="flex flex-col md:flex-row max-w-7xl mx-auto px-2 sm:px-6 lg:px-8 py-8 gap-8">
|
||||
{/* Sidebar Navigation */}
|
||||
<nav className="md:w-56 w-full flex md:flex-col flex-row gap-2 md:gap-4">
|
||||
{NAV.map((item) => (
|
||||
<button
|
||||
key={item.key}
|
||||
onClick={() => setSection(item.key)}
|
||||
className={`flex items-center gap-2 px-4 py-2 rounded-lg font-medium transition
|
||||
${section === item.key
|
||||
? 'bg-blue-900 text-blue-50 shadow'
|
||||
: 'bg-white text-blue-900 hover:bg-blue-50 hover:text-blue-900 border border-blue-200'}`}
|
||||
>
|
||||
{item.icon}
|
||||
<span>{item.label}</span>
|
||||
</button>
|
||||
))}
|
||||
{/* tighter horizontal padding on mobile */}
|
||||
<div className="flex flex-col md:flex-row max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 md:py-8 gap-6 md:gap-8">
|
||||
{/* Sidebar Navigation (mobile = horizontal scroll tabs, desktop = vertical) */}
|
||||
<nav className="md:w-56 w-full md:self-start md:sticky md:top-6">
|
||||
<div className="flex md:flex-col flex-row gap-2 md:gap-3 overflow-x-auto md:overflow-visible -mx-4 px-4 md:mx-0 md:px-0 pb-2 md:pb-0">
|
||||
{NAV.map((item) => (
|
||||
<button
|
||||
key={item.key}
|
||||
onClick={() => setSection(item.key)}
|
||||
className={`flex flex-shrink-0 items-center gap-2 px-4 py-2 rounded-lg font-medium transition whitespace-nowrap text-sm md:text-base
|
||||
${section === item.key
|
||||
? 'bg-blue-900 text-blue-50 shadow'
|
||||
: 'bg-white text-blue-900 hover:bg-blue-50 hover:text-blue-900 border border-blue-200'}`}
|
||||
>
|
||||
{item.icon}
|
||||
<span>{item.label}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{/* Main Content */}
|
||||
<main className="flex-1 space-y-8">
|
||||
<header className="sticky top-0 z-10 bg-white/90 backdrop-blur border-b border-blue-100 py-10 px-8 rounded-2xl shadow-lg flex flex-col gap-4 mb-4">
|
||||
<h1 className="text-4xl font-extrabold text-blue-900 tracking-tight">Contract Management</h1>
|
||||
<p className="text-lg text-blue-700">
|
||||
<main className="flex-1 space-y-6 md:space-y-8">
|
||||
{/* sticky only on md+; smaller padding/title on mobile */}
|
||||
<header className="md:sticky md:top-0 z-10 bg-white/90 backdrop-blur border-b border-blue-100 py-5 px-4 md:py-10 md:px-8 rounded-2xl shadow-lg flex flex-col gap-3 md:gap-4 mb-2 md:mb-4">
|
||||
<h1 className="text-2xl md:text-4xl font-extrabold text-blue-900 tracking-tight">Contract Management</h1>
|
||||
<p className="text-sm md:text-lg text-blue-700">
|
||||
Manage contract templates, company stamp, and create new templates.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
{/* Section Panels */}
|
||||
{/* Section Panels (compact padding on mobile) */}
|
||||
{section === 'stamp' && (
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-6">
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-4 md:p-6">
|
||||
<h2 className="text-xl font-semibold text-blue-900 mb-4 flex items-center gap-2">
|
||||
<svg className="w-6 h-6" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="10"/><path d="M12 8v4l3 3"/></svg>
|
||||
Company Stamp
|
||||
@ -86,7 +90,7 @@ export default function ContractManagementPage() {
|
||||
</section>
|
||||
)}
|
||||
{section === 'templates' && (
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-6">
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-4 md:p-6">
|
||||
<h2 className="text-xl font-semibold text-blue-900 mb-4 flex items-center gap-2">
|
||||
<svg className="w-6 h-6" fill="none" stroke="currentColor"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
|
||||
Templates
|
||||
@ -101,7 +105,7 @@ export default function ContractManagementPage() {
|
||||
</section>
|
||||
)}
|
||||
{section === 'editor' && (
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-6">
|
||||
<section className="rounded-2xl bg-white shadow-lg border border-gray-100 p-4 md:p-6">
|
||||
<h2 className="text-xl font-semibold text-blue-900 mb-4 flex items-center gap-2">
|
||||
<svg className="w-6 h-6" fill="none" stroke="currentColor"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 113 3L7 19l-4 1 1-4 12.5-12.5z"/></svg>
|
||||
Create Template
|
||||
|
||||
@ -85,20 +85,25 @@ export default function DevManagementPage() {
|
||||
<PageTransitionEffect>
|
||||
<div className="min-h-screen flex flex-col bg-gradient-to-br from-slate-50 via-white to-blue-50">
|
||||
<Header />
|
||||
<main className="flex-1 py-8 px-4 sm:px-6 lg:px-8">
|
||||
{/* tighter padding on mobile */}
|
||||
<main className="flex-1 py-6 md:py-8 px-4 sm:px-6 lg:px-8">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<header className="bg-white/90 backdrop-blur border border-blue-100 py-8 px-6 rounded-2xl shadow-lg flex flex-col gap-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="h-12 w-12 rounded-xl bg-blue-100 border border-blue-200 flex items-center justify-center">
|
||||
<header className="bg-white/90 backdrop-blur border border-blue-100 py-6 md:py-8 px-4 sm:px-6 rounded-2xl shadow-lg flex flex-col gap-4">
|
||||
{/* stack on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-3">
|
||||
<div className="h-11 w-11 sm:h-12 sm:w-12 rounded-xl bg-blue-100 border border-blue-200 flex items-center justify-center flex-shrink-0">
|
||||
<CommandLineIcon className="h-6 w-6 text-blue-700" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-3xl font-extrabold text-blue-900">Dev Management</h1>
|
||||
<p className="text-blue-700">Import SQL dump files to run database migrations.</p>
|
||||
<div className="min-w-0">
|
||||
<h1 className="text-2xl sm:text-3xl font-extrabold text-blue-900">Dev Management</h1>
|
||||
<p className="text-sm sm:text-base text-blue-700">
|
||||
Import SQL dump files to run database migrations.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800 flex items-start gap-2">
|
||||
<ExclamationTriangleIcon className="h-5 w-5 mt-0.5" />
|
||||
<ExclamationTriangleIcon className="h-5 w-5 mt-0.5 flex-shrink-0" />
|
||||
<div>
|
||||
<div className="font-semibold">Use with caution</div>
|
||||
<div>SQL dumps run immediately and can modify production data.</div>
|
||||
@ -106,41 +111,52 @@ export default function DevManagementPage() {
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section className="mt-8 grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<div className="lg:col-span-2 rounded-2xl bg-white border border-gray-100 shadow-lg p-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<section className="mt-6 md:mt-8 grid grid-cols-1 lg:grid-cols-3 gap-4 md:gap-6">
|
||||
<div className="lg:col-span-2 rounded-2xl bg-white border border-gray-100 shadow-lg p-4 md:p-6">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4">
|
||||
<h2 className="text-lg font-semibold text-blue-900">SQL Dump Import</h2>
|
||||
<div className="flex items-center gap-3">
|
||||
|
||||
{/* actions: stack on mobile, full width */}
|
||||
<div className="flex flex-col sm:flex-row sm:flex-wrap items-stretch sm:items-center gap-2 sm:gap-3">
|
||||
<button
|
||||
onClick={() => fileInputRef.current?.click()}
|
||||
className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"
|
||||
>
|
||||
<ArrowUpTrayIcon className="h-4 w-4" /> Import SQL
|
||||
</button>
|
||||
<button
|
||||
onClick={clearResults}
|
||||
className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-700 hover:bg-gray-50"
|
||||
>
|
||||
<TrashIcon className="h-4 w-4" /> Clear
|
||||
</button>
|
||||
<button
|
||||
onClick={runImport}
|
||||
disabled={loading}
|
||||
className="inline-flex items-center gap-2 rounded-lg bg-blue-900 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-800 disabled:opacity-60"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center gap-2 rounded-lg bg-blue-900 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-800 disabled:opacity-60"
|
||||
>
|
||||
<PlayIcon className="h-4 w-4" /> {loading ? 'Importing...' : 'Import'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="rounded-xl border border-dashed border-gray-200 bg-slate-50 px-6 py-10 text-center">
|
||||
<div className="rounded-xl border border-dashed border-gray-200 bg-slate-50 px-4 sm:px-6 py-8 sm:py-10 text-center">
|
||||
<div className="text-sm text-gray-600">Select a .sql dump file using Import SQL.</div>
|
||||
<div className="mt-2 text-xs text-gray-500">Only SQL dump files are supported.</div>
|
||||
{selectedFile && (
|
||||
<div className="mt-4 text-sm text-blue-900 font-semibold">Selected: {selectedFile.name}</div>
|
||||
<div className="mt-4 text-sm text-blue-900 font-semibold break-words">
|
||||
Selected: {selectedFile.name}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input ref={fileInputRef} type="file" accept=".sql,text/plain" className="hidden" onChange={onImportFile} />
|
||||
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".sql,text/plain"
|
||||
className="hidden"
|
||||
onChange={onImportFile}
|
||||
/>
|
||||
|
||||
{error && (
|
||||
<div className="mt-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700">
|
||||
@ -149,7 +165,7 @@ export default function DevManagementPage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="rounded-2xl bg-white border border-gray-100 shadow-lg p-6">
|
||||
<div className="rounded-2xl bg-white border border-gray-100 shadow-lg p-4 md:p-6">
|
||||
<h3 className="text-lg font-semibold text-blue-900 mb-3">Result Summary</h3>
|
||||
<div className="space-y-2 text-sm text-gray-700">
|
||||
<div className="flex justify-between">
|
||||
@ -173,7 +189,7 @@ export default function DevManagementPage() {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="mt-8 rounded-2xl bg-white border border-gray-100 shadow-lg p-6">
|
||||
<section className="mt-6 md:mt-8 rounded-2xl bg-white border border-gray-100 shadow-lg p-4 md:p-6">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<h2 className="text-lg font-semibold text-blue-900">Import Results</h2>
|
||||
</div>
|
||||
@ -183,7 +199,7 @@ export default function DevManagementPage() {
|
||||
)}
|
||||
|
||||
{result?.result && (
|
||||
<pre className="mt-2 rounded-lg bg-slate-50 border border-gray-200 p-4 text-xs text-gray-800 overflow-auto">
|
||||
<pre className="mt-2 rounded-lg bg-slate-50 border border-gray-200 p-3 md:p-4 text-xs text-gray-800 overflow-auto">
|
||||
{JSON.stringify(result.result, null, 2)}
|
||||
</pre>
|
||||
)}
|
||||
|
||||
@ -347,12 +347,14 @@ export default function CompanySignContractPage() {
|
||||
<div className="absolute inset-0 bg-[radial-gradient(circle_at_top,_rgba(59,130,246,0.14),transparent_60%)]" />
|
||||
</div>
|
||||
|
||||
<main className="relative z-10 flex flex-col flex-1 w-full px-5 sm:px-8 lg:px-12 py-12">
|
||||
{/* CHANGED: tighter padding on mobile */}
|
||||
<main className="relative z-10 flex flex-col flex-1 w-full px-4 sm:px-8 lg:px-12 py-6 sm:py-10 lg:py-12">
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="relative max-w-5xl w-full mx-auto bg-white rounded-2xl shadow-xl ring-1 ring-black/10"
|
||||
>
|
||||
<div className="px-6 py-8 sm:px-10 lg:px-14">
|
||||
{/* CHANGED: tighter padding on mobile */}
|
||||
<div className="px-4 py-6 sm:px-10 sm:py-8 lg:px-14">
|
||||
<h1 className="text-center text-2xl sm:text-3xl font-semibold text-[#0F172A] mb-2">
|
||||
Sign Company Partnership Contract
|
||||
</h1>
|
||||
@ -360,18 +362,21 @@ export default function CompanySignContractPage() {
|
||||
Please review the contract details and sign on behalf of the company.
|
||||
</p>
|
||||
|
||||
<section className="grid gap-8 lg:grid-cols-2 mb-10">
|
||||
{/* CHANGED: smaller gaps on mobile */}
|
||||
<section className="grid gap-6 sm:gap-8 lg:grid-cols-2 mb-8 sm:mb-10">
|
||||
<div className="space-y-4">
|
||||
<div className="rounded-lg border border-gray-200 p-5 bg-gray-50">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
{/* CHANGED: tighter padding */}
|
||||
<div className="rounded-lg border border-gray-200 p-4 sm:p-5 bg-gray-50">
|
||||
{/* CHANGED: stack header + tabs on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-3">
|
||||
<h2 className="text-sm font-semibold text-gray-800">Document Information</h2>
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1">
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1 w-fit max-w-full overflow-x-auto">
|
||||
{(['contract','gdpr'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab)}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition whitespace-nowrap ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
>
|
||||
{tab === 'contract' ? 'Contract' : 'GDPR'}
|
||||
</button>
|
||||
@ -411,32 +416,37 @@ export default function CompanySignContractPage() {
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
<div className="rounded-lg border border-amber-200 bg-amber-50 p-5">
|
||||
{/* CHANGED: tighter padding */}
|
||||
<div className="rounded-lg border border-amber-200 bg-amber-50 p-4 sm:p-5">
|
||||
<h3 className="text-sm font-semibold text-amber-900 mb-2">Attention</h3>
|
||||
<p className="text-xs sm:text-sm text-amber-800 leading-relaxed">
|
||||
You confirm that you are authorized to sign on behalf of the company.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div className="rounded-lg border border-gray-200 bg-white relative overflow-hidden">
|
||||
<div className="flex items-center justify-between p-3 border-b border-gray-200 bg-gray-50">
|
||||
<div className="flex items-center gap-2 text-sm font-semibold text-gray-900">
|
||||
{/* CHANGED: stack toolbar on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-3 border-b border-gray-200 bg-gray-50">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-2 text-sm font-semibold text-gray-900">
|
||||
<span>Document Preview</span>
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1">
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1 w-fit max-w-full overflow-x-auto">
|
||||
{(['contract','gdpr'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab)}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition whitespace-nowrap ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
>
|
||||
{tab === 'contract' ? 'Contract' : 'GDPR'}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
{/* CHANGED: buttons wrap + full width on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
@ -447,7 +457,7 @@ export default function CompanySignContractPage() {
|
||||
window.open(url, '_blank', 'noopener,noreferrer')
|
||||
}}
|
||||
disabled={!previewState[activeTab]?.html}
|
||||
className="inline-flex items-center rounded-md bg-gray-100 hover:bg-gray-200 text-gray-900 px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 text-gray-900 px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
>
|
||||
Open in new tab
|
||||
</button>
|
||||
@ -455,20 +465,22 @@ export default function CompanySignContractPage() {
|
||||
type="button"
|
||||
onClick={() => loadPreview(activeTab)}
|
||||
disabled={previewState[activeTab].loading}
|
||||
className="inline-flex items-center rounded-md bg-indigo-600 hover:bg-indigo-500 text-white px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md bg-indigo-600 hover:bg-indigo-500 text-white px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
>
|
||||
{previewState[activeTab].loading ? 'Loading…' : 'Refresh'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* CHANGED: shorter on mobile */}
|
||||
{previewLoading || previewState[activeTab].loading ? (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-gray-500">Loading preview…</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-gray-500">Loading preview…</div>
|
||||
) : previewState[activeTab].error ? (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-red-600 px-4 text-center">{previewState[activeTab].error}</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-red-600 px-4 text-center">{previewState[activeTab].error}</div>
|
||||
) : previewState[activeTab].html ? (
|
||||
<iframe title={`Company Document Preview ${activeTab}`} className="w-full h-72" srcDoc={previewState[activeTab].html || ''} />
|
||||
<iframe title={`Company Document Preview ${activeTab}`} className="w-full h-64 sm:h-72" srcDoc={previewState[activeTab].html || ''} />
|
||||
) : (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-gray-500">No contract available at this moment, please contact us.</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-gray-500">No contract available at this moment, please contact us.</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@ -488,7 +500,7 @@ export default function CompanySignContractPage() {
|
||||
ref={canvasRef}
|
||||
width={800}
|
||||
height={220}
|
||||
className="w-full h-48 rounded-md border border-gray-200 bg-white shadow-inner touch-none"
|
||||
className="w-full h-40 sm:h-48 rounded-md border border-gray-200 bg-white shadow-inner touch-none"
|
||||
onMouseDown={startDrawing}
|
||||
onMouseMove={draw}
|
||||
onMouseUp={endDrawing}
|
||||
@ -497,11 +509,12 @@ export default function CompanySignContractPage() {
|
||||
onTouchMove={draw}
|
||||
onTouchEnd={endDrawing}
|
||||
/>
|
||||
<div className="mt-3 flex items-center gap-3 text-xs text-gray-600">
|
||||
{/* CHANGED: stack helper row on mobile */}
|
||||
<div className="mt-3 flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 text-xs text-gray-600">
|
||||
<button
|
||||
type="button"
|
||||
onClick={clearSignature}
|
||||
className="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50"
|
||||
className="inline-flex items-center justify-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
@ -556,18 +569,19 @@ export default function CompanySignContractPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-10 flex items-center justify-between">
|
||||
{/* CHANGED: stack bottom actions on mobile */}
|
||||
<div className="mt-10 flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => router.push('/quickaction-dashboard')}
|
||||
className="inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 bg-white hover:bg-gray-50"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 bg-white hover:bg-gray-50"
|
||||
>
|
||||
Back to Dashboard
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={submitting || success || (!previewState.contract.html && !previewState.gdpr.html)}
|
||||
className="inline-flex items-center justify-center rounded-md bg-indigo-600 px-8 py-3 text-sm font-semibold text-white shadow hover:bg-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed transition"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md bg-indigo-600 px-8 py-3 text-sm font-semibold text-white shadow hover:bg-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed transition"
|
||||
>
|
||||
{submitting ? 'Signing…' : success ? 'Signed' : 'Sign Now'}
|
||||
</button>
|
||||
|
||||
@ -356,12 +356,14 @@ export default function PersonalSignContractPage() {
|
||||
<div className="absolute inset-0 bg-[radial-gradient(circle_at_top,_rgba(59,130,246,0.14),transparent_60%)]" />
|
||||
</div>
|
||||
|
||||
<main className="relative z-10 flex flex-col flex-1 w-full px-5 sm:px-8 lg:px-12 py-12">
|
||||
{/* CHANGED: tighter padding on mobile */}
|
||||
<main className="relative z-10 flex flex-col flex-1 w-full px-4 sm:px-8 lg:px-12 py-6 sm:py-10 lg:py-12">
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="relative max-w-5xl w-full mx-auto bg-white rounded-2xl shadow-xl ring-1 ring-black/10"
|
||||
>
|
||||
<div className="px-6 py-8 sm:px-10 lg:px-14">
|
||||
{/* CHANGED: tighter padding on mobile */}
|
||||
<div className="px-4 py-6 sm:px-10 sm:py-8 lg:px-14">
|
||||
<h1 className="text-center text-2xl sm:text-3xl font-semibold text-[#0F172A] mb-2">
|
||||
Sign Personal Participation Contract
|
||||
</h1>
|
||||
@ -370,18 +372,20 @@ export default function PersonalSignContractPage() {
|
||||
</p>
|
||||
|
||||
{/* Contract Meta + Preview */}
|
||||
<section className="grid gap-8 lg:grid-cols-2 mb-10">
|
||||
<section className="grid gap-6 sm:gap-8 lg:grid-cols-2 mb-8 sm:mb-10">
|
||||
<div className="space-y-4">
|
||||
<div className="rounded-lg border border-gray-200 p-5 bg-gray-50">
|
||||
<div className="flex items-center justify-between mb-3">
|
||||
{/* CHANGED: tighter padding */}
|
||||
<div className="rounded-lg border border-gray-200 p-4 sm:p-5 bg-gray-50">
|
||||
{/* CHANGED: stack header + tabs on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 mb-3">
|
||||
<h2 className="text-sm font-semibold text-gray-800">Document Information</h2>
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1">
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1 w-fit max-w-full overflow-x-auto">
|
||||
{(['contract','gdpr'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab)}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition whitespace-nowrap ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
>
|
||||
{tab === 'contract' ? 'Contract' : 'GDPR'}
|
||||
</button>
|
||||
@ -421,7 +425,8 @@ export default function PersonalSignContractPage() {
|
||||
)
|
||||
})()}
|
||||
</div>
|
||||
<div className="rounded-lg border border-indigo-100 bg-indigo-50/60 p-5">
|
||||
{/* CHANGED: tighter padding */}
|
||||
<div className="rounded-lg border border-indigo-100 bg-indigo-50/60 p-4 sm:p-5">
|
||||
<h3 className="text-sm font-semibold text-indigo-900 mb-2">Note</h3>
|
||||
<p className="text-xs sm:text-sm text-indigo-800 leading-relaxed">
|
||||
Your electronic signature is legally binding. Please ensure all details are correct.
|
||||
@ -430,23 +435,26 @@ export default function PersonalSignContractPage() {
|
||||
</div>
|
||||
<div>
|
||||
<div className="rounded-lg border border-gray-200 bg-white relative overflow-hidden">
|
||||
<div className="flex items-center justify-between p-3 border-b border-gray-200 bg-gray-50">
|
||||
<div className="flex items-center gap-2 text-sm font-semibold text-gray-900">
|
||||
{/* CHANGED: stack toolbar on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 p-3 border-b border-gray-200 bg-gray-50">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-2 text-sm font-semibold text-gray-900">
|
||||
<span>Contract Preview</span>
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1">
|
||||
<div className="flex items-center gap-1 rounded-full border border-gray-200 bg-white px-1 w-fit max-w-full overflow-x-auto">
|
||||
{(['contract','gdpr'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
onClick={() => setActiveTab(tab)}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
className={`px-2.5 py-1 text-xs rounded-full transition whitespace-nowrap ${activeTab === tab ? 'bg-indigo-600 text-white shadow' : 'text-gray-700 hover:bg-gray-100'}`}
|
||||
>
|
||||
{tab === 'contract' ? 'Contract' : 'GDPR'}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
{/* CHANGED: button full width on mobile */}
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
@ -457,20 +465,22 @@ export default function PersonalSignContractPage() {
|
||||
window.open(url, '_blank', 'noopener,noreferrer')
|
||||
}}
|
||||
disabled={!previewState[activeTab]?.html}
|
||||
className="inline-flex items-center rounded-md bg-gray-100 hover:bg-gray-200 text-gray-900 px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md bg-gray-100 hover:bg-gray-200 text-gray-900 px-2.5 py-1.5 text-xs disabled:opacity-60"
|
||||
>
|
||||
Open in new tab
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* CHANGED: shorter on mobile */}
|
||||
{previewLoading || previewState[activeTab].loading ? (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-gray-500">Loading preview…</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-gray-500">Loading preview…</div>
|
||||
) : previewState[activeTab].error ? (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-red-600 px-4 text-center">{previewState[activeTab].error}</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-red-600 px-4 text-center">{previewState[activeTab].error}</div>
|
||||
) : previewState[activeTab].html ? (
|
||||
<iframe title={`Contract Preview ${activeTab}`} className="w-full h-72" srcDoc={previewState[activeTab].html || ''} />
|
||||
<iframe title={`Contract Preview ${activeTab}`} className="w-full h-64 sm:h-72" srcDoc={previewState[activeTab].html || ''} />
|
||||
) : (
|
||||
<div className="h-72 flex items-center justify-center text-xs text-gray-500">No contract available at this moment, please contact us.</div>
|
||||
<div className="h-64 sm:h-72 flex items-center justify-center text-xs text-gray-500">No contract available at this moment, please contact us.</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@ -491,7 +501,7 @@ export default function PersonalSignContractPage() {
|
||||
ref={canvasRef}
|
||||
width={800}
|
||||
height={220}
|
||||
className="w-full h-48 rounded-md border border-gray-200 bg-white shadow-inner touch-none"
|
||||
className="w-full h-40 sm:h-48 rounded-md border border-gray-200 bg-white shadow-inner touch-none"
|
||||
onMouseDown={startDrawing}
|
||||
onMouseMove={draw}
|
||||
onMouseUp={endDrawing}
|
||||
@ -500,11 +510,12 @@ export default function PersonalSignContractPage() {
|
||||
onTouchMove={draw}
|
||||
onTouchEnd={endDrawing}
|
||||
/>
|
||||
<div className="mt-3 flex items-center gap-3 text-xs text-gray-600">
|
||||
{/* CHANGED: stack helper row on mobile */}
|
||||
<div className="mt-3 flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 text-xs text-gray-600">
|
||||
<button
|
||||
type="button"
|
||||
onClick={clearSignature}
|
||||
className="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50"
|
||||
className="inline-flex items-center justify-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 hover:bg-gray-50"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
@ -560,18 +571,19 @@ export default function PersonalSignContractPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-10 flex items-center justify-between">
|
||||
{/* CHANGED: stack bottom actions on mobile */}
|
||||
<div className="mt-10 flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => router.push('/quickaction-dashboard')}
|
||||
className="inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 bg-white hover:bg-gray-50"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 bg-white hover:bg-gray-50"
|
||||
>
|
||||
Back to Dashboard
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={submitting || success || (!previewState.contract.html && !previewState.gdpr.html)}
|
||||
className="inline-flex items-center justify-center rounded-md bg-indigo-600 px-8 py-3 text-sm font-semibold text-white shadow hover:bg-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed transition"
|
||||
className="w-full sm:w-auto inline-flex items-center justify-center rounded-md bg-indigo-600 px-8 py-3 text-sm font-semibold text-white shadow hover:bg-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed transition"
|
||||
>
|
||||
{submitting ? 'Signing…' : success ? 'Signed' : 'Sign Now'}
|
||||
</button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user