Rev 36641 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<section class="wrapper"><div class="row"><div class="col-lg-12"><h3 class="page-header"><i class="icon_document_alt"></i> BEAT PLAN - BULK UPLOAD</h3><ol class="breadcrumb"><li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li><li><i class="icon_document_alt"></i>Beat Plan Bulk Upload</li></ol></div></div><div class="row"><div class="col-lg-8"><div class="panel panel-default"><div class="panel-heading"><strong>Upload Beat Plans (XLSX)</strong><a href="${rc.contextPath}/beatPlan/downloadTemplate" class="btn btn-xs btn-info pull-right">DownloadTemplate</a></div><div class="panel-body"><p style="margin-bottom:15px;color:#666;">Upload an Excel file (.xlsx) to create beat plans and schedule them on the calendar in onego.<br><strong>One partner per row.</strong> Beats are grouped by <strong>beat_name +auth_user_id</strong>.</p><div class="well" style="background:#f9f9f9;"><strong>XLSX Format (one row = one partner):</strong><table class="table table-bordered table-condensed" style="margin-top:10px;font-size:12px;"><thead><tr style="background:#eee;"><th>beat_name</th><th>auth_user_id</th><th>start_date</th><th>day_number</th><th>sequence_order</th><th>partner_code</th></tr></thead><tbody><tr><td>Jaipur East Route</td><td>280</td><td>2026-06-02</td><td>1</td><td>1</td><td>RJKAI1478</td></tr><tr><td></td><td></td><td></td><td>1</td><td>2</td><td>RJBUN1449</td></tr><tr><td></td><td></td><td></td><td>1</td><td>3</td><td>RJDEG1443</td></tr><tr><td></td><td></td><td></td><td>2</td><td>1</td><td>RJALR1362</td></tr><tr><td></td><td></td><td></td><td>2</td><td>2</td><td>RJBTR1388</td></tr><tr><td></td><td></td><td></td><td>3</td><td>1</td><td>RJRSD1518</td></tr><tr><td></td><td></td><td></td><td>3</td><td>2</td><td>RJSML356</td></tr><tr style="border-top:2px solid #ccc;"><td>Agra Circuit</td><td>145</td><td>2026-06-05</td><td>1</td><td>1</td><td>UPAGR101</td></tr><tr><td></td><td></td><td></td><td>1</td><td>2</td><td>UPAGR102</td></tr></tbody></table><p style="font-size:11px;color:#888;"><strong>beat_name</strong>: Name for the beat - <strong>only on the first row of thebeat</strong>.Leave blank for subsequent rows of the same beat. Extra spaces are normalized automatically.<br><strong>auth_user_id</strong>: Sales user ID - <strong>only on the first row of thebeat</strong>.<br><strong>start_date</strong>: Start date (YYYY-MM-DD) - <strong>only on the first row of thebeat</strong>.System auto-calculates remaining days, skipping holidays. Leave empty for unscheduledbeat.<br><strong>day_number</strong>: Day within the beat (1, 2, 3...) - required on every row.<br><strong>sequence_order</strong>: Visit order within the day (1, 2, 3...). Optional - roworder is used if blank.<br><strong>partner_code</strong>: Single partner code for this row.<br><br>Multiple beats in one file - just start a new beat row (non-blank beat_name) wherever youwant to switch.</p></div><form id="beat-bulk-form" enctype="multipart/form-data" style="margin-top:15px;"><div class="form-group"><label>Select XLSX File</label><input type="file" id="beat-bulk-file" name="file" accept=".xlsx" class="form-control"></div><div class="checkbox" style="margin-bottom:10px;"><label><input type="checkbox" id="beat-bulk-include-sundays"> Include Sundays (don't skipSundays when scheduling)</label></div><button type="button" class="btn btn-primary beat-bulk-submit">Upload & Process</button></form><div id="beat-bulk-result" style="display:none;margin-top:15px;"></div></div></div></div></div></section><script>$(document).on('click', '.beat-bulk-submit', function () {var fileInput = document.getElementById('beat-bulk-file');if (!fileInput.files || !fileInput.files[0]) {alert('Please select an XLSX file');return;}var formData = new FormData();formData.append('file', fileInput.files[0]);formData.append('includeSundays', $('#beat-bulk-include-sundays').is(':checked'));var $btn = $(this);$btn.prop('disabled', true).text('Processing...');$.ajax({url: context + '/beatPlan/bulkUploadProcess',type: 'POST',data: formData,processData: false,contentType: false,success: function (response) {$btn.prop('disabled', false).text('Upload & Process');var data = response.response || response;var html = '<div class="alert alert-' + (data.errors > 0 ? 'warning' : 'success') + '">';html += '<strong>Done!</strong> ' + data.beatsCreated + ' beat(s) created.';if (data.errors > 0) {html += ' ' + data.errors + ' error(s).';html += '<ul style="margin-top:8px;font-size:12px;">';(data.errorMessages || []).forEach(function (msg) {html += '<li>' + msg + '</li>';});html += '</ul>';}html += '</div>';$('#beat-bulk-result').html(html).show();},error: function (xhr) {$btn.prop('disabled', false).text('Upload & Process');$('#beat-bulk-result').html('<div class="alert alert-danger">Error: ' + (xhr.responseText || xhr.statusText) + '</div>').show();}});});</script>