Spaces:
Running
Running
| class SupportTicket extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .ticket-container { | |
| background: white; | |
| border-radius: 8px; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| padding: 2rem; | |
| max-width: 600px; | |
| margin: 2rem auto; | |
| } | |
| .ticket-header { | |
| display: flex; | |
| align-items: center; | |
| margin-bottom: 1.5rem; | |
| } | |
| .ticket-icon { | |
| font-size: 2rem; | |
| margin-right: 1rem; | |
| color: #4f46e5; | |
| } | |
| .ticket-title { | |
| font-size: 1.5rem; | |
| font-weight: 600; | |
| color: #111827; | |
| } | |
| .form-group { | |
| margin-bottom: 1.5rem; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 0.5rem; | |
| font-weight: 500; | |
| color: #374151; | |
| } | |
| input, select, textarea { | |
| width: 100%; | |
| padding: 0.75rem; | |
| border: 1px solid #d1d5db; | |
| border-radius: 6px; | |
| font-size: 1rem; | |
| } | |
| textarea { | |
| min-height: 120px; | |
| resize: vertical; | |
| } | |
| .submit-btn { | |
| background: #4f46e5; | |
| color: white; | |
| border: none; | |
| padding: 0.75rem 1.5rem; | |
| border-radius: 6px; | |
| font-weight: 500; | |
| cursor: pointer; | |
| transition: background 0.2s; | |
| } | |
| .submit-btn:hover { | |
| background: #4338ca; | |
| } | |
| .confirmation { | |
| text-align: center; | |
| padding: 2rem; | |
| } | |
| .confirmation-icon { | |
| font-size: 3rem; | |
| color: #10b981; | |
| margin-bottom: 1rem; | |
| } | |
| .confirmation-title { | |
| font-size: 1.5rem; | |
| font-weight: 600; | |
| margin-bottom: 1rem; | |
| color: #111827; | |
| } | |
| .confirmation-message { | |
| color: #4b5563; | |
| margin-bottom: 1.5rem; | |
| } | |
| .hidden { | |
| display: none; | |
| } | |
| </style> | |
| <div class="ticket-container"> | |
| <div id="ticketForm"> | |
| <div class="ticket-header"> | |
| <div class="ticket-icon">๐๏ธ</div> | |
| <h2 class="ticket-title">Create Support Ticket</h2> | |
| </div> | |
| <form id="supportForm"> | |
| <div class="form-group"> | |
| <label for="subject">Subject</label> | |
| <input type="text" id="subject" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="department">Department</label> | |
| <select id="department" required> | |
| <option value="">Select department</option> | |
| <option value="technical">Technical Support</option> | |
| <option value="billing">Billing</option> | |
| <option value="account">Account</option> | |
| <option value="general">General Inquiry</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label for="priority">Priority</label> | |
| <select id="priority" required> | |
| <option value="low">Low</option> | |
| <option value="medium" selected>Medium</option> | |
| <option value="high">High</option> | |
| <option value="critical">Critical</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label for="description">Description</label> | |
| <textarea id="description" required></textarea> | |
| </div> | |
| <button type="submit" class="submit-btn">Submit Ticket</button> | |
| </form> | |
| </div> | |
| <div id="confirmation" class="hidden"> | |
| <div class="confirmation"> | |
| <div class="confirmation-icon">โ</div> | |
| <h3 class="confirmation-title">Ticket Created Successfully!</h3> | |
| <p class="confirmation-message"> | |
| Your support ticket has been created. Our team will respond within 24 hours. | |
| You can reply to the confirmation email for further communication. | |
| </p> | |
| <button id="newTicketBtn" class="submit-btn">Create New Ticket</button> | |
| </div> | |
| </div> | |
| </div> | |
| `; | |
| const form = this.shadowRoot.getElementById('supportForm'); | |
| const ticketForm = this.shadowRoot.getElementById('ticketForm'); | |
| const confirmation = this.shadowRoot.getElementById('confirmation'); | |
| const newTicketBtn = this.shadowRoot.getElementById('newTicketBtn'); | |
| form.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| // In a real app, you would send the form data to your backend | |
| ticketForm.classList.add('hidden'); | |
| confirmation.classList.remove('hidden'); | |
| }); | |
| newTicketBtn.addEventListener('click', () => { | |
| form.reset(); | |
| confirmation.classList.add('hidden'); | |
| ticketForm.classList.remove('hidden'); | |
| }); | |
| } | |
| } | |
| customElements.define('support-ticket', SupportTicket); |