message-ra / index.html
sandyram's picture
nice , i want to change the offer type to message type, in that i want to add notice kind of message like a informative message so if there is any general information to be passed it can create. if i am using in mobile, i want to add contact so it can say teh name of the person if in desktop mode it can be just adding name - Initial Deployment
b569214 verified
Raw History Blame Contribute Delete
16.8 kB
<!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>