cloudlog/application/views/backup/import_preview.php
Peter Goodhall 79cd4b4397 Add user-level backup and restore functionality
Introduces user-facing JSON+ZIP export and import for stations, logbooks, and QSOs, including preview and progress views. Updates backup controller to allow all authenticated operators (level 2+) and replaces legacy backup card with new workflow in the UI. Adds new views for import preview and progress, supporting selective import and conflict handling.
2025-11-24 17:30:40 +00:00

48 lines
No EOL
2 KiB
PHP

<div class="mt-3">
<h5>Import Preview</h5>
<form method="post" hx-post="<?php echo site_url('backup/user_do_import'); ?>" hx-target="#user-import-progress" hx-swap="innerHTML">
<div class="row">
<div class="col-md-6">
<h6>Stations</h6>
<ul class="list-unstyled">
<?php foreach ($stations as $station): ?>
<li>
<label class="form-check-label">
<input type="checkbox" class="form-check-input" name="import_stations[]" value="<?php echo $station['station_id']; ?>" checked>
<?php echo htmlspecialchars($station['station_callsign'].' - '.$station['station_profile_name']); ?> (<?php echo $station['qsos_count']; ?> QSOs)
</label>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="col-md-6">
<h6>Logbooks</h6>
<ul class="list-unstyled">
<?php foreach ($logbooks as $logbook): ?>
<li>
<label class="form-check-label">
<input type="checkbox" class="form-check-input" name="import_logbooks[]" value="<?php echo $logbook['logbook_id']; ?>" checked>
<?php echo htmlspecialchars($logbook['logbook_name']); ?> (<?php echo $logbook['qsos_count']; ?> QSOs)
</label>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<button type="submit" class="btn btn-primary mt-2">Import Selected</button>
</form>
<div id="user-import-progress" class="mt-3">
<div id="user-import-spinner" style="display:none;">
<div class="d-flex align-items-center">
<strong>Importing, please wait...</strong>
<div class="spinner-border ms-3" role="status" aria-hidden="true"></div>
</div>
</div>
</div>
<script>
(function(){
var f = document.querySelector('#user-import-preview form');
if(f){ f.addEventListener('submit', function(){ document.getElementById('user-import-spinner').style.display='block'; }); }
})();
</script>
</div>