diff --git a/src/app/pages/veriable-form/veriable-form.component.html b/src/app/pages/veriable-form/veriable-form.component.html
index 871ef4c..fe0ba53 100644
--- a/src/app/pages/veriable-form/veriable-form.component.html
+++ b/src/app/pages/veriable-form/veriable-form.component.html
@@ -4,45 +4,37 @@
-
\ No newline at end of file
+
diff --git a/src/app/pages/veriable-form/veriable-form.component.sass b/src/app/pages/veriable-form/veriable-form.component.sass
index 9559e06..287f5ac 100644
--- a/src/app/pages/veriable-form/veriable-form.component.sass
+++ b/src/app/pages/veriable-form/veriable-form.component.sass
@@ -1,71 +1,49 @@
-// General form styles
-form
- max-width: 100%
- margin: 20px auto
- padding: 20px
- border: 1px solid #ddd
- border-radius: 5px
- background-color: #f9f9f9
-
- .form-row
- display: flex
- flex-direction: column
- margin-bottom: 20px
- padding: 10px
- border: 1px solid #ccc
- border-radius: 5px
- background-color: #fff
-
- .form-column
- display: flex
- align-items: center
- margin-bottom: 10px
+.container
+ margin-top: 20px
- > *
- margin-right: 10px
+.add-col-section
+ display: flex
+ flex-direction: row
- select, input
- padding: 8px
- border-radius: 3px
- border: 1px solid #ccc
- width: 150px
+.add-col-section div
+ display:flex
+ flex-direction: row
- .row-buttons
- margin-top: 10px
+.column-section
+ width: auto
+ display: flex
+ flex-direction: row
- .column-buttons
- margin-left: auto // Push button to the right
-
- // Button styles
- button
- padding: 10px 15px
- border: none
- background-color: #007bff
- color: white
- border-radius: 5px
- cursor: pointer
- margin-right: 10px
+.form-group
+ margin-bottom: 15px
+ width: 150px
+ display: flex
+ margin-right: 10px!important
- &:hover
- background-color: #0056b3
+.add-column-btn
+ margin-top: 10px
+ display: block
- &[type="submit"]
- margin-top: 20px
- background-color: #28a745
+.add-row-btn
+ margin-top: 20px
- &:hover
- background-color: #218838
+.submit-btn
+ margin-top: 30px
-// Media queries for responsiveness
-@media (max-width: 768px)
- .form-row
- flex-direction: column
+.row-section
+ border: 1px solid #ccc
+ padding: 20px
+ margin-bottom: 20px
+ position: relative
- .form-column
- flex-direction: column
- align-items: flex-start
+@media (min-width: 768px)
+ .add-col-section
+ display: flex // Ensures that the columns are stacked vertically
- > *
- margin-bottom: 10px
- width: 100%
+ .column-section
+ display: flex
+ margin-bottom: 15px
+ flex-direction: row
+ .row-section
+ padding: 20px
diff --git a/src/app/pages/veriable-form/veriable-form.component.ts b/src/app/pages/veriable-form/veriable-form.component.ts
index 25f1345..c080e2f 100644
--- a/src/app/pages/veriable-form/veriable-form.component.ts
+++ b/src/app/pages/veriable-form/veriable-form.component.ts
@@ -17,7 +17,8 @@ export class VeriableFormComponent implements OnInit {
variableList = ['Variable 1', 'Variable 2', 'Variable 3'];
public componentDestroyed = new Subject();
rdsValues: any;
- selectedParamValue: any;
+ selectedParamValue: any = {};
+ inputValue: any;
constructor(private fb: FormBuilder, private api: ApiService) {
this.form = this.fb.group({
@@ -79,18 +80,26 @@ export class VeriableFormComponent implements OnInit {
});
}
- onParamChange(event: any) {
+ onParamChange(event: any, rowIndex: number, colIndex: number) {
const selectedParam = event.target.value;
- // Iterate through the 'modbus' array and find the parameter
+
for (let item of this.rdsValues.modbus) {
if (item.hasOwnProperty(selectedParam)) {
- this.selectedParamValue = item[selectedParam];
+ // Initialize the row if not present
+ if (!this.selectedParamValue[rowIndex]) {
+ this.selectedParamValue[rowIndex] = {};
+ }
+ // Assign the selected param value to the specific row and column
+ this.selectedParamValue[rowIndex][colIndex] = item[selectedParam];
break;
}
}
- console.log(this.selectedParamValue);
+ this.inputValue = this.selectedParamValue[rowIndex][colIndex]
+ console.log(`Row: ${rowIndex}, Column: ${colIndex}, Value:`, this.selectedParamValue[rowIndex][colIndex]);
}
+
+
onSubmit(): void {
console.log(this.form.value);
}