817 lines
30 KiB
PHP
817 lines
30 KiB
PHP
<?php include('log_entry.php');
|
|
include('includes/config/config.php'); ?>
|
|
<?php
|
|
$i = 0;
|
|
$sql = "select a.item_id,a.unit_id,a.item_name,a.reorder_store_level,a.min_store_level,a.indent_percent_reorderlevel,sum(i.stock_qty) as item_stock_qty
|
|
from tbl_items a left join item_stock i on a.item_id = i.item_id
|
|
group by a.item_id having sum(i.stock_qty)<= a.reorder_store_level";
|
|
$result = mysqli_query($conn, $sql);
|
|
error_log("INDENT STOCK QUERY::" . $sql);
|
|
if (isset($_REQUEST['flex_indent_id'])) {
|
|
$sql = "select indent_master.indent_id, indent_master.indent_date,indent_master.remarks from indent_master where indent_master.indent_id='" . $_REQUEST['flex_indent_id'] . "'";
|
|
//echo "query:".$sql;
|
|
error_log("sql indent " . $sql);
|
|
$result = mysqli_query($conn, $sql);
|
|
$num_rows = @mysqli_num_rows($result);
|
|
$row = null;
|
|
if ($num_rows > 0) {
|
|
$row = @mysqli_fetch_array($result);
|
|
$row['mrp-gst']=$row['mrp']-(($row['mrp']*$row['gst'])/100);
|
|
$row['discount_rate']=($row['mrp-gst']*$row['discount']/100);
|
|
}
|
|
}
|
|
?>
|
|
<div class="modal fade" id="modal-indent-status" name="modal-indent-status" role="dialog" aria-hidden="true">
|
|
<form role="form" id="indent_status_form" name="indent_status_form" action="item_rate.php" method="post">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="widget-header">
|
|
<h5 class="widget-title">Change Rate</h5>
|
|
<div class="widget-toolbar">
|
|
<div class="widget-menu">
|
|
<a href="#" class="close" data-action="close" data-dismiss="modal">
|
|
<i class="ace-icon fa fa-times"></i>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal-body">
|
|
<div class="row" style="display:none" id="remarks_div">
|
|
<div class="col-sm-5">
|
|
<div class="form-group">
|
|
|
|
<label>Rate Change Date</label>
|
|
|
|
<div class="input-group date">
|
|
<div class="input-group-addon">
|
|
<i class="fa fa-calendar"></i>
|
|
</div>
|
|
<input class="form-control date-picker" name="indent_date0" id="indent_date0"
|
|
type="text"
|
|
value="<?php echo date_format(date_create($row['indent_date']), "d/m/Y") ?>"
|
|
data-date-format="dd/mm/yyyy" />
|
|
</div>
|
|
<!-- /.input group -->
|
|
</div>
|
|
|
|
<!-- <div class="form-group">
|
|
|
|
<label>Indent Reference No.</label>
|
|
|
|
<div class="input-group date">
|
|
|
|
<input class="form-control" name="indent_ref_no0" id="indent_ref_no0" type="text" value="<?php echo $row['indent_ref_no'] ?>" />
|
|
</div>
|
|
|
|
</div> -->
|
|
</div>
|
|
|
|
<div class="form-group col-sm-6">
|
|
<label>Remarks</label>
|
|
<textarea name="remarks" id="remarks" rows="3" class="autosize-transition form-control"
|
|
style="overflow: hidden; overflow-wrap: break-word; resize: horizontal; height: 49px;"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class='row' align='center'>
|
|
<select style="width:50%;border:none" disabled class="form-control" id="item_id" name="item_id"
|
|
data-placeholder="Item...">
|
|
<option value="" selected disabled> please select Item</option>
|
|
<strong><?php echo generateOption('tbl_items','item_name','item_id','','');
|
|
?></strong>
|
|
</select>
|
|
</div>
|
|
<table id="myTable" class="table table-bordered table-hover order-list">
|
|
<thead class="thin-border-bottom">
|
|
<tr>
|
|
<th style="display:none"><i class="ace-icon fa fa-caret-right blue"></i>Item Name</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>MRP</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>GST(%)</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>MRP-GST</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Discount(%)</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Discount Price</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Price Without GST</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Final Price With GST
|
|
</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Unit
|
|
</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Per Unit Rate
|
|
</th>
|
|
<th><i class="ace-icon fa fa-caret-right blue"></i>Vendor
|
|
</th>
|
|
|
|
<th style="display:none" id='new_id_th'><i
|
|
class="ace-icon fa fa-caret-right blue"></i>Enter New Rate</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody id="tbody">
|
|
|
|
<tr id="main-form">
|
|
|
|
<td style="width:30%;display:none ">
|
|
<input type="hidden" name="id" id="id" value="<?php echo $row['id']?>" />
|
|
<input type="hidden" name="rateTr" id="rateTr" value="" />
|
|
<select style="width:100%;" class="form-control" id="item_id" name="item_id"
|
|
data-placeholder="Item...">
|
|
<option value="" selected disabled> please select Item</option>
|
|
<?php echo generateOption('tbl_items','item_name','item_id','','');
|
|
?>
|
|
</select>
|
|
</td>
|
|
<td style="width:8%">
|
|
<input type="number" style="width:100%" name="mrp" value="<?php echo $row['mrp']?>"
|
|
id="mrp" maxlength="50" class="form-control"
|
|
onchange="getMrpGst();getDiscountRate();perUnitPrice()" />
|
|
|
|
</td>
|
|
<td style="width:8%">
|
|
<input type="number" style="width:90%" name="gst" value="<?php echo $row['gst']?>"
|
|
onchange="getMrpGst();perUnitPrice()" id="gst" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
|
|
<td style="width:10%">
|
|
<input type="number" style="width:100%" name="mrp-gst" disabled
|
|
value="<?php echo $row['mrp-gst']?>" id="mrp-gst" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
|
|
<td style="width:8%">
|
|
<input type="number" style="width:100%" name="discount"
|
|
onchange="getDiscountRate();perUnitPrice()"
|
|
value="<?php echo $row['discount']?>" id="discount" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
|
|
<td style="width:10%">
|
|
<input type="number" style="width:100%" name="discount_price" disabled
|
|
value="<?php echo $row['discount_price']?>" id="discount_price" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
<td style="width:10%">
|
|
<input type="text" disabled style="width:100%" name="net_value-gst"
|
|
value="<?php echo $row['net_value-gst']?>" id="net_value-gst" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
<td style="width:10%">
|
|
<input type="text" style="width:100%" name="net_value"
|
|
value="<?php echo $row['net_value']?>" id="net_value" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
<td style="width:10%">
|
|
<input type="number" style="width:100%" name="stock_qty" onchange="perUnitPrice()"
|
|
value="<?php echo $row['qty']?>" id="stock_qty" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
<td style="width:10%">
|
|
<input type="number" disabled style="width:100%" name="per_unit_rate"
|
|
value="<?php echo $row['per_unit_rate']?>" id="per_unit_rate" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
|
|
<td style="width:10%">
|
|
<select style="width:100%" name="vendor" value="<?php echo $row['vendor_code']?>"
|
|
id="vendor" class="form-control">
|
|
<option value="" selected disabled> please select Item</option>
|
|
<?php echo generateOption('employer_contractor', 'employer_contractor_name', 'id', '', ''); ?>
|
|
</select>
|
|
|
|
|
|
</td>
|
|
|
|
<td style="width:10%;display:none" id='new_id_td'>
|
|
<input type="text" style="width:100%" name="new_rate"
|
|
value="<?php echo $row['new_rate']?>" id="new_rate" maxlength="50"
|
|
class="form-control" />
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
</tbody>
|
|
<tfoot>
|
|
<!-- <tr style="margin-left:10px;">
|
|
<td colspan="6">
|
|
<input type="button" class="btn btn-sm btn-block " id="addrow" value="Add Row" />
|
|
<input type="hidden" name="count_items" id="count_items" value="<?php echo $i ?>" />
|
|
</td>
|
|
|
|
</tr> -->
|
|
<tr>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="widget-toolbox padding-8 clearfix">
|
|
<button type="button" class="btn btn-info btn-sm save_button" id="save_button"
|
|
onclick="validate();"><i class="ace-icon fa fa-floppy-o bigger-110"></i>Save </button>
|
|
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal"><i
|
|
class="ace-icon fa fa-times bigger-110"></i>Cancel</button>
|
|
<!-- <button type="button" id="approval_button" class="btn btn-info btn-sm save_button"
|
|
onclick="approval1();"><i class="ace-icon fa fa-floppy-o bigger-110"></i>Send for
|
|
Approval</button> -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
function getDiscountRate() {
|
|
var mrp = $('#mrp-gst').val();
|
|
var discount = $('#discount').val();
|
|
var discount_price = (mrp * discount) / 100;
|
|
discount_price = discount_price.toFixed(2);
|
|
$('#discount_price').val(discount_price);
|
|
totalRate();
|
|
}
|
|
|
|
function totalRate() {
|
|
var mrp = $('#mrp').val();
|
|
var mrp_gst = $('#mrp-gst').val();
|
|
var rateTr = $('#rateTr').val();
|
|
var discount = $('#discount_price').val();
|
|
var totalRate = mrp - discount;
|
|
// alert('#' + rateTr);
|
|
$('#' + rateTr).val(totalRate);
|
|
|
|
var totalRateWithoutGst = mrp_gst - discount;
|
|
// alert('#' + rateTr);
|
|
$('#net_value-gst').val(totalRateWithoutGst);
|
|
perUnitPrice();
|
|
}
|
|
|
|
function perUnitPrice() {
|
|
var rateTr = $('#rateTr').val();
|
|
var mrp = $('#' + rateTr).val();
|
|
var unit = $('#stock_qty').val();
|
|
// alert(unit);
|
|
var per_unit_rate = (mrp / unit);
|
|
// alert(per_unit_rate);
|
|
per_unit_rate = per_unit_rate.toFixed(2);
|
|
$('#per_unit_rate').val(per_unit_rate);
|
|
}
|
|
|
|
function getMrpGst() {
|
|
var mrp = $('#mrp').val();
|
|
var gst = $('#gst').val();
|
|
|
|
var MrpGst = mrp / ((gst / 100) + 1);
|
|
MrpGst = MrpGst.toFixed(2);
|
|
$('#mrp-gst').val(MrpGst);
|
|
getDiscountRate()
|
|
totalRate();
|
|
}
|
|
|
|
function approval1() {
|
|
var id = document.getElementById('indent_id0').value;
|
|
// alert(id);
|
|
approval(id);
|
|
}
|
|
</script>
|
|
<style>
|
|
#modal-indent-status {
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<script type="text/javascript">
|
|
$('.select2').select2()
|
|
jQuery(function($) {
|
|
|
|
var myTable =
|
|
$('#dynamic-table')
|
|
|
|
.DataTable({
|
|
bAutoWidth: false,
|
|
"aoColumns": [{
|
|
"bSortable": false
|
|
},
|
|
null, null, null, null, null,
|
|
{
|
|
"bSortable": false
|
|
}
|
|
],
|
|
"aaSorting": [],
|
|
|
|
|
|
|
|
|
|
|
|
select: {
|
|
style: 'multi'
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
var defaultCopyAction = myTable.button(1).action();
|
|
myTable.button(1).action(function(e, dt, button, config) {
|
|
defaultCopyAction(e, dt, button, config);
|
|
$('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white');
|
|
});
|
|
|
|
|
|
var defaultColvisAction = myTable.button(0).action();
|
|
myTable.button(0).action(function(e, dt, button, config) {
|
|
|
|
defaultColvisAction(e, dt, button, config);
|
|
|
|
|
|
if ($('.dt-button-collection > .dropdown-menu').length == 0) {
|
|
$('.dt-button-collection')
|
|
.wrapInner('<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />')
|
|
.find('a').attr('href', '#').wrap("<li />")
|
|
}
|
|
$('.dt-button-collection').appendTo('.tableTools-container .dt-buttons')
|
|
});
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
$($('.tableTools-container')).find('a.dt-button').each(function() {
|
|
var div = $(this).find(' > div').first();
|
|
if (div.length == 1) div.tooltip({
|
|
container: 'body',
|
|
title: div.parent().text()
|
|
});
|
|
else $(this).tooltip({
|
|
container: 'body',
|
|
title: $(this).text()
|
|
});
|
|
});
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
|
|
myTable.on('select', function(e, dt, type, index) {
|
|
if (type === 'row') {
|
|
$(myTable.row(index).node()).find('input:checkbox').prop('checked', true);
|
|
}
|
|
});
|
|
myTable.on('deselect', function(e, dt, type, index) {
|
|
if (type === 'row') {
|
|
$(myTable.row(index).node()).find('input:checkbox').prop('checked', false);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
$('th input[type=checkbox], td input[type=checkbox]').prop('checked', false);
|
|
|
|
|
|
$('#dynamic-table > thead > tr > th input[type=checkbox], #dynamic-table_wrapper input[type=checkbox]').eq(
|
|
0).on('click', function() {
|
|
var th_checked = this.checked;
|
|
|
|
$('#dynamic-table').find('tbody > tr').each(function() {
|
|
var row = this;
|
|
if (th_checked) myTable.row(row).select();
|
|
else myTable.row(row).deselect();
|
|
});
|
|
});
|
|
|
|
|
|
$('#dynamic-table').on('click', 'td input[type=checkbox]', function() {
|
|
var row = $(this).closest('tr').get(0);
|
|
if (this.checked) myTable.row(row).deselect();
|
|
else myTable.row(row).select();
|
|
});
|
|
|
|
|
|
|
|
$(document).on('click', '#dynamic-table .dropdown-toggle', function(e) {
|
|
e.stopImmediatePropagation();
|
|
e.stopPropagation();
|
|
e.preventDefault();
|
|
});
|
|
|
|
|
|
|
|
|
|
var active_class = 'active';
|
|
$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function() {
|
|
var th_checked = this.checked;
|
|
|
|
$(this).closest('table').find('tbody > tr').each(function() {
|
|
var row = this;
|
|
if (th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0)
|
|
.prop('checked', true);
|
|
else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop(
|
|
'checked', false);
|
|
});
|
|
});
|
|
|
|
$('#simple-table').on('click', 'td input[type=checkbox]', function() {
|
|
var $row = $(this).closest('tr');
|
|
if ($row.is('.detail-row ')) return;
|
|
if (this.checked) $row.addClass(active_class);
|
|
else $row.removeClass(active_class);
|
|
});
|
|
|
|
|
|
|
|
|
|
$('[data-rel="tooltip"]').tooltip({
|
|
placement: tooltip_placement
|
|
});
|
|
|
|
|
|
function tooltip_placement(context, source) {
|
|
var $source = $(source);
|
|
var $parent = $source.closest('table')
|
|
var off1 = $parent.offset();
|
|
var w1 = $parent.width();
|
|
|
|
var off2 = $source.offset();
|
|
|
|
|
|
if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
|
|
return 'left';
|
|
}
|
|
|
|
|
|
|
|
|
|
/***************/
|
|
$('.show-details-btn').on('click', function(e) {
|
|
e.preventDefault();
|
|
$(this).closest('tr').next().toggleClass('open');
|
|
$(this).find(ace.vars['.icon']).toggleClass('fa-angle-double-down').toggleClass(
|
|
'fa-angle-double-up');
|
|
});
|
|
/***************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
function cal_discount(counter) {
|
|
|
|
var mrp = $('#mrp' + counter).val();
|
|
var dis = $('#discount' + counter).val();
|
|
|
|
var net_value = mrp - (dis / 100) * mrp;
|
|
|
|
$('#net_value' + counter).val(net_value);
|
|
}
|
|
|
|
function approval(flex_indent_id) {
|
|
let status = "PENDING";
|
|
$.ajax({
|
|
url: 'save_app_indent.php ',
|
|
type: "POST",
|
|
data: {
|
|
status: status,
|
|
indent_id: flex_indent_id
|
|
},
|
|
success: function(data) {
|
|
BootstrapDialog.show({
|
|
title: 'Information',
|
|
message: 'Indent Sent Successfully.',
|
|
buttons: [{
|
|
label: 'OK',
|
|
action: function(dialog) {
|
|
location.href = "indent_form.php";
|
|
}
|
|
}]
|
|
});
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error in Sending.Try Again');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
format: 'dd/mm/yyyy'
|
|
}).next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
});
|
|
</script>
|
|
<!-- bootstrap & fontawesome -->
|
|
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
|
|
<!-- page specific plugin styles -->
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|
<link rel="stylesheet" href="assets/css/chosen.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
|
|
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script src="assets/js/chosen.jquery.min.js"></script>
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-timepicker.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.min.js"></script>
|
|
<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
|
|
<script src="assets/js/dataTables.buttons.min.js"></script>
|
|
<script src="assets/js/buttons.flash.min.js"></script>
|
|
<script src="assets/js/buttons.html5.min.js"></script>
|
|
<script src="assets/js/buttons.print.min.js"></script>
|
|
<script src="assets/js/buttons.colVis.min.js"></script>
|
|
<script src="assets/js/dataTables.select.min.js"></script>
|
|
<script src="assets/js/moment.min.js"></script>
|
|
<script src="assets/js/daterangepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
|
|
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
|
|
<script src="assets/js/jquery.knob.min.js"></script>
|
|
<script src="assets/js/autosize.min.js"></script>
|
|
<script src="assets/js/jquery.inputlimiter.min.js"></script>
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|
<script src="assets/js/bootstrap-tag.min.js"></script>
|
|
<script src="assets/js/ace-elements.min.js"></script>
|
|
<script type="text/javascript">
|
|
function GetDetail(item_id, count) {
|
|
//alert(item_id+""+count);
|
|
$.ajax({
|
|
url: "gen_indent.php",
|
|
type: "POST",
|
|
dataType: 'json',
|
|
async: false,
|
|
data: {
|
|
item_id: item_id
|
|
},
|
|
success: function(data) {
|
|
$("#itm_stk" + count).val(data.item_stock_qty);
|
|
$("#reorder_level" + count).val(data.reorder_store_level);
|
|
var indent = getIndent(data.indent_percent_reorderlevel, count);
|
|
$("#indent_qty" + count).val(indent);
|
|
$("#child_item_unit" + count).val(data.unit_name);
|
|
},
|
|
error: function(data) {}
|
|
});
|
|
}
|
|
|
|
function getIndent(indent_percent, count) {
|
|
var current = document.getElementById("itm_stk" + count).value;
|
|
|
|
var ind = indent_percent / 100 * current;
|
|
return ind;
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var counter = $("#count_items").val();
|
|
var itemOptions =
|
|
"<?php echo generate_options("SELECT item_id,trim(concat(ifnull(form_name,''),' ',item_name)) item_name FROM tbl_items i left join medicine_form f on i.item_form_id=f.form_id where status='1' order by item_name", '', 'item_id', 'item_name', '', ''); ?>";
|
|
$("#addrow").on("click", function() {
|
|
var newRow = $("<tr>");
|
|
var cols = "";
|
|
var select_treatment = "";
|
|
select_treatment += "<select style='width:280px'";
|
|
select_treatment += "id=\"item_id" + counter + "\"name=\"item_id" + counter +
|
|
"\" data-placeholder=\"Choose a item...\" class=\"form-control select2\" ";
|
|
//select_treatment+="style=\"display: none;\"";
|
|
select_treatment += " onchange=\"GetDetail(this.value," + counter + ")\">";
|
|
select_treatment += "<option value=\"\"> </option>";
|
|
select_treatment += itemOptions
|
|
select_treatment += "</select>";
|
|
cols += '<td>' + select_treatment + '</td>';
|
|
cols += '<td><input type="text" class="form-control" id="itm_stk' + counter +
|
|
'" name="itm_stk' + counter + '"></select></td>';
|
|
cols += '<td><input type="text" class="form-control" id="reorder_level' + counter +
|
|
'" name="reorder_level' + counter + '"></td>';
|
|
cols += '<td><input type="text" class="form-control" id="indent_qty' + counter +
|
|
'" name="indent_qty' + counter + '"></td>';
|
|
cols += '<td><input type="text" id=\"child_item_unit' + counter + '" ></td>'
|
|
cols +=
|
|
'<td align="center"><a href="#" class="btn-lg" data-toggle="tooltip" id="deletebtn" title="Delete"><span class="glyphicon glyphicon-trash"></span></a></td>';
|
|
newRow.append(cols);
|
|
$("table.order-list").append(newRow);
|
|
//$('#item_id'+counter).chosen({allow_single_deselect:true});
|
|
//$('#item_id'+counter).next().css({'width': $('#item_id'+counter).parent().width()});
|
|
counter++;
|
|
$('.select2').select2()
|
|
$("#count_items").val(counter);
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true
|
|
})
|
|
});
|
|
$("table.order-list").on("click", "#deletebtn", function(event) {
|
|
$(this).closest("tr").remove();
|
|
// counter -= 1
|
|
// $("#count_items").val(counter);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
<script type="text/javascript">
|
|
jQuery(function($) {
|
|
$('#id-disable-check').on('click', function() {
|
|
var inp = $('#form-input-readonly').get(0);
|
|
if (inp.hasAttribute('disabled')) {
|
|
inp.setAttribute('readonly', 'true');
|
|
inp.removeAttribute('disabled');
|
|
inp.value = "This text field is readonly!";
|
|
} else {
|
|
inp.setAttribute('disabled', 'disabled');
|
|
inp.removeAttribute('readonly');
|
|
inp.value = "This text field is disabled!";
|
|
}
|
|
});
|
|
|
|
|
|
if (!ace.vars['touch']) {
|
|
$('.chosen-select').chosen({
|
|
allow_single_deselect: true
|
|
});
|
|
|
|
|
|
$(window)
|
|
.off('resize.chosen')
|
|
.on('resize.chosen', function() {
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({
|
|
'width': $this.parent().width()
|
|
});
|
|
})
|
|
}).trigger('resize.chosen');
|
|
//resize chosen on sidebar collapse/expand
|
|
$(document).on('settings.ace.chosen', function(e, event_name, event_val) {
|
|
if (event_name != 'sidebar_collapsed') return;
|
|
$('.chosen-select').each(function() {
|
|
var $this = $(this);
|
|
$this.next().css({
|
|
'width': $this.parent().width()
|
|
});
|
|
})
|
|
});
|
|
|
|
|
|
$('#chosen-multiple-style .btn').on('click', function(e) {
|
|
var target = $(this).find('input[type=radio]');
|
|
var which = parseInt(target.val());
|
|
if (which == 2) $('#form-field-select-4').addClass('tag-input-style');
|
|
else $('#form-field-select-4').removeClass('tag-input-style');
|
|
});
|
|
}
|
|
|
|
|
|
$('[data-rel=tooltip]').tooltip({
|
|
container: 'body'
|
|
});
|
|
$('[data-rel=popover]').popover({
|
|
container: 'body'
|
|
});
|
|
|
|
autosize($('textarea[class*=autosize]'));
|
|
|
|
$('textarea.limited').inputlimiter({
|
|
remText: '%n character%s remaining...',
|
|
limitText: 'max allowed : %n.'
|
|
});
|
|
|
|
|
|
|
|
|
|
//"jQuery UI Slider"
|
|
//range slider tooltip example
|
|
$("#slider-range").css('height', '200px').slider({
|
|
orientation: "vertical",
|
|
range: true,
|
|
min: 0,
|
|
max: 100,
|
|
values: [17, 67],
|
|
slide: function(event, ui) {
|
|
var val = ui.values[$(ui.handle).index() - 1] + "";
|
|
|
|
if (!ui.handle.firstChild) {
|
|
$("<div class='tooltip right in' style='display:none;left:16px;top:-6px;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>")
|
|
.prependTo(ui.handle);
|
|
}
|
|
$(ui.handle.firstChild).show().children().eq(1).text(val);
|
|
}
|
|
}).find('span.ui-slider-handle').on('blur', function() {
|
|
$(this.firstChild).hide();
|
|
});
|
|
|
|
|
|
$("#slider-range-max").slider({
|
|
range: "max",
|
|
min: 1,
|
|
max: 10,
|
|
value: 2
|
|
});
|
|
|
|
$("#slider-eq > span").css({
|
|
width: '90%',
|
|
'float': 'left',
|
|
margin: '15px'
|
|
}).each(function() {
|
|
// read initial values from markup and remove that
|
|
var value = parseInt($(this).text(), 10);
|
|
$(this).empty().slider({
|
|
value: value,
|
|
range: "min",
|
|
animate: true
|
|
|
|
});
|
|
});
|
|
|
|
$("#slider-eq > span.ui-slider-purple").slider('disable'); //disable third item
|
|
|
|
|
|
$('#id-input-file-1 , #id-input-file-2').ace_file_input({
|
|
no_file: 'No File ...',
|
|
btn_choose: 'Choose',
|
|
btn_change: 'Change',
|
|
droppable: false,
|
|
onchange: null,
|
|
thumbnail: false //| true | large
|
|
//whitelist:'gif|png|jpg|jpeg'
|
|
//blacklist:'exe|php'
|
|
//onchange:''
|
|
//
|
|
});
|
|
//pre-show a file name, for example a previously selected file
|
|
//$('#id-input-file-1').ace_file_input('show_file_list', ['myfile.txt'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//datepicker plugin
|
|
//link
|
|
$('.date-picker').datepicker({
|
|
autoclose: true,
|
|
todayHighlight: true
|
|
})
|
|
//show datepicker when clicking on the icon
|
|
.next().on(ace.click_event, function() {
|
|
$(this).prev().focus();
|
|
});
|
|
|
|
|
|
|
|
//chosen plugin inside a modal will have a zero width because the select element is originally hidden
|
|
//and its width cannot be determined.
|
|
//so we set the width after modal is show
|
|
$('#modal-form').on('shown.bs.modal', function() {
|
|
if (!ace.vars['touch']) {
|
|
$(this).find('.chosen-container').each(function() {
|
|
$(this).find('a:first-child').css('width', '210px');
|
|
$(this).find('.chosen-drop').css('width', '210px');
|
|
$(this).find('.chosen-search input').css('width', '200px');
|
|
});
|
|
}
|
|
})
|
|
/**
|
|
//or you can activate the chosen plugin after modal is shown
|
|
//this way select element becomes visible with dimensions and chosen works as expected
|
|
$('#modal-form').on('shown', function () {
|
|
$(this).find('.modal-chosen').chosen();
|
|
})
|
|
*/
|
|
|
|
|
|
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|
autosize.destroy('textarea[class*=autosize]')
|
|
|
|
$('.limiterBox,.autosizejs').remove();
|
|
$('.daterangepicker.dropdown-menu,.colorpicker.dropdown-menu,.bootstrap-datetimepicker-widget.dropdown-menu')
|
|
.remove();
|
|
});
|
|
|
|
});
|
|
</script>
|