File size: 5,042 Bytes
6759add
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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);