Untitled

 avatar
user_0464790
plain_text
6 months ago
1.6 kB
2
Indexable
Never
import React, { useState } from 'react';
//import './TicketForm.css'; // Assume TicketForm.css contains the CSS styles for the form
 
function TicketForm() {
  const [customerId, setCustomerId] = useState("");
  const [productId, setProductId] = useState("");
  const [title, setTitle] = useState("");
  const [description, setDescription] = useState("");
  const [ticketId, setTicketId] = useState(1); // Assuming the ticket ID starts from 1 and auto-increments for new tickets
 
  const handleSubmit = (e) => {
    e.preventDefault();
    // Add your logic here to submit the ticket
    console.log("Ticket ID:", ticketId);
    console.log("Customer ID:", customerId);
    console.log("Product ID:", productId);
    console.log("Title:", title);
    console.log("Description:", description);
  };
 
  return (
    <div className="ticket-form">
      <h2>Raise a Ticket Form</h2>
      <form onSubmit={handleSubmit}>
        <label>Customer ID:</label><br />
        <input type="text" value={customerId} onChange={(e) => setCustomerId(e.target.value)} /><br />
 
        <label>Product ID:</label><br />
        <input type="text" value={productId} onChange={(e) => setProductId(e.target.value)} /><br />
 
        <label>Title:</label><br />
        <input type="text" value={title} onChange={(e) => setTitle(e.target.value)} /><br />
 
        <label>Description:</label><br />
        <textarea value={description} onChange={(e) => setDescription(e.target.value)} /><br />
 
        <button type="submit">Submit</button>
      </form>
    </div>
  );
}
 
export default TicketForm;
Leave a Comment