437 lines
13 KiB
PHP
Executable File
437 lines
13 KiB
PHP
Executable File
<script>
|
||
//window.onload=al();
|
||
function al()
|
||
{
|
||
alert($('#Configid').val());
|
||
}
|
||
</script>
|
||
<?php
|
||
|
||
$Configid = '';
|
||
$ConfigName = '';
|
||
$Comments = '';
|
||
$ConfigValue ='';
|
||
$Key = '';
|
||
|
||
|
||
if(!empty($master))
|
||
{
|
||
foreach ($master as $con)
|
||
{
|
||
//print_r($config);die();
|
||
$Configid= $con->Config_ID;
|
||
|
||
$ConfigName = $con->ConfigName;
|
||
$Comments = $con->Comments;
|
||
//$ConfigValue = $con->ConfigValue;
|
||
|
||
}
|
||
}
|
||
|
||
if(!empty($master))
|
||
{
|
||
foreach ($child as $con)
|
||
{
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
?>
|
||
|
||
|
||
|
||
<style>
|
||
|
||
.ui-datepicker-month {
|
||
display: none;
|
||
}
|
||
.ui-datepicker-prev{
|
||
display: none;
|
||
}
|
||
.ui-datepicker-next{
|
||
display: none;
|
||
}
|
||
</style>
|
||
<div class="content-wrapper" style="min-height: 537px;">
|
||
<!-- Content Header (Page header) -->
|
||
<section class="content-header">
|
||
<h1>
|
||
<center>Siddharth Industries - Edit Config Details</center>
|
||
|
||
</h1>
|
||
|
||
</section>
|
||
|
||
<section class="content">
|
||
<div style="text-align:right;">
|
||
<a href="<?php echo base_url() ?>configlisting" class="btn btn-primary" value="Back">Back</a>
|
||
</div>
|
||
<br>
|
||
|
||
<div class="row">
|
||
<!-- left column -->
|
||
<div class="col-md-12">
|
||
|
||
|
||
|
||
<div class="box box-primary">
|
||
|
||
<!-- form start -->
|
||
<?php
|
||
$attributes = array('class' => 'form-label-left EditConfig ','name' => 'EditConfig','id' => 'EditConfig');
|
||
|
||
echo form_open($this->config->base_url().'configedit/',$attributes); ?>
|
||
|
||
<div class="box-body">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="CostName">Configuration ID </label><font color="Red">*</font>
|
||
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'Configid','value' => set_value('Configid',$Configid),'id'=>'Configid', 'class' => 'form-control' ,'required' => 'true','readonly'=>'true','onclick'=>'al();');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="Description">Configuration Name</label><font color="Red">*</font>
|
||
<div class="form-group" >
|
||
<?php
|
||
$data = array('name' => 'ConfigName','value' => set_value('ConfigName',$ConfigName),'id'=>'CostName', 'class' => 'form-control' ,'required' => 'true','maxlength'=>'20');//'style'=>'text-transform:uppercase;'
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-3">
|
||
<div class="form-group">
|
||
<label for="Description">Comments</label><font color="Red">*</font>
|
||
<div class="form-group">
|
||
<?php
|
||
$data = array('name' => 'Remarks','value' => set_value('Remarks',$Comments),'id'=>'CostName', 'class' => 'form-control' ,'required' => 'true','maxlength'=>'20');
|
||
echo form_input($data);
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
<br>
|
||
|
||
|
||
<!-- Modal Footer -->
|
||
|
||
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="table-responsive">
|
||
<table id="configtable" class="table table-striped responsive-utilities jambo_table" >
|
||
<thead style="background-color: #CFCFCF;">
|
||
|
||
<th>S.NO</th>
|
||
|
||
<th>Config Value</th>
|
||
<th>Action</th>
|
||
</thead>
|
||
<tbody id="tempAppend">
|
||
<?php if(!empty($master && $child))
|
||
{
|
||
$index =0;
|
||
foreach ($child as $con)
|
||
|
||
|
||
{
|
||
?>
|
||
<?php $index=$index+1;?>
|
||
<input type="hidden" name ="Key<?php echo $index?>" id="<?php echo $index?>" value="<?php echo $index?>">
|
||
<input type="hidden" name ="DbKey<?php echo $index?>" id="DbKey<?php echo $index?>" value="<?php echo $con->Key?>">
|
||
<input type="hidden" name ="configID<?php echo $index?>" id="configID<?php echo $index?>" value="<?php echo $con->Config_ID?>">
|
||
<input type="hidden" name ="configVal<?php echo $index?>" id="configVal<?php echo $index?>" value="<?php echo $con->ConfigValue?>">
|
||
|
||
|
||
<tr><td><?php echo $index;?></td><td><?php echo $con->ConfigValue;?></td><td><a data-target='#Edit' data-id="<?php echo $index;?>" data-userid="<?php echo $index;?>" data-toggle="modal" href="#Edit"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the Budget details"></i> </a></td></tr>
|
||
<?php
|
||
}
|
||
}
|
||
|
||
?>
|
||
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index ?>" />
|
||
|
||
</tbody>
|
||
|
||
|
||
</table>
|
||
|
||
<!-- Modal For edit -->
|
||
|
||
|
||
|
||
|
||
|
||
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<!-- Modal Header -->
|
||
<div class="modal-header">
|
||
<button type="button" class="close"
|
||
data-dismiss="modal">
|
||
<span aria-hidden="true">×</span>
|
||
<span class="sr-only">Close</span>
|
||
</button>
|
||
<h4 class="modal-title" id="myModalLabel">
|
||
<center> Edit Config</center>
|
||
</h4>
|
||
</div>
|
||
<!-- Modal Body -->
|
||
<div class="modal-body">
|
||
|
||
<form class="form-horizontal" role="form">
|
||
<div class="form-group">
|
||
<div class="row">
|
||
<div class="col-md-3 col-md-offset-2">
|
||
S.NO :
|
||
</div>
|
||
<div class="col-md-5">
|
||
<?php
|
||
$data = array('name' => 'key', 'value' => set_value('key'),'id'=>'key', 'class' => 'form-control','readonly'=>'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<div class="row">
|
||
<div class="col-md-3 col-md-offset-2">
|
||
Config ID :
|
||
</div>
|
||
<div class="col-md-5">
|
||
<?php
|
||
$data = array('name' => 'Config_ID', 'value' => set_value('Config_ID'),'id'=>'Config_ID', 'class' => 'form-control','readonly'=>'true');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<div class="row">
|
||
<div class="col-md-3 col-md-offset-2">
|
||
Config Value :
|
||
</div>
|
||
<div class="col-md-5">
|
||
<?php
|
||
$data = array('name' => 'ConfigValue', 'value' => set_value('ConfigValue'),'id'=>'ConfigValue', 'class' => 'form-control');
|
||
echo form_input($data);
|
||
?>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</form>
|
||
</div>
|
||
<!-- Modal Footer -->
|
||
<div class="modal-footer">
|
||
<a class="btn btn-primary font tempClickEdit" ID="tempClickEdit" style="margin-top: -24px;"><i class="fa fa-plus"></i> <span class="bold">Update</span></a>
|
||
<a class="btn btn-primary" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">cancel</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="box-footer" style="text-align:right">
|
||
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment" />
|
||
<input type="submit" class="btn btn-primary" value="Update" />
|
||
<a href="<?php echo base_url() ?>configlisting" class="btn btn-primary" id="cancel" value="Cancel">Cancel</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<div class="col-md-4">
|
||
<?php
|
||
$this->load->helper('form');
|
||
$error = $this->session->flashdata('error');
|
||
if($error)
|
||
{
|
||
?>
|
||
<div class="alert alert-danger alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo $this->session->flashdata('error'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
<?php
|
||
$success = $this->session->flashdata('success');
|
||
if($success)
|
||
{
|
||
?>
|
||
<div class="alert alert-success alert-dismissable">
|
||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||
<?php echo $this->session->flashdata('success'); ?>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<?php echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
|
||
|
||
|
||
<script>
|
||
var index = $('#txtRowCount').val();
|
||
var userid = '';
|
||
|
||
$("#Edit").on("shown.bs.modal", function(e) {
|
||
userid = $(e.relatedTarget).data('userid');
|
||
//alert(userid);
|
||
$('#key').val($('#configtable tr:eq('+ userid +') td:eq(0)').text());
|
||
//$('#Config_ID').val($('#configtable tr:eq('+ userid +') td:eq(2)').text());
|
||
//alert($('#Configid').val());
|
||
$('#Config_ID').val($('#Configid').val());
|
||
$('#ConfigValue').val($('#configtable tr:eq('+ userid +') td:eq(1)').text());
|
||
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
function addHidden(theForm, key, value) {
|
||
// Create a hidden input element, and append it to the form:
|
||
var input = document.createElement('input');
|
||
input.type = 'hidden';
|
||
input.name = key;'name-as-seen-at-the-server';
|
||
input.value = value;
|
||
theForm.append(input);
|
||
}
|
||
|
||
|
||
$('.tempClickEdit').click(function()
|
||
{
|
||
if ( $('#Config_ID').val() != '' && $('#ConfigValue').val() != '' )
|
||
{
|
||
|
||
var temp = index;
|
||
|
||
var ConfigID = $("#Config_ID").val();
|
||
var ConfigValue = $("#ConfigValue").val();
|
||
//alert(ConfigValue);
|
||
$('#configVal'+userid).val(ConfigValue);
|
||
// $('#configtable tr:eq('+ userid +') td:eq(1)').text(ConfigID);
|
||
$('#configtable tr:eq('+ userid +') td:eq(1)').text(ConfigValue);
|
||
//$('#configtable tr:eq('+ userid +') td:eq(3)').text(BudRemarks);
|
||
|
||
$('#Config_ID'+userid).val(ConfigID);
|
||
$('#ConfigValue'+userid).val(ConfigValue);
|
||
|
||
}
|
||
else
|
||
{
|
||
// alert('Please enter all the values');
|
||
|
||
}
|
||
|
||
});
|
||
|
||
|
||
|
||
function ConfirmDelete()
|
||
{
|
||
var x = confirm("Are you sure you want to delete?");
|
||
if (x)
|
||
return true;
|
||
else
|
||
return false;
|
||
}
|
||
|
||
function isNumberKey(evt)
|
||
{
|
||
var charCode = (evt.which) ? evt.which : evt.keyCode;
|
||
if (charCode != 46 && charCode > 31
|
||
&& (charCode < 48 || charCode > 57))
|
||
return false;
|
||
|
||
return true;
|
||
}
|
||
</script>
|
||
|
||
<script>
|
||
|
||
|
||
|
||
|
||
//var baseurl = "<?php print base_url(); ?>";
|
||
$(".EditConfig").submit(function(e)
|
||
{
|
||
if(validate())
|
||
{
|
||
|
||
$('#content').loader('show');
|
||
$.ajax({
|
||
data:$('.EditConfig').serialize(),
|
||
type:'POST',
|
||
url:"<?php echo base_url(); ?>configurationctrl/configedit",
|
||
success:function(data) {
|
||
//alert(data);
|
||
if(data)
|
||
{
|
||
$('#content').loader('hide');
|
||
//alert(data);
|
||
$('#txtSelectedDepartment').val('');
|
||
$('#txtRowCount').val('');
|
||
|
||
//window.location = baseurl + 'CostCenter/CostListing';
|
||
|
||
}
|
||
|
||
}
|
||
});
|
||
//$('#content').loader('hide');
|
||
}
|
||
|
||
});
|
||
|
||
|
||
function validate()
|
||
{
|
||
if($("option:selected", $("#ApprovedBy")).val() == '-1')
|
||
{
|
||
alert('Please Select Approver Names');
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
return true;
|
||
}
|
||
|
||
}
|
||
</script>
|
||
|