Skip to content

Commit

Permalink
Merge branch 'master' into 705-icons
Browse files Browse the repository at this point in the history
  • Loading branch information
lunamoonmoon authored Dec 10, 2024
2 parents d1d48db + 314dbe4 commit afa9162
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 64 deletions.
24 changes: 12 additions & 12 deletions app/Agri.Data/SeedData/FertigationData.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,30 +201,30 @@
],
"FertilizerTypes":[
{
"Id": 1,
"Name": "Dry Fertilizer",
"DryLiquid": "Dry",
"Id": 3,
"Name": "Liquid Fertilizer",
"LiquidSolid": "Solid",
"Custom": false,
"StaticDataVersionId": 14
},
{
"Id": 2,
"Name": "Dry Fertilizer (Custom)",
"LiquidSolid": "Liquid",
"Id": 4,
"Name": "Liquid Fertilizer (Custom)",
"LiquidSolid": "Solid",
"Custom": true,
"StaticDataVersionId": 14
},
{
"Id": 3,
"Name": "Liquid Fertilizer",
"LiquidSolid": "Solid",
"Id": 1,
"Name": "Dry Fertilizer",
"DryLiquid": "Dry",
"Custom": false,
"StaticDataVersionId": 14
},
{
"Id": 4,
"Name": "Liquid Fertilizer (Custom)",
"LiquidSolid": "Solid",
"Id": 2,
"Name": "Dry Fertilizer (Custom)",
"LiquidSolid": "Liquid",
"Custom": true,
"StaticDataVersionId": 14
}
Expand Down
12 changes: 6 additions & 6 deletions app/Server/src/SERVERAPI/Controllers/NutrientsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ private void FertigationDetail_Reset(ref FertigationDetailsViewModel fgvm)
fgvm.totPIcon = "";
fgvm.totKIcon = "";

fgvm.fertigationTime = 0.0M;
fgvm.fertigationTime = 0M;
fgvm.totProductVolPerFert = 0.0M;
fgvm.totProductVolPerSeason = 0.0M;

Expand Down Expand Up @@ -801,11 +801,11 @@ public IActionResult FertigationDetails(FertigationDetailsViewModel fgvm)
decimal convertedProductRate = Convert.ToDecimal(fgvm.productRate) * _fU.ConversionToImperialGallonsPerAcre;

//Total Product Volume per fertigation
fgvm.totProductVolPerFert = Math.Round((field.Area * convertedProductRate), 2); // convert to int/string? Error messages?
fgvm.totProductVolPerFert = Math.Round((field.Area * convertedProductRate), 1); // convert to int/string? Error messages?

// Total product volume per growing season calc
// Product Rate x Fertigation area x fert per season
fgvm.totProductVolPerSeason = Math.Round((field.Area * convertedProductRate * fgvm.eventsPerSeason), 2); // convert to int/string? Error messages?
fgvm.totProductVolPerSeason = Math.Round((field.Area * convertedProductRate * fgvm.eventsPerSeason), 1); // convert to int/string? Error messages?

decimal injectionRateConversion = 0;
switch (fgvm.selInjectionRateUnitOption)
Expand All @@ -830,7 +830,7 @@ public IActionResult FertigationDetails(FertigationDetailsViewModel fgvm)

//Fertigation time
decimal fertTimeVal = Convert.ToDecimal(fgvm.totProductVolPerFert) / (Convert.ToDecimal(fgvm.injectionRate) / injectionRateConversion);
fgvm.fertigationTime = Math.Round(fertTimeVal, 2);
fgvm.fertigationTime = Math.Round(fertTimeVal, 0);

//Applied nutrients per fertigation
fgvm.calcN = Convert.ToInt32(fertilizerNutrients.fertilizer_N).ToString();
Expand Down Expand Up @@ -1021,10 +1021,10 @@ private void SolidFertigationCalculation(FertigationDetailsViewModel fgvm){
fgvm.nutrientConcentrationP205 = Convert.ToString(Math.Round(amountToDissolve * Convert.ToDecimal(fgvm.valP2o5) / 100 / tankVolume, 2));

decimal injectionRate = Convert.ToDecimal(fgvm.injectionRate);
fgvm.fertigationTime = Math.Round(Convert.ToDecimal(fgvm.tankVolume) / injectionRate, 2);
fgvm.fertigationTime = Math.Round(Convert.ToDecimal(fgvm.tankVolume) / injectionRate, 0);

if (amountToDissolve <= tankVolume * solInWater){
fgvm.dryAction = "Good";
fgvm.dryAction = "Soluble";
}
else{
fgvm.dryAction = "Reduce the amount to dissolve";
Expand Down
102 changes: 56 additions & 46 deletions app/Server/src/SERVERAPI/Views/Nutrients/FertigationDetails.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</select>
<span asp-validation-for="selTypOption" class="text-danger"></span>
</div>
<div class="form-group col-sm-3" style="margin-top: 8px; height: 57.56px;">
@if(Model.selTypOption == "4" || Model.selTypOption == "2"){ // if custom liquid fertigation
<div class="form-group col-sm-3" style="width:200px; margin-top: 8px; height: 57.56px;">
@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,7 +52,7 @@
</select>
<span asp-validation-for="selFertOption" class="text-danger"></span>
}

</div>
@if(Model.selTypOption == "1" || Model.selTypOption == "2"){
<div class="form-group col-sm-2" style="margin-right:0px; padding-right:0px; width:100px; margin-top: 8px;">
Expand Down Expand Up @@ -106,14 +106,14 @@
<div class="form-group col-sm-4" style="display:flex; align-items: center; width: 100px; margin-top: 8px;">
<div>
<label >
Action
Solubility Assessment
</label>
<div class="cell" style="text-align:center">
@if (Model.dryAction == "Good")
@if (Model.dryAction == "Soluble")
{
<span style="color: #4BB543;">@Model.dryAction </span>
<img src="~/images/good.svg" title="Good"/>
<img src="~/images/good.svg" title="Soluble"/>

}
else if (Model.dryAction == "Reduce the amount to dissolve")
{
Expand Down Expand Up @@ -154,7 +154,7 @@
</div>
} else {
<div class="form-group col-sm-2" style="margin-right:0px; padding-right:0px; width:120px">
<label for="rate">Product Rate</label>
<label for="rate">Application Rate</label>
<a href="#" data-toggle="tooltip" title="@Model.ExplainApplicationRate" id="toolTipExplainApplicationRate">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="Explanation of Application Rate" style="font-size:20px;"></span>
</a>
Expand Down Expand Up @@ -191,8 +191,8 @@
}
</div>
</div>
<div style="margin-top: 20px;"></div>

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

<div class="row">
<div class="form-group">
Expand All @@ -215,14 +215,14 @@
</div>
</div>
<div class="form-group col-sm-4">
<label for="eventsPerSeason" style="margin-top: 8px;">Proposed Number of Fertigation Per Season</label>
<label for="eventsPerSeason" style="margin-top: 8px;">Number of Fertigation Applications per Season</label>
<div>
<input class="form-control" id="eventsPerSeason" type="number" min="1" asp-for="eventsPerSeason" style="width:100px" />
<span asp-validation-for="eventsPerSeason" class="text-danger" value=1></span>
</div>
</div>
<div class="form-group col-sm-3">
<label for="ddlMan" style="margin-top: 8px;">Fertigation Scheduling</label>
<label for="ddlMan" style="margin-top: 8px;">Application Frequency</label>
<select class="form-control" id="ddlApplPeriod" style="width:100%" asp-for="selFertSchedOption" asp-items="@(new SelectList(Model.applPeriod,"Id","Value"))">
<option></option>
</select>
Expand All @@ -242,57 +242,57 @@
<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">
<div class="form-group" style="display:flex; justify-content:space-between; width:90%">
@if(Model.selTypOption == "1" || Model.selTypOption == "2"){
<div class="form-group col-sm-4" style="display:flex; align-items: center; margin-left: 30px;">
<div class="form-group col-sm-8" style="display:flex; align-items:center; margin:5px; height: 40px;">
<div>
<label >
Fertigation Time (Minutes)
<label style="display:flex; align-items:center; padding-left: 50px;">
Time per Application
</label>
<a href="#" data-toggle="tooltip" title="@Model.ExplainTime" id="toolTipExplainTime">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="Explanation of Time per Application" style="font-size:20px;"></span>
</a>
<div class="cell" style="text-align:center">
@Model.fertigationTime
<div class="cell" style="text-wrap: pretty; text-align: center;">
@Model.fertigationTime minutes
</div>
</div>
</div>
} else {
<div class="form-group col-sm-4" style="display:flex; align-items: center;">
<div>
<label style="text-wrap: pretty; text-align: center;">
Total Product Volume per Fertigation (Imp. gal)
<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)
</label>
<div class="cell" style="text-align:center">
@Model.totProductVolPerFert
</div>
</div>
</div>
<div class="form-group col-sm-4" style="display:flex; align-items: center;">
<div>
<label style="text-wrap: pretty; text-align: center;">
Total Product Volume for Growing Season (Imp. gal)
<div class="form-group col-sm-8" style="margin:5px">
<div class="table">
<label id="productVolumeGrowingLabel" style="text-wrap: pretty; text-align: center; height: 40px;">
Total Product Volume for Growing Season (select a unit)
</label>
<div class="cell" style="text-align:center">
@Model.totProductVolPerSeason
</div>
</div>
</div>
<div class="form-group col-sm-4" style="display:flex; align-items: center;">
<div>
<label >
Fertigation Time (Minutes)
<div class="form-group col-sm-8" style="margin:5px">
<div class="table">
<label style="height: 40px; text-align:center">
Time per Application
</label>
<a href="#" data-toggle="tooltip" title="@Model.ExplainTime" id="toolTipExplainTime">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true" title="Explanation of Time per Application" style="font-size:20px;"></span>
</a>
<div class="cell" style="text-align:center">
@Model.fertigationTime
@Model.fertigationTime minutes
</div>
</div>
</div>
Expand All @@ -301,10 +301,10 @@
</div>
<div class="row">
<div class="form-group" style="display:flex; justify-content:space-between; width:90%">
<div class="form-group col-sm-3" style="margin:5px">
<div class="form-group col-sm-8" style="margin:5px">
<div class="Table">
<div class="Title">
<p>Applied Nutrients Per Fetigation (lb/ac)</p>
<p>Applied Nutrients Per Fertigation (lb/ac)</p>
</div>
<div class="Heading">
<div class="Cell">
Expand All @@ -330,9 +330,9 @@
</div>
</div>
</div>
<div class="form-group col-sm-3" style="margin:5px">
<div class="form-group col-sm-8" style="margin:5px">
<div class="Table">
<div class="Title">
<div class="Title" style="height: 45px;">
<p>Total Applied Nutrients (lb/ac)</p>
</div>
<div class="Heading">
Expand All @@ -359,9 +359,9 @@
</div>
</div>
</div>
<div class="form-group col-sm-3" style="margin:5px">
<div class="form-group col-sm-8" style="margin:5px">
<div class="Table">
<div class="Title">
<div class="Title" style="height: 45px;">
<p>Still Required This Year (lbs/ac)</p>
</div>
<div class="Heading">
Expand Down Expand Up @@ -497,29 +497,39 @@ $(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);
}
}
// 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 unit label
updateUnits();
});
</script>

0 comments on commit afa9162

Please sign in to comment.