namngo commited on
Commit
a17038f
·
verified ·
1 Parent(s): 3a15f23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -26
app.py CHANGED
@@ -32,16 +32,27 @@ st.markdown("""
32
  font-weight: bold;
33
  }
34
 
35
- /* Custom layout for semester input boxes */
36
  .semester-box {
37
  border: 2px solid #003366;
38
- padding: 10px;
39
  border-radius: 8px;
40
  margin-top: 10px;
41
- width: 50%; /* Adjust width for a shorter input box */
42
  display: inline-block;
 
 
43
  }
44
 
 
 
 
 
 
 
 
 
 
45
  .input-field {
46
  border: 2px solid #003366;
47
  border-radius: 8px;
@@ -51,12 +62,26 @@ st.markdown("""
51
  margin-bottom: 10px;
52
  }
53
 
54
- /* Position the label and the input box side by side */
55
- .input-label {
56
- display: inline-block;
57
- width: 40%; /* Label width */
58
- margin-right: 10px;
 
59
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  </style>
61
  """, unsafe_allow_html=True)
62
 
@@ -213,24 +238,21 @@ else:
213
  example_data = sample_cntt_example_simple if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_simple if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
214
  default_values = example_data["semester_data"][idx*3:(idx+1)*3] if example_data else None # Fix this line to slice 3 values per semester (Số tín chỉ đạt, Số tín chỉ nợ, GPA)
215
 
216
- # First row (3 boxes)
217
- if idx < 3:
218
- with st.expander(f"📘 {sem}", expanded=True):
219
- col1, col2, col3 = st.columns(3) # 3 columns for the first row
220
- with col1:
221
- sotc_qua = st.number_input(f"Số tín chỉ đạt - {sem}", 0, value=default_values[0] if default_values else 0, key=f"tcqua_imp_{sem}")
222
- with col2:
223
- sotcno = st.number_input(f"Số tín chỉ nợ - {sem}", 0, value=default_values[1] if default_values else 0, key=f"tcno_imp_{sem}")
224
- with col3:
225
- TBCHK = st.number_input(f"Điểm trung bình - {sem}", 0.0, 10.0, value=default_values[2] if default_values else 0.0, step=0.01, key=f"gpa_imp_{sem}")
226
- else: # Second row (2 boxes)
227
- with st.expander(f"📘 {sem}", expanded=True):
228
- col1, col2 = st.columns(2) # 2 columns for the second row
229
- with col1:
230
- sotc_qua = st.number_input(f"Số tín chỉ đạt - {sem}", 0, value=default_values[0] if default_values else 0, key=f"tcqua_imp_{sem}")
231
- sotcno = st.number_input(f"Số tín chỉ nợ - {sem}", 0, value=default_values[1] if default_values else 0, key=f"tcno_imp_{sem}")
232
- with col2:
233
- TBCHK = st.number_input(f"Điểm trung bình - {sem}", 0.0, 10.0, value=default_values[2] if default_values else 0.0, step=0.01, key=f"gpa_imp_{sem}")
234
 
235
  # Collect semester data
236
  data += [sotc_qua, sotcno, TBCHK]
 
32
  font-weight: bold;
33
  }
34
 
35
+ /* Styling for the semester box */
36
  .semester-box {
37
  border: 2px solid #003366;
38
+ padding: 15px;
39
  border-radius: 8px;
40
  margin-top: 10px;
41
+ width: 45%; /* Adjust width of the box */
42
  display: inline-block;
43
+ margin-right: 20px; /* Space between boxes */
44
+ margin-bottom: 20px;
45
  }
46
 
47
+ /* Styling for the label */
48
+ .input-label {
49
+ font-weight: bold;
50
+ font-size: 14px;
51
+ margin-bottom: 5px;
52
+ display: block;
53
+ }
54
+
55
+ /* Styling for the input field */
56
  .input-field {
57
  border: 2px solid #003366;
58
  border-radius: 8px;
 
62
  margin-bottom: 10px;
63
  }
64
 
65
+ /* Styling for the whole semester input section */
66
+ .semester-section {
67
+ display: flex;
68
+ flex-wrap: wrap;
69
+ justify-content: space-between;
70
+ margin-bottom: 20px;
71
  }
72
+
73
+ /* Input container for the label and field alignment */
74
+ .input-container {
75
+ display: flex;
76
+ flex-direction: column;
77
+ margin-bottom: 10px;
78
+ }
79
+
80
+ /* Ensure space between the label and field */
81
+ .semester-box-inner {
82
+ margin-bottom: 15px;
83
+ }
84
+
85
  </style>
86
  """, unsafe_allow_html=True)
87
 
 
238
  example_data = sample_cntt_example_simple if sample_option == "Dùng ví dụ mẫu ngành Công nghệ thông tin" else sample_kinhte_example_simple if sample_option == "Dùng ví dụ mẫu ngành Kinh tế" else None
239
  default_values = example_data["semester_data"][idx*3:(idx+1)*3] if example_data else None # Fix this line to slice 3 values per semester (Số tín chỉ đạt, Số tín chỉ nợ, GPA)
240
 
241
+ with st.expander(f"📘 {sem}", expanded=True):
242
+ # Create a box for each semester with 3 rows of label and input box
243
+ col1 = st.columns(1)[0] # Ensure single column for each input box
244
+
245
+ # Row 1
246
+ st.write("Số tín chỉ đạt:")
247
+ sotc_qua = st.number_input(f"Điền Số tín chỉ đạt - {sem}", 0, value=default_values[0] if default_values else 0, key=f"tcqua_imp_{sem}")
248
+
249
+ # Row 2
250
+ st.write("Số tín chỉ nợ:")
251
+ sotcno = st.number_input(f"Điền Số tín chỉ nợ - {sem}", 0, value=default_values[1] if default_values else 0, key=f"tcno_imp_{sem}")
252
+
253
+ # Row 3
254
+ st.write("Điểm trung bình:")
255
+ TBCHK = st.number_input(f"Điền Điểm trung bình - {sem}", 0.0, 10.0, value=default_values[2] if default_values else 0.0, step=0.01, key=f"gpa_imp_{sem}")
 
 
 
256
 
257
  # Collect semester data
258
  data += [sotc_qua, sotcno, TBCHK]