إدارة الطلبات
تابع طلبات الزبائن وحدّث حالاتها لحظة بلحظة
كل الطلبات
| الطلب | الزبون | المنتج | وصل الدفع | الحالة | إجراءات |
|---|---|---|---|---|---|
جارٍ التحميل... يتم الآن جلب الطلبات من قاعدة البيانات | |||||
إضافة عرض جديد
العروض الحالية
إضافة حساب للخزنة
الحسابات المخزّنة
تقييمات الزبائن
| الزبون | التقييم | التعليق | الوقت | إجراءات |
|---|
سجل نشاطات لوحة التحكم
| العملية | التفاصيل | الطلب / العنصر | الوقت |
|---|
طرق الدفع
تظهر للزبون في صفحة الدفع مع زر نسخ. أوقف أي طريقة لإخفائها فوراً من المتجر.
قنوات التواصل
رقم الواتساب الذي تصله متابعات الزبائن، وحساب التيك توك المعروض بالموقع.
توفر شحن الأجهزة
مفاتيح فورية: ما توقفه هنا يختفي فوراً من نموذج الطلب في المتجر، ويُحفظ تلقائياً في القاعدة.
إذا عطّلت المنصتين معاً يتوقف استقبال طلبات الكوينز في المتجر وتظهر رسالة "متوقف مؤقتاً" للزبائن.
إرسال الإيميلات للزبائن
يُرسل إيميل جاهز للزبون عند اكتمال طلبه. الوضع الافتراضي يفتح برنامج البريد لديك بالرسالة معبأة. لإرسال آلي كامل ضع رابط Webhook (مثل EmailJS / Zapier / Make).
اختبر بنفسك: أدخل بريدك أنت وأرسل إيميلاً تجريبياً للتأكد من النظام قبل استقبال طلبات حقيقية.
إشعارات تيليجرام
تصلك تفاصيل كل طلب جديد فوراً على حسابك في تيليجرام.
الأمان — كلمة المرور
غيّر كلمة مرور لوحة التحكم. ستُطلب منك عند كل دخول جديد.
إعداد قاعدة البيانات — Supabase
انسخ الكود كاملاً والصقه في صفحة SQL Editor داخل مشروعك على Supabase ثم اضغط Run. الكود الآن آمن تماماً — يمكنك تنفيذه أكثر من مرة دون أخطاء، ويعمل حتى لو كانت الجداول منشأة مسبقاً (سيضيف الأعمدة الناقصة فقط).
أمر الإصلاح السريع: إذا ظهرت لك رسالة "تأكد من إنشاء جدول products" أو "فشل التحديث" — فهذا يعني أن جداولك أُنشئت بكود قديم. الصق هذه الأسطر الثلاثة فقط في SQL Editor ثم Run وستُحل المشكلة فوراً دون المساس ببياناتك:
alter table public.products add column if not exists gallery text default '[]'; alter table public.products add column if not exists is_sold boolean default false; alter table public.orders add column if not exists device text default ''; alter table public.orders add column if not exists user_id uuid; alter table public.orders add column if not exists user_email text default ''; create table if not exists public.activity_logs ( id uuid primary key default gen_random_uuid(), action text default '', details text default '', ref text default '', actor text default 'admin', created_at timestamptz default now() ); alter table public.activity_logs enable row level security; drop policy if exists "pub logs" on public.activity_logs; create policy "pub logs" on public.activity_logs for all using (true) with check (true); create table if not exists public.profiles ( id uuid primary key references auth.users(id) on delete cascade, email text default '', full_name text default '', phone text default '', created_at timestamptz default now() ); alter table public.profiles enable row level security; drop policy if exists "profiles read own" on public.profiles; drop policy if exists "profiles insert own" on public.profiles; drop policy if exists "profiles update own" on public.profiles; create policy "profiles read own" on public.profiles for select using (auth.uid() = id); create policy "profiles insert own" on public.profiles for insert with check (auth.uid() = id); create policy "profiles update own" on public.profiles for update using (auth.uid() = id);
-- أساسي: يضمن توفر دالة توليد المعرفات في بعض المشاريع القديمة
create extension if not exists pgcrypto;
-- 1) جدول المنتجات والعروض
create table if not exists public.products (
id uuid primary key default gen_random_uuid(),
name text not null,
category text default 'coins',
description text default '',
price numeric not null default 0,
old_price numeric,
badge text default '',
image text default '',
gallery text default '[]',
is_active boolean default true,
is_sold boolean default false,
sort_order int default 0,
created_at timestamptz default now()
);
-- 2) جدول الطلبات
create table if not exists public.orders (
id uuid primary key default gen_random_uuid(),
order_number text unique,
customer_name text not null,
konami_email text not null,
konami_password text not null,
phone text not null,
device text default '',
product_name text,
product_price text,
category text default 'coins',
receipt_url text,
receipt_name text,
status text default 'pending',
created_at timestamptz default now()
);
-- 3) جدول الإعدادات (مفتاح / قيمة)
create table if not exists public.settings (
key text primary key,
value text default ''
);
-- 3.b) خزنة الحسابات الجاهزة للبيع
create table if not exists public.accounts_vault (
id uuid primary key default gen_random_uuid(),
title text default '',
email text default '',
password text default '',
code text default '',
notes text default '',
is_sold boolean default false,
sold_to text default '',
created_at timestamptz default now()
);
alter table public.accounts_vault enable row level security;
drop policy if exists "pub vault" on public.accounts_vault;
create policy "pub vault" on public.accounts_vault for all using (true) with check (true);
-- 3.c) سجل النشاطات
create table if not exists public.activity_logs (
id uuid primary key default gen_random_uuid(),
action text default '',
details text default '',
ref text default '',
actor text default 'admin',
created_at timestamptz default now()
);
alter table public.activity_logs enable row level security;
drop policy if exists "pub logs" on public.activity_logs;
create policy "pub logs" on public.activity_logs for all using (true) with check (true);
-- 3.d) ملفات الزبائن (تُملأ تلقائياً عند التسجيل)
create table if not exists public.profiles (
id uuid primary key references auth.users(id) on delete cascade,
email text default '',
full_name text default '',
phone text default '',
created_at timestamptz default now()
);
alter table public.profiles enable row level security;
drop policy if exists "profiles read own" on public.profiles;
drop policy if exists "profiles insert own" on public.profiles;
drop policy if exists "profiles update own" on public.profiles;
create policy "profiles read own" on public.profiles for select using (auth.uid() = id);
create policy "profiles insert own" on public.profiles for insert with check (auth.uid() = id);
create policy "profiles update own" on public.profiles for update using (auth.uid() = id);
-- 4) صلاحيات الوصول العام (متجر صغير) — آمن لإعادة التشغيل
alter table public.products enable row level security;
alter table public.orders enable row level security;
alter table public.settings enable row level security;
drop policy if exists "pub products" on public.products;
drop policy if exists "pub orders" on public.orders;
drop policy if exists "pub settings" on public.settings;
create policy "pub products" on public.products for all using (true) with check (true);
create policy "pub orders" on public.orders for all using (true) with check (true);
create policy "pub settings" on public.settings for all using (true) with check (true);
-- 5) حاويات التخزين: وصولات الدفع + صور المنتجات
insert into storage.buckets (id, name, "public") values ('receipts','receipts', true) on conflict (id) do nothing;
insert into storage.buckets (id, name, "public") values ('products','products', true) on conflict (id) do nothing;
drop policy if exists "receipts upload" on storage.objects;
drop policy if exists "receipts read" on storage.objects;
drop policy if exists "products upload" on storage.objects;
drop policy if exists "products read" on storage.objects;
drop policy if exists "products delete" on storage.objects;
create policy "receipts upload" on storage.objects for insert with check (bucket_id = 'receipts');
create policy "receipts read" on storage.objects for select using (bucket_id = 'receipts');
create policy "products upload" on storage.objects for insert with check (bucket_id = 'products');
create policy "products read" on storage.objects for select using (bucket_id = 'products');
create policy "products delete" on storage.objects for delete using (bucket_id = 'products');
-- 6) أعمدة إضافية آمنة (للمشاريع التي أنشأت الجداول من قبل — لا تسبب أي خطأ)
alter table public.products add column if not exists gallery text default '[]';
alter table public.products add column if not exists is_sold boolean default false;
alter table public.orders add column if not exists device text default '';
alter table public.orders add column if not exists user_id uuid;
alter table public.orders add column if not exists user_email text default '';
-- 7) إعدادات افتراضية (تُدار من تبويب الإعدادات)
insert into public.settings (key, value) values
('device_android','on'), ('device_ios','on'), ('shop_email',''), ('mail_hook',''),
('pay_baridimob','on'), ('pay_ccp','on'), ('baridimob_number',''), ('products_order','asc')
on conflict (key) do nothing;
alter table public.orders add column if not exists pay_method text default '';
-- 7.b) جدول التقييمات (تُنشر بعد موافقة الأدمن)
create table if not exists public.reviews (
id uuid primary key default gen_random_uuid(),
name text default '', rating int default 5, comment text default '',
user_email text default '', is_approved boolean default false,
is_verified boolean default false, created_at timestamptz default now()
);
alter table public.reviews enable row level security;
drop policy if exists "reviews read approved" on public.reviews;
drop policy if exists "reviews insert any" on public.reviews;
drop policy if exists "reviews manage" on public.reviews;
create policy "reviews read approved" on public.reviews for select using (true);
create policy "reviews insert any" on public.reviews for insert with check (true);
create policy "reviews manage" on public.reviews for all using (true) with check (true);
-- 8) حماية خلفية على مستوى القاعدة: تُرفض طلبات المنصات المعطلة تلقائياً
create or replace function public.check_device_available()
returns trigger language plpgsql as $$
declare a text; i text;
begin
if coalesce(new.category,'coins') <> 'accounts' then
select value into a from public.settings where key = 'device_android';
select value into i from public.settings where key = 'device_ios';
if new.device = 'Android' and coalesce(a,'on') = 'off' then
raise exception 'ANDROID_UNAVAILABLE';
end if;
if new.device = 'iPhone' and coalesce(i,'on') = 'off' then
raise exception 'IOS_UNAVAILABLE';
end if;
end if;
return new;
end $$;
drop trigger if exists trg_check_device on public.orders;
create trigger trg_check_device before insert on public.orders
for each row execute function public.check_device_available();