-- 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());
ตั้งค่าเลขที่เอกสาร
NKR-2568-0001
จัดการ Storage
📁 ไฟล์ทั้งหมด
—
💾 ใช้พื้นที่
—
จาก 1,024 MB
พื้นที่ที่ใช้—%
insert into storage.buckets (id, name, public) values ('doc-attachments', 'doc-attachments', true) on conflict (id) do nothing;
-- 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 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());
—
เอกสารทั้งหมด
ปีนี้
4.2h
เวลาอนุมัติเฉลี่ย
ต่อเอกสาร
78%
อัตราผ่านอนุมัติ
เดือนนี้
—
ผู้ใช้งานทั้งหมด
คน
เอกสารรายเดือน
สัดส่วนตามแผนก
สรุปประสิทธิภาพตามแผนก
แผนก
เอกสารทั้งหมด
อนุมัติแล้ว
รออนุมัติ
กำลังตรวจสอบ
อัตราผ่าน
กำลังโหลด...
Dashboard / เอกสารของฉัน
ทั้งหมด
แบบร่าง
รออนุมัติ
เสร็จสิ้น
เลขที่เอกสาร
หัวข้อเอกสาร
แผนก
สถานะ
วันที่สร้าง
Workflow
การแจ้งเตือน
DOC-2024-0070 รอการอนุมัติจากคุณ
2 ชั่วโมงที่แล้ว
DOC-2024-0069 ได้รับการอนุมัติแล้ว
5 ชั่วโมงที่แล้ว
DOC-2024-0068 เกิน SLA 24 ชั่วโมง
1 วันที่แล้ว
ระบุเหตุผลที่ไม่อนุมัติ
เพิ่มขั้นตอนอนุมัติ
เพิ่มผู้ใช้งานใหม่
รายคน
นำเข้าทั้งหมด (50 รายการ)
นำเข้า email ทั้งหมดจากโรงพยาบาลนครินทร์ — ใช้ Service Role Key ในการสร้าง user ใน Supabase Auth