ESH/product_service_master.php
2024-10-23 18:28:06 +05:30

1542 lines
54 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="#">Data Setup</li>
<li class="#">Masters</li>
<li class="active">Product Service Master</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div class="box box-primary">
<form id="productservice_form" method="post">
<!-- box-body-->
<div class="box-body" id="reload_amb">
<div class="row">
<div class="col-sm-12">
<div class="form-group col-sm-3">
<label for="role" style="display:block;"></label>
<label for="image_logo">
<div class="box-header with-border" style="padding-top:0 !important">
<h3 class="box-title">Product Logo</h3>
</div>
<img class="editable img-responsive" alt="Product Logo" id="product" src="images/no_image.png" />
</label>
<input type="file" style="display:none" name="image_logo" id="image_logo" onchange="loadFile(event)" accept="image/png, image/gif, image/jpeg" />
</div>
<div class="form-group col-sm-9">
<div class="col-sm-4 form-group">
<label for="product_name">Product Name</label>
<select class="form-control chosen-select" name="product_name" id="product_name">
<option value="">Select Test</option>
<?= generateOption('checkup_form_section','section_name','section_id','','')?>;
</select>
<!-- <input type="text" class="form-control" name="product_name" id="product_name" placeholder="Enter Product Name " required /> -->
</div>
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<div class="form-group col-sm-4">
<label for="product_code">Product Code</label>
<input type="text" class="form-control" name="product_code" id="product_code" placeholder="Enter Product Code " required />
</div>
<div class="form-group col-sm-4">
<label for="product_code">HSN Code</label>
<input type="text" class="form-control" name="hsn_code" id="hsn_code" placeholder="Enter Hsn Code " required />
</div>
<!-- <div class="row"> -->
<div class="form-group col-sm-4">
<label for="rate_per_unit">Rate Per Unit</label>
<!-- <div class="col-sm-4"> -->
<input type="number" class="form-control" id="rate_per_unit" name="rate_per_unit" placeholder="Enter Rate Per Unit" steps="0.001" required />
</div>
<div class="form-group col-sm-4">
<label for="is_service">Is product A Service</label>
<select id="is_service" name="is_service" class="form-control">
<option value="" selected disabled>Is this product service?</option>
<option value="1">YES</option>
<option value="0">NO</option>
</select>
</div>
<div class="form-group col-sm-4">
<label for="is_active">Is Product Active</label>
<select id="is_active" name="is_active" class="form-control">
<!-- <option value="" selected disabled>Is this product active?</option> -->
<option value="1">YES</option>
<option value="0">NO</option>
</select>
</div>
<div class="form-group col-sm-4">
<label for="icon_text">Icon Text</label>
<!-- <div class="col-sm-4"> -->
<input type="text" class="form-control" id="icon_text" name="icon_text" placeholder="Enter Icon Text" required />
<!-- </div> -->
<!-- </div> -->
</div>
<div class="form-group col-sm-4">
<label for="image_url"> Image Url</label>
<input type="text" class="form-control" name="image_url" id="image_url" placeholder="Enter Image Url " required />
</div>
<div class="form-group col-sm-4">
<label for="tax_code1">Tax Code1</label>
<!-- <div class="col-sm-4"> -->
<input type="text" class="form-control" id="tax_code1" name="tax_code1" placeholder="Enter Tax Code1" required />
</div>
<div class="form-group col-sm-4">
<label for="tax_rate1">Tax Rate1</label>
<!-- <div class="col-sm-4"> -->
<input type="number" class="form-control" id="tax_rate1" name="tax_rate1" placeholder="Enter Tax Rate" steps="0.001" required />
</div>
<div class="form-group col-sm-4">
<label for="tax_code2">Tax Code2</label>
<!-- <div class="col-sm-4"> -->
<input type="text" class="form-control" id="tax_code2" name="tax_code2" placeholder="Enter Tax Code2" required />
</div>
<div class="form-group col-sm-4">
<label for="tax_rate2">Tax Rate2</label>
<!-- <div class="col-sm-4"> -->
<input type="number" class="form-control" id="tax_rate2" name="tax_rate2" placeholder="Enter Tax Rate2" steps="0.001" required />
</div>
<div class="form-group col-sm-4">
<label for="discount_percentage">Discount Percentage</label>
<!-- <div class="col-sm-4"> -->
<input type="number" class="form-control" id="discount_percentage" name="discount_percentage" placeholder="Enter Discount Percentage" steps="0.001" required />
</div>
<div class="col-sm-8 form-group">
<label for="description">Product Description</label>
<textarea name="description" id="description" class="form-control"></textarea>
<input type="hidden" class="form-control" name="product_id" id="product_id" placeholder="Enter Product Id" required />
</div>
</div>
</div>
</div>
</div>
<!-- <div class="row"> -->
<!-- <div class="row"> -->
<!-- <div class="col-sm-12"> -->
<!-- <div class="form-group col-sm-3"> -->
<!-- <div class="form-group col-sm-3"> -->
<!-- <label for="icon_text">Icon Text</label> -->
<!-- <div class="col-sm-4"> -->
<!-- <input type="text" class="form-control"id="icon_text" -->
<!-- name="icon_text" placeholder="Enter Icon Text" required/> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="col-sm-4 form-group"> -->
<!-- <label for="Productservice">Product Description</label> -->
<!-- <textarea></textarea> -->
<!-- <input type="hidden" class="form-control" name="product_id" -->
<!-- id="product_id" placeholder="Enter Product Id" required/> -->
<!-- </div> -->
<!-- <div class="form-group col-sm-4"> -->
<!-- <label for="image_url">Image Url</label> -->
<!-- <div class="col-sm-4"> -->
<!-- <textarea></textarea> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="row"> -->
<!-- <div class="col-sm-12"> -->
<!-- <div class="form-group col-sm-4"> -->
<!-- <label for="icon_text">Icon Text</label> -->
<!-- <div class="col-sm-4"> -->
<!-- <input type="text" id="icon_text" -->
<!-- name="icon_text" placeholder="Enter Icon Text" required/> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="form-group col-sm-6"> -->
<!-- <label for="image_url">Image Url</label> -->
<!-- <div class="col-sm-4"> -->
<!-- <textarea></textarea> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="form-group">
<label for="Productservice"> Product Description</label>
<input type="text" class="form-control" name="description"
id="description" placeholder="Enter Product Description " required/>
</div>
<div class="form-group">
<label for="Productservice">Is product A Service</label>
<select id="is_service" name="is_service" class="form-control" >
<option value="" selected disabled>Is this product service?</option>
<option value="1">YES</option>
<option value="0">NO</option>
</select>
</div>
<div class="form-group">
<label for="Productservice">Is Product Active</label>
<select id="is_active" name="is_active" class="form-control" >
<option value="" selected disabled>Is this product active?</option>
<option value="1">YES</option>
<option value="0">NO</option>
</select>
</div>
<div class="form-group">
<label for="Productservice">Icon Text</label>
<input type="text" class="form-control" name="icon_text"
id="icon_text" placeholder="Enter Icon Text " required/>
</div>
<div class="form-group">
<label for="Productservice"> Image Url</label>
<input type="text" class="form-control" name="image_url"
id="image_url" placeholder="Enter Image Url " required/>
</div>
-->
<!-- <div class="row" > -->
<!-- <div class="col-sm-8"> -->
<!-- <table id="myTable" class="table table-bordered order-list" > -->
<!-- <thead> -->
<!-- <tr> -->
<!-- <th>PRODUCT NAME</th> -->
<!-- <th>PRODUCT CODE</th> -->
<!-- <th>RATE PER UNIT</th> -->
<!-- <th>PRODUCT DESCRIPTION</th> -->
<!-- </tr> -->
<!-- </thead> -->
<!-- <tbody> -->
<!-- <tr> -->
<!-- <td style="width:8%"> -->
<!-- <input type="hidden" name="product_id" id="product_id" value="<?= $row['product_id'] ?>" /> -->
<!-- <input type="text" name="product_name" value="<?= $row['product_name'] ?>" id="product_name" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <input type="text" name="product_code" id="product_code" value="<?= $row['product_code'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <input type="number" step="0.001" name="rate_per_unit" id="rate_per_unit" value="<?= $row['rate_per_unit'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <input type="text" name="description" id="description" value="<?= $row['description'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- </tr> -->
<!-- <input type="hidden" name="count_items" id="count_items" value="" /> -->
<!-- </tbody> -->
<!-- <tfoot> -->
<!-- <tr> -->
<!-- </tr> -->
<!-- </tfoot> -->
<!-- </table> -->
<!-- </div> -->
<!-- </div> -->
<!-- <div class="row" > -->
<!-- <div class="col-sm-8"> -->
<!-- <table id="myTable" class="table table-bordered order-list" > -->
<!-- <thead> -->
<!-- <tr> -->
<!-- <th>IS SERVICE</th> -->
<!-- <th>IS ACTIVE</th> -->
<!-- <th>ICON TEXT</th> -->
<!-- <th>IMAGE URL</th> -->
<!-- </tr> -->
<!-- </thead> -->
<!-- <tbody> -->
<!-- <tr> -->
<!-- <td style="width:8%"> -->
<!-- <select id="is_service" name="is_service" class="form-control" > -->
<!-- <option value="" selected disabled>Is this product service?</option> -->
<!-- <option value="1">YES</option> -->
<!-- <option value="0">NO</option> -->
<!-- </select> -->
<!-- <input type="number" name="is_service" id="is_service" value="<?= $row['is_service'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <select id="is_active" name="is_active" class="form-control" > -->
<!-- <option value="" selected disabled>Is this product active?</option> -->
<!-- <option value="1">YES</option> -->
<!-- <option value="0">NO</option> -->
<!-- </select> -->
<!-- <input type="number" name="is_active" id="is_active" value="<?= $row['is_active'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <input type="text" name="icon_text" id="icon_text" value="<?= $row['icon_text'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- <td style="width:8%"> -->
<!-- <input type="text" name="image_url" id="image_url" value="<?= $row['image_url'] ?>" class="form-control"/> -->
<!-- </td> -->
<!-- </tr> -->
<!-- </tbody> -->
<!-- <tfoot> -->
<!-- <tr> -->
<!-- </tr> -->
<!-- </tfoot> -->
<!-- </table> -->
<!-- </div> -->
<!-- </div> -->
<!-- </div> -->
<!-- End box-body-->
<!--box-footer-->
<?
//$hasWriteAccess = isAccessible ( $_SESSION ['RoleId'], $menu_key, 'W' );
?>
<? //if ($hasWriteAccess) {
?>
<div class="box-footer" style="text-align: center;">
<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
New
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-info save_button" type="button" id="save_button" onclick="validate();">
<i class="ace-icon fa fa-floppy-o bigger-110"></i>
Save
</button>
&nbsp; &nbsp; &nbsp;
<button class="btn btn-warning" type="reset">
<i class="ace-icon fa fa-undo bigger-110"></i>
Reset
</button>
</div>
<? //}
?>
<br>
<br>
<!--End box-footer-->
</form>
</div>
</div>
</div>
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="page-content" style="margin-top: -47px;">
<div id="flexigridDiv" class="table-responsive">
<form name="f1" method="post" action="" id="flex_form_productservice">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_product_id" id="flex_product_id" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
</div>
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'product_service_script.php',
dataType: 'json',
colModel: [{
display: 'Sr No',
name: 'count',
width: w * .03,
sortable: false,
align: 'left'
},
{
display: 'Product Name',
name: 'product_name',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Product Code',
name: 'product_code',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'HSN Code',
name: 'hsn_code',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Rate Per Unit',
name: 'rate_per_unit',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Product Description',
name: 'description',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: 'Is Service',
name: 'is_service',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Is Active',
name: 'is_active',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Icon Text',
name: 'icon_text',
width: w * .08,
sortable: true,
align: 'left'
},
{
display: 'Image Url',
name: 'image_url',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: 'Tax Code1',
name: 'tax_code1',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Tax Rate1',
name: 'tax_rate1',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Tax Code2',
name: 'tax_code2',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Tax Rate2',
name: 'tax_rate2',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Discount Percentage',
name: 'discount_percentage',
width: w * .12,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
width: w * .07,
sortable: true,
align: 'left'
},
],
buttons: [
// {name: 'Add', bclass: 'add', onpress : add},
// {separator: true},
{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
}
],
searchitems: [
{
display: 'Product Name',
name: 'product_name'
},
{
display: 'Product Description ',
name: 'description'
}
],
sortname: "product_id",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 20, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function pdf() {
window.open('productservice_pdf.php');
}
function excel() {
window.location = 'productservice_excel.php';
}
function add() {
// $(".save_button").show();
$("#product_id").val("");
$("#product_name").val("");
$("#product_code").val("");
$("#hsn_code").val("");
$("#rate_per_unit").val("");
$("#description").val("");
$("#is_service").val("");
$("#is_active").val("");
// $("#image_logo").val("");
$("#icon_text").val("");
$("#image_url").val("");
$("#tax_code1").val("");
$("#tax_rate1").val("");
$("#tax_code2").val("");
$("#tax_rate2").val("");
$("#discount_percentage").val("");
// $('#modal-add-productservice').modal("show");
}
var loadFile = function(event) {
var output = document.getElementById('product');
output.src = URL.createObjectURL(event.target.files[0]);
output.onload = function() {
URL.revokeObjectURL(output.src)
}
};
function show_save_button() {
$("#save_button").show();
$("#product_id").val("");
}
function delete_productservice(product_id) {
$("#flex_product_id").val(product_id);
BootstrapDialog.confirm('Are you sure to delete the Product Details?', function(result) {
if (result) {
$.ajax({
url: 'delete_productservice.php',
type: "POST",
data: $("#flex_form_productservice").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('Product Details Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Product Details');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Product Details');
return;
}
});
}
});
}
function save_productservice() {
// var sub_category_id;
var formData = new FormData($("#productservice_form")[0]);
$.ajax({
url: 'save_productservice.php',
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function(data) {
BootstrapDialog.alert('Product Details Saved Successfully');
$("#flex1").flexReload();
return;
},
error: function(data) {
BootstrapDialog.alert('Error Saving Product Details');
return;
}
});
$('.close').click();
}
function open_productservice(product_id, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_productservice.php?product_id=' + product_id + ' ',
type: 'POST',
success: function(data) {
var data = $.parseJSON(data);
$("#product_id").val(data.product_id);
$("#product_name").val(data.product_name);
$("#product_code").val(data.product_code);
$("#hsn_code").val(data.hsn_code);
$("#rate_per_unit").val(data.rate_per_unit);
$("#description").val(data.description);
$("#is_service").val(data.is_service);
$("#is_active").val(data.is_active);
if (data.image_logo != "") {
$("#image_type").val(data.image_type);
// $("#product").val(data.image_logo);
$("#product").attr("src", "data:" + data.image_type + ";base64," + data.image_logo);
} else {
$("#product").attr("src", "images/no_image.png");
}
// $("#image_logo").val(data.image_logo);
$("#icon_text").val(data.icon_text);
$("#image_url").val(data.image_url);
$("#tax_code1").val(data.tax_code1);
$("#tax_rate1").val(data.tax_rate1);
$("#tax_code2").val(data.tax_code2);
$("#tax_rate2").val(data.tax_rate2);
$("#discount_percentage").val(data.discount_percentage);
$("#is_service").trigger("chosen:updated");
$("#is_active").trigger("chosen:updated");
if (data.is_service == 1) {
$("#is_service_div").html("YES");
} else {
$("#is_service_div").html("NO");
}
if (data.is_active == 1) {
$("#is_active_div").html("YES");
} else {
$("#is_active_div").html("NO");
}
// $('#modal-add-productservice').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Product Details');
return;
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<script>
function validate() {
var product_name = $('#product_name').val();
if (product_name == '') {
BootstrapDialog.alert('Please Enter Product Name.!!!');
return false;
}
var product_code = $('#product_code').val();
if (product_code == '') {
BootstrapDialog.alert('Please Enter Product Code.!!!');
return false;
}
var hsn_code = $('#hsn_code').val();
if (hsn_code == '') {
BootstrapDialog.alert('Please Enter Hsn Code.!!!');
return false;
}
var rate_per_unit = $('#rate_per_unit').val();
if (rate_per_unit == '') {
BootstrapDialog.alert('Please Enter Product Rate Per Unit.!!!');
return false;
}
var description = $('#description').val();
if (description == '') {
BootstrapDialog.alert('Please Enter Product Description.!!!');
return false;
}
var is_service = $('#is_service').val();
if (is_service == '') {
BootstrapDialog.alert('Please Enter If Product Is Service .!!!');
return false;
}
var is_active = $('#is_active').val();
if (is_active == '') {
BootstrapDialog.alert('Please Enter If Product Is Active.!!!');
return false;
}
var icon_text = $('#icon_text').val();
if (icon_text == '') {
BootstrapDialog.alert('Please Enter Product Icon Text.!!!');
return false;
}
var image_url = $('#image_url').val();
if (image_url == '') {
BootstrapDialog.alert('Please Enter Image Url.!!!');
return false;
}
// var tax_code1= $('#tax_code1').val();
// if(tax_code1 == ''){
// BootstrapDialog.alert('Please Enter Tax Code1.!!!');
// return false;
// }
// var tax_rate1= $('#tax_rate1').val();
// if(tax_rate1 == ''){
// BootstrapDialog.alert('Please Enter Tax Rate1.!!!');
// return false;
// }
// var tax_code2= $('#tax_code2').val();
// if(tax_code2 == ''){
// BootstrapDialog.alert('Please Enter Tax Code2.!!!');
// return false;
// }
// var tax_rate2= $('#tax_rate2').val();
// if(tax_rate2 == ''){
// BootstrapDialog.alert('Please Enter Tax Rate2.!!!');
// return false;
// }
var discount_percentage = $('#discount_percentage').val();
if (discount_percentage == '') {
BootstrapDialog.alert('Please Enter Discount Percentage.!!!');
return false;
}
save_productservice();
}
</script>
<style>
#modal-add-ailment {
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');
});
/***************/
})
$('.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">
$(document).ready(function() {
var counter = $("#count_items").val();
//alert (counter);
$("#addrow").on("click", function() {
var newRow = $("<tr>");
var cols = "";
cols += '<td><input type="text" class="form-control" id="product_name' + counter + '" name="product_name' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="product_code' + counter + '" name="product_code' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="hsn_code' + counter + '" name="hsn_code' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="rate_per_unit' + counter + '" name="rate_per_unit' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="description' + counter + '" name="description' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="is_service' + counter + '" name="is_service' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="is_active' + counter + '" name="is_active' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="icon_text' + counter + '" name="icon_text' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="image_url' + counter + '" name="image_url' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="tax_code1' + counter + '" name="tax_code1' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="tax_rate1' + counter + '" name="tax_rate1' + counter + '"/></td>';
cols += '<td><input type="text" class="form-control" id="tax_code2' + counter + '" name="tax_code2' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="tax_rate2' + counter + '" name="tax_rate2' + counter + '"/></td>';
cols += '<td><input type="number" class="form-control" id="discount_percentage' + counter + '" name="discount_percentage' + 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);
$("#myTable").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
})
});
$("#myTable").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>
<style>
.row img {
width: 90%;
height: 100%;
object-fit: cover;
cursor: pointer;
border: 2px solid black;
}
.logo {
margin: auto;
width: 17%;
height: 130px;
text-align: center;
padding: 6px;
margin-top: -2rem;
margin-left: -2rem;
margin-bottom: 3rem;
}
</style>