...
 
Commits (8)
......@@ -101,7 +101,12 @@ if($("#additem").is(':visible'))
$("#additem").focus();
}
else{
$("#addproddesc").focus();
if($("#addcatselect").length == 0){
$("#addproddesc").focus();
}
else {
$("#addcatselect").focus();
}
}
$("#godownflag").click(function(e){
......@@ -340,19 +345,21 @@ $("#openingstock").focus(function(event) {
}
});
$(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) {
// Keydown event for add unit of measurement.
$(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) {
// Event for 'Enter' key.
if (event.which == 13) {
if ($("#adduom option:selected").val()==""){
$("#uomblank-alert").alert();
$("#uomblank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#uomblank-alert").hide();
});
$("#uomblank-alert").alert();
$("#uomblank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#uomblank-alert").hide();
});
$("#adduom").focus();
}
else if (specspresent == 1) {
event.preventDefault();
$("#spec_table tbody tr:first td:eq(1) input:first").focus();
}
else if (specspresent == 1) {
event.preventDefault();
$("#spec_table tbody tr:first td:eq(1) input:first").focus();
}
else {
if ($("#product_tax_table tbody").length > 0) {
......@@ -360,23 +367,28 @@ $(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) {
}
else{
if ($("#additem option:selected").val()=='7'){
if ($("#godownpresence").val()==0) {
$("#openingstock").focus().select();
}
if ($("#godownpresence").val()==1)
{
$("#godownflag").focus().select();
}
if(sessionStorage.invflag==0){
$("#apsubmit").focus();
}
}
else{
$("#apsubmit").focus();
}
if ($("#godownpresence").val()==0) {
$("#openingstock").focus().select();
}
else
{
//If godownflag is hidden, i.e when user is godownkeeper focus shifts to godown name.
if ($("#godownflag").is(":hidden")) {
$(".godown_name:first").focus();
}
else{
$("#godownflag").focus().select();
}
}
if(sessionStorage.invflag==0){
$("#apsubmit").focus();
}
}
else{
$("#apsubmit").focus();
}
}
}
}
}
else if (event.which==32)
{
......@@ -422,8 +434,10 @@ $(document).off('keydown', '#addcatselect').on('keydown', '#addcatselect',functi
}
});
//Events for field to add new unit of measurement.
$(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) {
/* Act on the event */
/* Act on the event */
//Events triggered when Escape key is pressed.
if (event.which==27)
{
event.preventDefault();
......@@ -431,6 +445,7 @@ $(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) {
$(".newuom").hide();
$("#adduom").focus();
}
// Events triggered when Enter key is pressed.
if (event.which==13)
{
......@@ -470,8 +485,47 @@ $(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) {
$('#adduom').append($('<option value='+uom["uomid"]+'>'+uom["unitname"]+'</option>'));
}
//Added uom is selected.
$("#adduom option").filter(function(i,e){return $(e).text()==unitname;}).prop('selected', true);
$("#product_tax_table tbody tr:first td:eq(0) select").focus();
//If specs are present focus shifts to specs.
if (specspresent == 1) {
event.preventDefault();
$("#spec_table tbody tr:first td:eq(1) input:first").focus();
}
else {
// If Tax is present focus shifts to Tax.
if ($("#product_tax_table tbody").length > 0) {
$("#product_tax_table tbody tr:first td:eq(0) select").focus();
}
else{
//Events triggered in case of Goods.
if ($("#additem option:selected").val()=='7'){
if ($("#godownpresence").val()==0) {
$("#openingstock").focus().select();
}
else
{
//If godownflag is hidden, i.e when user is godownkeeper focus shifts to godown name.
if ($("#godownflag").is(":hidden")) {
$(".godown_name:first").focus();
}
//Else it shifts to godown flag.
else{
$("#godownflag").focus().select();
}
}
//If inventory is not enabled focus
if(sessionStorage.invflag==0){
$("#apsubmit").focus();
}
}
//In case of Service focus shifts to Save button.
else{
$("#apsubmit").focus();
}
}
}
}
})
.fail(function() {
......@@ -942,19 +996,25 @@ $(document).off("change",".godown_name").on("change",".godown_name",function(eve
selectedgodown = $('#godown_ob_table tbody tr:eq('+curindex+') td:eq(0) select').val();
});
// Key Up event for godown name.
$(document).off("keyup",".godown_name").on("keyup",".godown_name",function(event)
{
var curindex = $(this).closest('tr').index();
var nextindex = curindex+1;
var previndex = curindex-1;
var previndex = curindex-1;
//Events that are triggered when Shift Key and '<' key are triggered.
if (event.which==188 && event.shiftKey)
{
if (curindex==0) {
if (curindex==0) {
//When godownflag is hidden focus shifts to adduom.
if($("#godownflag").is(":hidden")){
$("#adduom").focus();
}
$("#godownflag").focus().select();
}
if(previndex>-1 && curindex != 0)
{
event.preventDefault();
event.preventDefault();
$('#godown_ob_table tbody tr:eq('+previndex+') td:eq(0) select').focus().select();
}
}
......
......@@ -63,11 +63,13 @@ if (sessionStorage.invflag=='1' ){
event.preventDefault();
$("#smalllink").html('See more. <span class="glyphicon glyphicon-triangle-bottom"></span>');
});
$("#addcatselect").focus();
if($("#addcatselect").length == 0)
{
$("#addproddesc").focus();
}
else{
$("#addcatselect").focus();
}
$("#openingstock").numeric();
$("#godownflag").click(function(e){
if ($(this).is(":checked")) {
......@@ -175,17 +177,22 @@ $("#openingstock").focus(function(event) {
}
});
$(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) {
if (event.which == 13) {
// Events for Unit of Measurement field.
$(document).off('keydown', '#adduom').on('keydown', '#adduom', function(event) {
// Events that happen when Enter key is pressed.
if (event.which == 13) {
// When specs are present focus shifts to specs table.
if (!$("#specdiv").is(":hidden")) {
$("#spec_table tbody tr:first td:eq(1) input:first").focus();
}
else {
else {
// If Tax is present focus shifts to Tax table.
if ($("#product_tax_table").length > 0) {
$("#product_tax_table tbody tr:first td:eq(0) select").focus();
}
else{
$("#godownflag").focus();
else{
// For godown keeper Tax table is not visible. Focus shifts to godown name.
$(".godown_name:first").focus();
}
}
}
......@@ -277,8 +284,20 @@ $(document).off('keydown', '#newuom').on('keydown', '#newuom', function(event) {
$('#adduom').append($('<option value='+uom["uomid"]+'>'+uom["unitname"]+'</option>'));
}
$("#adduom option").filter(function(i,e){return $(e).text()==unitname}).prop('selected', true);
$("#product_tax_table tbody tr:first td:eq(0) select").focus();
$("#adduom option").filter(function(i,e){return $(e).text()==unitname;}).prop('selected', true);
if (!$("#specdiv").is(":hidden")) {
$("#spec_table tbody tr:first td:eq(1) input:first").focus();
}
else {
// If Tax is present focus shifts to Tax table.
if ($("#product_tax_table").length > 0) {
$("#product_tax_table tbody tr:first td:eq(0) select").focus();
}
else{
// For godown keeper Tax table is not visible. Focus shifts to godown name.
$(".godown_name:first").focus();
}
}
}
})
.fail(function() {
......@@ -794,7 +813,12 @@ $(document).off("keyup",".godown_name").on("keyup",".godown_name",function(event
if (event.which==188 && event.shiftKey)
{
if (curindex==0) {
$("#godownflag").focus().select();
if($("#godownflag").is(":hidden")){
$("#adduom").focus();
}
else{
$("#godownflag").focus().select();
}
}
if(previndex>-1 && curindex != 0)
{
......@@ -998,9 +1022,9 @@ $(document).off("click","#apsubmit").on("click", '#apsubmit', function(event) {
if ($("#addproddesc").val()=="")
{
$('.modal-backdrop').remove();
$("#blank-alert").alert();
$("#blank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#blank-alert").hide();
$("#product-blank-alert").alert();
$("#product-blank-alert").fadeTo(2250, 500).slideUp(500, function(){
$("#product-blank-alert").hide();
});
$("#addproddesc").focus();
$("#addproddesc").select();
......
......@@ -13,17 +13,15 @@
{% else %}
<div class="row" hidden id="serviceproductdiv">
{% endif %}
<div class="form-group col-sm-11 pd">
<div class="form-group col-sm-11 pd">
<label for="additem">{% trans %}Item Type{% endtrans %} :</label><label for="additem" style="color:red;font-size: 120%;">*</label>
<select name="gsflag" class="form-control input-sm" id="additem" accesskey="">
<option value="7" id=sel_product>Product</option>
<option value="19" id=sel_service>Service</option>
</select>
<label for="additem">{% trans %}Item Type{% endtrans %} :</label><label for="additem" style="color:red;font-size: 120%;">*</label>
<select name="gsflag" class="form-control input-sm" id="additem">
<option value="7">Product</option>
<option value="19">Service</option>
</select>
</div>
</div>
</div>
<div class="row productclass">
......@@ -234,13 +232,14 @@
</div>
</div>
{% else %}
<div class="form-group col-sm-12">
{% if userrole|int != 3 %}
<div class="form-group col-sm-12">
<input type="checkbox" name="godownflag" id="godownflag" value=0>
</input>
<input type="text" id="godownpresence" value="1" hidden="">
<label class="" for="godownflag">{% trans %}Godown Wise Opening Stock{% endtrans %}</label>
</div>
<div id="nogodown" class="form-group pds col-sm-6 noinventory">
</div>
<div id="nogodown" class="form-group pds col-sm-6 noinventory">
<label for="openingstock" class="">{% trans %}Opening Stock{% endtrans %} :</label>
<div class="input-group">
<input type='text' class="form-control text-right input-sm numtype" name="openingstock" id="openingstock" value="0.00" aria-describedby="unitaddon">
......@@ -248,6 +247,12 @@
</div>
</div>
<div id="openingstockdiv" class="form-group col-sm-12" hidden>
{% else %}
<input type="hidden" name="godownflag" id="godownflag" value="1">
</input>
<input type="text" id="godownpresence" value="1" hidden>
<div id="openingstockdiv" class="form-group col-sm-12">
{% endif %}
<div class="panel">
<table id="godown_ob_table" class="table table-condensed table-bordered fixed-table">
<thead class="bg-primary input-sm">
......
<input type="text" id="numberofspecs" value="{{gkresult|length}}" hidden>
{% if (gkresult|length)>0 %}
<div class="col-sm-11">
<div class="col-sm-12 nopadding">
<div class="panel">
<table id="spec_table" class="table table-condensed table-bordered fixed-table ">
<thead class="bg-primary input-sm">
......
......@@ -192,20 +192,27 @@
</div>
</div>
{% else %}
<div class="form-group col-sm-12">
<input type="checkbox" name="godownflag" id="godownflag" value=0>
{% if userrole|int != 3 %}
<div class="form-group col-sm-12">
<input type="checkbox" name="godownflag" id="godownflag" value=0>
</input>
<input type="text" id="godownpresence" value="1" hidden="">
<label class="" for="godownflag">{% trans %}Godown Wise Opening Stock{% endtrans %}</label>
</div>
<div id="nogodown" class="form-group pds col-sm-6">
<label for="openingstock" class="">{% trans %}Opening Stock{% endtrans %} :</label>
<div class="input-group">
<input type='text' class="form-control text-right input-sm" name="openingstock" id="openingstock" value="0.00" aria-describedby="unitaddon">
<span class="input-group-addon input-sm" id="unitaddon"></span>
</div>
</div>
<div id="openingstockdiv" class="form-group col-sm-12" hidden>
<div id="nogodown" class="form-group pds col-sm-6 noinventory">
<label for="openingstock" class="">{% trans %}Opening Stock{% endtrans %} :</label>
<div class="input-group">
<input type='text' class="form-control text-right input-sm numtype" name="openingstock" id="openingstock" value="0.00" aria-describedby="unitaddon">
<span class="input-group-addon input-sm" id="unitaddon"></span>
</div>
</div>
<div id="openingstockdiv" class="form-group col-sm-12" hidden>
{% else %}
<input type="hidden" name="godownflag" id="godownflag" value="1">
</input>
<input type="text" id="godownpresence" value="1" hidden>
<div id="openingstockdiv" class="form-group col-sm-12">
{% endif %}
<div class="panel">
<table id="godown_ob_table" class="table table-condensed table-bordered fixed-table">
<thead class="bg-primary input-sm">
......
......@@ -12,7 +12,11 @@
{% if numberofproducts ==0 %}
<label class="text-danger">{% trans %}No Product/Service Found!{% endtrans %}</label>
{% else %}
<label for="prodselect" id="prodselect_lbl">{% trans %}List of Products / Services {% endtrans %} :</label>
{% if userrole|int != 3 %}
<label for="prodselect" id="prodselect_lbl">{% trans %}List of Products / Services {% endtrans %} :</label>
{% else %}
<label for="prodselect" id="prodselect_lbl">{% trans %}List of Products {% endtrans %} :</label>
{%endif%}
<select class = "form-control input-sm" name = "productcode" id="prodselect" >
<option value="" disabled selected hidden>{% trans %}Select Product / Service{% endtrans %}</option>
{% for prod in gkresult %}
......