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
/
mapqa
/
Views
/
FarmerDiary
/
Edit 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>Enterprise</strong></label> <input type="text" class=" required form-control" id="Enterprise" name="EnterprisePlan" > </div>*@ <div class="form-group col-md-2"> <label><strong>Enterprise</strong></label> @* <select type="text" class="form-control required" id="CommodityIncome" onchange="commodityChangeCalled()" data-api="/commodity/by/memberid/@Model.MemberDetailView.Id">*@ <select type="text" class="form-control required" name="Commodity" onclick="filterCommodities()" id="CommodityForProductionTab" data-api="/commodity/by/memberid/@Model.MemberDetailView.Id"></select> </div> <div class="form-group col-md-2"> <label><strong>Commodity</strong></label> <select type="text" class="form-control required" name="Category" id="CategoryForProductionTab"></select> </div> <div class="form-group col-md-2"> <label><strong>Type Of Production</strong></label> <select type="text" class="form-control required" name="ProductionType" id="ProductionType" data-api="/TypeOfProduction/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 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 class="form-group col-md-6"> <label><strong>Remarks</strong></label> <input type="text" class=" 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.ProjectDirector || meta.RoleId == (int)EnumRoleHelper.Roles.BDS || 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">Enterprise</th>*@ <th rowspan="2" style="text-align:center;padding-top:20px">Enterprise</th> <th rowspan="2" style="text-align:center;padding-top:20px">Commodity</th> <th colspan="5" 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> Type</th> <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() { debugger; $('#CommodityForProductionTab').trigger("change"); 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 filterCommodities() { debugger; var selectElement = document.getElementById("CommodityForProductionTab"); var options = selectElement.options; for (var i = options.length - 1; i >= 0; i--) { var value = options[i].value; var text = options[i].text; if (value === "23" && text === "Others") { selectElement.removeChild(options[i]); } } } function addProductionPlanListToTable(response) { 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.enterprise + "</td>"; row += "<td>" + x.commodity + "</td>"; row += "<td>" + x.category + "</td>"; row += "<td>" + x.type_of_production + "</td>"; row += "<td>" + getNumberWithComma(x.production_area == null ? '' : x.production_area) + " </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 || 0); table.append(row); }) var tblFooter = $("#tblProductionPlan tfoot"); var footerRow = `<tr> <td></td> <td ></td><td><strong>Total :${getNumberWithComma(totalProductionAreaInHectare.toFixed(3))}</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 () { debugger; function request(model) { console.log("modellll",model) const url = "/farmer_diary/production_plan/create"; const data = JSON.stringify(model); debugger; console.log("data", data) return window.getAjaxRequest(url, "POST", data); } const form = $("#CreateProductionPlan"); console.log("from", form); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; }; if (!window.confirmAction()) { return; }; WorkForce.loader.show(); var allFormData = window.serializeForm(form); function getModel() { return (getFarmerDiaryProductionPlan()); } function getFarmerDiaryProductionPlan() { debugger; 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.Type_Of_Production = allFormData.ProductionType; farmerDiaryProductionPlan.ProductionAreaHectare = convertToHectare(farmerDiaryProductionPlan.ProductionUnit, farmerDiaryProductionPlan.ProductionArea); aProductionData = farmerDiaryProductionPlan; farmerDiaryProductionPlan.Enterprise = allFormData.EnterprisePlan; return farmerDiaryProductionPlan; console.log("farmerDiaryProductionPlan", 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(""); $('#ProductionType').val(""); $('#ProductionRemarks').val(""); $('#Enterprise').val $('#CommodityForProductionTab').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); setTimeout( function () { $("#CategoryForProductionTab").val(response.Category); $('#ProductionQuantityUnit').val(response.ProductionQuantityUnit); }, 300); $('#CommodityForProductionTab').val(response.Commodity); $('#ProductionType').val(response.Type_Of_Production); $('#CommodityForProductionTab').trigger("change"); $('#ProductionPlanId').val(response.Id); $('#ProductionArea').val(response.ProductionArea); $('#ProductionUnit').val(response.ProductionUnit); $('#ProductionQuantity').val(getNumberWithComma(response.ProductionQuantity)); $('#ProductionQuantityUnit').val(response.ProductionQuantityUnit); $('#ProductionRemarks').val(response.Remarks); @* $('#CategoryForProductionTab').val(response.Category);*@ $('#Enterprise').val(response.Enterprise); loadProduction(); 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>
Save