Doc_chelvyn/Mito/Sfa/SFA — Index.md

21 KiB
Raw Blame History

judul proyek terkait stack repo tags diperbarui
SFA — Index Dokumentasi SFA CMS Mito · Odoo 18 Laravel · Filament · PHP 8.3 · MySQL https://repo.sinerka.id/MITO/sfa-cms
sfa
cms
index
2026-11-09

SFA — Index Dokumentasi

Hub dokumen SFA-CMS (aplikasi Laravel/Filament) dan integrasinya ke Odoo 18. Ditaruh di bawah Mito/ karena sumber datanya mito_odoo, walau repo aplikasinya terpisah (MITO/sfa-cms).

Induk: Mito — Index · Vault: Sinerka Index

[!danger] Dokumen di folder ini memuat kredensial & IP server Ada password admin, kredensial MySQL, dan IP publik VPS di dalamnya. Jangan di-share keluar tim, dan password admin default masih belum diganti (lihat To-Do).


📄 Dokumen

🚀 Deploy & Setup — tulisan internal

Dokumen Isi Status
SFA CMS — Deployment VPS MITO Production di AWS EC2 16.79.56.41 — VPS yang sama dengan 4 instance Odoo Docker. Spesifikasi, tabel port terpakai, alasan pakai default_server port 80, cara redeploy, 4 masalah + fix-nya, instalasi lama yang jangan diganggu, catatan security, to-do ⚠️ Jalan, tapi belum ada domain, SSL, & backup
SFA CMS — Deploy 2026-10-06 Log deploy Self Registration + Sync Odoo ke VPS (branch develop 8d5f815): backup DB pertama, migrate biasa gagal (pakai --path), artisan sebagai ubuntu, dry-run sync (product deleted=191, customer deleted=836), cron schedule:run ⚠️ Sebagian — sync pertama, role reviewer, Node API belum
SFA API — Pembersihan .env dari Riwayat Git .env lengkap (DB password, JWT_SECRET, SECRET_KEY) ter-commit di sfa-api sejak Agustus 2025 → riwayat di-rewrite & force-push (main = 58e1831). Dump SQL lama di sfa-cms dibiarkan (hash sudah tidak berlaku) 🔴 Rotasi secret belum
SFA CMS — Setup Development Lokal Jalanin di laptop pakai PHP native (tanpa Docker), kredensial MySQL lokal, 7 migration hasil rekonstruksi skema (44 tabel + 1 view), konvensi tanda qty invent_trans, Filament Shield, symlink upload ✅ Aktif

🔗 Integrasi — tulisan internal

Dokumen Isi Status
SFA CMS — Sync Master Product dari Odoo Scheduler CMS odoo:sync-products yang menarik 639 finished good dari API mito_base /api/v1/products (DB MITO_PRODUCTION_20082026) ke tabel product (kunci kolom lama product_id, tanpa kolom baru; produk lama CMS di-soft delete). Isinya: arsitektur, auth Bearer, masalah no_database, file yang dibuat, mapping field (mengisi TBD FDD §3.4), aturan create/update/soft delete, cara pakai, langkah deploy, 12 temuan ✅ Ter-deploy 06-10-2026 (develop), cron 01:00/01:15 WIB
SFA CMS — Sync Customer dari Odoo Scheduler odoo:sync-customers: 1.259 customer status validate dari /api/v1/customers → tabel customer (kunci cust_code = id Odoo, tanpa kolom baru; 834 customer lama di-soft delete, kecuali hasil Customer Registration). Mapping area/channel/grade/salesperson, 6 temuan ✅ Ter-deploy 06-10-2026 (develop), cron 01:00/01:15 WIB
SFA — Reward Claim ke Odoo (Draft Vendor Bill) Claim reward → Draft Vendor Bill Odoo (FDD v0.4): endpoint POST /api/v1/reward-bills di mito_base (vendor dari CMS User ID = users.id, product dari Default Reward Product, amount = claim, idempotent per Claim ID lewat unique constraint), worker CMS odoo:push-reward-claims tiap menit (retry bertahap, 422 = permanen, tombol Kirim Ulang ke Odoo). Penjelasan per file kode, Mermaid alur/status/retry, kontrak API, hasil uji, 8 keputusan terbuka untuk Finance. Diagram meeting: SFA — Reward Claim ke Odoo (diagram).excalidraw 🛠️ Teruji lokal 14-10-2026 — cms 46fc3c7 di-push, odoo a5cc341e belum di-push; belum deploy

🧩 Fitur — tulisan internal

Dokumen Isi Status
SFA — Self Registration Implementasi FDD Self Registration: 6 endpoint Node API (/registration/*, publik + daftarkan orang lain), menu Filament Customer Registrations (Review/Approve/Revision/Reject/Activate), 3 tabel + users.user_type, aktivasi → users (tanpa akses panel) + customer, keamanan hash $2b$→$2y$ ⚠️ CMS ter-deploy; Node API menunggu merge feature/self-registration; notifikasi & login customer belum
SFA — Staff Registration Implementasi FDD Staff Registration: dealer login mendaftarkan staff (4 endpoint /registration/staff/*), akun staff EXTERNAL PENDING + role Dealer Staff, review di menu Employee External (Approve = aktivasi), 3 tabel baru staff_registration*. Tidak mengubah /auth/login maupun /registration/* 🛠️ Di-push ke develop 13-10-2026 (cms 9271eea, api 79be952), belum deploy
SFA — Customer Registration Implementasi FDD Customer Registration: sales mendaftarkan calon customer baru (POST /master/customer → tabel customer PENDING_APPROVAL, resubmit PUT /master/customer/:id/resubmit), menu CMS Customer Approval (Approve / Revision / Reject, Potential Duplicates, Kirim Ulang ke Odoo, Cek Status Odoo), approve langsung membuat partner Draft lewat POST /api/v1/customers mito_base (idempotent per CMS-CR-xxxxxx, 409 duplicate_email), outbox retry tiap menit, aktif setelah Finance Validate (ditarik odoo:sync-customers lewat odoo_partner_id). Mermaid alur + 3 status, 12 keputusan TBD, perubahan kontrak mobile ⚠️ CMS (d98522a) & Node (b444930) ter-deploy dev 20-10-2026; Odoo 639721ba (cj/api) menunggu PR ke develop
SFA — Reward Implementasi tahap 1 FDD SFA Reward: 7 tabel (program, mapping produk, ledger, saldo, claim, pengajuan IMEI header + line), 6 endpoint Node /reward/* (scan IMEI → pengajuan menunggu approval, riwayat pengajuan, saldo + pending_approval, ledger, claim full balance, riwayat claim) dengan idempotency request_id + lock saldo, menu CMS grup Reward (Reward Program, Saldo Reward + tombol Claim, Claim History, IMEI Registration: satu pengajuan per customer, input IMEI dari CMS, tolak per IMEI, approve per pengajuan). IMEI unik per produk ⚠️ CMS ter-deploy ke dev 13-10-2026 (cms 137aca2 + fix db25341, api 63c9153) — scan IMEI lewat IMEI Registration (approval), claim dari CMS; Draft Vendor Bill Odoo → SFA — Reward Claim ke Odoo (Draft Vendor Bill)
SFA — Revisi Self Registration MoM 22-10-2026 Checklist 4 poin revisi Self Registration dari MoM 22-10-2026: label Kode Referral Sales & Lampiran NPWP di CMS + pesan error / Swagger API, CMS hanya Internal (sudah jalan lewat canAccessPanel), alasan kenapa label "Kode Referal Karyawan" / "Lampiran KTP" tidak ada di CMS (teks mobile). Belum: NIK/NPWP mandatory, lampiran NPWP wajib untuk Company ⚠️ Label ter-deploy dev 29-10-2026 (cms ae16617, api 87ebd72), validasi belum, label mobile di tim mobile
SFA — Revisi Reward MoM 22-10-2026 Checklist 10 poin revisi Reward dari MoM 22-10-2026: IMEI scan 1x (apa pun produknya), hanya IMEI terjual (product_qty = 0, master IMEI CMS hanya simpan yang siap scan), attachment opsional, GET /reward/imei/check. Minimum claim Rp 500.000 (BELOW_MIN_CLAIM), effective from/to mapping dihapus (periode ikut header program), Staff Dealer hanya scan (reward ke saldo dealer, 403 STAFF_NOT_ALLOWED), multi customer — customer per baris produk, 1 customer per baris (produk sama boleh beda nominal per dealer, revisi Oliver 30-10-2026; tab Customer dihapus). Export/import Excel Reward Program (1 sheet, blok per program: produk & customer berjejer ke bawah; upsert, 1 error = semua ditolak). Jobsheet: dipilih dari Odoo (GET /api/v1/jobsheets, dropdown realtime), ikut ke Vendor Bill sebagai referensi teks Jobsheet No. (1 bill per claim, tanpa AP Form). Export program terpilih (centang). Tabel keputusan K1–K5, info tim mobile, mermaid alur scan IMEI + jobsheet ⚠️ 10/10 — CMS (54285e6) & API (35e312d) ter-deploy dev 30-10-2026; revisi customer per baris produk ter-deploy dev 31-10-2026 (CMS 0da379f, API c6fc18a); Odoo Jobsheet bb955bd2 (cj/api) menunggu review senior + deploy; Staff Dealer mobile belum
SFA — Plan Revisi 09-11-2026 Plan 5 revisi (belum ada kode): SO lewat CMS/API atau Mobile langsung ke Odoo (usulan: outbox CMS, idempotent snk_sfa_order_ref), Vendor Bill dipisah per Reward Program (membalik K1; rewards[] di POST /api/v1/reward-bills, unique (claim, program) + migration mito_base, 1 transaksi), history scan IMEI per staff untuk dealer (scanned_by, filter staff_id dari token, summary per staff), export edit/update by ID / External ID (Odoo bawaan vs CMS), IMEI ketik manual (input_method = SCAN / MANUAL, validasi tetap lewat /reward/imei/check). Mermaid per poin, 8 keputusan P1–P8 ⬜ Plan, menunggu keputusan
SFA CMS — Area-Based Visibility Implementasi FDD Area-Based Visibility: employee internal hanya melihat Reward Program (Area creator AND Area customer), baris Product Reward Mapping, dan Master Customer se-Area; Admin CMS (super_admin) semua. Tabel baru employee_area (Employee multi-Area, area_id tetap untuk SFA Mobile), service AreaAccess, import Excel khusus Admin. Mermaid alur visibilitas + simpan mapping, 5 keputusan di luar FDD, temuan: dealer lama belum terhubung ke customer & ±130 user super_admin ⚠️ Ter-deploy dev 03-11-2026 (cms 377b146) — Reward dev semua dibuat super_admin tanpa Area, jadi belum terlihat employee non-admin
SFA API — Login Terpadu auth-login Rancangan /auth/login satu URL untuk user INTERNAL (employee code atau email) dan EXTERNAL (email, tanpa baris employee): users jadi pusat identitas, cek user_type + status, roles di token, pembatasan akses per route, hasil implementasi + uji 29/29, hal yang harus dikabari ke tim mobile, 3 keputusan masih terbuka (role external, satu aplikasi, nasib /registration/login) 🛠️ Di-push ke develop (635ee0e) 12-10-2026, belum diuji di server

🐞 Bug — catatan bug & insiden

Dokumen Isi Status
2026-10-06_deploy-sfa-cms-dev 11 error saat deploy SFA CMS dev 06-10-2026: migrate app_params already exists, ViewSalesTracking not found (namespace Pages\Pages), Permission denied git, symlink public/storage rusak, deploy key Gitea (base64, port 222), webhook Jenkins, hash $2b$, .env sfa-api di riwayat git ⚠️ 10/12 solved, migration workaround, rotasi secret belum
2026-10-13_deploy-reward-npwp-notasi-ilmiah Deploy Reward ke SFA CMS dev 13-10-2026: migration 000002 (NPWP/NIK → BIGINT) gagal karena NPWP tersimpan sebagai notasi ilmiah (Node kirim JSON number sebelum kolom BIGINT) + data uji i, sehingga migration reward tertahan; git pull sebagai root ditolak (port 222 / deploy key milik ubuntu) ✅ Solved — migration diperbaiki (db25341)
2026-10-20_registrasi-role-customer-direname-dealer POST /registration/submit di server dev: 400 arrayMin (attachment []), lalu 500 Role Customer belum ada karena role id 6 Customer di-rename jadi Dealer lewat Shield; server Node tidak bisa pull (HTTPS tanpa kredensial) → deploy via git bundle ✅ Solved — sfa-api 19fba4d, sfa-cms 940e492
2026-10-22_patch-php-cve-php2shell Security: PHP2Shell (CVE-2026-109618 & CVE-2026-109619), RCE tanpa login di PHP-FPM. PHP VPS MITO 8.3.26 → 8.3.36, cek tanda kompromi (bersih), session.upload_progress.enabled=0. Instalasi lama cms.mito.co.id / cms.stein.co.id ikut ter-upgrade, sudah dicek normal. Mermaid alur penanganan bisa dipakai ulang di server lain ✅ Solved — server lain belum dicek

📋 FDD — dokumen dari tim luar

Dokumen Versi · Tanggal Isi Status
Mito - FDD - CMS - Master Product - Revised 1.0 · 08 Sep 2026 Integrasi Master Product Odoo 18 → CMS → SFA Mobile: overview, detail fitur, flow 10 langkah, data mapping, validasi, access right, error handling, 10 test script ⚠️ Draft — Approvers & Distribution masih kosong
SFA_MD_CMS_Self_Registration_v1.0 1.0 Self Registration dari SFA Mobile: alur 11 langkah, status Draft→Active, data requirement, validasi, notifikasi, audit trail, 11 test script. API & 14 open issue masih TBD ⚠️ Draft — keputusan teknis di SFA — Self Registration
SFA – CMS – Staff Registration 1.0 Staff Registration dealer: 7 langkah (terima API, simpan profile, validasi, approve/reject, revisi, aktivasi, notifikasi). Field, validasi, API, error code semuanya TBD ⚠️ Draft — keputusan teknis di SFA — Staff Registration
Functional Design — SFA Reward, CMS, dan Integrasi Odoo 0.2 · 13 Okt 2026 Reward rupiah dari scan IMEI: config program + nominal per produk, ledger & saldo lintas bulan, claim full balance, Draft Vendor Bill Odoo, rekonsiliasi bulanan, UAT, 11 open decision ⚠️ Draft — uniqueness IMEI diputuskan per produk; keputusan lain di SFA — Reward
SFA–CMS Reward Claim Integration to Odoo 18 0.4 · 14 Okt 2026 Draft Vendor Bill dari claim reward: field CMS User ID di Vendor, Default Reward Product di Accounting Settings, flow one-way, error handling & idempotency, 8 open decision ⚠️ Draft — metode integrasi diputuskan custom API mito_base; keputusan lain di SFA — Reward Claim ke Odoo (Draft Vendor Bill)
CUSTOMER REGISTRATION 1.0 · Okt 2026 Customer Registration calon customer SFA → CMS approval → Odoo 18 realtime, status Pending Finance → Active setelah COA AR/AP, validasi email unik + potential duplicate, idempotency registration_id, 12 test script, 10 open issue ⚠️ Draft for Review — keputusan teknis di SFA — Customer Registration
FDD_Area_Based_Visibility_CMS 1.0 Area-Based Visibility CMS: Reward visible bila Area creator & Area customer beririsan dengan Area employee, Master Customer & dropdown Customer per Area, Admin CMS lintas Area, validasi backend, 14 test scenario ⚠️ Draft — asumsi Employee–Area many2many ternyata belum ada; keputusan teknis di SFA CMS — Area-Based Visibility

[!info] Dokumen FDD jangan diedit isinya Itu kiriman tim SFA/CMS — biar tetap bisa dibandingkan dengan revisi berikutnya. Tanggapan & keputusan internal ditulis di halaman ini. Revisi baru → simpan sebagai file terpisah, jangan ditimpa.


Peta Sistem

Odoo 18 (mito_odoo)  ──API──►  SFA-CMS (Laravel/Filament)  ──►  SFA Mobile
 source of truth                scheduler/cron, mapping,
 + API provider                 validasi, create/update, log

Yang paling penting buat sisi kita: polanya pull — scheduler ada di CMS, bukan di Odoo. Odoo cuma menyediakan endpoint dan mengembalikan data saat diminta. Jadi beban kerja kita = API yang stabil, bukan bikin job sinkronisasi.

Pembagian tanggung jawab (FDD §4):

Komponen Tanggung jawab
Odoo 18 Sediakan API Master Product, kembalikan data sesuai request CMS
CMS Scheduler, request, mapping, validasi Product ID, create/update, logging, kirim ke SFA
SFA Mobile Terima & pakai data product dari CMS
User Tidak menjalankan scheduler manual di normal business flow

⚠️ Yang Perlu Diklarifikasi Duluan

[!warning] Ada 2 instalasi SFA-CMS hidup bersamaan, FDD tidak menyebut yang mana targetnya Dari SFA CMS — Deployment VPS MITO#5. Instalasi Lama yang Masih Hidup — JANGAN DIGANGGU: instalasi lama di cms.mito.co.id (/var/www/html/sfa-cms, DB sfacms) masih pegang data produksi asli — 1.496 customer, 499 employee, 94 product — dan nasibnya belum diputuskan. Instalasi baru ada di /var/www/sfa_mito (DB sfa_mito), masih diakses lewat IP. FDD Master Product tidak menyebut integrasinya masuk ke yang mana. Ini harus dijawab sebelum ngoding endpoint.

[!question] Sudah ada Node API /api/sfa — FDD-nya bicara sistem yang sama atau bukan? Instalasi lama punya Node.js API pendamping di port 3000 (MITO) dan 3001 (STEIN) dengan endpoint /api/sfa. Perlu dipastikan apakah integrasi Master Product ini lewat jalur itu, atau jalur baru sama sekali.

Ditambah 6 hal yang FDD sendiri akui belum dispesifikasikan:

# Yang belum jelas Kenapa nge-blok
1 Nama field teknis Odoo ✅ Terjawab: lihat [[SFA CMS — Sync Master Product dari Odoo#4. Mapping Field (mengisi kolom TBD di FDD §3.4)|mapping field]]
2 Endpoint API & authentication ✅ Terjawab: GET /api/v1/products dari mito_base, Authorization: Bearer <mito_base.api_key>
3 Interval scheduler ✅ Terjawab: harian 01:00 WIB (full sync)
4 Payload JSON & retry mechanism Belum ada contoh request/response
5 Delete / archive handling ✅ Diputuskan: FG yang hilang dari Odoo di-soft delete saat full sync, di-restore kalau muncul lagi
6 Full sync vs incremental ✅ Full sync harian. Incremental tersedia lewat --since (param updated_since API)

✅ To-Do Terbuka

Diangkat dari SFA CMS — Deployment VPS MITO#9. To-Do Selanjutnya dan SFA CMS — Deployment VPS MITO#8. Catatan Security — Belum Dibereskan:

Prioritas Hal Detail
✅ Ganti password admin default 06-10-2026: admin@sfa-mito.sinerka.id dibuat ulang di server dev dengan password baru
🔴 Tinggi ±140 user server punya role super_admin (termasuk sales lapangan) Semua bisa masuk panel dengan akses penuh. Sisakan untuk admin, buat role terbatas untuk sales. Lihat 2026-10-06_deploy-sfa-cms-dev#Error 12: Tidak bisa login panel — akun admin tidak ada
🔴 Tinggi Port 3306 (MySQL) terbuka ke 0.0.0.0/0 Pastikan dulu tidak ada sistem luar yang connect, baru tutup
🔴 Tinggi Backup DB sfa_mito belum otomatis Backup manual pertama 06-10-2026 (/root/backup_sfa_mito_2026-10-06_0433.sql). Perlu cron mysqldump + simpan di luar server
🔴 Tinggi Rotasi JWT_SECRET, SECRET_KEY, password DB sfa-api Bocor di riwayat git sejak Agustus 2025. Lihat SFA API — Pembersihan .env dari Riwayat Git
🔴 Tinggi Prospect dari SFA Mobile ter-soft delete tiap malam oleh odoo:sync-customers Putuskan sebelum production. Lihat SFA CMS — Sync Customer dari Odoo#4. Temuan & Catatan Terbuka
🟡 Sedang Domain + SSL untuk CMS baru Sekarang masih default_server port 80, diakses lewat IP
🟡 Sedang Keputusan nasib instalasi lama MITO Migrasi data? jalan paralel? deprecate? — perlu koordinasi tim/client
🔴 Tinggi mito_base.api_key Odoo masih MITO_API_KEY Ganti string acak ≥32 karakter sebelum sync jalan di production
🔴 Tinggi /web/database/list Odoo terbuka publik Set list_db = False + dbfilter di odoo.conf
🟡 Sedang Deploy sync Master Product ke VPS ✅ 06-10-2026. Sisa: konfirmasi sync pertama & cek log besok. Lihat SFA CMS — Deploy 2026-10-06
🟡 Sedang Merge develop → main (sfa-cms) & feature/self-registration → main (sfa-api) Server CMS mengikuti main di dokumen deployment
🟡 Sedang Deploy Node API self registration Pull, filePath=/var/www/sfa_mito/storage/app/public/files, pm2 restart
🟡 Sedang Permission role reviewer Customer Registration Shield → Roles
🟡 Sedang Fix migration rekonstruksi supaya migrate biasa tidak gagal di server Sementara pakai --path
🟡 Sedang Self Registration: notifikasi (channel TBD) & login customer setelah aktif Lihat SFA — Self Registration#8. Belum Dikerjakan / Keputusan Terbuka
🟡 Sedang Keputusan kategori & harga (list_price = 0), menu Product dijadikan read-only
🟡 Sedang Customer: 37 master area/channel baru, 13 salesperson tidak cocok ke employee, Customer Registration belum terkirim ke Odoo Lihat SFA CMS — Sync Customer dari Odoo#4. Temuan & Catatan Terbuka
🟢 Rendah Port 8002, 8003, 4000, 4001 kebuka di ufw Belum diketahui dipakai siapa
🟢 Rendah System update pending di Ubuntu Jadwalkan reboot saat maintenance

Konvensi Folder

Mito/Sfa/
├── SFA — Index.md        ← kamu di sini
├── Deploy & Setup/        tulisan internal — production & lokal
├── Integrasi/             tulisan internal — integrasi Odoo ↔ CMS
├── Fitur/                 tulisan internal — implementasi fitur (mis. Self Registration)
├── Bug/                   catatan bug & insiden: YYYY-MM-DD_<judul>.md
└── FDD/                   dokumen kiriman tim SFA/CMS, simpan apa adanya

Dokumen eksternal → masuk FDD/, isinya jangan diubah, cukup tambah frontmatter + breadcrumb. Tulisan kita sendiri → Deploy & Setup/ atau folder kategori baru. Tiap dokumen baru, tambahkan barisnya di tabel Dokumen di atas.