Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
32349 amit.gupta 1
<section class="wrapper">
2
    <div class="row">
3
        <div class="col-lg-12">
4
            <h3 class="page-header">
5
                <i class="icon_document_alt"></i>Seller
6
            </h3>
7
            <ol class="breadcrumb">
8
                <li><i class="fa fa-home"></i><a
9
                        href="${rc.contextPath}/dashboard">Home</a></li>
10
                <li><i class="icon_document_alt"></i>Supplier Form</li>
11
            </ol>
12
        </div>
13
    </div>
14
    <form id="new-supplier-create-form">
15
        <div class="form-row">
16
            <div class="form-group col-md-6">
17
                <label for="name">Name</label>
34329 aman.kumar 18
                <input type="text" class="form-control" id="name" name="inputName" placeholder="Name"
19
                       value="$supplier.getName()" readonly>
32349 amit.gupta 20
            </div>
28494 tejbeer 21
 
32349 amit.gupta 22
            <div class="form-group col-md-6">
23
                <label for="phone">Phone</label>
32567 tejbeer 24
                <input type="number" class="form-control" id="phone" name="inputPhone" placeholder="Phone" value="$supplier.getPhone()">
32349 amit.gupta 25
            </div>
26
 
27
            <div class="form-group col-md-6">
28
                <label for="gst">GSTIN</label>
34329 aman.kumar 29
                <input type="text" class="form-control" id="gst" name="inputGst" placeholder="GST"
30
                       value="$supplier.getGstin()">
32349 amit.gupta 31
            </div>
32
            <div class="form-group col-md-6">
33
                <label for="panNumber">PAN</label>
34329 aman.kumar 34
                <input type="text" class="form-control" id="panNumber" name="inputPan" placeholder="pan"
35
                       value="$supplier.getPan()" readonly>
32349 amit.gupta 36
            </div>
37
            <div class="form-group col-md-6">
38
                <label for="Fax">Fax</label>
32567 tejbeer 39
                <input type="text" class="form-control" id="Fax" name="inputFax" placeholder="Fax" value="$supplier.getFax()">
32349 amit.gupta 40
            </div>
34329 aman.kumar 41
 
32349 amit.gupta 42
            <div class="form-group col-md-6">
43
                <label for="headName">Head Name</label>
32567 tejbeer 44
                <input type="text" class="form-control" id="headName" name="inputHeadName" placeholder="Head Name" value="$supplier.getHeadName()">
32349 amit.gupta 45
            </div>
46
 
47
            <div class="form-group col-md-6">
32567 tejbeer 48
                <label for="headDesign">Head Designation</label>
34329 aman.kumar 49
                #if($supplier.getHeadDesignation())
50
                    <input type="text" class="form-control" id="headDesign" name="inputHeadDesign"
51
                           placeholder="Head Designation" value="$supplier.getHeadDesignation()">
52
                #else
53
                    <input type="text" class="form-control" id="headDesign" name="inputHeadDesign"
54
                           placeholder="Head Designation" value="">
55
                #end
56
 
32349 amit.gupta 57
            </div>
58
            <div class="form-group col-md-6">
59
                <label for="headEmail">Head Email</label>
34329 aman.kumar 60
                <input type="email" class="form-control" id="headEmail" name="inputHeadEmail" placeholder="Head Email"
61
                       value="$supplier.getHeadEmail()">
32349 amit.gupta 62
            </div>
63
            <div class="form-group col-md-6">
64
                <label for="contactPerson">Contact Person</label>
65
                <input type="text" class="form-control" id="contactPerson" name="inputContactPerson"
34329 aman.kumar 66
                       placeholder="Contact Person" value="$supplier.getContactName()">
32349 amit.gupta 67
            </div>
68
            <div class="form-group col-md-6">
32567 tejbeer 69
                            <label for="contactPhone">Contact Phone</label>
70
                            <input type="number" class="form-control" id="contactPhone" name="inputContactPhone"
71
                                   placeholder="Contact Phone" value="$supplier.getContactPhone()">
72
                        </div>
73
            <div class="form-group col-md-6">
32349 amit.gupta 74
                <label for="contactEmail">Contact Email</label>
75
                <input type="email" class="form-control" id="contactEmail" name="inputContactEmail"
32567 tejbeer 76
                       placeholder="Contact Email" value="$supplier.getContactEmail()">
32349 amit.gupta 77
            </div>
78
            <div class="form-group col-md-6">
32567 tejbeer 79
                                        <label for="document">Document</label>
80
                                        <input type="file" id="document" name="inputDocument">
81
 
82
                         </div>
34329 aman.kumar 83
            ##            <div class="form-group col-md-6">
84
            ##                <label for="contactFax">Contact Fax</label>
85
            ##                <input type="text" class="form-control" id="contactFax" name="inputContactFax"
86
            ##                       placeholder="Contact Fax" value="$supplier.getContactFax()">
87
            ##            </div>
32349 amit.gupta 88
 
89
            <div class="form-group col-md-6">
90
                <label for="registeredAddress">Registered Address</label>
91
                <input type="text" class="form-control" id="registeredAddress" name="inputRegisteredAddress"
34329 aman.kumar 92
                       placeholder="Registered Address" value="$supplier.getRegisteredAddress()" readonly>
32349 amit.gupta 93
            </div>
94
            <div class="form-group col-md-6">
95
                <label for="communicationAddress">Communication Address</label>
96
                <input type="text" class="form-control" id="communicationAddress" name="inputCommunicationAddress"
32567 tejbeer 97
                       placeholder="Communication Address" value="$supplier.getCommunicationAddress()">
32349 amit.gupta 98
            </div>
99
            <div class="form-group col-md-6">
100
                <label for="terms&Conditions">Terms & Conditions</label>
101
                <input type="text" class="form-control" id="terms&Conditions" name="inputTermConditions"
34329 aman.kumar 102
                       placeholder="Terms & Conditions" value="$supplier.getTnc()">
32349 amit.gupta 103
            </div>
32567 tejbeer 104
            <div class="form-group col-md-6">
35922 ranu 105
                <input type="checkbox" id="warehouseCheckbox" name="warehouseCheckbox" value=""
106
                    #if($supplier.getInternalWarehouseId()) checked #end>
107
                <label for="warehouseCheckbox">Internal Warehouse</label><br>
108
            </div>
109
            <div class="form-group col-md-6">
110
                <label for="warehouse">Warehouse Name</label>
111
                <select class="form-control input-sm" id="internalWarehouseId" name="internalWarehouseId"
112
                        placeholder="Warehouse Name"
113
                    #if(!$supplier.getInternalWarehouseId()) disabled #end>
114
                    <option value="" disabled #if(!$supplier.getInternalWarehouseId()) selected #end>Warehouse Name
115
                    </option>
116
                    #foreach($warehouseEntry in $warehouseMap.entrySet())
117
                        <option value="$warehouseEntry.getKey()"
118
                            #if($supplier.getInternalWarehouseId() && $supplier.getInternalWarehouseId() == $warehouseEntry.getKey())
119
                                selected #end>
120
                            $warehouseEntry.getValue()
121
                        </option>
122
                    #end
123
                </select>
124
            </div>
32349 amit.gupta 125
 
126
            <div class="form-group col-md-6">
127
                <label for="warehouseLocation">Warehouse Location</label>
128
                <select class="chosen-select" id="warehouseLocation" name="inputWarehouseLocation"
129
                        data-placeholder="Warehouse Location" multiple style="width:500px;" tabindex="4">
32779 shampa 130
                    #foreach($warehouseIdAndStateEntry in $warehouseIdAndState.entrySet())
131
                        <option value="$warehouseIdAndStateEntry.getKey()"
34329 aman.kumar 132
                            #if($supplierPhysicalWarehouseIds.contains($warehouseIdAndStateEntry.getKey()))
133
                                selected #end >
32779 shampa 134
                        $warehouseIdAndStateEntry.getValue().getPrefix()
135
                            ($warehouseIdAndStateEntry.getValue().getStateName())
32349 amit.gupta 136
                        </option>
137
                    #end
138
                </select>
139
            </div>
140
 
32567 tejbeer 141
 
32349 amit.gupta 142
            <div class="form-group col-md-6">
143
                <label for="state">State</label>
144
                <select class="form-control input-sm" id="stateId" name="stateId" placeholder="State"
32779 shampa 145
                        >
146
                    <option value="" disabled>State </option>
34329 aman.kumar 147
                    #foreach($stateName in $state)
148
                        <option value="$stateName.getId()"
149
                            #if($stateName.getId() == $supplier.getStateId()) selected #end
150
                        >$stateName.getName()</option>
32349 amit.gupta 151
                    #end
152
                </select>
153
            </div>
154
 
155
            <div class="form-group col-md-6">
156
                <label for="pOValidityLimit">PO Validity Days Limit</label>
157
                <input type="number" class="form-control" id="pOValidityLimit" name="inputPOValidityLimit"
34329 aman.kumar 158
                       placeholder="PO Validity Days Limit" value="$supplier.getPoValidityLimit()">
32349 amit.gupta 159
            </div>
160
            <div class="form-group col-md-6">
34329 aman.kumar 161
                <button type="button" class="btn btn-primary submit-supplier-edit " style="margin: 20px;"
162
                        data-dd="$supplier.getId()">Update
32349 amit.gupta 163
                </button>
164
 
165
            </div>
166
        </div>
167
    </form>
168
</section>
169
 
170
<script>
171
 
172
    $(document).ready(function () {
173
        $('.chosen-select').chosen({
174
            search_contains: true
175
 
176
        });
35922 ranu 177
 
178
        // Handle internal warehouse checkbox toggle
179
        $('#warehouseCheckbox').on('change', function () {
180
            const warehouseSelect = $('#internalWarehouseId');
181
            if (this.checked) {
182
                warehouseSelect.prop('disabled', false);
183
            } else {
184
                warehouseSelect.prop('disabled', true);
185
                warehouseSelect.val('');
186
            }
187
        });
32349 amit.gupta 188
    });
189
 
34329 aman.kumar 190
    function isValidGST(gstin) {
191
        const gstRegex = /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[A-Z0-9]{1}[Z]{1}[A-Z0-9]{1}$/;
192
        return gstRegex.test(gstin);
193
    }
194
 
195
    // Check GST field on document ready
196
    $(document).ready(function () {
197
        const gstInput = $('#gst');
198
        const gstin = gstInput.val().trim();
199
 
200
        // Check if GST is valid
201
        if (gstin && isValidGST(gstin)) {
202
            gstInput.prop('readonly', true);
203
        } else {
204
            gstInput.prop('readonly', false);
205
        }
206
 
207
        // If GSTIN field changes, validate it dynamically
208
        gstInput.on('input', function () {
209
            const gstValue = $(this).val().trim();
210
            if (isValidGST(gstValue)) {
211
                $(this).prop('readonly', true);
212
            } else {
213
                $(this).prop('readonly', false);
214
            }
215
        });
216
    });
217
 
32349 amit.gupta 218
</script>
28494 tejbeer 219
 
220
 
221