Subversion Repositories SmartDukaan

Rev

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