feat: desktop image thumbnails, gallery lightbox portal, client-side compression, clickable table rows, fix header gap
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import { ID, Permission, Role } from "node-appwrite";
|
||||
import { ID, Permission, Role, Query } from "node-appwrite";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
import { customerSchema } from "@/lib/validation/customers";
|
||||
import { DATABASE_ID, TABLES } from "./schema";
|
||||
import { DATABASE_ID, TABLES, type CustomerStage } from "./schema";
|
||||
import { createAdminClient } from "./server";
|
||||
import { requireTenant } from "@/lib/appwrite/tenant-guard";
|
||||
|
||||
@@ -35,6 +35,10 @@ export async function createCustomerAction(
|
||||
email: data.email,
|
||||
phone: data.phone,
|
||||
type: data.type,
|
||||
stage: data.stage ?? "ilk_temas",
|
||||
source: data.source,
|
||||
nextFollowUpDate: data.nextFollowUpDate,
|
||||
assigneeId: data.assigneeId,
|
||||
notes: data.notes,
|
||||
createdBy: ctx.user.id,
|
||||
},
|
||||
@@ -74,6 +78,10 @@ export async function updateCustomerAction(
|
||||
email: data.email,
|
||||
phone: data.phone,
|
||||
type: data.type,
|
||||
stage: data.stage,
|
||||
source: data.source,
|
||||
nextFollowUpDate: data.nextFollowUpDate,
|
||||
assigneeId: data.assigneeId,
|
||||
notes: data.notes,
|
||||
});
|
||||
} catch {
|
||||
@@ -84,6 +92,23 @@ export async function updateCustomerAction(
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
export async function updateCustomerStageAction(
|
||||
id: string,
|
||||
stage: CustomerStage,
|
||||
): Promise<ActionState> {
|
||||
await requireTenant();
|
||||
const { tablesDB } = createAdminClient();
|
||||
|
||||
try {
|
||||
await tablesDB.updateRow(DATABASE_ID, TABLES.customers, id, { stage });
|
||||
} catch {
|
||||
return { ok: false, error: "Aşama güncellenemedi." };
|
||||
}
|
||||
|
||||
revalidatePath("/customers");
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
export async function deleteCustomerAction(id: string): Promise<ActionState> {
|
||||
await requireTenant();
|
||||
const { tablesDB } = createAdminClient();
|
||||
|
||||
Reference in New Issue
Block a user