Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $limitQty = $('#product_name_1').val();
- $('#product_name_1'+$orderItem_id).on('mouseup keyup', function () {
- $(this).val(Math.min({{$remainingDeliveries}}, Math.max(0, $(this).val())));
- });
- //autocomplete script
- $(document).on('focus','.autocomplete_txt',function(){
- type = $(this).data('type');
- if(type =='product_code' )autoType='product_code';
- if(type =='product_name' )autoType='name';
- // if(type =='qty_in' )autoType='qty_in';
- // if(type =='product_id' )autoType='id';
- $(this).autocomplete({
- minLength: 0,
- source: function( request, response ) {
- $.ajax({
- url: "{{ route('searchStock') }}",
- dataType: "json",
- data: {
- term : request.term,
- type : type,
- },
- success: function(data) {
- var array = $.map(data, function (item) {
- return {
- label: item[autoType],
- value: item[autoType],
- data : item
- }
- });
- response(array)
- }
- });
- },
- select: function( event, ui ) {
- var data = ui.item.data;
- id_arr = $(this).attr('id');
- id = id_arr.split("_");
- elementId = id[id.length-1];
- $('#product_code_'+elementId).val(data.product_code);
- $('#product_name_'+elementId).val(data.name);
- $('#qty_in_'+elementId).val(data.qty_in);
- $('#qty_out_'+elementId).val(data.qty_out);
- $('#product_id_'+elementId).val(data.id);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement