Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
31702 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>Manage PCM
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>Manage PCM</li>
11
            </ol>
12
        </div>
13
    </div>
14
    <div class="row">
15
        <div class="col-lg-10">
16
            <table class="table table-condensed" id="partner-pcm">
17
                <thead>
18
                <tr>
32381 jai.hind 19
                    <th>Id</th>
20
                    <th>Code</th>
31702 amit.gupta 21
                    <th>Partner Name</th>
22
                    <th>City</th>
23
                    <th>State</th>
24
                    <th>PCM Date</th>
25
                </tr>
26
                </thead>
27
                <tbody>
28
                    #foreach($retailer in $retailerMap.values())
29
                    <tr>
30
                        <td>$retailer.getPartnerId()</td>
31
                        <td>$retailer.getCode()</td>
32
                        <td>$retailer.getBusinessName()</td>
33
                        <td>$retailer.getAddress().getCity()</td>
34
                        <td>$retailer.getAddress().getState()</td>
35
                        <td><input type="date" onchange="onPcmDateChanged(this)" data-id="$retailer.getPartnerId()"
36
                            #if($samsungPCMMap.get($retailer.getPartnerId()))
37
                                   value="$samsungPCMMap.get($retailer.getPartnerId())"
38
                            #end
39
                        />
40
                        </td>
41
                    </tr>
42
                    #end
43
                </tbody>
44
            </table>
45
        </div>
46
    </div>
47
</section>
48
 
49
<script type="text/javascript">
50
    $(document).ready(function () {
51
        $('#partner-pcm').DataTable({
52
            "lengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
53
        });
54
    });
55
 
56
    function onPcmDateChanged(pcmDateInput, event) {
57
        console.log(typeof pcmDateInput.value);
58
        const fofoId = $(pcmDateInput).data("id");
59
        if (confirm("Are you sure you want to change the PCM Date")) {
60
            let pcmModel = {
61
                fofoId: fofoId,
62
                pcmDate: pcmDateInput.value
63
            }
64
            doPostAjaxRequestWithJsonHandler(`${context}/brand-pcm`, JSON.stringify(pcmModel), function (response) {
65
                if (response) {
66
                    alert("Date updated Successfully");
67
                    window.open(`${context}/brand-pcm/download?fofoId=${fofoId}`, "_blank");
68
                }
69
            });
70
        } else {
71
            pcmDateInput.value = pcmDateInput.oldValue;
72
        }
73
 
74
    }
75
 
76
 
77
</script>