Subversion Repositories SmartDukaan

Rev

Rev 35336 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35336 Rev 35971
Line 408... Line 408...
408
                            <input type="number" class="form-control" required name="storePotential"
408
                            <input type="number" class="form-control" required name="storePotential"
409
                                   min="400000" id="storePotential"
409
                                   min="400000" id="storePotential"
410
                                   placeholder="Store Potential" value="">
410
                                   placeholder="Store Potential" value="">
411
                        </div>
411
                        </div>
412
                    </div>
412
                    </div>
413
                    <div class="col-lg-3">
413
                </div>
414
                        <!-- Finance Code -->
414
                <div class="row">
415
                        <div class="form-group">
415
                    <div class="col-lg-12">
416
                            <label>Finance Code</label>
416
                        <h4>Finance Codes</h4>
417
                            <span style="color:red ;font-size: 140%"></span>
-
 
418
                            <input type="text" class="form-control" required name="finCode"
-
 
419
                                   id="mk_finance_Code"
-
 
420
                                   placeholder="Finance code" value="">
-
 
421
                        </div>
-
 
422
                    </div>
417
                    </div>
-
 
418
                    #foreach($finOption in $paperFinanceOptions)
-
 
419
                        <div class="col-lg-3">
-
 
420
                            <div class="form-group">
-
 
421
                                <label>$finOption.getName()</label>
-
 
422
                                <input type="text" class="form-control finance-code-input"
-
 
423
                                       data-payment-option-id="$finOption.getId()"
-
 
424
                                       name="finCode_$finOption.getId()"
-
 
425
                                       placeholder="Finance code" value="">
-
 
426
                            </div>
-
 
427
                        </div>
-
 
428
                    #end
423
                </div>
429
                </div>
424
                <h4>Brand Commitment</h4>
430
                <h4>Brand Commitment (Qty)</h4>
425
                <div id="loiBrandCommitment form-contro" class="row">
431
                <div id="loiBrandCommitment form-contro" class="row">
426
                    #foreach($brandCommit in $brandCommits)
432
                    #foreach($brandCommit in $brandCommits)
427
                        <div class="col-lg-3">
433
                        <div class="col-lg-3">
428
                            <div class="form-group">
434
                            <div class="form-group">
429
                                <label>$brandCommit.getBrand()</label><span
435
                                <label>$brandCommit.getBrand() (Qty)</label><span
430
                                    style="color:red ;font-size: 140%">*</span>
436
                                    style="color:red ;font-size: 140%">*</span>
431
                                <input type="number" class="form-control brand-commitment" required
437
                                <input type="number" class="form-control brand-commitment" required
432
                                       name="$brandCommit.getBrand()" value="">
438
                                       name="$brandCommit.getBrand()" min="0" max="1000" placeholder="0" value="">
433
                            </div>
439
                            </div>
434
                        </div>
440
                        </div>
435
                    #end
441
                    #end
436
                    <div>
442
                    <div>
437
                        <div class="col-lg-3">
443
                        <div class="col-lg-3">
438
                            <div class="form-group">
444
                            <div class="form-group">
439
                                <label>Accessories</label><span
445
                                <label>Accessories (Qty)</label><span
440
                                    style="color:red ;font-size: 140%">*</span>
446
                                    style="color:red ;font-size: 140%">*</span>
441
                                <input type="number" class="form-control brand-commitment" required
447
                                <input type="number" class="form-control brand-commitment" required
442
                                       name="Accessories" value="">
448
                                       name="Accessories" min="0" max="1000" placeholder="0" value="">
443
                            </div>
449
                            </div>
444
                        </div>
450
                        </div>
445
                        <div class="col-lg-3">
451
                        <div class="col-lg-3">
446
                            <div class="form-group">
452
                            <div class="form-group">
447
                                <label>Other</label><span
453
                                <label>Other (Qty)</label><span
448
                                    style="color:red ;font-size: 140%">*</span>
454
                                    style="color:red ;font-size: 140%">*</span>
449
                                <input type="number" class="form-control brand-commitment" required
455
                                <input type="number" class="form-control brand-commitment" required
450
                                       name="Other" value="">
456
                                       name="Other" min="0" max="1000" placeholder="0" value="">
451
                            </div>
457
                            </div>
452
                        </div>
458
                        </div>
453
                        <div class="col-lg-3">
459
                        <div class="col-lg-3">
454
                            <div class="form-group">
460
                            <div class="form-group">
455
                                <label>Total Commitment</label>
461
                                <label>Total Qty</label>
456
                                <span style="font-size: 140%"></span>
462
                                <span style="font-size: 140%"></span>
457
                                <input type="number" class="form-control " name="totaCommitmentAmount" id="totalAmount"
463
                                <input type="number" class="form-control " name="totaCommitmentAmount" id="totalAmount"
458
                                       readonly required
464
                                       readonly required
459
                                       placeholder="Total Commitment" value="">
465
                                       placeholder="Total Qty" value="">
460
                            </div>
466
                            </div>
461
                        </div>
467
                        </div>
462
                    </div>
468
                    </div>
463
                </div>
-
 
464
                <div class="row">
469
                    <div id="lessCommitReasonSection" style="display: none;">
465
                    <div class="col-lg-4">
470
                        <div class="col-lg-12">
466
                        <div class="form-group hide-textarea" id="textArea">
471
                            <div class="form-group">
467
                            <label>Reason for less Commit</label><span
472
                                <label>Reason for Less Commitment</label><span
468
                                style="color:red ;font-size: 140%">*</span>
473
                                    style="color:red ;font-size: 140%">*</span>
469
                            <input type="text" class="form-control " name="lessCommitReason" id="lessCommitReason"
474
                                <textarea class="form-control" name="lessCommitReason" rows="2"
470
                                   placeholder="specify the reason"
475
                                          placeholder="Please provide reason for commitment below 70% of store potential"></textarea>
471
                                   value="">
476
                            </div>
472
 
-
 
473
                        </div>
477
                        </div>
474
                    </div>
478
                    </div>
475
                </div>
479
                </div>
476
                ##                Agreed Brand fees (INR)
480
                ##                Agreed Brand fees (INR)
477
                <div class="row">
481
                <div class="row">
Line 524... Line 528...
524
                    <div class="col-lg-4">
528
                    <div class="col-lg-4">
525
                        <div class="form-group">
529
                        <div class="form-group">
526
                            <label>Payment Reference No</label><span
530
                            <label>Payment Reference No</label><span
527
                                style="color:red ;font-size: 140%">*</span>
531
                                style="color:red ;font-size: 140%">*</span>
528
                            <input type="text" class="form-control" id="paymentReferenceNo" required
532
                            <input type="text" class="form-control" id="paymentReferenceNo" required
529
                                   name="paymentReferenceNo" placeholder="">
533
                                   name="paymentReferenceNo" placeholder="Payment Reference No">
530
                        </div>
534
                        </div>
531
                    </div>
535
                    </div>
532
                    <!-- fee collection date -->
536
                    <!-- fee collection date -->
533
                    <div class="col-lg-4">
537
                    <div class="col-lg-4">
534
                        <div class="form-group">
538
                        <div class="form-group">
Line 659... Line 663...
659
        brandCommitmentInputs[brandCommitmentInputs.length - 1].addEventListener("blur", function () {
663
        brandCommitmentInputs[brandCommitmentInputs.length - 1].addEventListener("blur", function () {
660
            updateTotalCommitmentAmount();
664
            updateTotalCommitmentAmount();
661
        });
665
        });
662
 
666
 
663
        function updateTotalCommitmentAmount() {
667
        function updateTotalCommitmentAmount() {
664
            // Recalculate the total commitment amount
668
            // Recalculate the total commitment qty
665
            totalCommitmentAmount = 0;
669
            totalCommitmentAmount = 0;
-
 
670
            var hasInvalidQty = false;
666
            brandCommitmentInputs.forEach(function (input) {
671
            brandCommitmentInputs.forEach(function (input) {
667
                var commitmentValue = parseInt(input.value);
672
                var commitmentValue = parseInt(input.value);
668
                if (!isNaN(commitmentValue)) {
673
                if (!isNaN(commitmentValue)) {
-
 
674
                    if (commitmentValue > 1000) {
-
 
675
                        hasInvalidQty = true;
-
 
676
                        input.classList.add('border-red');
-
 
677
                    } else {
-
 
678
                        input.classList.remove('border-red');
669
                    totalCommitmentAmount += commitmentValue;
679
                        totalCommitmentAmount += commitmentValue;
-
 
680
                    }
670
                }
681
                }
671
            });
682
            });
672
 
683
 
-
 
684
            if (hasInvalidQty) {
-
 
685
                alert("Quantity per brand cannot exceed 1000. Please enter valid quantities.");
-
 
686
            }
-
 
687
 
673
            var totalCommitmentInput = document.getElementById("totalAmount");
688
            var totalCommitmentInput = document.getElementById("totalAmount");
674
            totalCommitmentInput.value = totalCommitmentAmount;
689
            totalCommitmentInput.value = totalCommitmentAmount;
675
 
690
 
676
            var storePotential = document.getElementById("storePotential").value;
691
            // Check 70% validation: (totalQty × 20000) >= 70% of storePotential
677
            var minCommitLimit = storePotential * 0.7; // 70% of the store's potential
692
            var storePotential = parseInt($('input[name="storePotential"]').val()) || 0;
678
            if (totalCommitmentAmount >= minCommitLimit) {
693
            var estimatedValue = totalCommitmentAmount * 20000;
679
                totalCommitmentInput.classList.remove('border-red');
694
            var minRequired = 0.7 * storePotential;
680
                totalCommitmentInput.classList.add('border-green');
695
            var lessCommitSection = document.getElementById("lessCommitReasonSection");
681
                document.getElementById("textArea").classList.remove('show-textarea');
696
            if (estimatedValue < minRequired && storePotential > 0) {
682
                document.getElementById("textArea").classList.add('hide-textarea');
697
                lessCommitSection.style.display = "block";
683
            } else {
698
            } else {
684
                alert("Total commit amount should be greater than or equal to 70% of the store's potential. Specify the reason");
-
 
685
                totalCommitmentInput.classList.remove('border-green');
-
 
686
                totalCommitmentInput.classList.add('border-red');
699
                lessCommitSection.style.display = "none";
687
                document.getElementById("textArea").classList.remove('hide-textarea');
-
 
688
                document.getElementById("textArea").classList.add('show-textarea');
-
 
689
                document.getElementById("textArea").focus();
-
 
690
            }
700
            }
691
        }
701
        }
692
    });
702
    });
693
    $(".gstNo").on("input", function () {
703
    $(".gstNo").on("input", function () {
694
        this.value = this.value.toUpperCase();
704
        this.value = this.value.toUpperCase();