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
/
WorkPlan
/
View File Name :
Create.cshtml
@model RER_Project.DataAccess.ViewModels.WorkPlan.WorkPlanViewModel <style> .months-form-group .col-md-1 { padding-right: 0 } .amount-form-group .col-md-1 { padding-right: 0px; } .btn { border-radius: 0px; } .planning { padding: 0px; } </style> @{ ViewBag.Title = "WorkPlan Create"; } <div class="wrapper wrapper-content animated fadeInRight"> <div class="row"> <div class="col-lg-12"> <div class="ibox float-e-margins"> <div class="ibox-content"> <label style="font-size: medium"><b>Create Annual WorkPlan For Fiscal Year: @Model.FiscalYear </b></label> <hr /> <form id="Create"> <div id="eror_msg"></div> <input type="hidden" id="FiscalYearId" name="FiscalYearId" value="@Model.FiscalYearId" /> <input type="hidden" id="FiscalYear" name="FiscalYear" value="@Model.FiscalYear" /> <input type="hidden" id="WorkPlanId" name="WorkPlanId" value="@Model.WorkPlanId" /> <div class="row"> <div class="form-group col-md-4"> <label><strong>Assigned to</strong></label> <select type="text" class="form-control required clear" name="AssignedTo" id="AssignedTo" data-api="/user-level-one/select"></select> </div> <div class="form-group col-md-4"> <label><strong>Component</strong></label> <select class="form-control required clear" id="ComponentId" name="ComponentId" data-api="/component/select"></select> </div> <div class="form-group col-md-4"> <label><strong>Sub Component</strong></label> <select class="form-control required clear" id="SubComponentId" name="SubComponentId" data-api="/sub-component/select" disabled=""></select> </div> </div> <div class="row"> <div class="form-group col-md-4"> <label><strong>Activities</strong></label> <select type="text" class="form-control required clear" id="ActivityId" name="ActivityId" data-api="/activity-by-category/select" disabled=""></select> </div> <div class="form-group col-md-4"> <label><strong>Planning Unit</strong></label> <select class="form-control required clear" id="Unit" name="Unit" data-api="/activity-target-unit/select"></select> </div> <div class="form-group col-md-4"> <label><strong>Planned Budget</strong></label> <div class="inputWithIcon"> <input type="text" class="curr form-control required currencyFormatter clear" onkeypress="return isNumberKey(this,event)" placeholder="Planned Budget" maxlength="12" id="PlannedBudget" name="PlannedBudget"> <span><strong>Rs</strong></span> </div> </div> </div> <div class="row"> <div class="form-group col-md-12" style="margin-bottom:0px"> <label><strong>Planning Qty</strong></label> </div> <div class="row"> <div class="form-group col-md-8"> <div class="col-md-2"> <input type="text" class="curr form-control required clear" name="FirstQuadQuantity" onkeypress="return isNumberKey(this,event)" maxlength="4" id="FirstQuadQuantity" placeholder="1st Quarter" /> </div> <div class="col-md-2"> <input type="text" class="curr form-control required clear" name="SecondQuadQuantity" onkeypress="return isNumberKey(this,event)" maxlength="4" id="SecondQuadQuantity" placeholder="2nd Quarter" /> </div> <div class="col-md-2"> <input type="text" class="curr form-control required clear" name="ThirdQuadQuantity" onkeypress="return isNumberKey(this,event)" maxlength="4" id="ThirdQuadQuantity" placeholder="3rd Quarter" /> </div> <div class="col-md-2"> <input type="text" class="curr form-control required clear" name="FourthQuadQuantity" onkeypress="return isNumberKey(this,event)" maxlength="4" id="FourthQuadQuantity" placeholder="4th Quarter" /> </div> </div> </div> <div class="form-group col-md-1"> <a onclick="addPlanningQty()" class="btn btn-sm btn-primary"><i class="fa fa-plus"></i> Add</a> </div> </div> <div class="row"> <div class="table-responsive" style="margin-top:16px;"> <table class="footable table table-hover" id="AnnualActivityPlaningTable"> <thead> <tr> <th>Assigned to</th> <th>Component</th> <th>SubComponent</th> <th>Activity</th> <th>Unit</th> <th>Planned Budget (Rs)</th> <th>1st Quarter</th> <th>2nd Quarter</th> <th>3rd Quarter</th> <th>4th Quarter</th> <th>Action</th> </tr> </thead> <tbody> @foreach (var item in Model.WorkPlanLevelOneViewsList) { <tr> <td>@item.UserName<input type=hidden name='AssignedTo' value="@item.AssignedTo" /></td> <td>@item.Component<input type=hidden name='ComponentId' value="@item.ComponentId" /></td> <td>@item.SubComponent<input type=hidden name='SubComponentId' value="@item.SubComponentId" /></td> <td>@item.Activity<input type=hidden name='ActivityId' id="ActivityId" value="@item.ActivityId" /></td> <td>@item.UnitName<input type=hidden name='PlanningUnitId' value="@item.UnitId"></td> <td> @String.Format(System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN"), "{0:#,0.00}", Convert.ToDouble(item.PlannedBudget)) </td> <td><input type="text" onkeypress="return isNumberKey(this,event)" maxlength="4" class="form-control" name="FirstQuadQuantity" value="@item.FirstQuadQuantity" /></td> <td><input type="text" onkeypress="return isNumberKey(this,event)" maxlength="4" class="form-control" name="SecondQuadQuantity" value="@item.SecondQuadQuantity" /></td> <td><input type="text" onkeypress="return isNumberKey(this,event)" maxlength="4" class="form-control" name="ThirdQuadQuantity" value="@item.ThirdQuadQuantity" /></td> <td><input type="text" onkeypress="return isNumberKey(this,event)" maxlength="4" class="form-control" name="FourthQuadQuantity" value="@item.FourthQuadQuantity" /></td> <td> <a onclick="deleteRow(this)" class="btn btn-default btn-xs" title="Delete"><i class="fa fa-remove" style='color: red;'></i></a> </td> </tr> } </tbody> </table> </div> </div> <div class="row"> <div class="pull-right"> <input type="button" value="Save" class="btn btn-primary" id="SubmitButton" /> <a href="/workplan" class="btn btn-default">Back</a> </div> </div> </form> </div> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function () { window.initializeSelectApis(); window.initializeCascadeComponent(); //calcSub(); }) var fiscalyear = $("#FiscalYearId").val(); var workplanId = $("#WorkPlanId").val(); var fyname = $("#FiscalYear").val(); var projectId = $("#ProjectId").val(); function checkIfExist(activity, unit, el) { var exists = false; el.find("tr").each(function () { var activityId = $(this).find("input[name='ActivityId']").val(); var unitId = $(this).find("input[name='Unit']").val(); var activitydropdownTypeId = activity.val(); var unitdropdownId = unit.val(); if (activityId === activitydropdownTypeId && unitId === unitdropdownId) { exists = true; return; } }); return exists; } function addPlanningQty() { const form = $("#Create"); var table = $('#AnnualActivityPlaningTable tbody'); const activity = $("#ActivityId option:selected"); const activityCategory = $("#ActivityCategoryId option:selected"); const subComponent = $("#SubComponentId option:selected"); const component = $("#ComponentId option:selected"); const planningUnit = $("#Unit option:selected"); const assigned = $("#AssignedTo option:selected"); $.validator.unobtrusive.parse(form); if (!form.valid()) { return false; } if (!window.confirmAction()) { return; }; if (checkIfExist(activity, planningUnit, table)) { ShowMessage("error", "The selected activity already exists."); return false; }; const model = window.serializeForm(form); var f = document.getElementById("FirstQuadQuantity").value; var s = document.getElementById("SecondQuadQuantity").value; var t = document.getElementById("ThirdQuadQuantity").value; var fo = document.getElementById("FourthQuadQuantity").value; var row = "<tr>"; row += "<td>" + assigned.text() + "<input type=hidden name='AssignedTo' value=" + assigned.val() + "></td>"; row += "<td>" + component.text() + "<input type=hidden name='ComponentId' value=" + component.val() + "></td>"; row += "<td>" + subComponent.text() + "<input type=hidden name='SubComponentId' value=" + subComponent.val() + "></td>"; row += "<td> " + activity.text() + "<input type=hidden name='ActivityId' value=" + activity.val() + "></td > "; row += "<td>" + planningUnit.text() + "<input type=hidden name='Unit' value=" + planningUnit.val() + "></td>"; row += "<td>" + model.PlannedBudget + "</td>"; row += "<td><input type='text' name='FirstQuadQuantity' class='form-control' value='" + f + "' /> </td>"; row += "<td><input type='text' name='SecondQuadQuantity' class='form-control' value='" + s + "' /></td>" row += "<td><input type='text' name='ThirdQuadQuantity' class='form-control' value='" + t + "' /></td>" row += "<td><input type='text' name='FourthQuadQuantity' class='form-control' value='" + fo + "' /></td>" row += "<td><a class='btn btn-default btn-xs' onclick='deleteRow(this)' title='Delete'><i class='fa fa-remove' style='color: red;'></i></a></td>" $(row).prependTo("table > tbody"); // $(row).insertBefore('table > tbody > tr:first'); // table.append(row); clearAll(); } function deleteRow(e) { if (!window.confirmAction()) { return; }; $(e).closest("tr").remove(); }; function clearAll() { $('.clear').val(''); } function annualActivityPlanningList() { var annualActivityPlanninglist = []; $("#AnnualActivityPlaningTable tbody tr").each(function () { debugger; const assigned = $(this).find("td:eq(0)").find("input[type='hidden']").val(); const componentId = $(this).find("td:eq(1)").find("input[type='hidden']").val(); const subcomponentId = $(this).find("td:eq(2)").find("input[type='hidden']").val(); const activityId = $(this).find("td:eq(3)").find("input[type='hidden']").val(); const unit = $(this).find("td:eq(4)").find("input[type='hidden']").val(); var plannedBudget = $(this).find("td:eq(5)").text(); const first = $(this).find("td:eq(6)").find("input[type='text']").val(); const second = $(this).find("td:eq(7)").find("input[type='text']").val(); const third = $(this).find("td:eq(8)").find("input[type='text']").val(); const fourth = $(this).find("td:eq(9)").find("input[type='text']").val(); plannedBudget = removeCommaFromString(plannedBudget.trim()); debugger; annualActivityPlanninglist.push({ ComponentId: componentId, SubComponentId: subcomponentId, ActivityId: activityId, PlannedBudget: plannedBudget, FirstQuadQuantity: first, SecondQuadQuantity: second, ThirdQuadQuantity: third, FourthQuadQuantity: fourth, FiscalYearId: fiscalyear, UnitId: unit, AssignedTo: assigned, WorkPlanId: workplanId }); }); return annualActivityPlanninglist; } $("#SubmitButton").off("click").on("click", function () { function request(model) { const url = "/workplan/create"; const data = JSON.stringify(model); return window.getAjaxRequest(url, "POST", data); } if (!window.confirmAction()) { return; }; debugger; WorkForce.loader.show(); function getModel() { return ({ WorkPlanLevelOnes: annualActivityPlanningList(), FiscalYearId: fiscalyear, FiscalYear: fyname, WorkPlanId: workplanId }); }; const model = getModel(); const ajax = request(model); ajax.done(function (response) { WorkForce.loader.hide(); showNotification("success"); window.location = "/workplan"; }); ajax.fail(function (xhr) { WorkForce.loader.hide(); ShowMessage("error", xhr.responseText); }); }); function isNumberKey(element, evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && !(charCode == 46 || charCode == 8)) return false; else { var len = $(element).val().length; var index = $(element).val().indexOf('.'); if (index > 0 && charCode == 46) { return false; } if (index > 0) { var CharAfterdot = (len + 1) - index; if (CharAfterdot > 3) { return false; } } } return true; } function getNumberWithComma(value) { value = value || 0 return Number(parseFloat(value).toFixed(2)).toLocaleString("en-IN", { minimumFractionDigits: 0 }) } function removeCommaFromString(value) { var result = parseFloat(value.replace(/,/g, '')); if (isNaN(result)) { return 0; } else { return result; } } </script>