Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1ed8f803b | ||
|
|
f4358eb00b | ||
|
|
e3c8f980f7 |
@@ -17,10 +17,12 @@
|
|||||||
"bcryptjs": "^3.0.3",
|
"bcryptjs": "^3.0.3",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"cn": "^0.2.6",
|
||||||
"date-fns": "^4.4.0",
|
"date-fns": "^4.4.0",
|
||||||
"jose": "^6.2.10",
|
"jose": "^6.2.10",
|
||||||
"lucide-react": "^1.34.0",
|
"lucide-react": "^1.34.0",
|
||||||
"next": "16.3.3",
|
"next": "16.3.3",
|
||||||
|
"next-themes": "^0.4.6",
|
||||||
"prisma": "^5.22.0",
|
"prisma": "^5.22.0",
|
||||||
"react": "19.2.8",
|
"react": "19.2.8",
|
||||||
"react-day-picker": "^10.0.1",
|
"react-day-picker": "^10.0.1",
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
"react-hook-form": "^7.86.0",
|
"react-hook-form": "^7.86.0",
|
||||||
"recharts": "^3.10.1",
|
"recharts": "^3.10.1",
|
||||||
"shadcn": "^4.19.0",
|
"shadcn": "^4.19.0",
|
||||||
|
"sonner": "^2.0.8",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwind-merge": "^3.6.0",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"uuid": "^14.0.2",
|
"uuid": "^14.0.2",
|
||||||
|
|||||||
+16
-11
@@ -1,6 +1,3 @@
|
|||||||
// This is your Prisma schema file,
|
|
||||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
@@ -31,20 +28,22 @@ model Order {
|
|||||||
allow_custom Boolean @default(false)
|
allow_custom Boolean @default(false)
|
||||||
status String @default("DRAFT")
|
status String @default("DRAFT")
|
||||||
creator_id String
|
creator_id String
|
||||||
creator User @relation("CreatedOrders", fields: [creator_id], references: [id])
|
|
||||||
available_items AvailableItem[]
|
|
||||||
submissions Submission[]
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
|
description String?
|
||||||
|
available_items AvailableItem[]
|
||||||
|
creator User @relation("CreatedOrders", fields: [creator_id], references: [id])
|
||||||
|
submissions Submission[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model AvailableItem {
|
model AvailableItem {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
order_id String
|
order_id String
|
||||||
name String
|
name String
|
||||||
order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
|
is_sold_out Boolean @default(false)
|
||||||
|
order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
model Submission {
|
model Submission {
|
||||||
@@ -52,13 +51,13 @@ model Submission {
|
|||||||
order_id String
|
order_id String
|
||||||
user_id String
|
user_id String
|
||||||
bill Int?
|
bill Int?
|
||||||
paid_amount Int?
|
|
||||||
payment_status String @default("BELUM_BAYAR")
|
payment_status String @default("BELUM_BAYAR")
|
||||||
|
created_at DateTime @default(now())
|
||||||
|
updated_at DateTime @updatedAt
|
||||||
|
paid_amount Int?
|
||||||
order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
|
order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
|
||||||
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
||||||
items SubmissionItem[]
|
items SubmissionItem[]
|
||||||
created_at DateTime @default(now())
|
|
||||||
updated_at DateTime @updatedAt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
model SubmissionItem {
|
model SubmissionItem {
|
||||||
@@ -67,7 +66,13 @@ model SubmissionItem {
|
|||||||
name String
|
name String
|
||||||
qty Int @default(1)
|
qty Int @default(1)
|
||||||
is_custom Boolean @default(false)
|
is_custom Boolean @default(false)
|
||||||
submission Submission @relation(fields: [submission_id], references: [id], onDelete: Cascade)
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
|
submission Submission @relation(fields: [submission_id], references: [id], onDelete: Cascade)
|
||||||
|
}
|
||||||
|
|
||||||
|
model Setting {
|
||||||
|
key String @id
|
||||||
|
value String
|
||||||
|
updated_at DateTime @updatedAt
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react'
|
|||||||
import { useParams, useRouter, notFound } from 'next/navigation'
|
import { useParams, useRouter, notFound } from 'next/navigation'
|
||||||
import { getOrderDetail, updateSubmissionPayment, updateOrderStatus, updateOrder, deleteOrder, getSessionUser, getBalancesAsCreator } from '@/app/actions'
|
import { getOrderDetail, updateSubmissionPayment, updateOrderStatus, updateOrder, deleteOrder, getSessionUser, getBalancesAsCreator } from '@/app/actions'
|
||||||
import { Card, CardContent } from '@/components/ui/card'
|
import { Card, CardContent } from '@/components/ui/card'
|
||||||
|
import { SummaryGenerator } from '@/components/SummaryGenerator'
|
||||||
import { Button, buttonVariants } from '@/components/ui/button'
|
import { Button, buttonVariants } from '@/components/ui/button'
|
||||||
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
|
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
@@ -109,40 +110,11 @@ export default function OrderDetailPage() {
|
|||||||
notFound()
|
notFound()
|
||||||
}
|
}
|
||||||
|
|
||||||
const isCreator = userId === order.creator_id
|
const isCreator = order.creator_id === userId
|
||||||
const isClosed = order.status === 'CLOSE'
|
const isClosed = order.status === 'CLOSE'
|
||||||
const isDraft = order.status === 'DRAFT'
|
const isDraft = order.status === 'DRAFT'
|
||||||
const canDelete = isDraft || isClosed
|
const canDelete = isDraft || isClosed
|
||||||
|
|
||||||
let summaryByPerson = `${order.title}\n`
|
|
||||||
const itemCounts: Record<string, number> = {}
|
|
||||||
|
|
||||||
order.submissions.forEach((sub: any) => {
|
|
||||||
const itemStrings = sub.items.map((i: any) => `${i.name} ${i.qty}x`)
|
|
||||||
summaryByPerson += `- ${sub.user.name} : ${itemStrings.join(', ')}\n`
|
|
||||||
|
|
||||||
sub.items.forEach((i: any) => {
|
|
||||||
itemCounts[i.name] = (itemCounts[i.name] || 0) + i.qty
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
let summaryByItem = `${order.title}\n`
|
|
||||||
Object.entries(itemCounts).forEach(([name, qty]) => {
|
|
||||||
summaryByItem += `- ${name} : ${qty} pcs\n`
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleCopyPerson = () => {
|
|
||||||
navigator.clipboard.writeText(summaryByPerson)
|
|
||||||
setCopiedPerson(true)
|
|
||||||
setTimeout(() => setCopiedPerson(false), 2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleCopyItem = () => {
|
|
||||||
navigator.clipboard.writeText(summaryByItem)
|
|
||||||
setCopiedItem(true)
|
|
||||||
setTimeout(() => setCopiedItem(false), 2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6 animate-in fade-in duration-500 pb-12">
|
<div className="space-y-6 animate-in fade-in duration-500 pb-12">
|
||||||
{/* Top Breadcrumb Header */}
|
{/* Top Breadcrumb Header */}
|
||||||
@@ -255,6 +227,11 @@ export default function OrderDetailPage() {
|
|||||||
<h1 className="text-xl sm:text-2xl font-black text-slate-900 dark:text-white tracking-tight leading-tight">
|
<h1 className="text-xl sm:text-2xl font-black text-slate-900 dark:text-white tracking-tight leading-tight">
|
||||||
{order.title}
|
{order.title}
|
||||||
</h1>
|
</h1>
|
||||||
|
{order.description && (
|
||||||
|
<p className="text-sm text-slate-600 dark:text-slate-400 mt-1.5 font-medium leading-relaxed">
|
||||||
|
{order.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
<p className="text-xs text-slate-500 font-medium pt-0.5">
|
<p className="text-xs text-slate-500 font-medium pt-0.5">
|
||||||
Oleh <span className="text-slate-800 dark:text-slate-200 font-bold">{order.creator.name}</span>
|
Oleh <span className="text-slate-800 dark:text-slate-200 font-bold">{order.creator.name}</span>
|
||||||
</p>
|
</p>
|
||||||
@@ -306,6 +283,7 @@ export default function OrderDetailPage() {
|
|||||||
{order.status === 'OPEN' && (
|
{order.status === 'OPEN' && (
|
||||||
<ShareButton
|
<ShareButton
|
||||||
orderId={order.id}
|
orderId={order.id}
|
||||||
|
orderTitle={order.title}
|
||||||
className="h-8.5 text-xs font-bold rounded-xl border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-300 gap-1.5"
|
className="h-8.5 text-xs font-bold rounded-xl border-slate-200 dark:border-slate-700 text-slate-700 dark:text-slate-300 gap-1.5"
|
||||||
showText={true}
|
showText={true}
|
||||||
/>
|
/>
|
||||||
@@ -434,61 +412,7 @@ export default function OrderDetailPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right 1 Col: Summary Generators */}
|
{/* Right 1 Col: Summary Generators */}
|
||||||
<div className="space-y-6">
|
<SummaryGenerator order={order} />
|
||||||
<div className="px-1">
|
|
||||||
<h3 className="text-lg font-black text-slate-900 dark:text-white flex items-center gap-2">
|
|
||||||
<Receipt className="w-5 h-5 text-[#1B2CC1]" />
|
|
||||||
<span>Generator Rekap</span>
|
|
||||||
</h3>
|
|
||||||
<p className="text-xs text-slate-500 mt-0.5">Salin format teks siap kirim ke WhatsApp / grup.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Rekap Per Orang */}
|
|
||||||
<Card className="rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden">
|
|
||||||
<div className="p-4 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/40">
|
|
||||||
<span className="text-xs font-bold text-slate-800 dark:text-slate-200">
|
|
||||||
Rekap per Orang
|
|
||||||
</span>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={handleCopyPerson}
|
|
||||||
className="h-8 text-xs font-bold rounded-lg border-slate-200 gap-1.5 hover:bg-[#1B2CC1] hover:text-white transition-all"
|
|
||||||
>
|
|
||||||
{copiedPerson ? <Check className="w-3.5 h-3.5 text-emerald-500" /> : <Copy className="w-3.5 h-3.5" />}
|
|
||||||
<span>{copiedPerson ? 'Tersalin!' : 'Copy Text'}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<CardContent className="p-4">
|
|
||||||
<pre className="text-xs font-mono bg-slate-50 dark:bg-slate-800/80 p-3.5 rounded-xl overflow-x-auto whitespace-pre-wrap border border-slate-200/80 dark:border-slate-700 text-slate-700 dark:text-slate-300 leading-relaxed">
|
|
||||||
{summaryByPerson}
|
|
||||||
</pre>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
{/* Rekap Per Item */}
|
|
||||||
<Card className="rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden">
|
|
||||||
<div className="p-4 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/40">
|
|
||||||
<span className="text-xs font-bold text-slate-800 dark:text-slate-200">
|
|
||||||
Rekap per Item (Akumulasi)
|
|
||||||
</span>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={handleCopyItem}
|
|
||||||
className="h-8 text-xs font-bold rounded-lg border-slate-200 gap-1.5 hover:bg-[#1B2CC1] hover:text-white transition-all"
|
|
||||||
>
|
|
||||||
{copiedItem ? <Check className="w-3.5 h-3.5 text-emerald-500" /> : <Copy className="w-3.5 h-3.5" />}
|
|
||||||
<span>{copiedItem ? 'Tersalin!' : 'Copy Text'}</span>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<CardContent className="p-4">
|
|
||||||
<pre className="text-xs font-mono bg-slate-50 dark:bg-slate-800/80 p-3.5 rounded-xl overflow-x-auto whitespace-pre-wrap border border-slate-200/80 dark:border-slate-700 text-slate-700 dark:text-slate-300 leading-relaxed">
|
|
||||||
{summaryByItem}
|
|
||||||
</pre>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -728,18 +652,20 @@ function SubmissionRow({
|
|||||||
|
|
||||||
function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClose: () => void, onSuccess: () => void }) {
|
function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClose: () => void, onSuccess: () => void }) {
|
||||||
const [title, setTitle] = useState(order.title || '')
|
const [title, setTitle] = useState(order.title || '')
|
||||||
|
const [description, setDescription] = useState(order.description || '')
|
||||||
const [allowCustom, setAllowCustom] = useState(order.allow_custom || false)
|
const [allowCustom, setAllowCustom] = useState(order.allow_custom || false)
|
||||||
const [items, setItems] = useState<Array<{ id: string, name: string }>>(
|
const [items, setItems] = useState<Array<{ id: string, name: string, is_sold_out: boolean }>>(
|
||||||
order.available_items?.length > 0
|
order.available_items?.length > 0
|
||||||
? order.available_items.map((ai: any) => ({ id: ai.id, name: ai.name }))
|
? order.available_items.map((ai: any) => ({ id: ai.id, name: ai.name, is_sold_out: ai.is_sold_out || false }))
|
||||||
: [{ id: '1', name: '' }]
|
: [{ id: '1', name: '', is_sold_out: false }]
|
||||||
)
|
)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
const addItem = () => setItems([...items, { id: Math.random().toString(), name: '' }])
|
const addItem = () => setItems([...items, { id: Math.random().toString(), name: '', is_sold_out: false }])
|
||||||
const removeItem = (id: string) => setItems(items.filter(i => i.id !== id))
|
const removeItem = (id: string) => setItems(items.filter(i => i.id !== id))
|
||||||
const updateItem = (id: string, name: string) => setItems(items.map(i => i.id === id ? { ...i, name } : i))
|
const updateItem = (id: string, name: string) => setItems(items.map(i => i.id === id ? { ...i, name } : i))
|
||||||
|
const toggleSoldOut = (id: string, is_sold_out: boolean) => setItems(items.map(i => i.id === id ? { ...i, is_sold_out } : i))
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@@ -747,7 +673,7 @@ function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClo
|
|||||||
|
|
||||||
if (!title.trim()) return setError('Judul PO wajib diisi.')
|
if (!title.trim()) return setError('Judul PO wajib diisi.')
|
||||||
|
|
||||||
const validItems = items.filter(i => i.name.trim()).map(i => i.name.trim())
|
const validItems = items.filter(i => i.name.trim()).map(i => ({ name: i.name.trim(), is_sold_out: i.is_sold_out }))
|
||||||
if (!allowCustom && validItems.length === 0) {
|
if (!allowCustom && validItems.length === 0) {
|
||||||
return setError('Wajib menambahkan minimal 1 menu pilihan jika tidak mengizinkan custom item.')
|
return setError('Wajib menambahkan minimal 1 menu pilihan jika tidak mengizinkan custom item.')
|
||||||
}
|
}
|
||||||
@@ -756,6 +682,7 @@ function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClo
|
|||||||
|
|
||||||
const res = await updateOrder(order.id, {
|
const res = await updateOrder(order.id, {
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
|
description: description.trim(),
|
||||||
allow_custom: allowCustom,
|
allow_custom: allowCustom,
|
||||||
available_items: validItems
|
available_items: validItems
|
||||||
})
|
})
|
||||||
@@ -794,6 +721,19 @@ function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClo
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="detail-edit-desc" className="text-xs font-bold uppercase tracking-wider text-slate-700 dark:text-slate-300">
|
||||||
|
Deskripsi <span className="text-slate-400 font-normal lowercase">(opsional)</span>
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id="detail-edit-desc"
|
||||||
|
placeholder="Keterangan tambahan tentang PO ini"
|
||||||
|
value={description}
|
||||||
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
|
className="h-11 rounded-xl border-slate-200 dark:border-slate-800 focus-visible:ring-4 focus-visible:ring-[#1B2CC1]/15 focus-visible:border-[#1B2CC1]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Custom Item Checkbox */}
|
{/* Custom Item Checkbox */}
|
||||||
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -836,16 +776,34 @@ function EditDetailOrderModal({ order, onClose, onSuccess }: { order: any, onClo
|
|||||||
<Input
|
<Input
|
||||||
placeholder="Nama menu (mis: Es Kopi Susu Tetangga)"
|
placeholder="Nama menu (mis: Es Kopi Susu Tetangga)"
|
||||||
value={item.name}
|
value={item.name}
|
||||||
|
disabled={item.is_sold_out}
|
||||||
onChange={(e) => updateItem(item.id, e.target.value)}
|
onChange={(e) => updateItem(item.id, e.target.value)}
|
||||||
className="flex-1 h-9 rounded-lg bg-white dark:bg-slate-900 text-xs font-medium"
|
className={cn(
|
||||||
|
"flex-1 h-9 rounded-lg bg-white dark:bg-slate-900 text-xs font-medium transition-all",
|
||||||
|
item.is_sold_out && "opacity-60 cursor-not-allowed line-through decoration-rose-500/50"
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant={item.is_sold_out ? "default" : "outline"}
|
||||||
|
size="sm"
|
||||||
|
onClick={() => toggleSoldOut(item.id, !item.is_sold_out)}
|
||||||
|
className={cn(
|
||||||
|
"h-9 px-3 rounded-lg text-xs font-bold transition-all whitespace-nowrap",
|
||||||
|
item.is_sold_out
|
||||||
|
? "bg-rose-600 hover:bg-rose-700 text-white border-rose-600"
|
||||||
|
: "text-slate-500 hover:text-rose-600 hover:border-rose-300"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
Sold Out
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={() => removeItem(item.id)}
|
onClick={() => removeItem(item.id)}
|
||||||
disabled={items.length === 1 && !allowCustom}
|
disabled={items.length === 1 && !allowCustom}
|
||||||
className="h-8 w-8 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg"
|
className="h-8 w-8 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg shrink-0"
|
||||||
>
|
>
|
||||||
<MinusCircle className="h-4 w-4" />
|
<MinusCircle className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -312,9 +312,16 @@ export default function MyOrdersPage() {
|
|||||||
{/* Left: Info */}
|
{/* Left: Info */}
|
||||||
<div className="w-full md:flex-1 p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center">
|
<div className="w-full md:flex-1 p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center">
|
||||||
<div className="flex justify-between items-start gap-4">
|
<div className="flex justify-between items-start gap-4">
|
||||||
<h3 className="text-xl font-bold text-slate-900 dark:text-white line-clamp-2 leading-snug flex-1 min-w-0">
|
<div className="flex-1 min-w-0">
|
||||||
|
<h3 className="text-xl font-bold text-slate-900 dark:text-white line-clamp-2 leading-snug">
|
||||||
{order.title}
|
{order.title}
|
||||||
</h3>
|
</h3>
|
||||||
|
{order.description && (
|
||||||
|
<p className="text-xs text-slate-500 mt-1 line-clamp-2 font-medium">
|
||||||
|
{order.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div className="flex flex-col sm:flex-row items-end sm:items-center gap-2 shrink-0">
|
<div className="flex flex-col sm:flex-row items-end sm:items-center gap-2 shrink-0">
|
||||||
<span className="text-[11px] text-slate-500 font-semibold bg-slate-100/80 dark:bg-slate-800 px-2.5 py-1 rounded-full whitespace-nowrap">
|
<span className="text-[11px] text-slate-500 font-semibold bg-slate-100/80 dark:bg-slate-800 px-2.5 py-1 rounded-full whitespace-nowrap">
|
||||||
{format(date, 'EEEE, dd MMM yyyy', { locale: idLocale })}
|
{format(date, 'EEEE, dd MMM yyyy', { locale: idLocale })}
|
||||||
@@ -538,6 +545,7 @@ export default function MyOrdersPage() {
|
|||||||
|
|
||||||
function CreateOrderModal({ userId, onSuccess, initialData }: { userId: string, onSuccess: () => void, initialData?: any }) {
|
function CreateOrderModal({ userId, onSuccess, initialData }: { userId: string, onSuccess: () => void, initialData?: any }) {
|
||||||
const [title, setTitle] = useState(initialData ? `${initialData.title} (Copy)` : '')
|
const [title, setTitle] = useState(initialData ? `${initialData.title} (Copy)` : '')
|
||||||
|
const [description, setDescription] = useState(initialData ? (initialData.description || '') : '')
|
||||||
const [allowCustom, setAllowCustom] = useState(initialData ? initialData.allow_custom : false)
|
const [allowCustom, setAllowCustom] = useState(initialData ? initialData.allow_custom : false)
|
||||||
const [items, setItems] = useState<{ id: string; name: string }[]>(
|
const [items, setItems] = useState<{ id: string; name: string }[]>(
|
||||||
initialData && initialData.available_items?.length > 0
|
initialData && initialData.available_items?.length > 0
|
||||||
@@ -567,6 +575,7 @@ function CreateOrderModal({ userId, onSuccess, initialData }: { userId: string,
|
|||||||
const res = await createOrder({
|
const res = await createOrder({
|
||||||
creator_id: userId,
|
creator_id: userId,
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
|
description: description.trim(),
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
allow_custom: allowCustom,
|
allow_custom: allowCustom,
|
||||||
available_items: validItems
|
available_items: validItems
|
||||||
@@ -609,6 +618,19 @@ function CreateOrderModal({ userId, onSuccess, initialData }: { userId: string,
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="order-desc" className="text-xs font-bold uppercase tracking-wider text-slate-700 dark:text-slate-300">
|
||||||
|
Deskripsi <span className="text-slate-400 font-normal lowercase">(opsional)</span>
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id="order-desc"
|
||||||
|
placeholder="Keterangan tambahan tentang PO ini"
|
||||||
|
value={description}
|
||||||
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
|
className="h-11 rounded-xl border-slate-200 dark:border-slate-800 focus-visible:ring-4 focus-visible:ring-[#1B2CC1]/15 focus-visible:border-[#1B2CC1]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Custom Item Checkbox */}
|
{/* Custom Item Checkbox */}
|
||||||
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -689,18 +711,20 @@ function CreateOrderModal({ userId, onSuccess, initialData }: { userId: string,
|
|||||||
|
|
||||||
function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: () => void, onSuccess: () => void }) {
|
function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: () => void, onSuccess: () => void }) {
|
||||||
const [title, setTitle] = useState(order.title || '')
|
const [title, setTitle] = useState(order.title || '')
|
||||||
|
const [description, setDescription] = useState(order.description || '')
|
||||||
const [allowCustom, setAllowCustom] = useState(order.allow_custom || false)
|
const [allowCustom, setAllowCustom] = useState(order.allow_custom || false)
|
||||||
const [items, setItems] = useState<Array<{ id: string, name: string }>>(
|
const [items, setItems] = useState<Array<{ id: string, name: string, is_sold_out: boolean }>>(
|
||||||
order.available_items?.length > 0
|
order.available_items?.length > 0
|
||||||
? order.available_items.map((ai: any) => ({ id: ai.id, name: ai.name }))
|
? order.available_items.map((ai: any) => ({ id: ai.id, name: ai.name, is_sold_out: ai.is_sold_out || false }))
|
||||||
: [{ id: '1', name: '' }]
|
: [{ id: '1', name: '', is_sold_out: false }]
|
||||||
)
|
)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
|
|
||||||
const addItem = () => setItems([...items, { id: Math.random().toString(), name: '' }])
|
const addItem = () => setItems([...items, { id: Math.random().toString(), name: '', is_sold_out: false }])
|
||||||
const removeItem = (id: string) => setItems(items.filter(i => i.id !== id))
|
const removeItem = (id: string) => setItems(items.filter(i => i.id !== id))
|
||||||
const updateItem = (id: string, name: string) => setItems(items.map(i => i.id === id ? { ...i, name } : i))
|
const updateItem = (id: string, name: string) => setItems(items.map(i => i.id === id ? { ...i, name } : i))
|
||||||
|
const toggleSoldOut = (id: string, is_sold_out: boolean) => setItems(items.map(i => i.id === id ? { ...i, is_sold_out } : i))
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent) => {
|
const handleSubmit = async (e: React.FormEvent) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@@ -708,7 +732,7 @@ function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: ()
|
|||||||
|
|
||||||
if (!title.trim()) return setError('Judul PO wajib diisi.')
|
if (!title.trim()) return setError('Judul PO wajib diisi.')
|
||||||
|
|
||||||
const validItems = items.filter(i => i.name.trim()).map(i => i.name.trim())
|
const validItems = items.filter(i => i.name.trim()).map(i => ({ name: i.name.trim(), is_sold_out: i.is_sold_out }))
|
||||||
if (!allowCustom && validItems.length === 0) {
|
if (!allowCustom && validItems.length === 0) {
|
||||||
return setError('Wajib menambahkan minimal 1 menu pilihan jika tidak mengizinkan custom item.')
|
return setError('Wajib menambahkan minimal 1 menu pilihan jika tidak mengizinkan custom item.')
|
||||||
}
|
}
|
||||||
@@ -717,6 +741,7 @@ function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: ()
|
|||||||
|
|
||||||
const res = await updateOrder(order.id, {
|
const res = await updateOrder(order.id, {
|
||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
|
description: description.trim(),
|
||||||
allow_custom: allowCustom,
|
allow_custom: allowCustom,
|
||||||
available_items: validItems
|
available_items: validItems
|
||||||
})
|
})
|
||||||
@@ -758,6 +783,19 @@ function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: ()
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="edit-order-desc" className="text-xs font-bold uppercase tracking-wider text-slate-700 dark:text-slate-300">
|
||||||
|
Deskripsi <span className="text-slate-400 font-normal lowercase">(opsional)</span>
|
||||||
|
</Label>
|
||||||
|
<Input
|
||||||
|
id="edit-order-desc"
|
||||||
|
placeholder="Keterangan tambahan tentang PO ini"
|
||||||
|
value={description}
|
||||||
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
|
className="h-11 rounded-xl border-slate-200 dark:border-slate-800 focus-visible:ring-4 focus-visible:ring-[#1B2CC1]/15 focus-visible:border-[#1B2CC1]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Custom Item Checkbox */}
|
{/* Custom Item Checkbox */}
|
||||||
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
<div className="flex items-start space-x-3 p-4 rounded-xl border border-slate-200/80 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -800,16 +838,34 @@ function EditOrderModal({ order, onClose, onSuccess }: { order: any, onClose: ()
|
|||||||
<Input
|
<Input
|
||||||
placeholder="Nama menu (mis: Es Kopi Susu Tetangga)"
|
placeholder="Nama menu (mis: Es Kopi Susu Tetangga)"
|
||||||
value={item.name}
|
value={item.name}
|
||||||
|
disabled={item.is_sold_out}
|
||||||
onChange={(e) => updateItem(item.id, e.target.value)}
|
onChange={(e) => updateItem(item.id, e.target.value)}
|
||||||
className="flex-1 h-9 rounded-lg bg-white dark:bg-slate-900 text-xs font-medium"
|
className={cn(
|
||||||
|
"flex-1 h-9 rounded-lg bg-white dark:bg-slate-900 text-xs font-medium transition-all",
|
||||||
|
item.is_sold_out && "opacity-60 cursor-not-allowed line-through decoration-rose-500/50"
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant={item.is_sold_out ? "default" : "outline"}
|
||||||
|
size="sm"
|
||||||
|
onClick={() => toggleSoldOut(item.id, !item.is_sold_out)}
|
||||||
|
className={cn(
|
||||||
|
"h-9 px-3 rounded-lg text-xs font-bold transition-all whitespace-nowrap",
|
||||||
|
item.is_sold_out
|
||||||
|
? "bg-rose-600 hover:bg-rose-700 text-white border-rose-600"
|
||||||
|
: "text-slate-500 hover:text-rose-600 hover:border-rose-300"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
Sold Out
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={() => removeItem(item.id)}
|
onClick={() => removeItem(item.id)}
|
||||||
disabled={items.length === 1 && !allowCustom}
|
disabled={items.length === 1 && !allowCustom}
|
||||||
className="h-8 w-8 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg"
|
className="h-8 w-8 text-red-500 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-950/30 rounded-lg shrink-0"
|
||||||
>
|
>
|
||||||
<MinusCircle className="h-4 w-4" />
|
<MinusCircle className="h-4 w-4" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { getMyPurchases, submitOrder, getUserSubmission, getSessionUser } from '@/app/actions'
|
import { getMyPurchases, submitOrder, getUserSubmission, getSessionUser, deleteSubmission } from '@/app/actions'
|
||||||
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from '@/components/ui/card'
|
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from '@/components/ui/card'
|
||||||
import { Button, buttonVariants } from '@/components/ui/button'
|
import { Button, buttonVariants } from '@/components/ui/button'
|
||||||
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
|
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog'
|
||||||
@@ -23,7 +23,8 @@ import {
|
|||||||
Sparkles,
|
Sparkles,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight
|
ChevronRight,
|
||||||
|
Trash2
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
@@ -33,10 +34,25 @@ export default function MyPurchasesPage() {
|
|||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [filter, setFilter] = useState<'ALL' | 'BELUM_BAYAR' | 'LUNAS'>('ALL')
|
const [filter, setFilter] = useState<'ALL' | 'BELUM_BAYAR' | 'LUNAS'>('ALL')
|
||||||
const [editingPurchase, setEditingPurchase] = useState<any | null>(null)
|
const [editingPurchase, setEditingPurchase] = useState<any | null>(null)
|
||||||
|
const [deletingPurchase, setDeletingPurchase] = useState<any | null>(null)
|
||||||
|
const [isDeleting, setIsDeleting] = useState(false)
|
||||||
const [currentPage, setCurrentPage] = useState(1)
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
const [searchQuery, setSearchQuery] = useState('')
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
const ITEMS_PER_PAGE = 5
|
const ITEMS_PER_PAGE = 5
|
||||||
|
|
||||||
|
const handleDelete = async (submissionId: string) => {
|
||||||
|
if (!userId) return
|
||||||
|
setIsDeleting(true)
|
||||||
|
const res = await deleteSubmission(submissionId, userId)
|
||||||
|
if (res.success) {
|
||||||
|
loadPurchases(userId)
|
||||||
|
setDeletingPurchase(null)
|
||||||
|
} else {
|
||||||
|
alert(res.error || 'Gagal membatalkan pesanan')
|
||||||
|
}
|
||||||
|
setIsDeleting(false)
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
const user = await getSessionUser()
|
const user = await getSessionUser()
|
||||||
@@ -153,6 +169,30 @@ export default function MyPurchasesPage() {
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Delete Confirmation Modal */}
|
||||||
|
<Dialog open={!!deletingPurchase} onOpenChange={(open) => !open && setDeletingPurchase(null)}>
|
||||||
|
<DialogContent className="sm:max-w-md p-6 rounded-3xl border-slate-200/90 dark:border-slate-800">
|
||||||
|
<div className="flex flex-col items-center justify-center text-center gap-4">
|
||||||
|
<div className="w-16 h-16 bg-red-100 dark:bg-red-950/50 text-red-600 dark:text-red-400 rounded-full flex items-center justify-center">
|
||||||
|
<Trash2 className="w-8 h-8" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<DialogTitle className="text-xl font-black text-slate-900 dark:text-white mb-2">Batalkan Titipan?</DialogTitle>
|
||||||
|
<p className="text-sm text-slate-500">
|
||||||
|
Apakah Anda yakin ingin membatalkan titipan Anda untuk PO <strong>{deletingPurchase?.order?.title}</strong>? Aksi ini tidak dapat dibatalkan.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-3 w-full mt-4">
|
||||||
|
<Button variant="outline" onClick={() => setDeletingPurchase(null)} disabled={isDeleting} className="flex-1 rounded-xl h-11 font-bold border-slate-200 dark:border-slate-700">Tutup</Button>
|
||||||
|
<Button onClick={() => handleDelete(deletingPurchase?.id)} disabled={isDeleting} className="flex-1 rounded-xl h-11 bg-red-600 hover:bg-red-700 text-white font-bold shadow-md shadow-red-600/20 gap-2">
|
||||||
|
{isDeleting && <Loader2 className="w-4 h-4 animate-spin" />}
|
||||||
|
{isDeleting ? 'Membatalkan...' : 'Ya, Batalkan'}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
{filteredPurchases.length === 0 ? (
|
{filteredPurchases.length === 0 ? (
|
||||||
<div className="flex flex-col items-center justify-center p-16 text-center rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm">
|
<div className="flex flex-col items-center justify-center p-16 text-center rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm">
|
||||||
<div className="w-16 h-16 bg-[#1B2CC1]/10 rounded-2xl flex items-center justify-center mb-4 text-[#1B2CC1]">
|
<div className="w-16 h-16 bg-[#1B2CC1]/10 rounded-2xl flex items-center justify-center mb-4 text-[#1B2CC1]">
|
||||||
@@ -279,12 +319,21 @@ export default function MyPurchasesPage() {
|
|||||||
{/* Update Order Action Button */}
|
{/* Update Order Action Button */}
|
||||||
<div className="w-full mt-1">
|
<div className="w-full mt-1">
|
||||||
{isOrderOpen ? (
|
{isOrderOpen ? (
|
||||||
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setEditingPurchase(sub)}
|
onClick={() => setEditingPurchase(sub)}
|
||||||
className="w-full h-10 rounded-xl bg-[#1B2CC1] hover:bg-[#15229E] text-white font-bold text-xs shadow-sm gap-1.5"
|
className="flex-1 h-10 rounded-xl bg-[#1B2CC1] hover:bg-[#15229E] text-white font-bold text-xs shadow-sm gap-1.5"
|
||||||
>
|
>
|
||||||
<Pencil className="w-3.5 h-3.5" /> Ubah Titipan
|
<Pencil className="w-3.5 h-3.5" /> Ubah
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={() => setDeletingPurchase(sub)}
|
||||||
|
className="flex-1 h-10 rounded-xl bg-red-600 hover:bg-red-700 text-white font-bold text-xs shadow-sm gap-1.5"
|
||||||
|
title="Batalkan Pesanan"
|
||||||
|
>
|
||||||
|
<Trash2 className="w-3.5 h-3.5" /> Batalkan
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex items-center justify-center gap-1.5 py-2 text-[11px] text-slate-400 font-medium bg-slate-100/70 dark:bg-slate-800/40 rounded-xl">
|
<div className="flex items-center justify-center gap-1.5 py-2 text-[11px] text-slate-400 font-medium bg-slate-100/70 dark:bg-slate-800/40 rounded-xl">
|
||||||
<Lock className="w-3 h-3" />
|
<Lock className="w-3 h-3" />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export function PublicOrderActions({ order }: { order: any }) {
|
|||||||
<ShoppingBag className="w-4 h-4" />
|
<ShoppingBag className="w-4 h-4" />
|
||||||
Titip Sekarang
|
Titip Sekarang
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<OrderFormModal order={order} onSuccess={() => setOpen(false)} />
|
{open && <OrderFormModal order={order} onSuccess={() => setOpen(false)} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<ShareButton
|
<ShareButton
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { redirect, notFound } from 'next/navigation'
|
|||||||
import { Store, User, Users, CheckCircle2, ChevronLeft, MapPin, Sparkles } from 'lucide-react'
|
import { Store, User, Users, CheckCircle2, ChevronLeft, MapPin, Sparkles } from 'lucide-react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { PublicOrderActions } from './PublicOrderActions'
|
import { PublicOrderActions } from './PublicOrderActions'
|
||||||
|
import { SummaryGenerator } from '@/components/SummaryGenerator'
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { id as idLocale } from 'date-fns/locale'
|
import { id as idLocale } from 'date-fns/locale'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
@@ -96,7 +97,9 @@ export default async function PublicOrderDetailPage({ params }: { params: Promis
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Daftar Penitip (Submissions) */}
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 items-start">
|
||||||
|
{/* Left 2 Cols: Daftar Penitip */}
|
||||||
|
<div className="lg:col-span-2 space-y-6">
|
||||||
<div className="bg-white dark:bg-slate-900 rounded-3xl border border-slate-200/60 dark:border-slate-800 shadow-sm overflow-hidden">
|
<div className="bg-white dark:bg-slate-900 rounded-3xl border border-slate-200/60 dark:border-slate-800 shadow-sm overflow-hidden">
|
||||||
<div className="p-5 sm:p-6 border-b border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-800/30 flex items-center justify-between">
|
<div className="p-5 sm:p-6 border-b border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-800/30 flex items-center justify-between">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@@ -147,5 +150,10 @@ export default async function PublicOrderDetailPage({ params }: { params: Promis
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Right 1 Col: Summary Generators */}
|
||||||
|
<SummaryGenerator order={order} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
import { getSettings, updateSettings } from '@/app/actions'
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
import { Loader2, Save, MessageSquare, MessageCircle, AlertCircle } from 'lucide-react'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Input } from '@/components/ui/input'
|
||||||
|
import { Label } from '@/components/ui/label'
|
||||||
|
import { Textarea } from '@/components/ui/textarea'
|
||||||
|
|
||||||
|
export default function IntegrationsPage() {
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [saving, setSaving] = useState(false)
|
||||||
|
const [settings, setSettings] = useState({
|
||||||
|
MATTERMOST_WEBHOOK_URL: '',
|
||||||
|
MATTERMOST_TEMPLATE: '',
|
||||||
|
WHATSAPP_TEMPLATE: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchSettings = async () => {
|
||||||
|
const data = await getSettings()
|
||||||
|
if (data) {
|
||||||
|
setSettings({
|
||||||
|
MATTERMOST_WEBHOOK_URL: data.MATTERMOST_WEBHOOK_URL || '',
|
||||||
|
MATTERMOST_TEMPLATE: data.MATTERMOST_TEMPLATE || 'Halo tim! Lagi ada orderan open nih untuk {title}. Mumpung belum di-checkout, yang mau ikutan nitip bisa langsung cek ke sini ya: {url}',
|
||||||
|
WHATSAPP_TEMPLATE: data.WHATSAPP_TEMPLATE || 'Halo tim! Lagi ada orderan open nih untuk {title}. Mumpung belum di-checkout, yang mau ikutan nitip bisa langsung cek ke sini ya: {url}'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setLoading(false)
|
||||||
|
}
|
||||||
|
fetchSettings()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const handleChange = (key: string, value: string) => {
|
||||||
|
setSettings(prev => ({ ...prev, [key]: value }))
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSave = async () => {
|
||||||
|
setSaving(true)
|
||||||
|
const res = await updateSettings(settings)
|
||||||
|
if (res.success) {
|
||||||
|
toast.success('Berhasil Disimpan', {
|
||||||
|
description: 'Pengaturan integrasi berhasil disimpan!',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
toast.error('Gagal', {
|
||||||
|
description: 'Gagal menyimpan pengaturan',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setSaving(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center items-center h-64">
|
||||||
|
<Loader2 className="w-8 h-8 animate-spin text-[#1B2CC1]" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p-6 space-y-8">
|
||||||
|
<div>
|
||||||
|
<h2 className="text-xl font-bold text-slate-900 dark:text-white">Integrasi & Sharing</h2>
|
||||||
|
<p className="text-xs text-slate-500 mt-1">Konfigurasi endpoint API dan template pesan otomatis.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-6 max-w-3xl">
|
||||||
|
{/* Mattermost Section */}
|
||||||
|
<div className="p-5 rounded-2xl border border-slate-200 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/50 space-y-4">
|
||||||
|
<div className="flex items-center gap-2 text-indigo-600 dark:text-indigo-400 font-black">
|
||||||
|
<MessageSquare className="w-5 h-5" />
|
||||||
|
<h3>Mattermost Webhook</h3>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-slate-500">Gunakan URL Incoming Webhook dari Mattermost untuk mengirim broadcast PO baru secara otomatis.</p>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label className="text-xs font-bold uppercase text-slate-700">Webhook URL</Label>
|
||||||
|
<Input
|
||||||
|
value={settings.MATTERMOST_WEBHOOK_URL}
|
||||||
|
onChange={e => handleChange('MATTERMOST_WEBHOOK_URL', e.target.value)}
|
||||||
|
className="h-11 rounded-xl bg-white dark:bg-slate-950"
|
||||||
|
placeholder="https://mattermost.yourdomain.com/hooks/xxx"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label className="text-xs font-bold uppercase text-slate-700">Pesan Template</Label>
|
||||||
|
<Textarea
|
||||||
|
value={settings.MATTERMOST_TEMPLATE}
|
||||||
|
onChange={e => handleChange('MATTERMOST_TEMPLATE', e.target.value)}
|
||||||
|
className="rounded-xl min-h-[100px] bg-white dark:bg-slate-950"
|
||||||
|
placeholder="Template pesan..."
|
||||||
|
/>
|
||||||
|
<p className="text-[10px] text-slate-500 flex items-center gap-1"><AlertCircle className="w-3 h-3"/> Gunakan variabel: {'{title}'}, {'{url}'}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* WhatsApp Section */}
|
||||||
|
<div className="p-5 rounded-2xl border border-slate-200 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/50 space-y-4">
|
||||||
|
<div className="flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-black">
|
||||||
|
<MessageCircle className="w-5 h-5" />
|
||||||
|
<h3>WhatsApp Share Template</h3>
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-slate-500">Atur template teks default saat user menekan tombol share ke WhatsApp.</p>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label className="text-xs font-bold uppercase text-slate-700">Pesan Template</Label>
|
||||||
|
<Textarea
|
||||||
|
value={settings.WHATSAPP_TEMPLATE}
|
||||||
|
onChange={e => handleChange('WHATSAPP_TEMPLATE', e.target.value)}
|
||||||
|
className="rounded-xl min-h-[100px] bg-white dark:bg-slate-950"
|
||||||
|
placeholder="Template pesan..."
|
||||||
|
/>
|
||||||
|
<p className="text-[10px] text-slate-500 flex items-center gap-1"><AlertCircle className="w-3 h-3"/> Gunakan variabel: {'{title}'}, {'{url}'}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="pt-2">
|
||||||
|
<Button onClick={handleSave} disabled={saving} className="bg-[#1B2CC1] hover:bg-[#15229E] text-white rounded-xl h-11 px-8 font-bold shadow-md w-full sm:w-auto">
|
||||||
|
{saving ? <Loader2 className="w-4 h-4 animate-spin mr-2" /> : <Save className="w-4 h-4 mr-2" />}
|
||||||
|
Simpan Konfigurasi
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import Link from 'next/link'
|
||||||
|
import { usePathname } from 'next/navigation'
|
||||||
|
import { cn } from '@/lib/utils'
|
||||||
|
import { User, Share2 } from 'lucide-react'
|
||||||
|
|
||||||
|
export default function SettingsLayout({ children }: { children: React.ReactNode }) {
|
||||||
|
const pathname = usePathname()
|
||||||
|
|
||||||
|
const tabs = [
|
||||||
|
{ name: 'User Management', href: '/settings/users', icon: User },
|
||||||
|
{ name: 'Integrations & Share', href: '/settings/integrations', icon: Share2 },
|
||||||
|
]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 animate-in fade-in duration-500 pb-12">
|
||||||
|
{/* Settings Navigation Tabs */}
|
||||||
|
<div className="flex flex-col md:flex-row items-start md:items-center gap-4 bg-white dark:bg-slate-900 p-4 rounded-2xl border border-slate-200/80 dark:border-slate-800 shadow-sm overflow-x-auto">
|
||||||
|
<div className="flex items-center bg-slate-100 dark:bg-slate-800/80 p-1 rounded-xl text-xs font-bold w-full md:w-auto">
|
||||||
|
{tabs.map((tab) => {
|
||||||
|
const isActive = pathname === tab.href
|
||||||
|
const Icon = tab.icon
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={tab.href}
|
||||||
|
href={tab.href}
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 px-4 py-2 rounded-lg transition-all duration-200 whitespace-nowrap",
|
||||||
|
isActive
|
||||||
|
? "bg-white dark:bg-slate-900 text-[#1B2CC1] dark:text-blue-400 shadow-sm font-black"
|
||||||
|
: "text-slate-500 hover:text-slate-900 dark:hover:text-white"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<Icon className="w-4 h-4" />
|
||||||
|
{tab.name}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Settings Content */}
|
||||||
|
<div className="bg-white dark:bg-slate-900 rounded-2xl border border-slate-200/80 dark:border-slate-800 shadow-sm overflow-hidden">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -100,18 +100,17 @@ export default function UsersPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6 animate-in fade-in duration-500 pb-12">
|
<div className="p-6">
|
||||||
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
|
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-black text-slate-900 dark:text-white">Manajemen Pengguna</h1>
|
<h2 className="text-xl font-bold text-slate-900 dark:text-white">Manajemen Pengguna</h2>
|
||||||
<p className="text-sm text-slate-500 mt-1">Kelola data seluruh pengguna TitipIn.</p>
|
<p className="text-xs text-slate-500 mt-1">Kelola data seluruh pengguna TitipIn.</p>
|
||||||
</div>
|
</div>
|
||||||
<Button onClick={() => setIsCreateOpen(true)} className="bg-[#1B2CC1] hover:bg-[#15229E] text-white rounded-xl h-11 px-5 shadow-md">
|
<Button onClick={() => setIsCreateOpen(true)} className="bg-[#1B2CC1] hover:bg-[#15229E] text-white rounded-xl h-10 px-4 shadow-sm text-xs font-bold">
|
||||||
<Plus className="w-4 h-4 mr-2" /> Tambah User
|
<Plus className="w-4 h-4 mr-1.5" /> Tambah User
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Card className="rounded-3xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 overflow-hidden shadow-sm">
|
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<table className="w-full text-sm text-left">
|
<table className="w-full text-sm text-left">
|
||||||
<thead className="bg-slate-50/50 dark:bg-slate-800/50 border-b border-slate-100 dark:border-slate-800 text-xs uppercase font-bold text-slate-500">
|
<thead className="bg-slate-50/50 dark:bg-slate-800/50 border-b border-slate-100 dark:border-slate-800 text-xs uppercase font-bold text-slate-500">
|
||||||
@@ -232,7 +231,6 @@ export default function UsersPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Card>
|
|
||||||
|
|
||||||
{/* CREATE MODAL */}
|
{/* CREATE MODAL */}
|
||||||
<Dialog open={isCreateOpen} onOpenChange={setIsCreateOpen}>
|
<Dialog open={isCreateOpen} onOpenChange={setIsCreateOpen}>
|
||||||
@@ -156,7 +156,7 @@ export default function LoginPage() {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p className="text-center text-xs text-slate-400 mt-12 font-medium">
|
<p className="text-center text-xs text-slate-400 mt-12 font-medium">
|
||||||
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan by firmanramdhani
|
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export default function RegisterPage() {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p className="text-center text-xs text-slate-400 mt-12 font-medium">
|
<p className="text-center text-xs text-slate-400 mt-12 font-medium">
|
||||||
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan by firmanramdhani
|
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+92
-5
@@ -237,6 +237,7 @@ export async function getMyOrders(creator_id: string) {
|
|||||||
export async function createOrder(data: {
|
export async function createOrder(data: {
|
||||||
creator_id: string;
|
creator_id: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
description?: string;
|
||||||
date: Date;
|
date: Date;
|
||||||
allow_custom: boolean;
|
allow_custom: boolean;
|
||||||
available_items: string[];
|
available_items: string[];
|
||||||
@@ -245,6 +246,7 @@ export async function createOrder(data: {
|
|||||||
const order = await prisma.order.create({
|
const order = await prisma.order.create({
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
description: data.description || null,
|
||||||
date: data.date,
|
date: data.date,
|
||||||
allow_custom: data.allow_custom,
|
allow_custom: data.allow_custom,
|
||||||
creator_id: data.creator_id,
|
creator_id: data.creator_id,
|
||||||
@@ -273,12 +275,13 @@ export async function duplicateOrder(order_id: string) {
|
|||||||
const newOrder = await prisma.order.create({
|
const newOrder = await prisma.order.create({
|
||||||
data: {
|
data: {
|
||||||
title: oldOrder.title + ' (Copy)',
|
title: oldOrder.title + ' (Copy)',
|
||||||
|
description: oldOrder.description,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
allow_custom: oldOrder.allow_custom,
|
allow_custom: oldOrder.allow_custom,
|
||||||
creator_id: oldOrder.creator_id,
|
creator_id: oldOrder.creator_id,
|
||||||
status: 'DRAFT',
|
status: 'DRAFT',
|
||||||
available_items: {
|
available_items: {
|
||||||
create: oldOrder.available_items.map(ai => ({ name: ai.name }))
|
create: oldOrder.available_items.map(ai => ({ name: ai.name, is_sold_out: ai.is_sold_out }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -291,8 +294,9 @@ export async function duplicateOrder(order_id: string) {
|
|||||||
|
|
||||||
export async function updateOrder(order_id: string, data: {
|
export async function updateOrder(order_id: string, data: {
|
||||||
title: string;
|
title: string;
|
||||||
|
description?: string;
|
||||||
allow_custom: boolean;
|
allow_custom: boolean;
|
||||||
available_items: string[];
|
available_items: { name: string; is_sold_out: boolean }[];
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
const order = await prisma.order.findUnique({
|
const order = await prisma.order.findUnique({
|
||||||
@@ -312,9 +316,10 @@ export async function updateOrder(order_id: string, data: {
|
|||||||
where: { id: order_id },
|
where: { id: order_id },
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
|
description: data.description || null,
|
||||||
allow_custom: data.allow_custom,
|
allow_custom: data.allow_custom,
|
||||||
available_items: {
|
available_items: {
|
||||||
create: data.available_items.map(name => ({ name }))
|
create: data.available_items.map(item => ({ name: item.name, is_sold_out: item.is_sold_out }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -323,8 +328,9 @@ export async function updateOrder(order_id: string, data: {
|
|||||||
revalidatePath(`/my-orders/${order_id}`)
|
revalidatePath(`/my-orders/${order_id}`)
|
||||||
revalidatePath('/')
|
revalidatePath('/')
|
||||||
return { success: true, order: updatedOrder }
|
return { success: true, order: updatedOrder }
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
return { success: false, error: 'Gagal memperbarui order.' }
|
console.error("Update Order Error:", error)
|
||||||
|
return { success: false, error: 'Gagal memperbarui order: ' + error?.message }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,3 +703,84 @@ export async function getBalancesAsSubmittor(user_id: string) {
|
|||||||
|
|
||||||
return Array.from(balanceMap.values()).filter(b => b.amount !== 0)
|
return Array.from(balanceMap.values()).filter(b => b.amount !== 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function deleteSubmission(submission_id: string, user_id: string) {
|
||||||
|
try {
|
||||||
|
const submission = await prisma.submission.findUnique({
|
||||||
|
where: { id: submission_id },
|
||||||
|
include: { order: true }
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!submission) return { success: false, error: 'Pesanan tidak ditemukan' };
|
||||||
|
if (submission.user_id !== user_id) return { success: false, error: 'Tidak ada akses' };
|
||||||
|
if (submission.order.status !== 'OPEN') return { success: false, error: 'Hanya bisa membatalkan PO yang OPEN' };
|
||||||
|
|
||||||
|
await prisma.submission.delete({
|
||||||
|
where: { id: submission_id }
|
||||||
|
});
|
||||||
|
return { success: true };
|
||||||
|
} catch (error) {
|
||||||
|
return { success: false, error: 'Gagal membatalkan pesanan' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- SETTINGS ACTIONS ---
|
||||||
|
|
||||||
|
export async function getSettings() {
|
||||||
|
const settings = await prisma.setting.findMany()
|
||||||
|
const obj: Record<string, string> = {}
|
||||||
|
settings.forEach(s => {
|
||||||
|
obj[s.key] = s.value
|
||||||
|
})
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateSettings(settings: Record<string, string>) {
|
||||||
|
try {
|
||||||
|
for (const key of Object.keys(settings)) {
|
||||||
|
await prisma.setting.upsert({
|
||||||
|
where: { key },
|
||||||
|
update: { value: settings[key] },
|
||||||
|
create: { key, value: settings[key] }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return { success: true }
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
return { success: false, error: 'Gagal update settings' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- BROADCAST ACTIONS ---
|
||||||
|
|
||||||
|
export async function broadcastToMattermost(orderId: string, orderUrl: string) {
|
||||||
|
try {
|
||||||
|
const order = await prisma.order.findUnique({
|
||||||
|
where: { id: orderId }
|
||||||
|
})
|
||||||
|
if (!order) return { success: false, error: 'Order not found' }
|
||||||
|
|
||||||
|
const settings = await getSettings()
|
||||||
|
const webhookUrl = settings.MATTERMOST_WEBHOOK_URL
|
||||||
|
let template = settings.MATTERMOST_TEMPLATE || 'Halo tim! Lagi ada orderan open nih untuk {title}. Mumpung belum di-checkout, yang mau ikutan nitip bisa langsung cek ke sini ya: {url}'
|
||||||
|
|
||||||
|
if (!webhookUrl) return { success: false, error: 'Webhook URL belum di-setting' }
|
||||||
|
|
||||||
|
const message = template.replace('{title}', order.title).replace('{url}', orderUrl)
|
||||||
|
|
||||||
|
const res = await fetch(webhookUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ text: message })
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`Mattermost API Error: ${res.statusText}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true }
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
return { success: false, error: 'Gagal mengirim ke Mattermost' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Metadata, Viewport } from "next";
|
import type { Metadata, Viewport } from "next";
|
||||||
import { Roboto, Open_Sans } from "next/font/google";
|
import { Roboto, Open_Sans } from "next/font/google";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
|
|
||||||
|
|
||||||
const roboto = Roboto({
|
const roboto = Roboto({
|
||||||
@@ -64,6 +65,7 @@ export default function RootLayout({
|
|||||||
className="min-h-full flex flex-col bg-[#F4F6FB] dark:bg-[#0B0F19] font-sans antialiased"
|
className="min-h-full flex flex-col bg-[#F4F6FB] dark:bg-[#0B0F19] font-sans antialiased"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
<Toaster position="top-center" />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default function NotFound() {
|
|||||||
|
|
||||||
{/* Footer info */}
|
{/* Footer info */}
|
||||||
<p className="text-center text-xs text-slate-400 font-medium mt-8">
|
<p className="text-center text-xs text-slate-400 font-medium mt-8">
|
||||||
TitipIn © {new Date().getFullYear()} - Sistem Titip Pesanan by firmanramdhani
|
TitipIn © {new Date().getFullYear()} - Sistem Titip Pesanan
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { usePathname } from 'next/navigation'
|
import { usePathname } from 'next/navigation'
|
||||||
import { Menu, Calendar, Store, ClipboardList, Package, User, FileText, BarChart2 } from 'lucide-react'
|
import { Menu, Calendar, Store, ClipboardList, Package, User, FileText, BarChart2, Settings } from 'lucide-react'
|
||||||
import { buttonVariants } from '@/components/ui/button'
|
import { buttonVariants } from '@/components/ui/button'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
@@ -54,12 +54,13 @@ export function Header({ onMenuClick }: { onMenuClick: () => void }) {
|
|||||||
badge: 'Laporan',
|
badge: 'Laporan',
|
||||||
Icon: BarChart2
|
Icon: BarChart2
|
||||||
}
|
}
|
||||||
case '/users':
|
case '/settings/users':
|
||||||
|
case '/settings/integrations':
|
||||||
return {
|
return {
|
||||||
title: 'Manajemen Pengguna',
|
title: 'Pengaturan Aplikasi',
|
||||||
subtitle: 'Kelola data pengguna, role, dan status aktif.',
|
subtitle: 'Konfigurasi integrasi, role, dan sistem.',
|
||||||
badge: 'Superadmin',
|
badge: 'Superadmin',
|
||||||
Icon: User
|
Icon: Settings
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if (pathname.startsWith('/my-orders/')) {
|
if (pathname.startsWith('/my-orders/')) {
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import { Checkbox } from '@/components/ui/checkbox'
|
|||||||
import { Label } from '@/components/ui/label'
|
import { Label } from '@/components/ui/label'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
import { submitOrder, getUserSubmission, getSessionUser } from '@/app/actions'
|
import { submitOrder, getUserSubmission, getSessionUser } from '@/app/actions'
|
||||||
import { PlusCircle, MinusCircle, User, CheckCircle2, ShoppingBag, Sparkles, Users } from 'lucide-react'
|
import { PlusCircle, MinusCircle, User, CheckCircle2, ShoppingBag, Sparkles, Users, Eye } from 'lucide-react'
|
||||||
import { OrderFormModal } from '@/components/OrderFormModal'
|
import { OrderFormModal } from '@/components/OrderFormModal'
|
||||||
import { ShareButton } from '@/components/ShareButton'
|
import { ShareButton } from '@/components/ShareButton'
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
import { id as idLocale } from 'date-fns/locale'
|
import { id as idLocale } from 'date-fns/locale'
|
||||||
@@ -18,15 +19,24 @@ import { id as idLocale } from 'date-fns/locale'
|
|||||||
export function OrderCard({ order }: { order: any }) {
|
export function OrderCard({ order }: { order: any }) {
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
|
|
||||||
|
const activeItems = order.available_items.filter((i: any) => !i.is_sold_out)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col md:flex-row h-full md:h-auto rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm hover:shadow-xl hover:border-[#1B2CC1]/40 dark:hover:border-blue-500/40 transition-all duration-300 group overflow-hidden items-start md:items-stretch">
|
<div className="flex flex-col md:flex-row h-full md:h-auto rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm hover:shadow-xl hover:border-[#1B2CC1]/40 dark:hover:border-blue-500/40 transition-all duration-300 group overflow-hidden items-start md:items-stretch">
|
||||||
|
|
||||||
{/* Left: Info */}
|
{/* Left: Info */}
|
||||||
<div className="flex-[1.2] p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center min-w-0 w-full">
|
<div className="flex-[1.2] p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center min-w-0 w-full">
|
||||||
<div className="flex justify-between items-start gap-4">
|
<div className="flex justify-between items-start gap-4">
|
||||||
<h3 className="text-lg font-bold text-slate-900 dark:text-white line-clamp-2 leading-snug flex-1 min-w-0 group-hover:text-[#1B2CC1] dark:group-hover:text-blue-400 transition-colors">
|
<div className="flex-1 min-w-0">
|
||||||
|
<h3 className="text-lg font-bold text-slate-900 dark:text-white line-clamp-2 leading-snug group-hover:text-[#1B2CC1] dark:group-hover:text-blue-400 transition-colors">
|
||||||
{order.title}
|
{order.title}
|
||||||
</h3>
|
</h3>
|
||||||
|
{order.description && (
|
||||||
|
<p className="text-xs text-slate-500 mt-1 line-clamp-2 font-medium">
|
||||||
|
{order.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div className="flex flex-col sm:flex-row items-end sm:items-center gap-2 shrink-0">
|
<div className="flex flex-col sm:flex-row items-end sm:items-center gap-2 shrink-0">
|
||||||
<span className="text-[10px] sm:text-[11px] text-slate-500 font-semibold bg-slate-100/80 dark:bg-slate-800 px-2.5 py-1 rounded-full whitespace-nowrap">
|
<span className="text-[10px] sm:text-[11px] text-slate-500 font-semibold bg-slate-100/80 dark:bg-slate-800 px-2.5 py-1 rounded-full whitespace-nowrap">
|
||||||
{format(new Date(order.date), 'EEEE, dd MMM yyyy', { locale: idLocale })}
|
{format(new Date(order.date), 'EEEE, dd MMM yyyy', { locale: idLocale })}
|
||||||
@@ -64,7 +74,7 @@ export function OrderCard({ order }: { order: any }) {
|
|||||||
<div className="w-full md:w-64 p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center border-t md:border-t-0">
|
<div className="w-full md:w-64 p-5 md:border-r border-slate-100 dark:border-slate-800/80 flex flex-col justify-center border-t md:border-t-0">
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<span className="text-[10px] font-bold uppercase tracking-wider text-slate-400 block">
|
<span className="text-[10px] font-bold uppercase tracking-wider text-slate-400 block">
|
||||||
Item Tersedia ({order.available_items.length})
|
Item Tersedia ({activeItems.length})
|
||||||
</span>
|
</span>
|
||||||
{order.allow_custom && (
|
{order.allow_custom && (
|
||||||
<div className="inline-flex items-center gap-1 text-[9px] font-semibold text-[#1B2CC1] bg-blue-50 dark:bg-blue-950/40 px-1.5 py-0.5 rounded-md">
|
<div className="inline-flex items-center gap-1 text-[9px] font-semibold text-[#1B2CC1] bg-blue-50 dark:bg-blue-950/40 px-1.5 py-0.5 rounded-md">
|
||||||
@@ -75,7 +85,7 @@ export function OrderCard({ order }: { order: any }) {
|
|||||||
|
|
||||||
<div className="bg-slate-50 dark:bg-slate-800/40 p-3 rounded-xl border border-slate-200/70 dark:border-slate-800 max-h-24 overflow-y-auto scrollbar-thin">
|
<div className="bg-slate-50 dark:bg-slate-800/40 p-3 rounded-xl border border-slate-200/70 dark:border-slate-800 max-h-24 overflow-y-auto scrollbar-thin">
|
||||||
<ul className="space-y-1.5">
|
<ul className="space-y-1.5">
|
||||||
{order.available_items.map((item: any) => (
|
{activeItems.map((item: any) => (
|
||||||
<li key={item.id} className="text-[11px] flex items-start gap-2 text-slate-700 dark:text-slate-300 font-medium">
|
<li key={item.id} className="text-[11px] flex items-start gap-2 text-slate-700 dark:text-slate-300 font-medium">
|
||||||
<div className="w-3.5 h-3.5 rounded-full bg-[#1B2CC1]/10 text-[#1B2CC1] flex items-center justify-center shrink-0 mt-0.5">
|
<div className="w-3.5 h-3.5 rounded-full bg-[#1B2CC1]/10 text-[#1B2CC1] flex items-center justify-center shrink-0 mt-0.5">
|
||||||
<CheckCircle2 className="w-2.5 h-2.5" />
|
<CheckCircle2 className="w-2.5 h-2.5" />
|
||||||
@@ -83,34 +93,42 @@ export function OrderCard({ order }: { order: any }) {
|
|||||||
<span className="truncate leading-snug">{item.name}</span>
|
<span className="truncate leading-snug">{item.name}</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
{order.available_items.length === 0 && (
|
{activeItems.length === 0 && (
|
||||||
<li className="text-[10px] text-slate-400 italic">Hanya menerima item kustom.</li>
|
<li className="text-[10px] text-slate-400 italic">
|
||||||
|
{order.allow_custom ? "Hanya menerima kustom." : "Semua item habis."}
|
||||||
|
</li>
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Right: Actions */}
|
{/* Right: Actions */}
|
||||||
<div className="w-full md:w-48 p-5 bg-slate-50/60 dark:bg-slate-800/40 flex flex-col items-center justify-center gap-3 shrink-0">
|
<div className="w-full md:w-56 p-5 bg-slate-50/60 dark:bg-slate-800/40 flex flex-col items-center justify-center gap-2.5 shrink-0">
|
||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
<DialogTrigger className={cn(
|
<DialogTrigger className="w-full flex items-center justify-center h-10 rounded-xl bg-[#1B2CC1] hover:bg-[#15229E] text-white font-bold text-xs shadow-md shadow-[#1B2CC1]/20 gap-1.5 transition-all cursor-pointer px-2">
|
||||||
buttonVariants({ size: "sm" }),
|
<ShoppingBag className="w-4 h-4 shrink-0" />
|
||||||
"w-full h-9 rounded-xl bg-[#1B2CC1] hover:bg-[#15229E] text-white font-bold shadow-md shadow-[#1B2CC1]/20 transition-all hover:scale-[1.01] gap-1.5 cursor-pointer"
|
|
||||||
)}>
|
|
||||||
<ShoppingBag className="w-3.5 h-3.5 shrink-0" />
|
|
||||||
<span className="truncate">Titip Sekarang</span>
|
<span className="truncate">Titip Sekarang</span>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
<OrderFormModal order={order} onSuccess={() => setOpen(false)} />
|
{open && <OrderFormModal order={order} onSuccess={() => setOpen(false)} />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
<div className="flex w-full gap-2">
|
||||||
|
<Link
|
||||||
|
href={`/order/${order.id}`}
|
||||||
|
className="flex-1 flex items-center justify-center h-9 rounded-xl bg-white dark:bg-slate-900 hover:bg-slate-50 dark:hover:bg-slate-800 text-slate-700 dark:text-slate-300 font-bold text-xs shadow-sm gap-1.5 transition-all cursor-pointer px-1 border border-slate-200 dark:border-slate-700"
|
||||||
|
>
|
||||||
|
<Eye className="w-3.5 h-3.5 shrink-0" />
|
||||||
|
<span className="truncate">Detail</span>
|
||||||
|
</Link>
|
||||||
|
|
||||||
<ShareButton
|
<ShareButton
|
||||||
orderId={order.id}
|
orderId={order.id}
|
||||||
className="w-full h-9 rounded-xl font-bold text-xs gap-1.5 shadow-sm bg-white dark:bg-slate-900"
|
orderTitle={order.title}
|
||||||
|
className="flex-1 h-9 rounded-xl font-bold text-xs gap-1.5 shadow-sm bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-800 hover:text-slate-900 transition-all text-slate-700 dark:text-slate-300 px-1"
|
||||||
showText={true}
|
showText={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ import { DialogContent, DialogTitle } from '@/components/ui/dialog'
|
|||||||
import { Checkbox } from '@/components/ui/checkbox'
|
import { Checkbox } from '@/components/ui/checkbox'
|
||||||
import { Label } from '@/components/ui/label'
|
import { Label } from '@/components/ui/label'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
import { submitOrder, getUserSubmission, getSessionUser } from '@/app/actions'
|
import { submitOrder, getUserSubmission, getSessionUser, getOrderDetail } from '@/app/actions'
|
||||||
import { PlusCircle, MinusCircle, CheckCircle2 } from 'lucide-react'
|
import { PlusCircle, MinusCircle, CheckCircle2 } from 'lucide-react'
|
||||||
|
|
||||||
export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: () => void }) {
|
export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: () => void }) {
|
||||||
|
const [liveOrder, setLiveOrder] = useState<any>(order)
|
||||||
const [userId, setUserId] = useState<string>('')
|
const [userId, setUserId] = useState<string>('')
|
||||||
const [items, setItems] = useState<Record<string, { selected: boolean, qty: number }>>({})
|
const [items, setItems] = useState<Record<string, { selected: boolean, qty: number }>>({})
|
||||||
const [customItems, setCustomItems] = useState<Array<{ id: string, name: string, qty: number }>>([])
|
const [customItems, setCustomItems] = useState<Array<{ id: string, name: string, qty: number }>>([])
|
||||||
@@ -19,32 +20,35 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
|
const freshOrder = await getOrderDetail(order.id)
|
||||||
|
if (freshOrder) setLiveOrder(freshOrder)
|
||||||
|
|
||||||
const user = await getSessionUser()
|
const user = await getSessionUser()
|
||||||
if (user?.id) {
|
if (user?.id) {
|
||||||
setUserId(user.id)
|
setUserId(user.id)
|
||||||
loadExistingSubmission(user.id)
|
loadExistingSubmission(user.id, freshOrder || order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
}, [order.id])
|
}, [order.id])
|
||||||
|
|
||||||
const loadExistingSubmission = async (uid: string) => {
|
const loadExistingSubmission = async (uid: string, currentOrder: any) => {
|
||||||
const sub = await getUserSubmission(order.id, uid)
|
const sub = await getUserSubmission(currentOrder.id, uid)
|
||||||
if (sub) {
|
if (sub) {
|
||||||
const newItems: any = { ...items }
|
const freshItems: any = {}
|
||||||
const newCustoms: any[] = []
|
const newCustoms: any[] = []
|
||||||
|
|
||||||
sub.items.forEach((item: any) => {
|
sub.items.forEach((item: any) => {
|
||||||
if (!item.is_custom) {
|
if (!item.is_custom) {
|
||||||
const stdItem = order.available_items.find((ai: any) => ai.name === item.name)
|
const stdItem = currentOrder.available_items.find((ai: any) => ai.name === item.name)
|
||||||
if (stdItem) {
|
if (stdItem) {
|
||||||
newItems[stdItem.id] = { selected: true, qty: item.qty }
|
freshItems[stdItem.id] = { selected: true, qty: item.qty }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newCustoms.push({ id: Math.random().toString(), name: item.name, qty: item.qty })
|
newCustoms.push({ id: Math.random().toString(), name: item.name, qty: item.qty })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setItems(newItems)
|
setItems(freshItems)
|
||||||
setCustomItems(newCustoms)
|
setCustomItems(newCustoms)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +90,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
|
|
||||||
const payloadItems: any[] = []
|
const payloadItems: any[] = []
|
||||||
|
|
||||||
order.available_items.forEach((ai: any) => {
|
liveOrder.available_items.forEach((ai: any) => {
|
||||||
const state = items[ai.id]
|
const state = items[ai.id]
|
||||||
if (state?.selected && state.qty > 0) {
|
if (state?.selected && state.qty > 0) {
|
||||||
payloadItems.push({ name: ai.name, qty: state.qty, is_custom: false })
|
payloadItems.push({ name: ai.name, qty: state.qty, is_custom: false })
|
||||||
@@ -106,7 +110,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await submitOrder({
|
const res = await submitOrder({
|
||||||
order_id: order.id,
|
order_id: liveOrder.id,
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
items: payloadItems
|
items: payloadItems
|
||||||
})
|
})
|
||||||
@@ -124,7 +128,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
<div className="bg-gradient-to-br from-[#1B2CC1] to-[#121E85] p-6 text-white">
|
<div className="bg-gradient-to-br from-[#1B2CC1] to-[#121E85] p-6 text-white">
|
||||||
<span className="text-[11px] font-bold uppercase tracking-wider text-blue-200">Form Titipan</span>
|
<span className="text-[11px] font-bold uppercase tracking-wider text-blue-200">Form Titipan</span>
|
||||||
<DialogTitle className="text-2xl font-black tracking-tight text-white mt-1">
|
<DialogTitle className="text-2xl font-black tracking-tight text-white mt-1">
|
||||||
{order.title}
|
{liveOrder.title}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<p className="text-xs text-blue-100 mt-1">
|
<p className="text-xs text-blue-100 mt-1">
|
||||||
Pilih menu yang tersedia di bawah atau tambahkan item khusus jika diizinkan.
|
Pilih menu yang tersedia di bawah atau tambahkan item khusus jika diizinkan.
|
||||||
@@ -138,7 +142,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
Daftar Menu Tersedia
|
Daftar Menu Tersedia
|
||||||
</Label>
|
</Label>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{order.available_items.map((item: any) => {
|
{liveOrder.available_items.map((item: any) => {
|
||||||
const isSelected = items[item.id]?.selected || false
|
const isSelected = items[item.id]?.selected || false
|
||||||
const qty = items[item.id]?.qty || 0
|
const qty = items[item.id]?.qty || 0
|
||||||
return (
|
return (
|
||||||
@@ -154,12 +158,18 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
<div className="flex items-center gap-3 flex-1 min-w-0">
|
<div className="flex items-center gap-3 flex-1 min-w-0">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id={`item-${item.id}`}
|
id={`item-${item.id}`}
|
||||||
checked={isSelected}
|
checked={isSelected && !item.is_sold_out}
|
||||||
onCheckedChange={(c) => handleStandardItemToggle(item.id, c as boolean)}
|
disabled={item.is_sold_out}
|
||||||
className="rounded-lg data-[state=checked]:bg-[#1B2CC1] data-[state=checked]:border-[#1B2CC1]"
|
onCheckedChange={(c) => !item.is_sold_out && handleStandardItemToggle(item.id, c as boolean)}
|
||||||
|
className="rounded-lg data-[state=checked]:bg-[#1B2CC1] data-[state=checked]:border-[#1B2CC1] disabled:opacity-50"
|
||||||
/>
|
/>
|
||||||
<Label htmlFor={`item-${item.id}`} className="text-sm font-bold text-slate-800 dark:text-slate-200 cursor-pointer truncate">
|
<Label htmlFor={`item-${item.id}`} className={cn("text-sm font-bold truncate flex items-center gap-2", item.is_sold_out ? "text-slate-400 dark:text-slate-500 cursor-not-allowed" : "text-slate-800 dark:text-slate-200 cursor-pointer")}>
|
||||||
{item.name}
|
<span className={item.is_sold_out ? "line-through" : ""}>{item.name}</span>
|
||||||
|
{item.is_sold_out && (
|
||||||
|
<span className="text-[9px] bg-rose-100 dark:bg-rose-950/30 text-rose-600 dark:text-rose-400 px-1.5 py-0.5 rounded font-black uppercase tracking-wider border border-rose-200 dark:border-rose-900/50">
|
||||||
|
Sold Out
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
{isSelected && (
|
{isSelected && (
|
||||||
@@ -188,7 +198,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{order.available_items.length === 0 && (
|
{liveOrder.available_items.length === 0 && (
|
||||||
<p className="text-xs text-slate-400 text-center py-3 bg-slate-50 dark:bg-slate-800/40 rounded-xl border border-dashed border-slate-200 dark:border-slate-800">
|
<p className="text-xs text-slate-400 text-center py-3 bg-slate-50 dark:bg-slate-800/40 rounded-xl border border-dashed border-slate-200 dark:border-slate-800">
|
||||||
Tidak ada menu standar yang ditentukan.
|
Tidak ada menu standar yang ditentukan.
|
||||||
</p>
|
</p>
|
||||||
@@ -197,7 +207,7 @@ export function OrderFormModal({ order, onSuccess }: { order: any, onSuccess: ()
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Custom Items */}
|
{/* Custom Items */}
|
||||||
{order.allow_custom && (
|
{liveOrder.allow_custom && (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<Label className="text-xs font-bold uppercase tracking-wider text-slate-400">
|
<Label className="text-xs font-bold uppercase tracking-wider text-slate-400">
|
||||||
|
|||||||
@@ -2,52 +2,111 @@
|
|||||||
|
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Share2, Check } from 'lucide-react'
|
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
|
||||||
|
import { Share2, Check, Copy, MessageCircle, MessageSquare, Loader2 } from 'lucide-react'
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
|
import { broadcastToMattermost, getSettings } from '@/app/actions'
|
||||||
|
import { toast } from 'sonner'
|
||||||
|
|
||||||
interface ShareButtonProps {
|
interface ShareButtonProps {
|
||||||
orderId: string
|
orderId: string
|
||||||
|
orderTitle?: string
|
||||||
className?: string
|
className?: string
|
||||||
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost"
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost"
|
||||||
size?: "default" | "sm" | "lg" | "icon"
|
size?: "default" | "sm" | "lg" | "icon"
|
||||||
showText?: boolean
|
showText?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ShareButton({ orderId, className, variant = "outline", size = "sm", showText = true }: ShareButtonProps) {
|
export function ShareButton({ orderId, orderTitle = 'Pesanan', className, variant = "outline", size = "sm", showText = true }: ShareButtonProps) {
|
||||||
const [copied, setCopied] = useState(false)
|
const [copied, setCopied] = useState(false)
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
const [broadcasting, setBroadcasting] = useState(false)
|
||||||
|
|
||||||
const handleShare = () => {
|
const handleCopyLink = () => {
|
||||||
const url = `${window.location.origin}/order/${orderId}`
|
const url = `${window.location.origin}/order/${orderId}`
|
||||||
navigator.clipboard.writeText(url)
|
navigator.clipboard.writeText(url)
|
||||||
setCopied(true)
|
setCopied(true)
|
||||||
setTimeout(() => setCopied(false), 2000)
|
setTimeout(() => setCopied(false), 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleShareWA = async () => {
|
||||||
|
const settings = await getSettings()
|
||||||
|
let template = settings.WHATSAPP_TEMPLATE || 'Halo tim! Lagi ada orderan open nih untuk {title}. Mumpung belum di-checkout, yang mau ikutan nitip bisa langsung cek ke sini ya: {url}'
|
||||||
|
|
||||||
|
const url = `${window.location.origin}/order/${orderId}`
|
||||||
|
const text = template.replace('{title}', orderTitle).replace('{url}', url)
|
||||||
|
|
||||||
|
window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent(text)}`, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleBroadcastMattermost = async () => {
|
||||||
|
setBroadcasting(true)
|
||||||
|
const url = `${window.location.origin}/order/${orderId}`
|
||||||
|
const res = await broadcastToMattermost(orderId, url)
|
||||||
|
if (res.success) {
|
||||||
|
toast.success('Broadcast Terkirim!', {
|
||||||
|
description: 'Berhasil mengirim pesan ke Mattermost.',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
setOpen(false)
|
||||||
|
} else {
|
||||||
|
toast.error('Gagal Broadcast', {
|
||||||
|
description: res.error || 'Terjadi kesalahan saat mengirim.',
|
||||||
|
duration: 3000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setBroadcasting(false)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Button
|
<Button
|
||||||
variant={variant}
|
variant={variant}
|
||||||
size={size}
|
size={size}
|
||||||
onClick={handleShare}
|
className={cn("transition-all", className)}
|
||||||
className={cn(
|
|
||||||
"transition-all",
|
|
||||||
copied
|
|
||||||
? "bg-emerald-50 text-emerald-600 border-emerald-200 hover:bg-emerald-100 hover:text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-400 dark:border-emerald-800"
|
|
||||||
: "",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
title="Bagikan PO"
|
title="Bagikan PO"
|
||||||
|
onClick={() => setOpen(true)}
|
||||||
>
|
>
|
||||||
{copied ? (
|
|
||||||
<>
|
|
||||||
<Check className="w-3.5 h-3.5 shrink-0" />
|
|
||||||
{showText && <span className="truncate hidden sm:inline">Tersalin</span>}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<Share2 className="w-3.5 h-3.5 shrink-0" />
|
<Share2 className="w-3.5 h-3.5 shrink-0" />
|
||||||
{showText && <span className="truncate hidden sm:inline">Bagikan</span>}
|
{showText && <span className="truncate hidden sm:inline">Bagikan</span>}
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
|
<DialogContent className="sm:max-w-xs p-6 rounded-3xl border-slate-200/90 dark:border-slate-800">
|
||||||
|
<DialogTitle className="text-xl font-black text-center text-slate-900 dark:text-white mb-2">Bagikan Pesanan</DialogTitle>
|
||||||
|
<p className="text-sm text-slate-500 text-center mb-4">
|
||||||
|
Pilih metode untuk membagikan PO ini ke teman atau tim Anda.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div className="space-y-3">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
onClick={handleCopyLink}
|
||||||
|
className="w-full h-11 rounded-xl justify-start font-bold gap-3 text-slate-700 dark:text-slate-300"
|
||||||
|
>
|
||||||
|
{copied ? <Check className="w-4 h-4 text-emerald-500" /> : <Copy className="w-4 h-4" />}
|
||||||
|
{copied ? 'Tautan Disalin!' : 'Salin Tautan'}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={handleShareWA}
|
||||||
|
className="w-full h-11 rounded-xl justify-start font-bold gap-3 bg-[#25D366] hover:bg-[#20bd5a] text-white"
|
||||||
|
>
|
||||||
|
<MessageCircle className="w-4 h-4" />
|
||||||
|
Kirim ke WhatsApp
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
onClick={handleBroadcastMattermost}
|
||||||
|
disabled={broadcasting}
|
||||||
|
className="w-full h-11 rounded-xl justify-start font-bold gap-3 bg-[#0668E1] hover:bg-[#0557bc] text-white"
|
||||||
|
>
|
||||||
|
{broadcasting ? <Loader2 className="w-4 h-4 animate-spin" /> : <MessageSquare className="w-4 h-4" />}
|
||||||
|
{broadcasting ? 'Mengirim...' : 'Broadcast ke Mattermost'}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import {
|
|||||||
ArrowUpRight,
|
ArrowUpRight,
|
||||||
Info,
|
Info,
|
||||||
BarChart2,
|
BarChart2,
|
||||||
Wallet
|
Wallet,
|
||||||
|
Settings
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
@@ -63,7 +64,7 @@ export function Sidebar({ isOpen, onClose }: { isOpen?: boolean; onClose?: () =>
|
|||||||
// Dynamic Menu Items based on role
|
// Dynamic Menu Items based on role
|
||||||
const finalMenuItems = [...menuItems]
|
const finalMenuItems = [...menuItems]
|
||||||
if (userRole === 'superadmin') {
|
if (userRole === 'superadmin') {
|
||||||
finalMenuItems.push({ name: 'User Management', href: '/users', icon: UserCircle, desc: 'Kelola pengguna' })
|
finalMenuItems.push({ name: 'Pengaturan', href: '/settings/users', icon: Settings, desc: 'Konfigurasi aplikasi' })
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -240,7 +241,7 @@ export function Sidebar({ isOpen, onClose }: { isOpen?: boolean; onClose?: () =>
|
|||||||
{/* Copyright */}
|
{/* Copyright */}
|
||||||
<div className="mt-4 pt-4 border-t border-slate-100 dark:border-slate-800 text-center">
|
<div className="mt-4 pt-4 border-t border-slate-100 dark:border-slate-800 text-center">
|
||||||
<p className="text-[10px] text-slate-400 font-medium">
|
<p className="text-[10px] text-slate-400 font-medium">
|
||||||
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan<br/>by firmanramdhani
|
© {new Date().getFullYear()} TitipIn - Sistem Titip Pesanan
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useState } from 'react'
|
||||||
|
import { Card, CardContent } from '@/components/ui/card'
|
||||||
|
import { Button } from '@/components/ui/button'
|
||||||
|
import { Copy, Check, Receipt } from 'lucide-react'
|
||||||
|
|
||||||
|
export function SummaryGenerator({ order }: { order: any }) {
|
||||||
|
const [copiedPerson, setCopiedPerson] = useState(false)
|
||||||
|
const [copiedItem, setCopiedItem] = useState(false)
|
||||||
|
|
||||||
|
// Generate Summaries
|
||||||
|
let summaryByPerson = `${order.title}\n`
|
||||||
|
const itemCounts: Record<string, number> = {}
|
||||||
|
|
||||||
|
order.submissions?.forEach((sub: any) => {
|
||||||
|
const itemStrings = sub.items.map((i: any) => `${i.name} ${i.qty}x`)
|
||||||
|
summaryByPerson += `- ${sub.user?.name || 'Unknown'} : ${itemStrings.join(', ')}\n`
|
||||||
|
|
||||||
|
sub.items.forEach((i: any) => {
|
||||||
|
itemCounts[i.name] = (itemCounts[i.name] || 0) + i.qty
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
let summaryByItem = `${order.title}\n`
|
||||||
|
Object.entries(itemCounts).forEach(([name, qty]) => {
|
||||||
|
summaryByItem += `- ${name} : ${qty} pcs\n`
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleCopyPerson = () => {
|
||||||
|
navigator.clipboard.writeText(summaryByPerson)
|
||||||
|
setCopiedPerson(true)
|
||||||
|
setTimeout(() => setCopiedPerson(false), 2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleCopyItem = () => {
|
||||||
|
navigator.clipboard.writeText(summaryByItem)
|
||||||
|
setCopiedItem(true)
|
||||||
|
setTimeout(() => setCopiedItem(false), 2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<div className="px-1">
|
||||||
|
<h3 className="text-lg font-black text-slate-900 dark:text-white flex items-center gap-2">
|
||||||
|
<Receipt className="w-5 h-5 text-[#1B2CC1]" />
|
||||||
|
<span>Generator Rekap</span>
|
||||||
|
</h3>
|
||||||
|
<p className="text-xs text-slate-500 mt-0.5">Salin format teks siap kirim ke WhatsApp / grup.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Rekap Per Orang */}
|
||||||
|
<Card className="rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden">
|
||||||
|
<div className="p-4 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/40">
|
||||||
|
<span className="text-xs font-bold text-slate-800 dark:text-slate-200">
|
||||||
|
Rekap per Orang
|
||||||
|
</span>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleCopyPerson}
|
||||||
|
className="h-8 text-xs font-bold rounded-lg border-slate-200 gap-1.5 hover:bg-[#1B2CC1] hover:text-white transition-all"
|
||||||
|
>
|
||||||
|
{copiedPerson ? <Check className="w-3.5 h-3.5 text-emerald-500" /> : <Copy className="w-3.5 h-3.5" />}
|
||||||
|
<span>{copiedPerson ? 'Tersalin!' : 'Copy Text'}</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<pre className="text-xs font-mono bg-slate-50 dark:bg-slate-800/80 p-3.5 rounded-xl overflow-x-auto whitespace-pre-wrap border border-slate-200/80 dark:border-slate-700 text-slate-700 dark:text-slate-300 leading-relaxed">
|
||||||
|
{summaryByPerson}
|
||||||
|
</pre>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{/* Rekap Per Item */}
|
||||||
|
<Card className="rounded-2xl border border-slate-200/90 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-sm overflow-hidden">
|
||||||
|
<div className="p-4 border-b border-slate-100 dark:border-slate-800 flex justify-between items-center bg-slate-50/50 dark:bg-slate-800/40">
|
||||||
|
<span className="text-xs font-bold text-slate-800 dark:text-slate-200">
|
||||||
|
Rekap per Item (Akumulasi)
|
||||||
|
</span>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={handleCopyItem}
|
||||||
|
className="h-8 text-xs font-bold rounded-lg border-slate-200 gap-1.5 hover:bg-[#1B2CC1] hover:text-white transition-all"
|
||||||
|
>
|
||||||
|
{copiedItem ? <Check className="w-3.5 h-3.5 text-emerald-500" /> : <Copy className="w-3.5 h-3.5" />}
|
||||||
|
<span>{copiedItem ? 'Tersalin!' : 'Copy Text'}</span>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<pre className="text-xs font-mono bg-slate-50 dark:bg-slate-800/80 p-3.5 rounded-xl overflow-x-auto whitespace-pre-wrap border border-slate-200/80 dark:border-slate-700 text-slate-700 dark:text-slate-300 leading-relaxed">
|
||||||
|
{summaryByItem}
|
||||||
|
</pre>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useTheme } from "next-themes"
|
||||||
|
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
||||||
|
import { CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from "lucide-react"
|
||||||
|
|
||||||
|
const Toaster = ({ ...props }: ToasterProps) => {
|
||||||
|
const { theme = "system" } = useTheme()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Sonner
|
||||||
|
theme={theme as ToasterProps["theme"]}
|
||||||
|
className="toaster group"
|
||||||
|
icons={{
|
||||||
|
success: (
|
||||||
|
<CircleCheckIcon className="size-4" />
|
||||||
|
),
|
||||||
|
info: (
|
||||||
|
<InfoIcon className="size-4" />
|
||||||
|
),
|
||||||
|
warning: (
|
||||||
|
<TriangleAlertIcon className="size-4" />
|
||||||
|
),
|
||||||
|
error: (
|
||||||
|
<OctagonXIcon className="size-4" />
|
||||||
|
),
|
||||||
|
loading: (
|
||||||
|
<Loader2Icon className="size-4 animate-spin" />
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
style={
|
||||||
|
{
|
||||||
|
"--normal-bg": "var(--popover)",
|
||||||
|
"--normal-text": "var(--popover-foreground)",
|
||||||
|
"--normal-border": "var(--border)",
|
||||||
|
"--border-radius": "var(--radius)",
|
||||||
|
} as React.CSSProperties
|
||||||
|
}
|
||||||
|
toastOptions={{
|
||||||
|
classNames: {
|
||||||
|
toast: "cn-toast group-[.toaster]:bg-white dark:group-[.toaster]:bg-slate-950 group-[.toaster]:text-slate-950 dark:group-[.toaster]:text-slate-50 group-[.toaster]:border-slate-200 dark:group-[.toaster]:border-slate-800",
|
||||||
|
title: "font-bold",
|
||||||
|
description: "!text-slate-700 dark:!text-slate-300",
|
||||||
|
success: "group-[.toaster]:border-emerald-500 group-[.toaster]:bg-emerald-50 dark:group-[.toaster]:bg-emerald-950/50 group-[.toaster]:text-emerald-900 dark:group-[.toaster]:text-emerald-100 [&_svg]:text-emerald-600 dark:[&_svg]:text-emerald-400 [&_[data-description]]:!text-emerald-700 dark:[&_[data-description]]:!text-emerald-300",
|
||||||
|
error: "group-[.toaster]:border-red-500 group-[.toaster]:bg-red-50 dark:group-[.toaster]:bg-red-950/50 group-[.toaster]:text-red-900 dark:group-[.toaster]:text-red-100 [&_svg]:text-red-600 dark:[&_svg]:text-red-400 [&_[data-description]]:!text-red-700 dark:[&_[data-description]]:!text-red-300",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Toaster }
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
import { cn } from "cn"
|
||||||
|
|
||||||
|
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
||||||
|
return (
|
||||||
|
<textarea
|
||||||
|
data-slot="textarea"
|
||||||
|
className={cn(
|
||||||
|
"flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Textarea }
|
||||||
@@ -2714,6 +2714,11 @@ clsx@^2.1.1:
|
|||||||
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999"
|
resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.1.1.tgz#eed397c9fd8bd882bfb18deab7102049a2f32999"
|
||||||
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==
|
integrity sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==
|
||||||
|
|
||||||
|
cn@^0.2.6:
|
||||||
|
version "0.2.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/cn/-/cn-0.2.6.tgz#16e7a9f1746efcb104fbea027806c17810b5ee6a"
|
||||||
|
integrity sha512-+i4L0zUGgRcEnhsxueVrP7iBGxBx5iD0WOTYg1MwFEu2ZyCmH5Ov2V1cul2Ht5UchRQQgftCf4be/RxspuW6QQ==
|
||||||
|
|
||||||
code-block-writer@^13.0.3:
|
code-block-writer@^13.0.3:
|
||||||
version "13.0.3"
|
version "13.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-13.0.3.tgz#90f8a84763a5012da7af61319dd638655ae90b5b"
|
resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-13.0.3.tgz#90f8a84763a5012da7af61319dd638655ae90b5b"
|
||||||
@@ -4923,6 +4928,11 @@ negotiator@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
content-type "^2.1.0"
|
content-type "^2.1.0"
|
||||||
|
|
||||||
|
next-themes@^0.4.6:
|
||||||
|
version "0.4.6"
|
||||||
|
resolved "https://registry.yarnpkg.com/next-themes/-/next-themes-0.4.6.tgz#8d7e92d03b8fea6582892a50a928c9b23502e8b6"
|
||||||
|
integrity sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==
|
||||||
|
|
||||||
next@16.3.3:
|
next@16.3.3:
|
||||||
version "16.3.3"
|
version "16.3.3"
|
||||||
resolved "https://registry.yarnpkg.com/next/-/next-16.3.3.tgz#dc062aa903c34e2af41a0ffa2ad99c9369447d07"
|
resolved "https://registry.yarnpkg.com/next/-/next-16.3.3.tgz#dc062aa903c34e2af41a0ffa2ad99c9369447d07"
|
||||||
@@ -5906,6 +5916,11 @@ socks@^2.8.8:
|
|||||||
ip-address "^10.1.1"
|
ip-address "^10.1.1"
|
||||||
smart-buffer "^4.2.0"
|
smart-buffer "^4.2.0"
|
||||||
|
|
||||||
|
sonner@^2.0.8:
|
||||||
|
version "2.0.8"
|
||||||
|
resolved "https://registry.yarnpkg.com/sonner/-/sonner-2.0.8.tgz#dbfa02bb4eb0924616800a4594e9a455a9a195ac"
|
||||||
|
integrity sha512-UM/ByIoFra8yzV75n1o0Puu0bw5U/9UNnDacrJNspekBewIfsQ3D6ez1nvlWpt7aTsO6rujQtifBpycwIivqlg==
|
||||||
|
|
||||||
source-list-map@^2.0.0:
|
source-list-map@^2.0.0:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
|
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
|
||||||
|
|||||||
Reference in New Issue
Block a user