D
Modul

Kontak

Manajemen kontak pelanggan, tag, segment, import, reputation tracking lintas toko. Label sidebar Kontak, bukan CRM.

Modul Kontak mengelola database pelanggan merchant: kontak, tag, segment, import, dan reputation tracking lintas toko.

File kunci

FileBarisPeran
app/Http/Controllers/ContactController.php2.842CRUD contact, tag, segment, import, reputation
app/Models/Customer.php71Model customer
app/Models/Tag.php26Model tag
app/Models/Segment.php31Model segment

Model Customer

Field: name, wa, email, province/city/subdistrict/village/postal_code/address, tags (array of UUID), segment_id, rating, type ('Customer'), category ('private'/'group'), status ('archive'/aktif), store_id, profilepic, addresses, chat_note.

Relasi: orders() hasMany Order, segment() belongsTo, chats() (query builder, bukan relasi proper — N+1 manual).

Reputation tracking

profitRputationData() (:2264) — hitung reputation customer lintas toko. Query tanpa store_id — ambil semua customer dengan wa sama di seluruh platform. Tiap toko hitung 3 sub-skala: reputasi_pembelian_perchat, reputasi_pembayaran_perpembelian, skala_rating.

Controller method utama

MethodFungsi
store()Create — BUG double-create (lihat bug tracker)
createContact()Alternatif create (API)
updateContact()Update
updateTags()Update tag + upsert Tag
importContact()Import CSV
getDetailContact()API reputation
updateRating()Update rating → trigger profitRputationData
restoreOrArchiveContact()Archive/restore

Route

Web (routes/web.php:250)

Prefix /contact:

MethodPathFungsi
GET/contactIndex
GET/contact/segmentSegment list
GET/contact/tagTag list
GET/contact/archiveArsip
GET/contact/detail/{id}Detail
POST/contact/storeCreate

API (routes/api.php:295)

Prefix /contact:

MethodPathFungsi
POST/contact/listList lengkap
POST/contact/list_paginatePaginate + filter
PATCH/contact/updateUpdate
POST/contact/reputationsReputation
POST/contact/import-contactImport CSV
POST/contact/create-contactCreate (API)

Temuan

  • store() double-create (:629-640) — Customer dibuat 2x
  • Validasi wa regex tidak konsisten — store tanpa +, update dengan +
  • chats() return query builder — N+1 manual di index()
  • Index.vue (1.944 baris) vs IndexV2.vue (797 baris) — controller render V2, lama orphan