Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
aadhavan valli 2024-08-23 18:12:17 +05:30
commit b0739f5837
3 changed files with 192 additions and 402 deletions

View File

@ -38,24 +38,9 @@ if (!empty($ReqPOType)) {
window.onload = function() {
var serviceScheduleType = '<?php echo $serviceSchedule; ?>';
if (serviceScheduleType != '') {
if (serviceScheduleType != 'Recurring') {
$('#DisplayScheduleDiv').show();
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
} else {
$('#DisplayScheduleDiv').show();
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
}
$('#DisplayScheduleDiv').show();
} else {
document.getElementById('DisplayScheduleDiv').style.display = 'none';
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
$('#DisplayScheduleDiv').hide();
}
}
</script>
@ -97,7 +82,6 @@ if (!empty($ReqPOType)) {
$data = array('name' => 'RequestType', 'value' => set_value('RequestType', $ReqType), 'id' => 'RequestType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
<input type="hidden" name="txtReqNo" id="txtReqNo" value="<?php echo $ReqNo ?>" />
</div>
<div class="form-group col-md-3">
@ -130,55 +114,17 @@ if (!empty($ReqPOType)) {
?>
</div>
<div class="form-group col-md-3" id="DisplayScheduleDiv" style="display:none;">
<label for="ScheduleType" class="col-form-label">Service Schedule Type</label>
<?php
$Schdule = array("One Time", "Recurring");
if (!empty($Schdule)) {
foreach ($Schdule as $seletedSch) :
if ($serviceSchedule == $seletedSch) {
$SchType[$seletedSch] = $seletedSch;
}
endforeach;
foreach ($Schdule as $Sch) :
if ($serviceSchedule != $Sch) {
$SchType[$Sch] = $Sch;
}
$SchType[$Sch] = $Sch;
endforeach;
}
echo form_dropdown('ScheduleType', $SchType, set_value('ScheduleType'), 'id="ScheduleType"', 'class = "form-control"');
?>
</div>
<div class="form-group col-md-3" id="ServicePeriodOption" style="display:none;">
<label for="ServiceOptions" class="col-form-label">Service Period Option</label>
<?php
if (!empty($ServiceOption)) {
foreach ($ServiceOption as $SerOptionsel) :
if ($servicePeriod == $SerOptionsel->ConfigValue) {
$ServiceOptions[$SerOptionsel->ConfigValue] = $SerOptionsel->ConfigValue;
}
endforeach;
foreach ($ServiceOption as $SerOption) :
if ($servicePeriod != $SerOption->ConfigValue) {
$ServiceOptions[$SerOption->ConfigValue] = $SerOption->ConfigValue;
}
endforeach;
}
echo form_dropdown('ServiceOptions', $ServiceOptions, set_value('ServiceOptions'), 'id="ServiceOptions"', 'class = "form-control"');
?>
</div>
<div class="form-group col-md-3" id="DisplayScheduleDiv" style="display:none;">
<label for="ServiceNo" class="col-form-label">Number of Services</label>
<?php
$data = array('name' => 'ServiceNo', 'value' => set_value('ServiceNo', $noOfService), 'id' => 'ServiceNo', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
$selectedValue = set_value('ScheduleType') ? set_value('ScheduleType') : reset($SchType);
echo form_dropdown('ScheduleType', $SchType, $selectedValue, 'id="ScheduleType" class = "form-control searchabledropdown" data-toggle="select2"');
?>
</div>
</div>
@ -240,27 +186,50 @@ if (!empty($ReqPOType)) {
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $RowCount; ?>" />
<!-- Available Budget Amt -->
<input type="hidden" name="AvlBudgetAmount" id="AvlBudgetAmount" />
<input type="hidden" name="txtReqNo" id="txtReqNo" value="<?php echo $ReqNo ?>" />
<?php
$data = array('name' => 'ServiceNo', 'value' => set_value('ServiceNo', $noOfService), 'id' => 'ServiceNo', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);');
echo form_hidden($data);
?>
<div style="display:none;">
<label for="ServiceOptions" class="col-form-label">Service Period Option</label>
<?php
if (!empty($ServiceOption)) {
foreach ($ServiceOption as $SerOptionsel) :
if ($servicePeriod == $SerOptionsel->ConfigValue) {
$ServiceOptions[$SerOptionsel->ConfigValue] = $SerOptionsel->ConfigValue;
}
endforeach;
foreach ($ServiceOption as $SerOption) :
if ($servicePeriod != $SerOption->ConfigValue) {
$ServiceOptions[$SerOption->ConfigValue] = $SerOption->ConfigValue;
}
endforeach;
}
echo form_dropdown('ServiceOptions', $ServiceOptions, set_value('ServiceOptions'), 'id="ServiceOptions"', 'class = "form-control"');
?>
</div>
</div>
<div class="form-row float-right">
<?php if ($Status == REQ_DRAFT) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<a class="btn-primary waves-effect Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save As Draft</span></a>
<a class="btn-primary waves-effect submit" ID="submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn-soft-primary waves-effect waves-light submit" ID="submit" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<button type="button" class="btn btn-primary waves-effect Save" onclick="Save(0)" id="Save">Save As Draft</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" onclick="Save(1)" id="submit">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" onclick="Save(2)" id="submit">Approve</button>&nbsp;&nbsp;
<?php } else if ($Status == REQ_PENDING_APPROVAL) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<a class="btn-primary waves-effect Save" ID="submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn-soft-primary waves-effect waves-light submit" ID="submit" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<button type="button" class="btn btn-primary waves-effect submit" onclick="Save(1)" id="submit">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" onclick="Save(2)" id="submit">Approve</button>&nbsp;&nbsp;
<?php } ?>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
<!-- end row -->
</div><!-- end row -->
</div> <!-- container -->
<div id="add-req-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
@ -413,6 +382,7 @@ if (!empty($ReqPOType)) {
</div>
<div class="modal-footer">
<input type="hidden" name="Edituserid" id="Edituserid" />
<button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button>
<button type="button"
@ -470,78 +440,13 @@ if (!empty($ReqPOType)) {
var id = '<?php echo $CostCenterCode ?>';
var ReqType = '<?php echo $strReqPOType ?>';
var urlval = '';
urlval = "<?php echo base_url() ?>serviceAvilBudgetAmount";
$('#content').loader('show');
$.ajax({
data: {
id: id,
type: ReqType
},
type: "POST",
url: urlval,
success: function(data) {
if (data) {
$('#content').loader('hide');
$("#AvlBudgetAmount").val(parseFloat(data).toFixed(2));
if (parseFloat($("#AvlBudgetAmount").val()) <= 0) {
$('#AlertImg').removeAttr("style");
} else {
$('#AlertImg').attr("style", "display:none;");
}
} else {
$('#content').loader('hide');
// alert("Error");
}
}
});
$('#CostCenter').change(function() {
var id = $('#CostCenter').val();
$("#AvlBudgetAmount").val('');
var ReqType = '<?php echo $strReqPOType ?>';
var urlval = '';
if (ReqType == '<?php echo IMPORT ?>') {
urlval = "<?php echo base_url() ?>servicepurchaseorder/GetAvailableImportBudgetAmount?ReqType=" + ReqType;
} else {
urlval = "<?php echo base_url() ?>serviceAvilBudgetAmount";
}
if (id != '-1') {
$('#content').loader('show');
$.ajax({
data: {
id: id,
type: ReqType
},
type: "POST",
url: urlval,
success: function(data) {
if (data != '0') {
$('#content').loader('hide');
$("#AvlBudgetAmount").val(parseFloat(data).toFixed(2));
if (parseFloat($("#AvlBudgetAmount").val()) <= 0) {
$('#AlertImg').removeAttr("style");
} else {
$('#AlertImg').attr("style", "display:none;");
}
} else {
$('#content').loader('hide');
// alert("Error");
}
}
});
} else {
alert('Please select the Employee details');
if (id == '-1') {
alert('Please select the CostCenter details');
return false;
}
@ -565,7 +470,7 @@ if (!empty($ReqPOType)) {
if (id != '-1') {
if ((converttext != 'SERVICE')) {
$('#content').loader('show');
// $('#content').loader('show');
$.ajax({
data: {
@ -575,7 +480,7 @@ if (!empty($ReqPOType)) {
type: "POST",
url: "<?php echo base_url(); ?>getMaterialDetails",
success: function(json) {
$('#content').loader('hide');
// $('#content').loader('hide');
//alert(json.MatDetail);
$("#Description").val(json.MatDetail[0]['MaterialName']);
$("#UOM").val(json.MatDetail[0]['UOM']);
@ -595,18 +500,6 @@ if (!empty($ReqPOType)) {
});
});
</script>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Quantity%></td>
<td align="left">0.00</td>
<td align="left">NEW</td>
<td><a data-target='#edit-req-modal' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#edit-req-modal"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#' onclick="DeleteRow(index)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
</script>
<script>
var index = $('#txtRowCount').val();
var userid = '';
@ -645,7 +538,7 @@ if (!empty($ReqPOType)) {
return false;
} else {
//alert(document.getElementById('Items').rows.length);
$('#content').loader('show');
// $('#content').loader('show');
$('#txtStatus').val(stat);
var serviceSchedule = '';
@ -673,7 +566,7 @@ if (!empty($ReqPOType)) {
url: "<?php echo base_url() ?>EditRequisition",
success: function(data) {
if (data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
@ -765,7 +658,7 @@ if (!empty($ReqPOType)) {
url: "<?php echo base_url() ?>DeleteRequistionForm",
success: function(data) {
if (data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
} else {
alert("Error");
@ -808,28 +701,28 @@ if (!empty($ReqPOType)) {
index = parseInt(index) + 1;
var rowHtml = `<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="left">${uom}</td>
<td align="left">${quantity}</td>
<td align="left">0.00</td>
<td align="left">NEW</td>
<td>
<a data-id="${temp}" data-userid="${temp}" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal">
<i class="ri-pencil-fill" data-toggle="tooltip" title="Click here to view/Edit the ${materialCode} Material details"></i>
&nbsp;&nbsp;&nbsp;
</a>
<a onclick="DeleteRow(${temp})" class="link" data-id="${temp}" data-userid="${temp}" id="Del">
<span class="ri-delete-bin-7-fill"></span>
</a>
</td>
</tr>
`;
var template = jQuery("#tempList").html();
if (materialdescription == '') {
$('#tempAppend').append(_.template(template, {
index: temp,
MaterialCode: materialCode,
MaterialName: materialName,
UOM: uom,
Quantity: quantity
}));
} else {
$('#tempAppend').append(_.template(template, {
index: temp,
MaterialCode: materialCode,
MaterialName: materialdescription,
UOM: uom,
Quantity: quantity
}));
}
// Append the HTML to the table body
$('#tempAppend').append(rowHtml);
var theForm = $(".requistion");
@ -897,46 +790,35 @@ if (!empty($ReqPOType)) {
e.close();
}
});
$(document).ready(function() {
$("#edit-req-modal").on("shown.bs.modal", function(e) {
var $triggerElement = $(e.relatedTarget);
var userid = $triggerElement.data('userid');
var $tr = $('#' + userid);
var $cells = $tr.find('td');
var check = $cells.eq(2).text();
var upcheck = check.toUpperCase();
var decs = $('#materialdesc' + userid).val();
if (upcheck == 'SERVICE') {
$('#EditotherDescription').show();
$('#EditotherD').val(decs)
$("#edit-req-modal").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
//alert(userid);
var tr = document.getElementById(userid);
var cellval = tr.cells;
//var desc=cellval[2].innerHTML;
var check = cellval[2].innerHTML;
var upcheck = check.toUpperCase();
// var decs= <?php echo json_encode($materialdesc, JSON_PRETTY_PRINT) ?>;
//alert(decs)
//var desc= cellval[8].innerHTML
//alert(desc)
var decs = $('#materialdesc' + userid).val();
// alert(upcheck)
if (upcheck == 'SERVICE') {
$('#EditotherDescription').show();
$('#EditotherD').val(decs)
} else {
$('#EditotherDescription').hide();
$('#EditotherD').val('')
}
//alert(x[1].innerHTML);
$('#EditMaterialCode').val(cellval[1].innerHTML);
$('#EditDescription').val(cellval[2].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditQuantity').val(cellval[4].innerHTML);
} else {
$('#EditotherDescription').hide();
$('#EditotherD').val('')
}
$('#EditMaterialCode').val($cells.eq(1).text());
$('#EditDescription').val($cells.eq(2).text());
$('#EditUOM').val($cells.eq(3).text());
$('#EditQuantity').val($cells.eq(4).text());
$('#Edituserid').val(userid);
});
});
$('.EditClick').click(function() {
var editqty = parseInt(document.getElementById('EditQuantity').value);
if (isNaN(editqty) || editqty < 1) {
@ -953,19 +835,21 @@ if (!empty($ReqPOType)) {
var editDescription = $("#EditDescription").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var edituserid = $("#Edituserid").val();
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[1].innerHTML = editMaterialCode;
cellval[2].innerHTML = editDescription;
cellval[3].innerHTML = editUOM;
cellval[4].innerHTML = editQuantity;
var tr = $('#' + edituserid);
var cells = tr.find('td');
cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription);
cells.eq(3).text(editUOM);
cells.eq(4).text(editQuantity);
$('#MaterialCode' + userid).val(editMaterialCode);
$('#Description' + userid).val(editDescription);
$('#UOM' + userid).val(editUOM);
$('#Quantity' + userid).val(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription);
$('#UOM' + edituserid).val(editUOM);
$('#Quantity' + edituserid).val(editQuantity);
$('#edit-req-modal').modal('hide');
}
@ -979,18 +863,6 @@ if (!empty($ReqPOType)) {
"ordering": false,
"info": false,
"autoWidth": true
});
});
$("#ScheduleType").change(function() {
if ($('#ScheduleType').val().trim() != 'Recurring') {
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
} else {
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
}
});
</script>

View File

@ -106,27 +106,11 @@ if (!empty($Emp)) {
$SchType[$Sch] = $Sch;
endforeach;
}
echo form_dropdown('ScheduleType', $SchType, set_value('ScheduleType'), 'id="ScheduleType"', 'class = "form-control searchabledropdown"', 'data-toggle="select2"');
?>
</div>
<div class="form-group col-md-3" id="ServicePeriodOption" style="display:none;">
<label for="ServiceOptions" class="col-form-label">Service Period Option</label>
<?php
if (!empty($ServiceOption)) {
foreach ($ServiceOption as $SerOption) :
$ServiceOptions[$SerOption->ConfigValue] = $SerOption->ConfigValue;
endforeach;
}
echo form_dropdown('ServiceOptions', $ServiceOptions, set_value('ServiceOptions'), 'id="ServiceOptions"', 'class = "form-control searchabledropdown"', 'data-toggle="select2"');
?>
</div>
<div class="form-group col-md-3" id="DisplayScheduleDiv" style="display:none;">
<label for="ServiceNo" class="col-form-label">Number of Services</label>
<?php
$data = array('name' => 'ServiceNo', 'value' => set_value('ServiceNo'), 'id' => 'ServiceNo', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);');
echo form_input($data);
echo form_dropdown('ScheduleType', $SchType, set_value('ScheduleType'), 'id="ScheduleType" class = "form-control searchabledropdown" data-toggle="select2"');
?>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
@ -146,15 +130,28 @@ if (!empty($Emp)) {
<th>Action</th>
</tr>
</thead>
<tbody id="tempAppend"></tbody>
</table>
</div> <!-- end table-responsive-->
</div>
<div class="form-row">
<input type="hidden" name="txtRowCount" id="txtRowCount" />
<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />
<!-- Available Budget Amt -->
<input type="hidden" name="AvlBudgetAmount" id="AvlBudgetAmount" />
<?php
$data = array('name' => 'ServiceNo', 'value' => set_value('ServiceNo'), 'id' => 'ServiceNo', 'class' => 'form-control num', 'onkeypress' => 'return isNumberKey(event);');
echo form_hidden($data);
?>
<div style="display:none;">
<label for="ServiceOptions" class="col-form-label">Service Period Option</label>
<?php
if (!empty($ServiceOption)) {
foreach ($ServiceOption as $SerOption) :
$ServiceOptions[$SerOption->ConfigValue] = $SerOption->ConfigValue;
endforeach;
}
echo form_dropdown('ServiceOptions', $ServiceOptions, set_value('ServiceOptions'), 'id="ServiceOptions"', 'class = "form-control searchabledropdown"', 'data-toggle="select2"');
?>
</div>
</div>
<div class="form-row float-right">
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
@ -320,6 +317,7 @@ if (!empty($Emp)) {
</div>
<div class="modal-footer">
<input type="hidden" name="Edituserid" id="Edituserid" />
<button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button>
<button type="button"
@ -334,8 +332,6 @@ if (!empty($Emp)) {
$('#otherDescription').hide();
$('#EditotherDescription').hide();
var isExceed = 0;
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 &&
@ -355,41 +351,9 @@ if (!empty($Emp)) {
$('#CostCenter').change(function() {
var id = $('#CostCenter').val();
$("#AvlBudgetAmount").val('');
var ReqType = $('#RequestType').val();
if (id != '-1' && ReqType != '-1') {
$('#content').loader('show');
$.ajax({
data: {
id: id,
type: ReqType
},
type: "POST",
url: "<?php echo base_url() ?>serviceAvilBudgetAmount",
success: function(data) {
if (data != '0') {
$('#content').loader('hide');
$("#AvlBudgetAmount").val(parseFloat(data).toFixed(2));
if (parseFloat($("#AvlBudgetAmount").val()) <= 0) {
$('#AlertImg').removeAttr("style");
isExceed = 1;
} else {
$('#AlertImg').attr("style", "display:none;");
isExceed = 0;
}
} else {
$("#AvlBudgetAmount").val(parseFloat(data).toFixed(2));
$('#content').loader('hide');
// alert("Error");
}
}
});
} else {
if (id == '-1' && ReqType == '-1') {
alert('Please select the Requistion Type');
$('#CostCenter').val("-1");
return false;
@ -397,8 +361,6 @@ if (!empty($Emp)) {
});
$('#RequestType').change(function() {
$("#AvlBudgetAmount").val('');
$('#AlertImg').attr("style", "display:none;");
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
$("#Description").val('');
@ -417,7 +379,7 @@ if (!empty($Emp)) {
var id = $('#RequestType').val();
if (id != '-1') {
$('#content').loader('show');
// $('#content').loader('show');
$.ajax({
data: {
id: id
@ -427,7 +389,7 @@ if (!empty($Emp)) {
url: "<?php echo base_url(); ?>getMaterialCode",
success: function(json) {
console.log(json);
$('#content').loader('hide');
// $('#content').loader('hide');
$("#MaterialCode").empty();
$("#MaterialCode").append(json.Material);
@ -435,8 +397,6 @@ if (!empty($Emp)) {
// $("#UOM").val(json.UOM);
if (id != 'SERVICE') {
$('#DisplayScheduleDiv').hide();
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
} else {
$('#DisplayScheduleDiv').show();
}
@ -465,7 +425,7 @@ if (!empty($Emp)) {
if (id != '-1') {
if ((checkanswer != 'SERVICE')) {
$('#content').loader('show');
// $('#content').loader('show');
$.ajax({
data: {
@ -475,7 +435,7 @@ if (!empty($Emp)) {
type: "POST",
url: "<?php echo base_url(); ?>getMaterialDetails",
success: function(json) {
$('#content').loader('hide');
// $('#content').loader('hide');
//alert(json.MatDetail);
$("#Description").val(json.MatDetail[0]['MaterialName']);
$("#UOM").val(json.MatDetail[0]['UOM']);
@ -498,7 +458,6 @@ if (!empty($Emp)) {
});
var index = '1';
var userid = '';
function removeHiddenRows(rowcount) {
var step;
@ -512,35 +471,17 @@ if (!empty($Emp)) {
$("#UOM" + step).remove();
$("#Quantity" + step).remove();
index = '1';
userid = '';
}
}
}
</script>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
<td align="left"><%=index%></td>
<td align="left"><%=MaterialCode%></td>
<td align="left"><%=MaterialName%></td>
<td align="left"><%=UOM%></td>
<td align="left"><%=Quantity%></td>
<td>
<a class="a_tag_link" data-target='#edit-req-modal' data-id="<%=index%>" data-userid="<%=index%>" data-toggle="modal" href="#edit-req-modal"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the <%=MaterialCode%> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a class="a_tag_link" href='#' onclick="Deleterow(index)" class="link" data-id="<%=index%>" data-userid="<%=index%>" id="Del"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</script>
<script>
function validateBeforeAdd() {
// var isChecked = $('#IsOpenOrder').is(':checked');
// isChecked ? $('#Quantity').val(0).prop('readonly', true).prop('required', false)
// : $('#Quantity').val('').prop('readonly', false).prop('required', true);
if ($("option:selected", $("#RequestType")).val() == '-1') {
if ($("#RequestType").val() == '-1') {
alert('Please select the Request Type ');
$("#RequestType").focus();
return false;
@ -548,13 +489,7 @@ if (!empty($Emp)) {
alert('Please select the Cost center');
$("#CostCenter").focus();
return false;
}
// else if( isExceed == '1')
// {
// alert('You dont have available Budget Amount. You cant raise new Requisition');
// return false;
// }
else {
} else {
$('#add-req-modal').modal('show');
$('#otherDescription').hide();
}
@ -589,14 +524,14 @@ if (!empty($Emp)) {
var servicePeriod = '';
noOfService = '';
}
$('#content').loader('show');
// $('#content').loader('show');
$.ajax({
type: "POST",
data: $('.requistion').serialize() + "&serviceSchedule=" + serviceSchedule + "&servicePeriod=" + servicePeriod + "&noOfService=" + noOfService + "&ID=" + id,
url: "<?php echo base_url() ?>addNewRequisition",
success: function(data) {
if (data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
@ -626,13 +561,7 @@ if (!empty($Emp)) {
} else if ($("#txtRowCount").val().length < 1) {
alert('Please Add Line Item');
return false;
}
// else if(isExceed == 1)
// {
// alert('You dont have Budget and You cant Raise New Requisition');
// return false;
// }
else {
} else {
return true;
}
@ -680,7 +609,6 @@ if (!empty($Emp)) {
var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val();
//alert(materialdescription)
$('#MaterialCode option[value=' + materialCode + ']').remove();
@ -692,26 +620,31 @@ if (!empty($Emp)) {
index = parseInt(index) + 1;
var template = jQuery("#tempList").html();
var rowHtml = `<tr id="${temp}">
<td align="left">${temp}</td>
<td align="left">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="left">${uom}</td>
<td align="left">${quantity}</td>
<td>
<a
data-id="${temp}"
data-userid="${temp}"
data-toggle="modal"
href="#edit-req-modal"
class="edit-modal-trigger">
<i class="ri-pencil-fill" data-toggle="tooltip" title="Click here to view/Edit the ${materialCode} Material details"></i>
</a>
&nbsp;&nbsp;&nbsp;
<a href='#' onclick="Deleterow(${temp})" class="link" data-id="${temp}" data-userid="${temp}" id="Del">
<span class="ri-delete-bin-7-fill"></span>
</a>
</td>
</tr>
`;
if (materialdescription == '') {
$('#tempAppend').append(_.template(template, {
index: temp,
MaterialCode: materialCode,
MaterialName: materialName,
UOM: uom,
Quantity: quantity
}));
} else {
$('#tempAppend').append(_.template(template, {
index: temp,
MaterialCode: materialCode,
MaterialName: materialdescription,
UOM: uom,
Quantity: quantity
}));
}
// Append the HTML to the table body
$('#tempAppend').append(rowHtml);
var theForm = $(".requistion");
@ -723,9 +656,7 @@ if (!empty($Emp)) {
$('#txtRowCount').val(temp);
$('#add-req-modal').modal('hide');
toastr.success('Line Item Added!', 'Success');
// toastr.success('Line Item Added!', 'Success');
}
});
@ -752,19 +683,20 @@ if (!empty($Emp)) {
});
</script>
<script>
$("#edit-req-modal").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
// alert(userid);
var tr = document.getElementById(userid);
var cellval = tr.cells;
//alert(x[1].innerHTML);
$('#EditMaterialCode').val(cellval[1].innerHTML);
$('#EditDescription').val(cellval[2].innerHTML);
$('#EditUOM').val(cellval[3].innerHTML);
$('#EditQuantity').val(cellval[4].innerHTML);
$(document).ready(function() {
$("#edit-req-modal").on("shown.bs.modal", function(e) {
var $triggerElement = $(e.relatedTarget);
var userid = $triggerElement.data('userid');
var $tr = $('#' + userid);
var $cells = $tr.find('td');
$('#EditMaterialCode').val($cells.eq(1).text());
$('#EditDescription').val($cells.eq(2).text());
$('#EditUOM').val($cells.eq(3).text());
$('#EditQuantity').val($cells.eq(4).text());
$('#Edituserid').val(userid);
});
});
</script>
<script>
$('.EditClick').click(function() {
var editqty = parseInt(document.getElementById('EditQuantity').value);
if (isNaN(editqty) || editqty < 1) {
@ -773,28 +705,28 @@ if (!empty($Emp)) {
return false;
}
if ($('#EditQuantity').val() != '') {
var edituserid = $("#Edituserid").val();
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditDescription").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[1].innerHTML = editMaterialCode;
cellval[2].innerHTML = editDescription;
cellval[3].innerHTML = editUOM;
cellval[4].innerHTML = editQuantity;
var tr = $('#' + edituserid);
var cells = tr.find('td');
cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription);
cells.eq(3).text(editUOM);
cells.eq(4).text(editQuantity);
$('#MaterialCode' + userid).val(editMaterialCode);
$('#Description' + userid).val(editDescription);
$('#UOM' + userid).val(editUOM);
$('#Quantity' + userid).val(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription);
$('#UOM' + edituserid).val(editUOM);
$('#Quantity' + edituserid).val(editQuantity);
$('#edit-req-modal').modal('hide');
toastr.success('Line Item Updated!', 'Success');
// toastr.success('Line Item Updated!', 'Success');
}
});
@ -831,14 +763,14 @@ if (!empty($Emp)) {
var servicePeriod = '';
var noOfService = '';
}
$('#content').loader('show');
// $('#content').loader('show');
$.ajax({
data: $('.requistion').serialize() + "&serviceSchedule=" + serviceSchedule + "&servicePeriod=" + servicePeriod + "&noOfService=" + noOfService + "&ID=" + id,
type: "POST",
url: "<?php echo base_url() ?>addNewRequisition",
success: function(data) {
if (data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
@ -874,12 +806,8 @@ if (!empty($Emp)) {
<script>
$("#ScheduleType").change(function() {
if ($('#ScheduleType').val().trim() != 'Recurring') {
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
$('#ServiceNo').val('');
} else {
$('#ServicePeriodOption').hide();
$('#NoServices').hide();
$('#ServiceNo').val(1);
}

View File

@ -87,28 +87,18 @@ span.highlight {
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Requisition Listing</h4>
<?php if($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?>
<?php if($DraftCount > 0 ) {?>
<p><span class="highlight">The Requisition No <b><?php echo $ReqNo;?></b> is in Draft
status.</span> Please act on the requisition.<span class="highlight">Then only you can raise
New Requisition. </span></p>
<?php } ?>
</div>
</div>
</div>
<?php if($DraftCount > 0 ) {?><p style="text-align: center;">
<span class="highlight">The Requisition No <b><?php echo $ReqNo;?></b> is in Draft
status.</span> Please act on the requisition.<span class="highlight">Then only you can raise
New Requisition. </span>
</p> <?php } ?>
<div class="row" style="margin-top: -63px;">
<div class="col-md-12 text-left">
<div class="form-group row">
<div class="col-md-3"></div>
<div class="col-md-5 text-right"></div>
<div class="col-md-4 text-right">
<?php if($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">