%PDF- %PDF-
| Direktori : /home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/ |
| Current File : //home2/rezakur1/muakita.rezakurnia.com/Mua-Kita-Web/src/components/AddTenantModal.tsx |
import React from 'react';
import { X, Building2, Globe, Crown } from 'lucide-react';
interface AddTenantModalProps {
isOpen: boolean;
onClose: () => void;
onSubmit: (e: React.FormEvent) => void;
tenantName: string;
setTenantName: (val: string) => void;
tenantDomain: string;
setTenantDomain: (val: string) => void;
tenantPackage: 'Enterprise' | 'Pro' | 'Basic';
setTenantPackage: (val: 'Enterprise' | 'Pro' | 'Basic') => void;
}
export const AddTenantModal: React.FC<AddTenantModalProps> = ({
isOpen,
onClose,
onSubmit,
tenantName,
setTenantName,
tenantDomain,
setTenantDomain,
tenantPackage,
setTenantPackage
}) => {
if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 bg-slate-900/50 backdrop-blur-xs flex items-center justify-center p-4">
<div className="bg-white rounded-2xl max-w-md w-full border border-slate-200 shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 duration-200">
<div className="p-4 border-b border-slate-100 flex items-center justify-between">
<div className="flex items-center gap-2">
<div className="w-8 h-8 rounded-xl bg-pink-100 text-[#EC167F] flex items-center justify-center font-bold">
<Building2 className="w-4 h-4" />
</div>
<div>
<h3 className="text-sm font-extrabold text-slate-900">Tambah Tenant Baru</h3>
<p className="text-[11px] text-slate-500">Daftarkan bisnis MUA/Studio baru ke platform</p>
</div>
</div>
<button
onClick={onClose}
className="p-1 text-slate-400 hover:text-slate-600 rounded-lg hover:bg-slate-100 transition-colors"
>
<X className="w-4 h-4" />
</button>
</div>
<form onSubmit={onSubmit} className="p-4 space-y-3">
<div>
<label className="block text-xs font-bold text-slate-700 mb-1">Nama Tenant / Studio</label>
<input
type="text"
placeholder="Contoh: Bella Beauty Studio"
value={tenantName}
onChange={(e) => setTenantName(e.target.value)}
className="w-full px-3 py-2 bg-slate-50 border border-slate-200 rounded-xl text-xs focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
required
/>
</div>
<div>
<label className="block text-xs font-bold text-slate-700 mb-1">Subdomain Kustom</label>
<div className="flex items-center">
<input
type="text"
placeholder="bellabeauty"
value={tenantDomain}
onChange={(e) => setTenantDomain(e.target.value)}
className="flex-1 px-3 py-2 bg-slate-50 border border-r-0 border-slate-200 rounded-l-xl text-xs focus:bg-white focus:outline-none focus:ring-2 focus:ring-pink-500/20"
/>
<span className="px-3 py-2 bg-slate-100 border border-slate-200 rounded-r-xl text-xs text-slate-500 font-mono">
.muakita.com
</span>
</div>
</div>
<div>
<label className="block text-xs font-bold text-slate-700 mb-1">Pilih Paket</label>
<div className="grid grid-cols-3 gap-2">
{(['Basic', 'Pro', 'Enterprise'] as const).map(p => (
<button
type="button"
key={p}
onClick={() => setTenantPackage(p)}
className={`py-2 px-2 rounded-xl text-xs font-bold border transition-all text-center ${
tenantPackage === p
? 'bg-pink-50 border-[#EC167F] text-[#EC167F] shadow-2xs'
: 'border-slate-200 text-slate-600 hover:bg-slate-50'
}`}
>
{p}
</button>
))}
</div>
</div>
<div className="pt-2 flex justify-end gap-2">
<button
type="button"
onClick={onClose}
className="px-4 py-2 text-xs font-bold text-slate-600 hover:bg-slate-100 rounded-xl transition-colors"
>
Batal
</button>
<button
type="submit"
className="px-4 py-2 text-xs font-bold text-white bg-[#EC167F] hover:bg-[#D41270] rounded-xl shadow-xs transition-colors"
>
Simpan Tenant
</button>
</div>
</form>
</div>
</div>
);
};