EricGEGE commited on
Commit
f42647c
·
verified ·
1 Parent(s): 051a879

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -9
app.py CHANGED
@@ -34,26 +34,27 @@ def verify_username(username):
34
  inquiry_section: gr.update(visible=False)
35
  }
36
 
37
- def submit_inquiry(username, product_desc, purchase_qty, annual_amount, deadline, export_country):
38
  """Submit inquiry information to Google Sheet"""
39
  try:
40
  # Try to get the Inquiry worksheet, create it if it doesn't exist
41
  try:
42
  inquiry_sheet = sheet.worksheet('Inquiry')
43
  except gspread.WorksheetNotFound:
44
- inquiry_sheet = sheet.add_worksheet('Inquiry', 1000, 7)
45
  # Add headers
46
  inquiry_sheet.append_row([
47
- 'Timestamp', 'Username', 'Product Description',
48
- 'Purchase Quantity', 'Annual Amount (USD)',
49
- 'Purchase Deadline', 'Export Country'
 
50
  ])
51
 
52
  # Prepare the row data
53
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
54
  row_data = [
55
- timestamp, username, product_desc,
56
- purchase_qty, annual_amount,
57
  deadline, export_country
58
  ]
59
 
@@ -84,16 +85,24 @@ with gr.Blocks() as app:
84
  # Inquiry Form Section
85
  with gr.Group(visible=False) as inquiry_section:
86
  gr.Markdown("### 2. Inquiry Details")
 
 
 
 
 
 
 
 
87
  product_desc = gr.Textbox(
88
  label="Product Description",
89
  placeholder="Enter product description",
90
  lines=3
91
  )
92
- purchase_qty = gr.Textbox(
93
  label="Purchase Quantity",
94
  placeholder="Enter quantity"
95
  )
96
- annual_amount = gr.Textbox(
97
  label="Estimated Annual Purchase Amount (USD)",
98
  placeholder="Enter amount in USD"
99
  )
@@ -120,6 +129,8 @@ with gr.Blocks() as app:
120
  fn=submit_inquiry,
121
  inputs=[
122
  username_input,
 
 
123
  product_desc,
124
  purchase_qty,
125
  annual_amount,
 
34
  inquiry_section: gr.update(visible=False)
35
  }
36
 
37
+ def submit_inquiry(username, company_name, phone_number, product_desc, purchase_qty, annual_amount, deadline, export_country):
38
  """Submit inquiry information to Google Sheet"""
39
  try:
40
  # Try to get the Inquiry worksheet, create it if it doesn't exist
41
  try:
42
  inquiry_sheet = sheet.worksheet('Inquiry')
43
  except gspread.WorksheetNotFound:
44
+ inquiry_sheet = sheet.add_worksheet('Inquiry', 1000, 9) # Increased columns for new fields
45
  # Add headers
46
  inquiry_sheet.append_row([
47
+ 'Timestamp', 'Username', 'Company Name', 'Phone Number',
48
+ 'Product Description', 'Purchase Quantity',
49
+ 'Annual Amount (USD)', 'Purchase Deadline',
50
+ 'Export Country'
51
  ])
52
 
53
  # Prepare the row data
54
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
55
  row_data = [
56
+ timestamp, username, company_name, phone_number,
57
+ product_desc, purchase_qty, annual_amount,
58
  deadline, export_country
59
  ]
60
 
 
85
  # Inquiry Form Section
86
  with gr.Group(visible=False) as inquiry_section:
87
  gr.Markdown("### 2. Inquiry Details")
88
+ company_name = gr.Textbox(
89
+ label="Full Company Name",
90
+ placeholder="Enter your company's full name"
91
+ )
92
+ phone_number = gr.Textbox(
93
+ label="Phone Number",
94
+ placeholder="Enter your phone number"
95
+ )
96
  product_desc = gr.Textbox(
97
  label="Product Description",
98
  placeholder="Enter product description",
99
  lines=3
100
  )
101
+ purchase_qty = gr.Number(
102
  label="Purchase Quantity",
103
  placeholder="Enter quantity"
104
  )
105
+ annual_amount = gr.Number(
106
  label="Estimated Annual Purchase Amount (USD)",
107
  placeholder="Enter amount in USD"
108
  )
 
129
  fn=submit_inquiry,
130
  inputs=[
131
  username_input,
132
+ company_name,
133
+ phone_number,
134
  product_desc,
135
  purchase_qty,
136
  annual_amount,