import { defineField, defineType } from "sanity"; import { Handshake } from "lucide-react"; export default defineType({ name: "partnershipInquiry", title: "Partnership Inquiries", type: "document", icon: Handshake, readOnly: false, fields: [ defineField({ name: "status", title: "Proposal Status", type: "string", initialValue: "new", options: { list: [ { title: "🟡 New (Chưa liên hệ)", value: "new" }, { title: "🔵 Contacted (Đã phản hồi)", value: "contacted" }, { title: "🟣 Negotiating (Đang trao đổi hợp tác)", value: "negotiating" }, { title: "⚪ Archived (Lưu trữ)", value: "archived" }, ], layout: "radio", }, }), defineField({ name: "entityName", title: "Entity / Agency Name", type: "string", validation: (Rule) => Rule.required(), }), defineField({ name: "contactEmail", title: "Corporate Email Address", type: "string", validation: (Rule) => Rule.required().email(), }), defineField({ name: "contactPhone", title: "Phone / WhatsApp", type: "string", }), defineField({ name: "partnershipTier", title: "Partnership Tier / Model", type: "string", }), defineField({ name: "includeUHNW", title: "Include UHNW Advisory Add-on", type: "boolean", initialValue: false, }), defineField({ name: "vision", title: "Operational Capability & Vision", type: "text", rows: 4, }), defineField({ name: "internalNotes", title: "Internal Advisory Notes (Private)", type: "text", description: "Ghi chú nội bộ của Nhi Võ về tiến trình trao đổi đối tác.", rows: 3, }), defineField({ name: "submittedAt", title: "Submitted At", type: "datetime", initialValue: () => new Date().toISOString(), }), ], orderings: [ { title: "Submission Date, Newest", name: "submittedAtDesc", by: [{ field: "submittedAt", direction: "desc" }], }, ], preview: { select: { title: "entityName", status: "status", tier: "partnershipTier", uhnw: "includeUHNW", date: "submittedAt", }, prepare({ title, status, tier, uhnw }) { const statusIcons: Record = { new: "🟡 NEW", contacted: "🔵 CONTACTED", negotiating: "🟣 NEGOTIATING", archived: "⚪ ARCHIVED", }; const label = statusIcons[status || "new"] || "🟡 NEW"; const subtitle = [tier, uhnw ? "✦ UHNW Add-on" : ""].filter(Boolean).join(" • "); return { title: `${title || "Unnamed Entity"} [${label}]`, subtitle: subtitle || "No tier selected", }; }, }, });