File manager - Edit - /home/autoph/public_html/pms_v1/sales/salesGroupSetup.php
Back
<?php session_start(); if(isset($_SESSION['userID'])) { // echo "Session ID is '" . $_SESSION['userID']; // echo "<br>PMS Name id " . $_SESSION['userID']; $uID = $_SESSION['userID']; } include_once("../../../cfg/conn.php"); error_reporting(0); if(isset($_POST['grp'])){ //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== $roleID = userProfileID($userID); include ("../functions/users.php"); $roleID = userProfileID($uID); $moduleID = 43; $add =checkViewAccessM1024($roleID, $moduleID)[1]; $edit =checkViewAccessM1024($roleID, $moduleID)[2]; $delete =checkViewAccessM1024($roleID, $moduleID)[3]; $print =checkViewAccessM1024($roleID, $moduleID)[4]; $download =checkViewAccessM1024($roleID, $moduleID)[5]; echo "<input type='hidden' id='addAccess' value='$add'>"; echo "<input type='hidden' id='editAccess' value='$edit'>"; echo "<input type='hidden' id='deleteAccess' value='$delete'>"; echo "<input type='hidden' id='printAccess' value='$print'>"; echo "<input type='hidden' id='downloadAccess' value='$download'>"; if($add == 1){$addButton = '';}else{$addButton='Disabled';} if($edit == 1){$editButton = '';}else{$editButton='Disabled';} if($delete == 1){$deletButton = '';}else{$deletButton='Disabled';} if($print == 1){$printButton = '';}else{$printButton='Disabled';} if($download == 1){$downloadButton = '';}else{$downloadButton='Disabled';} if(checkViewAccessM1024($roleID, $moduleID)[0] == 0){ echo " <center><img src='./images/locked_out_icon.png' width='100' style='margin-top:100px'><img></center> "; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p>"; exit(); } //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== ?> <style> .menuItem{ background:none; color:black; font-size:12px; text-decoration:none; } .menuItem:hover{ background:none; color:blue; font-size:12px; text-decoration:underline; } ul, #myUL { list-style-type: none; } #myUL { margin: 0; padding: 0; } .caret { cursor: pointer; -webkit-user-select: none; /* Safari 3.1+ */ -moz-user-select: none; /* Firefox 2+ */ -ms-user-select: none; /* IE 10+ */ user-select: none; font-size:14px; font-weight:normal; } .caret:hover{ cursor: pointer; -webkit-user-select: none; /* Safari 3.1+ */ -moz-user-select: none; /* Firefox 2+ */ -ms-user-select: none; /* IE 10+ */ user-select: none; color:blue; font-size:14px; text-decoration:none; font-weight:normal; } .caret::before { content: "+"; /*"\271A";*/ color: black; display: inline-block; margin-right: 6px; font-weight:bold; font-size:22px } .caret-down::before { content: "- "; font-weight:bold; font-size:22px /*-ms-transform: rotate(90deg); IE 9 */ /*-webkit-transform: rotate(90deg); /* Safari /*transform: rotate(90deg); */ } .nested { display: none; cursor: pointer; } .active { display: block; } </style> <div class="shadow-sm mb-3 pageHeaderContainer content-justify-right pt-2 pb-2" style="padding:0px;" > <div class="pageSearchHeader bg-white p-1 pt-1" > <h4 class="ml-3 mt-1"><i class="fa fa-file-text-o" style='color:#0471AC'> Sales Group Setup </i></h4> </div> <div class="pageSearchHeader bg-white p-1 pt-1 "> <input class="form-control border p-3" type="search" placeholder="search" id="searchText" style="margin:0px;min-width:250px;width:75%;float:left"> <button type="button" class="btn btn-info" id="goSearchRecord" style="float:rigth;width:20%;margin-left:3px">Search</button> </div> </div> <div class="wrapper mt-3 p-0 shadow-sm float:left bg-white h-auto"> <div class="row fluid m-0 w-100 p-0 bg-white h-auto pageBodyMenu"> <div class="bg-red float:left text-left col-xs-12 col-md-4 col-lg-4 col-sm-12 p-2 h-auto" style='background:#fff;min-height:800px;border-right:1px solid lightgray'> <!--########################################################################################--> <!--########################################################################################--> <h4 class="btn btn-info w-100 text-left" >NAVIGATION:</h4> <div style="height:800px;overflow:auto;background:#fff"> <ul style='background:#fff;padding:10px;border:0px solid lightgray;'> <li><span class="caret" style='font-weight:bold'>SELECT COMPANY</span> <ul> <!--<ul class="nested"> --> <?php //LOAD LIST OF COMPANY IN TABULAR FORMAT $getComp = "SELECT * FROM `vts_company` WHERE `comp_status`=1 ORDER BY `comp_name` ASC"; $getC = mysqli_query($conn,$getComp); $statRow = mysqli_num_rows($getC); if($statRow > 0){ echo "<table id='compTable' class='w-75'>"; while($row = mysqli_fetch_array($getC)){ ?><tr onclick="javascript:compMenuID(this);" ><?php echo "<td class='menuItem'>".$row['comp_id']."</td>"; echo "<td class='menuItem'>".$row['comp_name']."</td>"; echo "</tr>"; } echo "</table>"; } ?> </ul> </li> </ul> <!-------------------------------------------------------------------------------------------> <ul style='background:#fff;padding:10px;border:0px solid lightgray;'> <li><span class="caret" style='font-weight:bold'>SELECT SALES GROUP</span> <ul> <!--<ul class="nested"> --> <?php //LOAD LIST OF COMPANY IN TABULAR FORMAT $getComp = "SELECT * FROM `pms_sales_group` WHERE `deleted`=0 ORDER BY `group_code` ASC"; $getC = mysqli_query($conn,$getComp); $statRow = mysqli_num_rows($getC); if($statRow > 0){ echo "<table id='groupTable' class='w-75'>"; while($row = mysqli_fetch_array($getC)){ ?><tr onclick="javascript:groupMenuID(this);" ><?php echo "<td class='menuItem'>".$row['id']."</td>"; echo "<td class='menuItem'>".$row['group_name']."</td>"; echo "</tr>"; } echo "</table>"; echo "<table id='groupTable' class='w-75'>"; echo "<tr>"; echo "<td colspan=2 class='text-right text-danger p-3 mt-5 bg-white'> <i data-toggle='modal' data-target='#addGroup' class='fa fa-plus font-weight-bold text-dark' aria-hidden='true' style='cursor:pointer;font-size:16px fa-left'> Add Sales Group</i></td>"; echo "</tr>"; echo "</table>"; } ?> </ul> </li> </ul> <!-------------------------------------------------------------------------------------------> </div> </div> <!--########################################################################################--> <!--########################################################################################--> <div id="activeReportFrom" class="bg-red float:left text-left col-xs-12 col-xs-12 col-md-8 col-lg-8 col-xl-8 col-sm-12 p-2 h-600"> <!--########################################################################################--> <!--########################################################################################--> <input type='hidden' id='salesPersonID' placeholder="Sales Record ID"> <input type='hidden' id='activeUnit' placeholder="activeUnit"> <input type='hidden' id='selUnitID' placeholder="selUnitID"> <input type='hidden' id='employeeSearchID' placeholder="employeeSearchID"> <input type='hidden' id='userID' value="<?php echo $uID;?>" placeholder="user ID"> <input type='hidden' id='selectedGroupID' placeholder="GroupID"> <input type='hidden' id='selectedGroupName' placeholder="Group Name"> <input type='hidden' id='selectedCompanyName' placeholder="Company Name"> <h4 id='activeTitle' class="btn btn-info w-100 text-left" >ACTIVE SALES GROUP / SALES PERSON:</h4> <table style="width:100%;border-collapse:collapse;"> <thead> <th style="width:10%;padding-left:2px;text-align:left;border:0px solid red">REC.ID</thd> <th style="width:15%;padding-left:2px;text-align:left;border:0px solid red">GROUP</th> <th style="width:40%;padding-left:2px;text-align:left;border:0px solid red">FIRSTNAME</th> <th style="width:30%;padding-left:2px;text-align:left;border:0px solid red">DEALER</th> <th style="width:5%;border:0px solid red;color:red;font-family:Calibri;font-size:18px;font-weight:normal"> <i data-toggle='modal' data-target='#addApproverForm' class='fa fa-plus' aria-hidden='true'></i> </th> </thead> <tr> <td colspan="6" style='padding:0px'> <div id='tdDataXX' style="maring:0px;overflow:auto"> <table id='tdDataTable' style='width:100%;border-collapse:collapse;'> </table> </div> </td> </tr> </table> <!--########################################################################################--> <!--########################################################################################--> </div> </div> </div> <!--MODAL FORM FOR ADD NEW GROUP--> <!-- The Modal --> <div class="modal fade " id="addGroup"> <div class="modal-dialog modal-md"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h5 class="modal-title" id='activeUnitName'>NEW GROUP</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body"> <input type="hidden" class="form-control" id="compName" disabled > <div class="form-group"> <label for="usr">GROUP CODE</label> <input class="form-control border p-4" type="search" placeholder="GRP#" id="newGroupCode" autofocus> </div> <div class="form-group"> <label for="usr">GROUP NAME</label> <input class="form-control border p-4" type="search" placeholder="Group 1" id="newGroupName"> </div> </div> <!-- Modal footer --> <div class="modal-footer"> <button <?php echo $addButton;?> type="button" class="btn btn-success pl-4 pr-4" data-dismiss="modal" id="saveNewGroup"> <span class="btn-label"><i class="fa fa-save"> Add</i></button> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span class="btn-label"><i class="fa fa-close"> Close</i></button> </div> </div> </div> </div> <!--MODAL FORM FOR ADD NEW GROUP--> <!-- The Modal --> <div class="modal fade " id="addApproverForm"> <div class="modal-dialog modal-md"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h5 class="modal-title" id='activeUnitName'>NEW APPROVER</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body"> <input type="hidden" class="form-control" id="compName" disabled > <div class="form-group"> <label for="usr">SEARCH BY NAME / EMP. ID:</label> <input class="form-control border p-4" type="search" placeholder="SEARCH BY NAME / EMP. ID" id="searchEmployee" OnkeyPress="searchMyEmployee()" style='background:yellow;border:1px solid gray' autofocus> </div> <div class="form-group"> <label>Sales Group:</label> <select id='selRole' class="form-select form-select-lg p-2 w-100 rounded-sm selectBG"> <option value='' selected>- Select Group -</option> <?php $gGrp="SELECT * FROM pms_sales_group WHERE deleted=0 ORDER BY group_name ASC"; $qGrp = mysqli_query($conn,$gGrp); while($grp=mysqli_fetch_array($qGrp)){ echo "<option value='".$grp['id']."'>".$grp['group_name']."</option>"; } ?> </select> </div> <div class="form-group" style="border:1px solid gray;boackground:lightgary;height:180px;overflow:auto"> <div id='searchData' style="width:100%;maring:0px;overflow:auto"> </div> </div> <p id='addThisName' style='padding:3px; color:red;margin:2px'></p> </div> <!-- Modal footer --> <div class="modal-footer"> <button <?php echo $addButton;?> type="button" class="btn btn-success pl-4 pr-4" data-dismiss="modal" id="addNewApproverID"> <span class="btn-label"><i class="fa fa-save"> Add</i></button> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span class="btn-label"><i class="fa fa-close"> Close</i></button> </div> </div> </div> </div> <?php } ?> <script> var toggler = document.getElementsByClassName("caret"); var i; for (i = 0; i < toggler.length; i++) { toggler[i].addEventListener("click", function() { this.parentElement.querySelector(".nested").classList.toggle("active"); this.classList.toggle("caret-down"); }); } function compMenuID(row) { var x=row.cells; document.getElementById("selectedCompanyName").value = x[1].innerHTML; document.getElementById("selUnitID").value = x[0].innerHTML; document.getElementById("compName").value = x[1].innerHTML; document.getElementById("activeUnit").value = "COMPANY"; document.getElementById("activeTitle").innerHTML = x[1].innerHTML; document.getElementById("activeUnitName").innerHTML = x[1].innerHTML + " - Approver"; } function groupMenuID(row) { var x=row.cells; var coName = $("#selectedCompanyName").val(); //alert(coName); document.getElementById("selectedGroupID").value = x[0].innerHTML; document.getElementById("selectedGroupName").value = x[1].innerHTML; document.getElementById("activeTitle").innerHTML = coName + " / " + x[1].innerHTML; document.getElementById("activeUnitName").innerHTML = x[1].innerHTML + " - Approver"; } function aprData(row){ var x=row.cells; document.getElementById("salesPersonID").value = x[0].innerHTML; } function getSearchEmpID(row) { var x=row.cells; document.getElementById("employeeSearchID").value = x[0].innerHTML; document.getElementById("addThisName").innerHTML = "Selected: " + x[2].innerHTML; } $('#compTable').on("click","tr td",function(){ var data = $(this).text(); var dCell = $(this).index(); var selUnitID = $("#selUnitID").val(); //alert(selUnitID); ShowUploadBar(); $.ajax({ url: "./sales/loadSalesGroup.php", method: 'POST', dataType: 'text', async:true, data: { "sgrp": "1", "selectedGroupID":"", "selUnitID": selUnitID }, success: function(d){ $("#tdDataTable").html(d); ShowUploadBar(); } }); }); $('#groupTable').on("click","tr td",function(){ var data = $(this).text(); var dCell = $(this).index(); var selUnitID = $("#selUnitID").val(); var selectedGroupID = $("#selectedGroupID").val(); //alert(selUnitID); ShowUploadBar(); $.ajax({ url: "./sales/loadSalesGroup.php", method: 'POST', dataType: 'text', async:true, data: { "sgrp": "1", "selectedGroupID":selectedGroupID, "selUnitID": selUnitID }, success: function(d){ $("#tdDataTable").html(d); ShowUploadBar(); } }); }); $('#tdDataTable').on("click","tr td",function(){ var data = $(this).text(); var dCell = $(this).index(); if(dCell ==4){ var userID = $("#userID").val(); var selUnitID = $("#selUnitID").val(); var salesPersonID = $("#salesPersonID").val(); var activeUnit = $("#activeUnit").val(); var deleteAccess = $("#deleteAccess").val(); // alert(salesPersonID); // return false; if(deleteAccess == 0){ Swal.fire({ icon: 'error', title: 'Access Denied', text: 'You are not allowed to delete record from this page...', footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } Swal.fire({ title: 'Deleting Record', text: "Are you sure you want to delete this record? You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then((result) => { if (result.isConfirmed) { ShowUploadBar(); $.ajax({ url: "./sales/loadSalesGroup.php", method: 'POST', dataType: 'text', async:true, data: { "sgrp": "3", "salesPersonID":salesPersonID, "userID":userID, "selUnitID": selUnitID }, success: function(d){ $("#tdDataTable").html(d); ShowUploadBar(); } }); } }) } }); function searchMyEmployee(){ var searchEmployee = $("#searchEmployee").val(); var selUnitID = $("#selUnitID").val(); var compName = $("#compName").val(); var len = searchEmployee.length; if(len > 0){ if(compName===""){ Swal.fire({ icon: 'error', title: 'Invalid Entry', text: 'No active company has been selected.' //footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } $.ajax({ url: "./apr/searchEmpByCompany.php", method: 'POST', dataType: 'text', async:true, data: { iSearch: 104, "searchEmployee": searchEmployee, "selUnitID": selUnitID }, success: function(d){ $("#searchData").html(d); } }); } //$('#marScore').val(myTotalScore.toFixed(2)); //$('#myVarianceNo').val(myVariance.toFixed(2)); } $("#addNewApproverID").click(function(){ var salesPersonID = $("#salesPersonID").val(); var selRole = $("#selRole").val(); var selUnitID = $("#selUnitID").val(); var employeeSearchID = $("#employeeSearchID").val(); var userID = $("#userID").val(); //alert(salesPersonID); //alert(selRole); //alert(selUnitID); // alert(employeeSearchID); //return false; if(employeeSearchID == ''){ Swal.fire({ icon: 'error', title: 'Invalid Entry', text: 'Please select employee to continue...' //footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } if(selRole == ''){ Swal.fire({ icon: 'error', title: 'Invalid Entry', text: 'Please select group to continue...' //footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } ShowUploadBar(); $.ajax({ url: "./sales/loadSalesGroup.php", type: "POST", async: true, data: { "salesPersonID":salesPersonID, "selRole":selRole, "selUnitID":selUnitID, "employeeSearchID":employeeSearchID, "userID":userID, "sgrp":"2"//save company approver }, success: function(dx){ $("#tdDataTable").html(dx); $("#searchEmployee").val(""); ShowUploadBar(); } }) }); $("#saveNewGroup").click(function(){ var newGroupCode = $("#newGroupCode").val(); var newGroupName = $("#newGroupName").val(); var userID = $("#userID").val(); //alert(salesPersonID); //alert(selRole); //alert(selUnitID); // alert(employeeSearchID); //return false; if(newGroupCode == ''){ Swal.fire({ icon: 'error', title: 'Invalid Entry', text: 'Group Code is required...' //footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } if(newGroupName == ''){ Swal.fire({ icon: 'error', title: 'Invalid Entry', text: 'Group Name is required...' //footer: '<a href="user-guide.php?code=new-area">Why do I have this issue?</a>' }) return false; } ShowUploadBar(); $.ajax({ url: "./sales/saveNewSalesGroup.php", type: "POST", async: true, data: { "newGroupCode":newGroupCode, "newGroupName":newGroupName, "userID":userID, "sgrp":"99" }, success: function(dx){ $("#groupTable").html(dx); //$("#searchEmployee").val(""); ShowUploadBar(); } }) }); </script>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings