-- 1. เพิ่ม columns ใน documents table alter table documents add column if not exists doc_number text, add column if not exists workflow_steps jsonb default '[]'::jsonb, add column if not exists workflow_template_id uuid, add column if not exists current_step int default 0, add column if not exists sla_due timestamptz, add column if not exists priority text default 'ปกติ', add column if not exists approval_mode text, add column if not exists approvers_json text;
-- 2. สร้าง app_settings table (เก็บ EmailJS config) create table if not exists app_settings (
key text primary key,
value jsonb,
updated_at timestamptz default now()
);
alter table documents add column if not exists doc_number text, add column if not exists workflow_steps jsonb default '[]'::jsonb, add column if not exists workflow_template_id uuid, add column if not exists current_step int default 0, add column if not exists sla_due timestamptz, add column if not exists priority text default 'ปกติ', add column if not exists approval_mode text, add column if not exists approvers_json text; create table if not exists app_settings (key text primary key, value jsonb, updated_at timestamptz default now()); create table if not exists approval_tokens (token uuid primary key default gen_random_uuid(), approval_id uuid, document_id uuid, approver_email text, approver_name text, used boolean default false, expires_at timestamptz, step_order int default 0, approval_mode text, total_steps int, creator_email text, email_config jsonb, created_at timestamptz default now());
—
ผู้ใช้งานทั้งหมด
—
แผนก
—
Workflow Templates
จัดการผู้ใช้งาน
จัดการแผนก
ระบบ & ความปลอดภัย
บังคับ 2FA สำหรับ Admin
บันทึก Audit Log ทุกการกระทำ
อนุญาต Login นอกเวลาทำงาน
Auto Backup ทุกคืน
Danger Zone
Dashboard / เอกสารของฉัน
ทั้งหมด
แบบร่าง
รออนุมัติ
เสร็จสิ้น
เลขที่เอกสาร
หัวข้อเอกสาร
แผนก
สถานะ
วันที่สร้าง
Workflow
การแจ้งเตือน
DOC-2024-0070 รอการอนุมัติจากคุณ
2 ชั่วโมงที่แล้ว
DOC-2024-0069 ได้รับการอนุมัติแล้ว
5 ชั่วโมงที่แล้ว
DOC-2024-0068 เกิน SLA 24 ชั่วโมง
1 วันที่แล้ว
ระบุเหตุผลที่ไม่อนุมัติ
คลิกแนบไฟล์
เพิ่มขั้นตอนอนุมัติ
เพิ่มผู้ใช้งานใหม่
รายคน
นำเข้าทั้งหมด (50 รายการ)
นำเข้า email ทั้งหมดจากโรงพยาบาลนครินทร์ — ใช้ Service Role Key ในการสร้าง user ใน Supabase Auth