Channel Deals Partner Portal | Affiliate System (IMP)♦️

🚀 Channel Deals Partner Portal (v7.6 Master Blueprint): Hamara Custom Affiliate System

Yeh document is baat ka record hai ki hamne kaise ek sadharan Blogger page aur Google Sheets ko aapas mein jod kar ek High-Level "Mini CRM" (Customer Relationship Management) aur Affiliate Tracking Software banaya.

Is system ka main maqsad tha: Partners ko automatically register karna, unki leads track karna, aur unka commission/wallet live dikhana.

🛠️ 1. Frontend Design (Blogger + HTML/CSS/JS)

Hamne sabse pehle Blogger ki default theme ko puri tarah se clean kiya taaki hamari website ek professional "Web App" jaisi dikhe.

  • CSS Cleaning: Hamne #sidebar-wrapper, #header-wrapper, .post-title, aur footer ko display: none !important; karke hata diya.

  • Dark UI Theme: Ek premium dark theme (#0f172a aur #1e293b) banayi gayi jismein text padhne mein aasaan ho.

  • Tab Layout: Page ko 2 hisson mein baanta gaya - "Register" aur "Dashboard". User ek hi page par dono kaam bina page load kiye kar sakta hai.

📝 2. Partner Registration System (Auto ID Generation)

Partner ko manually ID dene ki jhanjhat khatam karne ke liye hamne yeh logic lagaya:

  • Partner portal par aata hai aur apna Name, WhatsApp Number, aur UPI ID (commission ke liye) daalta hai.

  • Form submit hote hi hamari Google Apps Script (GAS_API) chal padti hai.

  • Script us data ko Partners_DB sheet mein save karti hai aur turant ek unique ID (jaise: pts-44656) banakar wahi screen par user ko dikha deti hai.

🔐 3. Smart Login & Live Dashboard

Partner ko baar-baar admin se apna balance na poochana pade, iske liye hamne Dashboard banaya:

  • Login Logic: Partner apni pts-XXXXX ID daalta hai. Script backend se data fetch karti hai. Agar ID sahi hai, toh login box hide ho jata hai aur dashboard khul jata hai.

  • Live Stats (4 Boxes):

    1. Wallet Balance (₹): Partner ki total kamayi.

    2. Total Leads: Partner ne aaj tak kitne leads bheje.

    3. Success Deals: Kitni leads convert/approve hui.

    4. Payment Status: Ek dynamic color-coded box jo sheet ke hisaab se Active (White), Pending (Yellow), ya Settled (Green) dikhata hai.

⚙️ 4. Google Sheets Automation (The Real Backend Magic)

Yeh is system ka sabse tagda hissa hai. Hamne Partners_DB sheet ko Leads_DB sheet se direct formulas ke zariye connect kar diya taaki saara calculation apne aap ho:

  • Success Deals Auto-Count: Leads_DB mein jin leads ka status "Approved" hai, unhe ginne ke liye hamne formula lagaya:

    =COUNTIFS(Leads_DB!B:B, B2, Leads_DB!G:G, "Approved")

  • Wallet Balance Calculation: Partner ka commission jodne aur Total Paid amount ko minus karne ke liye formula:

    =SUMIFS(Leads_DB!H:H, Leads_DB!B:B, B2, Leads_DB!G:G, "Approved") - I2

  • Auto-Payment Status: Agar wallet mein paise hain toh "Pending", agar payment kar diya gaya hai toh "Settled":

    =IF(H2>0, "Pending", IF(I2>0, "Settled", "Active"))

(Is automation se admin ko sirf Leads_DB mein "Approved" aur commission amount likhna hota hai. Baaki sab dashboard par auto-update ho jata hai!)

🚀 5. Dynamic Embedded Lead Form (No Page Reload)

Partner ko lead bhejne ke liye kisi doosre page par na jana pade, iske liye Dashboard ke theek neeche ek smart form embed kiya gaya:

  • Hidden Auto-ID: Jab partner login karta hai, toh Javascript chupke se uski ID ek hidden input <input type="hidden" id="hiddenPartnerId"> mein daal deti hai. Partner ko bas customer ki detail bharni hoti hai.

  • Dynamic Field Changer: Form mein ek dropdown lagaya gaya.

    • Agar partner "Buyer" chunta hai, toh form "Requirement" aur "Budget" poochta hai.

    • Agar partner "Seller" chunta hai, toh labels apne aap badal kar "Channel Link" aur "Expected Selling Price" ban jate hain. (Yeh updateLeadFields() JS function se kiya gaya).

  • AJAX Submit: Lead submit karne par form page ko reload nahi karta, balki usi page par success message dikha kar form ko naya customer add karne ke liye reset kar deta hai.