Subversion Repositories SmartDukaan

Rev

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

Rev 33973 Rev 35346
Line 75... Line 75...
75
                        </a>
75
                        </a>
76
                    </div>
76
                    </div>
77
                </form>
77
                </form>
78
            </div>
78
            </div>
79
        </div>
79
        </div>
-
 
80
 
-
 
81
        <div class="row" style="display: none;">
-
 
82
            <div class="col-lg-12">
-
 
83
                <form class="form-horizontal">
-
 
84
                    <label class="control-label col-sm-2" for="videocsvfile">Upload Video CSV:</label>
-
 
85
                    <div class="col-lg-3">
-
 
86
                        <div class="input-group">
-
 
87
                            <input class="form-control" type="file" id="videocsv" name="videocsv">
-
 
88
                            <span class="input-group-btn">
-
 
89
                                    <button class="btn btn-default videofileupload">Upload</button>
-
 
90
                                </span>
-
 
91
                        </div>
-
 
92
                    </div>
-
 
93
                    <div class="col-lg-2">
-
 
94
                        <button onclick="downloadTestCSV()">Download Test CSV</button>
-
 
95
 
-
 
96
                    </div>
-
 
97
                </form>
-
 
98
            </div>
-
 
99
        </div>
-
 
100
 
80
        <div class="row">
101
        <div class="row">
81
            <div class="col-lg-12">
102
            <div class="col-lg-12">
82
                <form class="form-horizontal">
103
                <form class="form-horizontal">
83
                    <label class="control-label col-sm-2" for="excelfile">Add Catalog CSV File:</label>
104
                    <label class="control-label col-sm-2" for="excelfile">Add Catalog CSV File:</label>
84
                    <div class="col-lg-3">
105
                    <div class="col-lg-3">
Line 146... Line 167...
146
            } else {
167
            } else {
147
                alert("Please upload file!");
168
                alert("Please upload file!");
148
            }
169
            }
149
            return false;
170
            return false;
150
        });
171
        });
-
 
172
 
-
 
173
        $(document).ready(function () {
-
 
174
            $('button.videofileupload').on('click', function () {
-
 
175
 
-
 
176
                var fileSelector = $('#videocsv')[0];
-
 
177
 
-
 
178
                if (fileSelector && fileSelector.files[0]) {
-
 
179
 
-
 
180
                    if (confirm("Confirm Video URL Upload?")) {
-
 
181
 
-
 
182
                        doAjaxUploadRequestHandler(
-
 
183
                                "/content/video/upload",     // <-- new endpoint
-
 
184
                                "POST",
-
 
185
                                fileSelector.files[0],
-
 
186
                                function (response) {
-
 
187
                                    if (response) {
-
 
188
                                        alert("Video URLs updated successfully!");
-
 
189
                                    }
-
 
190
                                }
-
 
191
                        );
-
 
192
                    }
-
 
193
 
-
 
194
                } else {
-
 
195
                    alert("Please upload CSV file!");
-
 
196
                }
-
 
197
 
-
 
198
                return false;
-
 
199
            });
-
 
200
        });
-
 
201
 
-
 
202
 
-
 
203
 
151
        $('button.catalogfileupload').on('click', function () {
204
        $('button.catalogfileupload').on('click', function () {
152
            var fileSelector = $('#skupload')[0];
205
            var fileSelector = $('#skupload')[0];
153
            if (fileSelector != undefined && fileSelector.files[0] != undefined) {
206
            if (fileSelector != undefined && fileSelector.files[0] != undefined) {
154
                if (confirm("Confirm Upload?")) {
207
                if (confirm("Confirm Upload?")) {
155
                    doAjaxUploadRequestHandler("${rc.contextPath}/catalog/upload", "POST", fileSelector.files[0], function (response) {
208
                    doAjaxUploadRequestHandler("${rc.contextPath}/catalog/upload", "POST", fileSelector.files[0], function (response) {
Line 291... Line 344...
291
            placeholder: 'thumb-image-container',
344
            placeholder: 'thumb-image-container',
292
            forceHelperSize: true
345
            forceHelperSize: true
293
        });
346
        });
294
    });
347
    });
295
 
348
 
-
 
349
    function downloadTestCSV() {
-
 
350
        const csvContent =
-
 
351
                "serialNumber,catalogId,videoUrl\n" +
-
 
352
                "1,12345,https://cdn.example.com/videos/demo-video-1.mp4\n" +
-
 
353
                "2,12345,https://cdn.example.com/videos/demo-video-2.mp4\n" +
-
 
354
                "3,54321,https://cdn.example.com/videos/demo-video-3.mp4";
-
 
355
 
-
 
356
        const blob = new Blob([csvContent], {type: "text/csv;charset=utf-8;"});
-
 
357
 
-
 
358
        const link = document.createElement("a");
-
 
359
        link.href = URL.createObjectURL(blob);
-
 
360
        link.download = "video_upload_test.csv";
-
 
361
        link.click();
-
 
362
    }
-
 
363
 
-
 
364
 
296
</script>
365
</script>