Subversion Repositories SmartDukaan

Rev

Rev 32311 | Details | Compare with Previous | Last modification | View Log | RSS feed

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