Spaces:
Running

File size: 16,787 Bytes
b569214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f60e4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Rasavita - Marketing Message Generator</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <style>
        .whatsapp-preview {
            background: #e5ddd5;
            border-radius: 12px;
            max-width: 400px;
            min-height: 200px;
            position: relative;
        }
        .whatsapp-preview:before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
            background: #075e54;
            border-radius: 12px 12px 0 0;
        }
        .whatsapp-header {
            position: relative;
            z-index: 1;
            color: white;
            padding: 15px;
            display: flex;
            align-items: center;
        }
        .whatsapp-body {
            padding: 15px;
            margin-top: 30px;
        }
        .message-bubble {
            background: white;
            border-radius: 8px;
            padding: 10px 15px;
            margin-bottom: 10px;
            box-shadow: 0 1px 0.5px rgba(0,0,0,0.13);
            max-width: 80%;
        }
        .message-time {
            font-size: 11px;
            color: #667781;
            text-align: right;
            margin-top: 5px;
        }
    </style>
</head>
<body class="font-poppins bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <div class="text-center mb-8">
            <h1 class="text-3xl font-bold text-amber-700">Rasavita Masala</h1>
            <p class="text-gray-600">Create perfect WhatsApp marketing messages</p>
        </div>

        <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6">
            <div class="md:flex">
                <div class="md:w-1/2 p-4">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">Create Your Message</h2>
                    
                    <div class="mb-4">
                        <label class="block text-gray-700 mb-2">Offer Type</label>
                        <select id="offerType" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                            <option value="discount">Discount Offer</option>
                            <option value="newproduct">New Product Launch</option>
                            <option value="festival">Festival Special</option>
                            <option value="combo">Combo Offer</option>
                            <option value="feedback">Feedback Request</option>
                            <option value="notice">Notice/Information</option>
                        </select>
                    </div>

                    <div id="contactContainer" class="mb-4 hidden">
                        <label class="block text-gray-700 mb-2">Contact Name (optional)</label>
                        <input type="text" id="contactName" placeholder="Customer name" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                    </div>

                    <div id="productContainer" class="mb-4">
                        <label class="block text-gray-700 mb-2">Product</label>
                        <select id="product" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                            <option value="rasam">Rasam Powder</option>
                            <option value="sambar">Sambar Powder</option>
                            <option value="bisibele">Bisi Bele Bath Powder</option>
                            <option value="vangibath">Vangi Bath Powder</option>
                            <option value="puliyogare">Puliyogare Powder</option>
                            <option value="idlychilli">Idly Chilli Powder</option>
                            <option value="curryleaves">Curry Leaves Powder</option>
                            <option value="pappulapodi">Pappula Podi</option>
                            <option value="bittergourd">Bitter Gourd Powder</option>
                            <option value="redchilli">Red Chilli Powder</option>
                            <option value="jeera">Jeera Powder</option>
                            <option value="methi">Methi Powder</option>
                            <option value="dhaniya">Dhaniya Powder</option>
                            <option value="garammasala">Garam Masala</option>
                            <option value="pongal">Pongal Premix</option>
                            <option value="milletpongal">Millet Pongal Premix</option>
                        </select>
                    </div>

                    <div id="discountContainer" class="mb-4">
                        <label class="block text-gray-700 mb-2">Discount (if any)</label>
                        <input type="number" id="discount" placeholder="20" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                    </div>

                    <div id="validUntilContainer" class="mb-4">
                        <label class="block text-gray-700 mb-2">Valid Until</label>
                        <input type="date" id="validUntil" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                    </div>

                    <div class="mb-4">
                        <label class="block text-gray-700 mb-2">Additional Notes</label>
                        <textarea id="additionalNotes" rows="3" placeholder="Any special instructions..." class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-amber-500 focus:border-amber-500"></textarea>
                    </div>

                    <button onclick="generateMessage()" class="w-full bg-amber-600 hover:bg-amber-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200 flex items-center justify-center">
                        <i data-feather="message-square" class="mr-2"></i> Generate Message
                    </button>
                </div>

                <div class="md:w-1/2 p-4">
                    <h2 class="text-xl font-semibold text-gray-800 mb-4">WhatsApp Preview</h2>
                    <div class="whatsapp-preview p-0">
                        <div class="whatsapp-header">
                            <div class="bg-white rounded-full p-1 mr-3">
                                <i data-feather="shopping-bag" class="text-amber-600"></i>
                            </div>
                            <div>
                                <p class="font-semibold">Rasavita Masala</p>
                                <p class="text-xs">Online</p>
                            </div>
                        </div>
                        <div class="whatsapp-body">
                            <div id="messagePreview">
                                <div class="message-bubble">
                                    <p>Your marketing message will appear here...</p>
                                    <div class="message-time">10:30 AM</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="mt-6">
                        <button onclick="copyToClipboard()" class="w-full bg-green-600 hover:bg-green-700 text-white font-bold py-3 px-4 rounded-lg transition duration-200 flex items-center justify-center mb-3">
                            <i data-feather="copy" class="mr-2"></i> Copy Message
                        </button>
                        <a id="whatsappLink" href="#" class="w-full bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-4 rounded-lg transition duration-200 flex items-center justify-center">
                            <i data-feather="send" class="mr-2"></i> Open in WhatsApp
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        feather.replace();
        
        function toggleFields() {
            const offerType = document.getElementById('offerType').value;
            const isFeedback = offerType === 'feedback';
            const isNotice = offerType === 'notice';
            const isMobile = window.innerWidth <= 768;
            
            document.getElementById('productContainer').style.display = isFeedback || isNotice ? 'none' : 'block';
            document.getElementById('discountContainer').style.display = isFeedback || isNotice ? 'none' : 'block';
            document.getElementById('validUntilContainer').style.display = isFeedback || isNotice ? 'none' : 'block';
            document.getElementById('contactContainer').style.display = isMobile ? 'block' : 'none';
        }

        function generateMessage() {
            const offerType = document.getElementById('offerType').value;
            const product = document.getElementById('product').value;
            const discount = document.getElementById('discount').value;
            const validUntil = document.getElementById('validUntil').value;
            const additionalNotes = document.getElementById('additionalNotes').value;

            // Get product display name
            let productName = '';
            switch(product) {
                case 'rasam': productName = 'Rasam Powder'; break;
                case 'sambar': productName = 'Sambar Powder'; break;
                case 'bisibele': productName = 'Bisi Bele Bath Powder'; break;
                case 'vangibath': productName = 'Vangi Bath Powder'; break;
                case 'puliyogare': productName = 'Puliyogare Powder'; break;
                case 'idlychilli': productName = 'Idly Chilli Powder'; break;
                case 'curryleaves': productName = 'Curry Leaves Powder'; break;
                case 'pappulapodi': productName = 'Pappula Podi'; break;
                case 'bittergourd': productName = 'Bitter Gourd Powder'; break;
                case 'redchilli': productName = 'Red Chilli Powder'; break;
                case 'jeera': productName = 'Jeera Powder'; break;
                case 'methi': productName = 'Methi Powder'; break;
                case 'dhaniya': productName = 'Dhaniya Powder'; break;
                case 'garammasala': productName = 'Garam Masala'; break;
                case 'pongal': productName = 'Pongal Premix'; break;
                case 'milletpongal': productName = 'Millet Pongal Premix'; break;
            }

            // Format date
            const formattedDate = validUntil ? new Date(validUntil).toLocaleDateString('en-IN', { day: 'numeric', month: 'long' }) : 'limited time';

            // Generate message based on offer type
            let message = '';
            switch(offerType) {
                case 'feedback':
                    message = `πŸ™ *WE VALUE YOUR FEEDBACK!* πŸ™\n\n` +
                              `Dear Customer,\n\n` +
                              `We would love to hear your thoughts about your recent experience with Rasavita Masala products.\n\n` +
                              `Your feedback helps us improve and serve you better!\n\n` +
                              `Please share your valuable feedback by replying to this message.\n\n` +
                              `Thank you for choosing Rasavita Masala!\n\n` +
                              `${additionalNotes ? additionalNotes + '\n\n' : ''}` +
                              `#RasavitaMasala #CustomerFirst`;
                    break;
                case 'discount':
                    message = `πŸ”₯ *SPECIAL OFFER ALERT!* πŸ”₯\n\n` +
                              `Get ${discount}% OFF on our premium *${productName}*!\n\n` +
                              `🏷️ Original Price: β‚Ή199\n` +
                              `πŸ’° Discounted Price: β‚Ή${Math.round(199 * (1 - discount/100))}\n\n` +
                              `⏳ Offer valid until ${formattedDate}\n\n` +
                              `πŸ›’ Order now: https://rasavita.com/${product}\n\n` +
                              `#RasavitaMasala #AuthenticTaste`;
                    break;
                case 'newproduct':
                    message = `πŸŽ‰ *NEW PRODUCT LAUNCH!* πŸŽ‰\n\n` +
                              `We're excited to introduce our new *${productName}*!\n\n` +
                              `Experience the authentic Indian flavors like never before.\n\n` +
                              `Special introductory price: β‚Ή179 (Limited time only)\n\n` +
                              `πŸ›’ Try it now: https://rasavita.com/${product}\n\n` +
                              `${additionalNotes ? additionalNotes + '\n\n' : ''}` +
                              `#RasavitaMasala #NewFlavors`;
                    break;
                case 'festival':
                    message = `πŸͺ” *FESTIVAL SPECIAL!* πŸͺ”\n\n` +
                              `Celebrate this festive season with our special *${productName}*!\n\n` +
                              `🎁 Get ${discount}% OFF + Free Gift with every order above β‚Ή500\n\n` +
                              `⏳ Offer valid until ${formattedDate}\n\n` +
                              `πŸ›’ Shop now: https://rasavita.com/${product}\n\n` +
                              `${additionalNotes ? additionalNotes + '\n\n' : ''}` +
                              `#RasavitaMasala #FestiveFlavors`;
                    break;
                case 'combo':
                    message = `πŸ’ *COMBO OFFER!* πŸ’\n\n` +
                              `Get our best-selling masalas together at amazing price!\n\n` +
                              `✨ ${productName} + Garam Masala + Chicken Masala\n` +
                              `πŸ’° Only β‚Ή499 (Save β‚Ή150)\n\n` +
                              `⏳ Offer valid until ${formattedDate}\n\n` +
                              `πŸ›’ Grab the deal: https://rasavita.com/combo\n\n` +
                              `${additionalNotes ? additionalNotes + '\n\n' : ''}` +
                              `#RasavitaMasala #ComboOffer`;
                    break;
                    
                case 'notice':
                    const contactName = document.getElementById('contactName').value;
                    const greeting = contactName ? `Dear ${contactName},\n\n` : 'Dear Customer,\n\n';
                    
                    message = `πŸ“’ *IMPORTANT NOTICE*  πŸ“’\n\n` +
                              greeting +
                              `${additionalNotes}\n\n` +
                              `Thank you,\n` +
                              `Team Rasavita Masala\n\n` +
                              `#RasavitaMasala #Update`;
                    break;
            }

            // Update preview
            document.getElementById('messagePreview').innerHTML = `
                <div class="message-bubble">
                    <p>${message.replace(/\n/g, '<br>')}</p>
                    <div class="message-time">${new Date().toLocaleTimeString('en-IN', { hour: '2-digit', minute: '2-digit' })}</div>
                </div>
            `;

            // Update WhatsApp link
            const whatsappLink = document.getElementById('whatsappLink');
            whatsappLink.href = `https://wa.me/?text=${encodeURIComponent(message)}`;
        }

        function copyToClipboard() {
            const messageBubble = document.querySelector('#messagePreview .message-bubble');
            const messageText = messageBubble.textContent.replace(/\s+/g, ' ').trim();
            
            navigator.clipboard.writeText(messageText).then(() => {
                alert('Message copied to clipboard!');
            }).catch(err => {
                console.error('Failed to copy: ', err);
            });
        }

        // Set default date to tomorrow
        const tomorrow = new Date();
        tomorrow.setDate(tomorrow.getDate() + 1);
        document.getElementById('validUntil').valueAsDate = tomorrow;
        
        // Initialize field visibility
        toggleFields();
        document.getElementById('offerType').addEventListener('change', toggleFields);
        window.addEventListener('resize', toggleFields);
    </script>
</body>
</html>