Subversion Repositories SmartDukaan

Rev

Rev 32256 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

       <div class="row">
                <div class="col-lg-12">
                    <table class="table table-border table-condensed table-bordered" id="invoice-purchase-validate" style="width:100%">
                                <thead>
                                        <tr>
                                        
                                                <th>Po Id</th>
                                                <th>Item Id </th>
                                                <th>Item</th>
                                                <th>Type</th>
                                                <th>Qty </th>
                                                <th>Issue</th>
                                            <th>Imeis</th>
                                                                        
                                                                        
                                        </tr>
                                </thead>
                                <tbody>
                                   #if(!$invoicePurchaseModel.getWarehousePurchaseModel().isEmpty())
                                   #foreach($invoicePurchase in $invoicePurchaseModel.getWarehousePurchaseModel())
                                   <tr>
                                   <td class="purchaseId"> $invoicePurchase.getPoId()</td>
                                   <td class="itemId"> $invoicePurchase.getItemId() </td>
                                                <td> $invoicePurchase.getItemDescription() </td>
                                                #if($invoicePurchase.isSerialized())
                                                <td class="itemType">Serialized</td>
                                                #else
                                                <td class="itemType">Non Serialized</td>
                                                #end
                                                <td class="qty"> $invoicePurchase.getQty() </td>
                                                #if($invoicePurchase.getIssue())
                                                <td> $invoicePurchase.getIssue()</td> 
                                                #else
                                                        <td>Validated</td> 
                                        
                                                #end
                                                #if($invoicePurchaseModel.isValidate() && $invoicePurchase.isSerialized())
                                                 <td>   <div> <input type="text" class="imeis-to-grn" placeholder=""> </div></td>
                                                #else
                                                <td> - </td>
                                                #end
                                         </tr> 
                                                          
                                        #end               
                                   #end
                                   
                                </tbody>
                        </table>
                        
                </div>
            </div>
            
            <div class="row"> 
            
                #if($invoicePurchaseModel.isValidate())
      
                 <div class="col-lg-2 form-group">
                        <input class="form-control btn btn-primary purchaseGrn" data-invoiceid = "$invoicePurchaseModel.getInvoiceId()"  type="button" value="Grn">     
                        </div>
                        
                        #end
                        
                        
    </div>      
    
    
    <script>
    $(function () {
        //debugger;
        $("#invoice-purchase-validate > tbody > tr").each(function() {
        
                
                var qty = $(this).find(".qty").text();
                
                imeisToValidate = [];
        
        let imeiInputElem = $(".imeis-to-grn");
        imeiInputElem.tagsinput({
            maxTags:qty,
            trimValue: true,
            allowDuplicates: false,
            confirmKeys: [13, 44, 188, 32],
            delimiterRegex: ',',
            trimValue: true,
            tagClass: function (item) {
                if (item.valid == null) return 'label label-primary';
                if (item.valid) {
                    return 'label label-success';
                } else {
                    return 'label label-danger';
                }
            },
        });
                
                
                 imeiInputElem.on('beforeItemAdd', (event) => {
            if (event.item.indexOf(' ') > 0) {
                event.cancel = true;
                let strItem = event.item.replaceAll(' ', '');
                imeiInputElem.tagsinput('add', strItem);
            }
        });
                
                });
        
        
     

     

    });

</script>