Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
32192 tejbeer 1
       <div class="row">
2
	    	<div class="col-lg-12">
3
	    	    <table class="table table-border table-condensed table-bordered" id="invoice-purchase-validate" style="width:100%">
4
	    			<thead>
5
	    				<tr>
6
 
7
	    					<th>Po Id</th>
8
	    					<th>Item Id </th>
9
	    					<th>Item</th>
10
	    					<th>Type</th>
11
	    					<th>Qty </th>
32256 tejbeer 12
	    					<th>Excess Qty </th>
13
	    					<th>Price Mismatch</th>
14
	    					<th>Issues</th>
32192 tejbeer 15
	    				    <th>Imeis</th>
32272 tejbeer 16
	    				    <th>Return Imeis</th>
32192 tejbeer 17
 
18
 
19
	    				</tr>
20
	    			</thead>
21
	    			<tbody>
22
	    			   #if(!$invoicePurchaseModel.getWarehousePurchaseModel().isEmpty())
23
	    			   #foreach($invoicePurchase in $invoicePurchaseModel.getWarehousePurchaseModel())
24
	    			   <tr>
25
	    			   <td class="purchaseId"> $invoicePurchase.getPoId()</td>
26
	    			   <td class="itemId"> $invoicePurchase.getItemId() </td>
27
						<td> $invoicePurchase.getItemDescription() </td>
28
						#if($invoicePurchase.isSerialized())
29
						<td class="itemType">Serialized</td>
30
						#else
31
						<td class="itemType">Non Serialized</td>
32
						#end
33
						<td class="qty"> $invoicePurchase.getQty() </td>
32256 tejbeer 34
 
35
					   <td class="excessQty"> $invoicePurchase.getExcessQty() </td>
32261 tejbeer 36
					   #if($invoicePurchase.getMismatch())
32272 tejbeer 37
					   <td class="priceMismatch"> $invoicePurchase.getMismatch()</td>
32256 tejbeer 38
					   #else
39
 
40
					    <td>-</td>
41
 
42
					   #end
43
						#if(!$invoicePurchase.getIssues().isEmpty())
44
						<td> $invoicePurchase.getIssues()</td> 
32192 tejbeer 45
						#else
46
							<td>Validated</td> 
47
 
48
						#end
49
						#if($invoicePurchaseModel.isValidate() && $invoicePurchase.isSerialized())
32311 tejbeer 50
						 <td width="20%"> <input type="text" class="imeis-to-grn" placeholder=""> </td>
32192 tejbeer 51
						#else
52
						<td> - </td>
53
						#end
32256 tejbeer 54
 
55
					    #if($invoicePurchaseModel.isValidate() && $invoicePurchase.isSerialized() && $invoicePurchase.getExcessQty() > 0)
32311 tejbeer 56
						 <td width = "20%">  <input type="text" class="imeis-to-grn-return" placeholder=""> </td>
32256 tejbeer 57
						#else
58
						<td> - </td>
59
						#end
32192 tejbeer 60
					 </tr> 
61
 
62
				    	#end		   
63
	    			   #end
64
 
65
	    			</tbody>
66
	    		</table>
67
 
68
	    	</div>
69
	    </div>
70
 
71
	    <div class="row"> 
72
 
32256 tejbeer 73
	    #if($invoicePurchaseModel.getStatus() == "pending")
74
 
75
	       <div class="col-lg-2 form-group">
76
	         	<input class="form-control btn btn-primary"   type="button" value="Grn">	
77
			</div>
78
 
79
	    #else
32192 tejbeer 80
	    	#if($invoicePurchaseModel.isValidate())
81
 
82
	         <div class="col-lg-2 form-group">
83
	         	<input class="form-control btn btn-primary purchaseGrn" data-invoiceid = "$invoicePurchaseModel.getInvoiceId()"  type="button" value="Grn">	
84
			</div>
85
 
32256 tejbeer 86
 
87
			#else
88
 
89
			   <div class="col-lg-2 form-group">
90
	         	<input class="form-control btn btn-primary grnRequest" data-invoiceid = "$invoicePurchaseModel.getInvoiceId()"  type="button" value="Raise Grn Request">	
91
			</div>
92
 
93
 
32192 tejbeer 94
			#end
32256 tejbeer 95
 
96
	 #end
32192 tejbeer 97
 
98
 
99
    </div>	
100
 
101
 
102
    <script>
103
    $(function () {
104
        //debugger;
105
        $("#invoice-purchase-validate > tbody > tr").each(function() {
106
 
107
 
108
		var qty = $(this).find(".qty").text();
109
 
110
		imeisToValidate = [];
111
 
32256 tejbeer 112
 
113
		let imeiInputElem = $(this).find(".imeis-to-grn");
114
		     imeiInputElem.tagsinput({
32192 tejbeer 115
            maxTags:qty,
116
            trimValue: true,
117
            allowDuplicates: false,
118
            confirmKeys: [13, 44, 188, 32],
119
            delimiterRegex: ',',
120
            trimValue: true,
121
            tagClass: function (item) {
122
                if (item.valid == null) return 'label label-primary';
123
                if (item.valid) {
124
                    return 'label label-success';
125
                } else {
126
                    return 'label label-danger';
127
                }
128
            },
129
        });
130
 
131
 
132
		 imeiInputElem.on('beforeItemAdd', (event) => {
133
            if (event.item.indexOf(' ') > 0) {
134
                event.cancel = true;
135
                let strItem = event.item.replaceAll(' ', '');
136
                imeiInputElem.tagsinput('add', strItem);
137
            }
138
        });
139
 
140
		});
141
 
32256 tejbeer 142
   $("#invoice-purchase-validate > tbody > tr").each(function() {
143
 
144
     var excessQty = $(this).find(".excessQty").text();
32192 tejbeer 145
 
146
 
32256 tejbeer 147
 
148
		imeisToValidate = [];
149
 
150
		let imeiInputElem = $(this).find(".imeis-to-grn-return");
151
		imeiInputElem.tagsinput({
152
			maxTags: excessQty,
153
			trimValue: true,
154
			allowDuplicates: false,
155
			confirmKeys: [13, 44, 188, 32],
156
			delimiterRegex: ',',
157
			trimValue: true,
158
			tagClass: function(item) {
159
				if (item.valid == null) return 'label label-primary';
160
				if (item.valid) {
161
					return 'label label-success';
162
				} else {
163
					return 'label label-danger';
164
				}
165
			},
166
		});
167
 
168
 
169
		imeiInputElem.on('beforeItemAdd', (event) => {
170
			if (event.item.indexOf(' ') > 0) {
171
				event.cancel = true;
172
				let strItem = event.item.replaceAll(' ', '');
173
				imeiInputElem.tagsinput('add', strItem);
174
			}
175
		});
176
		console.log(imeiInputElem);
177
 
178
 
179
		console.log(imeisToValidate);
180
 
181
     });
182
 
32192 tejbeer 183
    });
184
 
185
</script>