neerajkalyank commited on
Commit
abbb0da
1 Parent(s): 140a2ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -10
app.py CHANGED
@@ -108,6 +108,31 @@ body {
108
  transform: scale(1.05);
109
  }
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  /* Button Style */
112
  .gr-button {
113
  color: #ffffff;
@@ -161,6 +186,40 @@ body {
161
  background-color: rgba(255, 140, 0, 0.1);
162
  padding: 8px 16px;
163
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  """
165
 
166
  # Gradio Interface
@@ -189,21 +248,23 @@ with gr.Blocks(css=custom_css) as app:
189
  register_button = gr.Button("Register Patient", elem_id="register_button")
190
  registration_output = gr.Markdown(elem_id="registration_output")
191
  patient_id_display = gr.Textbox(label="Patient ID", interactive=False, elem_id="patient_id_display") # Display Patient ID as non-editable text
192
- copy_button = gr.Button("Copy Patient ID", elem_id="copy_button")
193
-
194
- # Callback for registration and display Patient ID
195
- register_button.click(registration_interface, [name, father_name, age, gender, phone, address], [registration_output, patient_id_display])
196
-
197
- # JavaScript function to copy Patient ID
198
- copy_button.click(None, [], None, _js="""
199
- function(){
200
- const text = document.querySelector('#patient_id_display input').value;
201
- navigator.clipboard.writeText(text).then(() => {
202
  alert('Patient ID copied to clipboard');
203
  });
204
  }
 
205
  """)
206
 
 
 
 
207
  with gr.Tab("Tests"):
208
  gr.Markdown("<h2>Select Tests for the Patient</h2>")
209
  patient_id_test = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID")
 
108
  transform: scale(1.05);
109
  }
110
 
111
+ /* Container Style */
112
+ .gradio-container {
113
+ max-width: 850px;
114
+ margin: 30px auto;
115
+ padding: 40px;
116
+ background: rgba(0, 0, 50, 0.95);
117
+ border-radius: 15px;
118
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
119
+ color: #e0f7fa;
120
+ }
121
+
122
+ /* Form Field Styles */
123
+ input, select, textarea {
124
+ max-width: 700px;
125
+ border: 1px solid #7fffd4;
126
+ border-radius: 8px;
127
+ padding: 10px 12px;
128
+ background: rgba(245, 245, 245, 0.95);
129
+ color: #2d2d2d;
130
+ font-size: 15px;
131
+ margin-bottom: 20px;
132
+ transition: all 0.3s ease;
133
+ box-shadow: 0px 3px 5px rgba(0, 0, 0, 0.15);
134
+ }
135
+
136
  /* Button Style */
137
  .gr-button {
138
  color: #ffffff;
 
186
  background-color: rgba(255, 140, 0, 0.1);
187
  padding: 8px 16px;
188
  }
189
+
190
+ /* Label Styling */
191
+ label {
192
+ font-size: 1em;
193
+ font-weight: 600;
194
+ color: #7fffd4;
195
+ margin-bottom: 5px;
196
+ }
197
+
198
+ /* Output Text Styling */
199
+ #test_output, #billing_output {
200
+ color: #ffffff !important;
201
+ background-color: rgba(0, 0, 50, 0.8) !important;
202
+ padding: 10px;
203
+ border-radius: 5px;
204
+ font-weight: bold;
205
+ text-align: left;
206
+ }
207
+
208
+ /* Responsive Design for Mobile Devices */
209
+ @media (max-width: 768px) {
210
+ .gradio-container {
211
+ padding: 20px;
212
+ }
213
+
214
+ #header {
215
+ font-size: 2em;
216
+ }
217
+
218
+ input, textarea, select, .gr-button {
219
+ font-size: 1em;
220
+ padding: 10px;
221
+ }
222
+ }
223
  """
224
 
225
  # Gradio Interface
 
248
  register_button = gr.Button("Register Patient", elem_id="register_button")
249
  registration_output = gr.Markdown(elem_id="registration_output")
250
  patient_id_display = gr.Textbox(label="Patient ID", interactive=False, elem_id="patient_id_display") # Display Patient ID as non-editable text
251
+
252
+ # Copy Patient ID functionality with JavaScript
253
+ gr.Markdown("""
254
+ <button onclick="copyPatientID()" class="gr-button" style="margin-top: 10px;">Copy Patient ID</button>
255
+ <script>
256
+ function copyPatientID() {
257
+ const patientID = document.querySelector('#patient_id_display input').value;
258
+ navigator.clipboard.writeText(patientID).then(() => {
 
 
259
  alert('Patient ID copied to clipboard');
260
  });
261
  }
262
+ </script>
263
  """)
264
 
265
+ # Callback for registration and display Patient ID
266
+ register_button.click(registration_interface, [name, father_name, age, gender, phone, address], [registration_output, patient_id_display])
267
+
268
  with gr.Tab("Tests"):
269
  gr.Markdown("<h2>Select Tests for the Patient</h2>")
270
  patient_id_test = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID")