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
/
map
/
Views
/
FarmerDiary
/
View File Name :
_FarmerDiaryProductionPlanTab.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="CreateProductionPlan"> <div id="eror_msg"></div> <div class="row"> <input type="hidden" name="Id" id="ProductionPlanId" /> <div class="form-group col-md-2"> <label><strong>Commodity</strong></label> <select type="text" class="form-control required" name="Commodity" id="CommodityForProductionTab" data-api="/commodity/select" data-api-selected-value="@Model.MemberDetailView.Commodity" disabled></select> </div> <div class="form-group col-md-2"> <label><strong>Product Name</strong></label> <select type="text" class="form-control required" name="Category" id="CategoryForProductionTab" data-api="/commodity_subtype/select"></select> </div> <div class="form-group col-md-2"> <label><strong>Production Area</strong></label> <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="7" class="required form-control" id="ProductionArea" name="ProductionArea" /> </div> <div class="form-group col-md-2"> <label><strong>Production Area Unit</strong></label> <select type="text" class="form-control required" name="ProductionUnit" id="ProductionUnit" data-api="/land/unit/select"></select> @*<select type="text" class="form-control required" name="ProductionUnit" id="ProductionUnit" data-api="/production/unit/select"></select>*@ </div> <div class="form-group col-md-2"> <label><strong>Production Quantity</strong></label> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="7" name="ProductionQuantity" id="ProductionQuantity"> @* <input type="text" onkeypress="return isNumberKey(this,event)" maxlength="5" class="required form-control" id="ProductionQuantity" name="ProductionQuantity" />*@ </div> <div class="form-group col-md-2"> <label><strong>Production Quantity Unit</strong></label> @*<select type="text" class="form-control required" name="IncomeQuantityUnit" id="IncomeUnit" data-api="/income_quantity_unit/select"></select>*@ <select type="text" class="form-control required" id="ProductionQuantityUnit" name="ProductionQuantityUnit" data-api="/income_quantity_unit/select"></select> </div> </div> <div class="row"> <div class="form-group col-md-6"> <label><strong>Remarks</strong></label> <input type="text" class="required form-control" id="ProductionRemarks" name="Remarks" /> </div> <div class="form-group col-md-4"> <label> </label><br /> @if (meta.RoleId == (int)EnumRoleHelper.Roles.Admin || meta.RoleId == (int)EnumRoleHelper.Roles.MnE || meta.RoleId == (int)EnumRoleHelper.Roles.MnEOfficer) { <input type="button" value="Save" class="btn btn-primary" id="SubmitProductionPlan" /> } <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> </form> } <div class="row"> <div class="col-lg-12"> <a class="btn btn-primary btnNext">Next <i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></a> </div> </div> <div class="table-responsive" style="margin-top: 16px;"> <table class="table table-bordered table-hover" name="tblProductionPlan" id="tblProductionPlan"> <thead> <tr> @*<th rowspan="2" style="text-align:center;">Fiscal Year</th> <th rowspan="2" style="text-align:center">Quadrimester</th>*@ <th rowspan="2" style="text-align:center;padding-top:20px">Product Name</th> <th colspan="4" style="text-align:center">Production</th> <th rowspan="2" style="text-align:center;padding-top:20px">Remarks</th> @if (memberStatus) { <th rowspan="2">Action</th> } </tr> <tr> <th> Area</th> <th> Area Unit</th> <th> Quantity</th> <th> Quantity Unit</th> </tr> </thead> <tbody> </tbody> <tfoot style="line-height:30px;background-color:#edf0ee;color:black" id="tblFooter"> </tfoot> </table> <span> Note: <strong>1 KATTHA = 0.033863159390965 HECTARE</strong> <strong>1 ROPANI = 0.050873706673504 HECTARE</strong> </span> </div> <script type="text/javascript"> function loadProduction() { const ajax = request(); function request() { const url = '/farmer_diary/production_plan/member/' + @Model.MemberDetailView.Id + "/fiscal/" + '@ViewBag.FiscalYear'; return window.getAjaxRequest(url, "Get", @Model.MemberDetailView.Id); } ajax.done(function (response) { addProductionPlanListToTable(response); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function addProductionPlanListToTable(response) { debugger; var status = '@memberStatus'; var totalProductionAreaInHectare = 0.0; $('#tblProductionPlan tbody > tr').remove(); $('#tblProductionPlan tfoot > tr').remove(); var table = $("#tblProductionPlan tbody"); response.forEach(function (x) { var row = "<tr>"; //row += "<td>" +x.fiscal_year+ "</td>"; //row += "<td>" + x.quadtrimester + "</td>"; row += "<td>" + x.category + "</td>"; row += "<td>" + getNumberWithComma(x.production_area == null ? '' : x.production_area) + "<br>(" + x.production_area_hectare + " Hectare)" + " </td>"; row += "<td>" + x.unit + "</td>"; row += "<td>" + getNumberWithComma(x.production_quantity) + "</td>"; row += "<td>" + x.quantity_unit + "</td>"; row += "<td>" + x.remarks + "</td>"; row += "<td class='hideshow'>" + "<a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=editProductionPlanForm(" + x.id + ") ><i class='fa fa-edit'></i >" + "</a > <a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=deleteProductionPlan(" + x.id + ") ><i class='fa fa-trash'></i ></a> " + " <span" + " style='cursor:pointer' onclick=showFarmerDiaryProductionPlanRecommendPopUp(" + x.id + ") class='badge'>Recommend</span> </center></td >"; totalProductionAreaInHectare += parseFloat(x.production_area_hectare || 0); table.append(row); }) var tblFooter = $("#tblProductionPlan tfoot"); var footerRow = `<tr> <td ><strong>Total : </strong></td><td><strong><center> ${getNumberWithComma(totalProductionAreaInHectare.toFixed(3))} Hectare</center ></strong ></td > <td></td><td></td><td></td><td></td><td></td></tr>`; tblFooter.append(footerRow); if (status === 'False') { $('.hideshow').hide(); } } $("#SubmitProductionPlan").off("click").on("click", function () { function request(model) { const url = "/farmer_diary/production_plan/create"; const data = JSON.stringify(model); return window.getAjaxRequest(url, "POST", data); } const form = $("#CreateProductionPlan"); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; }; if (!window.confirmAction()) { return; }; WorkForce.loader.show(); var allFormData = window.serializeForm(form); debugger; function getModel() { return (getFarmerDiaryProductionPlan()); } function getFarmerDiaryProductionPlan() { var farmerDiaryProductionPlan = {}; farmerDiaryProductionPlan.Id = allFormData.Id; farmerDiaryProductionPlan.Category = allFormData.Category; farmerDiaryProductionPlan.ProductionArea = allFormData.ProductionArea; farmerDiaryProductionPlan.ProductionUnit = allFormData.ProductionUnit; farmerDiaryProductionPlan.ProductionQuantity = removeCommaFromString(allFormData.ProductionQuantity); farmerDiaryProductionPlan.Remarks = allFormData.Remarks; farmerDiaryProductionPlan.Commodity = allFormData.Commodity; farmerDiaryProductionPlan.GroupId = @Model.MemberDetailView.GroupId; farmerDiaryProductionPlan.BaselineId = @Model.Baseline.Id; farmerDiaryProductionPlan.DistrictId = @Model.MemberDetailView.DistrictId; farmerDiaryProductionPlan.ProductionQuantityUnit = allFormData.ProductionQuantityUnit; farmerDiaryProductionPlan.FiscalYear = '@ViewBag.FiscalYear'; farmerDiaryProductionPlan.MemberId = @Model.MemberDetailView.Id; farmerDiaryProductionPlan.ProductionAreaHectare = convertToHectare(farmerDiaryProductionPlan.ProductionUnit, farmerDiaryProductionPlan.ProductionArea); aProductionData = farmerDiaryProductionPlan; return farmerDiaryProductionPlan; } const model = getModel(); const ajax = request(model); ajax.done(function (response) { WorkForce.loader.hide(); showNotification("success"); loadProduction(); //addCurrentlyInsertedProductionPlanToTable(aProductionData); clearProductionPlan(); }); function clearProductionPlan() { $('#ProductionPlanId').val(""); $('#CategoryForProductionTab').val(""); $('#ProductionArea').val(""); $('#ProductionUnit').val(""); $('#ProductionQuantity').val(""); $('#ProductionQuantityUnit').val(""); $('#ProductionRemarks').val(""); } function addCurrentlyInsertedProductionPlanToTable(response) { $('<tr class="anim highlight">' + `<td>${$("#FiscalYear option:selected").text()}</td > <td>${$('#Quadtrimester').val()}</td> <td>${$("#CommodityForProductionTab option:selected").text()}</td> <td>${ $("#CategoryForProductionTab option:selected").text()}</td> <td>${$('#ProductionArea').val()}</td> <td>${ $("#ProductionUnit option:selected").text()}</td> <td>${$('#ProductionQuantity').val()}</td> <td>${$('#ProductionQuantityUnit option:selected').text()}</td> <td>${$('#ProductionRemarks').val()}</td> <td><a class='' style='cursor:pointer;font-size:14px' onclick=editProductionPlanForm("${response.Id}") ><i style='padding:5px' class='fa fa-edit'></i ></a> <a class='' style='cursor:pointer;font-size:14px' onclick=getIncomeByMemberId(${response.Id}) ><i class='fa fa-eye'></i ></a> </tr >`) .hide() .prependTo('#tblProductionPlan tbody') .fadeIn("slow") .addClass('normal'); } ajax.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("error", xhr.responseText); }); }) function editProductionPlanForm(productionPlanId) { const ajax = request(productionPlanId); function request(productionPlanId) { const url = '/farmer_diary/production_plan/' + productionPlanId; return window.getAjaxRequest(url, "Get", productionPlanId); } ajax.done(function (response) { ; console.log(response); $('#ProductionPlanId').val(response.Id); $('#CategoryForProductionTab').val(response.Category); $('#ProductionArea').val(response.ProductionArea); $('#ProductionUnit').val(response.ProductionUnit); $('#ProductionQuantity').val(getNumberWithComma(response.ProductionQuantity)); $('#ProductionQuantityUnit').val(response.ProductionQuantityUnit); $('#ProductionRemarks').val(response.Remarks); window.scrollTo(200, 0); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function getIncomeByMemberId(id) { alert(id); } function clearAllProductionPlan() { $('#ProductionPlanId').val(''); $('#Commodity').val(''); $('#Category').val(''); $('#ProductionArea').val(''); $('#ProductionUnit').val(''); $('#ProductionQuantity').val(''); $('#ProductionRemarks').val(''); } function deleteProductionPlan(productionPlanId) { let conf = confirm(`Are you sure you want to delete this Production Plan ?`); if (!conf) { return; } else { const ajaxResponse = requestProductionPlanToDelete(productionPlanId); ajaxResponse.done(function (response) { WorkForce.loader.hide(); if (response) { loadProduction(); ShowMessage("success", "Successfully Deleted this Production Plan"); } WorkForce.loader.hide(); }); ajaxResponse.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("Error", xhr.responseText); }); WorkForce.loader.hide(); } } function requestProductionPlanToDelete(productionPlanId) { const url = "/farmer_diary/production_plan/delete/"; const data = JSON.stringify({ "Id": productionPlanId}); return window.getAjaxRequest(url, "POST", data); } function showFarmerDiaryProductionPlanRecommendPopUp(id) { $('#recommendFarmerDiaryModel').modal('show'); $('#RowIdInPopUp').val(id); $('#TableName').val('FarmerDiaryProductionPlan'); } 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>