Skip to content

Commit

Permalink
updating unit labels
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamoonmoon committed Nov 28, 2024
1 parent 4c8b185 commit c75b3be
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions app/Server/src/SERVERAPI/Views/Nutrients/FertigationDetails.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<span asp-validation-for="selTypOption" class="text-danger"></span>
</div>
<div class="form-group col-sm-3" style="width:200px;">
@if(Model.selTypOption == "4" || Model.selTypOption == "2"){ // if custom liquid fertigation
@if(Model.selTypOption == "4" || Model.selTypOption == "2"){ // if custom liquid fertigation
<div class="form-group col-sm-2" style="margin-right:0px; padding-right:0px; width:60px">
<label for="valN">N(%)</label>
<div>
Expand Down Expand Up @@ -52,9 +52,9 @@
</select>
<span asp-validation-for="selFertOption" class="text-danger"></span>
}

</div>
@if(Model.selTypOption == "1" || Model.selTypOption == "2"){
@if(Model.selTypOption == "1" || Model.selTypOption == "2"){
<div class="form-group col-sm-2" style="margin-right:0px; padding-right:0px; width:100px">
<label for="rate">Tank Volume</label>
<div>
Expand Down Expand Up @@ -113,7 +113,7 @@
{
<span style="color: #4BB543;">@Model.dryAction </span>
<img src="~/images/good.svg" title="Soluble"/>

}
else if (Model.dryAction == "Reduce the amount to dissolve")
{
Expand Down Expand Up @@ -188,8 +188,8 @@
}
</div>
</div>
<div style="margin-top: 20px;"></div>

<div style="margin-top: 20px;"></div>

<div class="row">
<div class="form-group">
Expand Down Expand Up @@ -236,10 +236,10 @@
<button class="btn" type="button" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary" id="calc_button" @( Model.btnText == "Calculate" ? Html.Raw(" style='background-color: #1abbed'") : Html.Raw(""))>Calculate</button>
</div>


<hr style="height:1px;border:none;color:blue;background-color:lightblue;padding:0; margin-top: 5px;" />

<div class="row">
<div class="form-group" style="display:flex; justify-content:space-between; width:90%">
@if(Model.selTypOption == "1" || Model.selTypOption == "2"){
Expand All @@ -257,7 +257,7 @@
<div class="form-group col-sm-8" style="margin:5px">
<div class="table">
<label id="productVolumeLabel" style="text-wrap: pretty; text-align: center; height: 40px;">
Total Product Volume per Application (select a unit)
Total Product Volume per Application (Select a unit)
</label>
<div class="cell" style="text-align:center">
@Model.totProductVolPerFert
Expand Down Expand Up @@ -457,42 +457,39 @@
<script>
$(document).ready(function () {
$('#applDate').datepicker({
format: "dd-M-yyyy",
format: "dd-M-yyyy",
autoclose: true,
todayHighlight: true,
clearBtn: true,
startView: 0,
minViewMode: 0,
minViewMode: 0,
endDate: '+10y',
defaultViewDate: new Date()
defaultViewDate: new Date()
}).on('changeDate', function(e) {
$('#applDate').val(e.format('dd-M-yyyy'));
$('#applDate').val(e.format('dd-M-yyyy'));
});
var existingDate = $('#applDate').val();
if (existingDate) {
var dateParts = existingDate.split('-');
if (dateParts.length === 3) {
var day = dateParts[0];
var month = new Date(Date.parse(dateParts[1] +" 1, 2024")).getMonth();
var month = new Date(Date.parse(dateParts[1] +" 1, 2024")).getMonth();
var year = dateParts[2];
var date = new Date(year, month, day);
var date = new Date(year, month, day);
$('#applDate').datepicker('setDate', date);
}
}
//change unit label based on userUnit selection of Application rate units
$('#ddlProdRate').on('change', function () {
var userUnit = $(this).find("option:selected").text();
// Function to update unit labels
function updateUnits() {
var userUnit = $('#ddlProdRate').find("option:selected").text();
$('#productVolumeLabel').text('Total Product Volume per Application (' + userUnit + ')');
$('#productVolumeGrowingLabel').text('Total Product Volume Growing Season (' + userUnit + ')');
});
// On page load, initialize the label based on the selected unit
$(function () {
var initialUnit = $('#ddlProdRate option:selected').text();
$('#productVolumeLabel').text('Total Product Volume per Application (' + initialUnit + ')');
$('#productVolumeGrowingLabel').text('Total Product Volume for Growing Season (' + initialUnit + ')');
});
}
// On page load, initialize unit label
updateUnits();
});
</script>

0 comments on commit c75b3be

Please sign in to comment.