Subversion Repositories SmartDukaan

Rev

Rev 32390 | Rev 32551 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32390 Rev 32549
Line 54... Line 54...
54
                    }
54
                    }
55
                });
55
                });
56
        }
56
        }
57
 
57
 
58
    });
58
    });
-
 
59
 
-
 
60
    //$(document).on('click', ".submit-edit", function () {
-
 
61
           // let supplierId = $(this).data('id');
-
 
62
            //if (confirm("Are you sure you want to edit this Supplier") == true) {
-
 
63
               // doGetAjaxRequestHandler(`${context}/supplier/edit/${supplierId}`,
-
 
64
                    //function (response) {
-
 
65
                     //   loadMainContent(response);
-
 
66
                    //});
-
 
67
            //}
-
 
68
 
-
 
69
       // });//
59
    $(document).on('click', ".taxation", function () {
70
    $(document).on('click', ".taxation", function () {
60
        loadTaxation("main-content");
71
        loadTaxation("main-content");
61
    });
72
    });
62
 
73
 
63
 
74
 
-
 
75
 
64
    $(document).on('click', ".create-warehouse", function () {
76
    $(document).on('click', ".create-warehouse", function () {
65
        loadCreateWarehouse("main-content");
77
        loadCreateWarehouse("main-content");
66
    });
78
    });
67
 
79
 
68
    $(document).on('click', ".warehouses", function () {
80
    $(document).on('click', ".warehouses", function () {
Line 182... Line 194...
182
        "userId": userId,
194
        "userId": userId,
183
        "itemIdQuantityMap": itemIdQuantityMap
195
        "itemIdQuantityMap": itemIdQuantityMap
184
    });
196
    });
185
    doPostAjaxRequestWithJsonHandler(context + "/instructionItem", postData, function (response) {
197
    doPostAjaxRequestWithJsonHandler(context + "/instructionItem", postData, function (response) {
186
        $('#main-content').html(response);
198
        $('#main-content').html(response);
187
        alert("Instructoin created successfully");
199
        alert("Instruction created successfully");
188
    });
200
    });
189
}
201
}
190
 
202
 
191
function configureWarehouseInstructionItemsDropDown() {
203
function configureWarehouseInstructionItemsDropDown() {
192
    $(document).ready(function () {
204
    $(document).ready(function () {
Line 220... Line 232...
220
    });
232
    });
221
}
233
}
222
 
234
 
223
function loadCreateWarehouse(domId) {
235
function loadCreateWarehouse(domId) {
224
    doGetAjaxRequestHandler(context + "/createWarehouse", function (response) {
236
    doGetAjaxRequestHandler(context + "/createWarehouse", function (response) {
225
        $('#' + domId).html(response);
237
        loadMainContent(response);
226
    });
238
    });
227
}
239
}
228
 
240
 
229
function loadTaxation(domId) {
241
function loadTaxation(domId) {
230
    doGetAjaxRequestHandler(context + "/createTaxation", function (response) {
242
    doGetAjaxRequestHandler(context + "/createTaxation", function (response) {
231
        $('#' + domId).html(response);
243
        loadMainContent(response);
232
    });
244
    });
233
}
245
}
234
 
246
 
235
function loadWarehouses(domId) {
247
function loadWarehouses(domId) {
236
    doGetAjaxRequestHandler(context + "/getWarehouses", function (response) {
248
    doGetAjaxRequestHandler(context + "/getWarehouses", function (response) {
Line 304... Line 316...
304
 
316
 
305
 
317
 
306
});
318
});
307
 
319
 
308
 
320
 
-
 
321
$(document).on('change', '#warehouseCheckbox', function(){
-
 
322
    let warehouseContainer = document.getElementById("warehouseId");
-
 
323
    warehouseContainer.disabled = !this.checked;
-
 
324
});
309
$(document).on('click', ".create-supplier-submit", function () {
325
$(document).on('click', ".create-supplier-submit", function () {
310
    console.log("hello");
326
    console.log("hello");
311
    var name = $("form#new-supplier-create-form input[name=inputName]").val();
327
    var name = $("form#new-supplier-create-form input[name=inputName]").val();
312
    if (name === "") {
328
    if (name === "") {
313
        alert("Name is required");
329
        alert("Name is required");
Line 331... Line 347...
331
    var headName = $("form#new-supplier-create-form input[name=inputHeadName]").val();
347
    var headName = $("form#new-supplier-create-form input[name=inputHeadName]").val();
332
    if (headName === "") {
348
    if (headName === "") {
333
        alert("Head Name is required");
349
        alert("Head Name is required");
334
        return false;
350
        return false;
335
    }
351
    }
336
    var headDesign = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
352
    var headDesign = $("form#new-supplier-create-form input[name=inputHeadDesign]").val();
337
    if (headDesign === "") {
353
    if (headDesign === "") {
338
        alert("Head Designation is required");
354
        alert("Head Designation is required");
339
        return false;
355
        return false;
340
    }
356
    }
341
 
357
 
Line 347... Line 363...
347
    var contactPerson = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
363
    var contactPerson = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
348
    if (contactPerson === "") {
364
    if (contactPerson === "") {
349
        alert("Contact Person is required");
365
        alert("Contact Person is required");
350
        return false;
366
        return false;
351
    }
367
    }
-
 
368
    var contactPhone = $("form#new-supplier-create-form input[name=inputContactPhone]").val();
-
 
369
        if (contactPhone === "") {
-
 
370
            alert("Contact Phone is required");
-
 
371
            return false;
-
 
372
        }
352
    var registeredAddress = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
373
    var registeredAddress = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
353
    if (registeredAddress === "") {
374
    if (registeredAddress === "") {
354
        alert("Registered Address is required");
375
        alert("Registered Address is required");
355
        return false;
376
        return false;
356
    }
377
    }
Line 363... Line 384...
363
    var warehouseId = $("#warehouseLocation").val();
384
    var warehouseId = $("#warehouseLocation").val();
364
    if (warehouseId === "") {
385
    if (warehouseId === "") {
365
        alert("Warehouse Location  is required");
386
        alert("Warehouse Location  is required");
366
        return false;
387
        return false;
367
    }
388
    }
-
 
389
    var warehouseName = $("#warehouseId").val();
-
 
390
        if (warehouseName === "") {
-
 
391
            alert("warehouseName  is required");
-
 
392
            return false;
-
 
393
        }
368
 
394
 
369
    var state = $("#stateId").val();
395
    var state = $("#stateId").val();
370
    if (state === "") {
396
    if (state === "") {
371
        alert("state  is required");
397
        alert("state  is required");
372
        return false;
398
        return false;
Line 379... Line 405...
379
    var termConditions = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
405
    var termConditions = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
380
    if (termConditions === "") {
406
    if (termConditions === "") {
381
        alert("termConditions  is required");
407
        alert("termConditions  is required");
382
        return false;
408
        return false;
383
    }
409
    }
-
 
410
    var internalWarehouse = $("#internalWarehouseId").val();
-
 
411
            if (internalWarehouse === "") {
-
 
412
                alert("internalWarehouse  is required");
-
 
413
                return false;
-
 
414
            }
384
 
415
 
385
    var json = newSuppilerObjectJson();
416
    var json = newSupplierCreateObjectJson();
386
 
417
 
387
 
418
 
388
    if (confirm("Are you sure you want to create supplier") == true) {
419
    if (confirm("Are you sure you want to create supplier")) {
389
        doAjaxRequestWithJsonHandler(context + "/submitNewSupplier", "POST", json, function (response) {
420
        doAjaxRequestWithJsonHandler(context + "/submitNewSupplier", "POST", json, function (response) {
390
            if (response == "true") {
421
                if(response){
391
                if (confirm("Are you sure you want to create New Supplier") == true) {
422
                    alert("Supplier created successfully. Its inactive as of now, pls check inactive section");
392
 
423
 
393
                    $("#main-content").html(response);
424
                    $("#main-content").html(response);
394
                }
425
                }
395
            }
426
            }
396
        });
427
        );
397
    }
428
    }
398
});
429
});
399
 
430
 
400
function newSuppilerObjectJson() {
431
function newSupplierCreateObjectJson() {
401
    var newSupplierCreateObject = {};
432
    var newSupplierCreateObject = {};
402
 
433
 
-
 
434
 
403
    newSupplierCreateObject['name'] = $("form#new-supplier-create-form input[name=inputName]").val();
435
    newSupplierCreateObject['name'] = $("form#new-supplier-create-form input[name=inputName]").val();
404
 
436
 
405
    newSupplierCreateObject['phone'] = $("form#new-supplier-create-form input[name=inputPhone]").val();
437
    newSupplierCreateObject['phone'] = $("form#new-supplier-create-form input[name=inputPhone]").val();
406
    newSupplierCreateObject['gst'] = $("form#new-supplier-create-form input[name=inputGst]").val();
438
    newSupplierCreateObject['gst'] = $("form#new-supplier-create-form input[name=inputGst]").val();
407
    newSupplierCreateObject['pan'] = $("form#new-supplier-create-form input[name=inputPan]").val();
439
    newSupplierCreateObject['pan'] = $("form#new-supplier-create-form input[name=inputPan]").val();
408
    newSupplierCreateObject['fax'] = $("form#new-supplier-create-form input[name=inputFax]").val();
440
    newSupplierCreateObject['fax'] = $("form#new-supplier-create-form input[name=inputFax]").val();
409
    newSupplierCreateObject['headName'] = $("form#new-supplier-create-form input[name=inputHeadName]").val();
441
    newSupplierCreateObject['headName'] = $("form#new-supplier-create-form input[name=inputHeadName]").val();
410
    newSupplierCreateObject['headDesign'] = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
442
    newSupplierCreateObject['headDesign'] = $("form#new-supplier-create-form input[name=inputHeadDesig]").val();
411
    newSupplierCreateObject['headEmail'] = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
443
    newSupplierCreateObject['headEmail'] = $("form#new-supplier-create-form input[name=inputHeadEmail]").val();
412
    newSupplierCreateObject['contactPerson'] = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
444
    newSupplierCreateObject['contactPerson'] = $("form#new-supplier-create-form input[name=inputContactPerson]").val();
-
 
445
    newSupplierCreateObject['contactPhone'] = $("form#new-supplier-create-form input[name=inputContactPhone]").val();
413
    newSupplierCreateObject['contactEmail'] = $("form#new-supplier-create-form input[name=inputContactEmail]").val();
446
    newSupplierCreateObject['contactEmail'] = $("form#new-supplier-create-form input[name=inputContactEmail]").val();
414
    newSupplierCreateObject['contactFax'] = $("form#new-supplier-create-form input[name=inputContactFax]").val();
447
    newSupplierCreateObject['contactFax'] = $("form#new-supplier-create-form input[name=inputContactFax]").val();
415
    newSupplierCreateObject['registeredAddress'] = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
448
    newSupplierCreateObject['registeredAddress'] = $("form#new-supplier-create-form input[name=inputRegisteredAddress]").val();
416
    newSupplierCreateObject['communicationAddress'] = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
449
    newSupplierCreateObject['communicationAddress'] = $("form#new-supplier-create-form input[name=inputCommunicationAddress]").val();
417
    newSupplierCreateObject['termConditions'] = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
450
    newSupplierCreateObject['termConditions'] = $("form#new-supplier-create-form input[name=inputTermConditions]").val();
418
    newSupplierCreateObject['warehouseId'] = $("#warehouseLocation").val();
451
    newSupplierCreateObject['warehouseId'] = $("#warehouseLocation").val();
-
 
452
    newSupplierCreateObject['internalWarehouseId'] = $("#internalWarehouse").val();
419
    newSupplierCreateObject['state'] = $("#stateId").val();
453
    newSupplierCreateObject['state'] = $("#stateId").val();
420
    newSupplierCreateObject['pOValidityLimit'] = $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
454
    newSupplierCreateObject['pOValidityLimit'] = $("form#new-supplier-create-form input[name=inputPOValidityLimit]").val();
421
 
455
 
422
 
456
 
423
    return JSON.stringify(newSupplierCreateObject);
457
    return JSON.stringify(newSupplierCreateObject);
424
}
458
}
425
 
-
 
426
 
-
 
427
 
-
 
428
 
-
 
429
 
-
 
430
 
-
 
431
 
-
 
432
459