Save user flights
This commit is contained in:
@@ -17,7 +17,7 @@ const selectedFile = ref<File | null>(null);
|
||||
|
||||
const blurb = computed(() => {
|
||||
if (status.value === 'success') {
|
||||
return `Successfully imported ${importedCount} flight${importedCount.value !== 1 ? 's' : ''}. You will just need to reconcile some mismatched airlines and airports.`;
|
||||
return `Successfully imported ${importedCount.value} flight${importedCount.value !== 1 ? 's' : ''}. You will just need to reconcile some mismatched airlines and airports.`;
|
||||
}
|
||||
return 'Import a CSV export from MyFlightRadar24. You will then be guided to reconcile any data mismatches.';
|
||||
});
|
||||
@@ -64,45 +64,49 @@ async function onFileChange(e: Event) {
|
||||
|
||||
<template>
|
||||
<Head title="Import" />
|
||||
<GlassBox title="Import Your Flights">
|
||||
<p v-if="status !== 'success'">
|
||||
Import a CSV export from MyFlightRadar24. You will then be guided
|
||||
to reconcile any data mismatches.
|
||||
</p>
|
||||
<p v-else-if="status === 'success'" type="success" >
|
||||
Successfully imported {{ importedCount }} flight{{ importedCount !== 1 ? 's' : '' }}. You will just need to reconcile some mismatched airlines and airports.
|
||||
</p>
|
||||
<v-file-input
|
||||
style="flex:0;width:100%"
|
||||
prepend-icon=""
|
||||
v-if="status !== 'uploading' && status !== 'success'"
|
||||
label="Select CSV File"
|
||||
accept=".csv"
|
||||
@change="onFileChange"
|
||||
ref="fileInput"
|
||||
v-model="selectedFile"
|
||||
/>
|
||||
<GlassBox title="Import Your Flights" :blurb="blurb">
|
||||
<v-row no-gutters class="ga-3">
|
||||
|
||||
<div v-else-if="status === 'uploading'" class="d-flex align-center ga-3 mt-2">
|
||||
<v-progress-circular indeterminate color="primary" />
|
||||
<span>Importing your flights…</span>
|
||||
</div>
|
||||
<!-- File input / loading / success -->
|
||||
<v-col cols="12">
|
||||
<v-file-input
|
||||
v-if="status !== 'uploading' && status !== 'success'"
|
||||
prepend-icon=""
|
||||
label="Select CSV File"
|
||||
accept=".csv"
|
||||
@change="onFileChange"
|
||||
ref="fileInput"
|
||||
v-model="selectedFile"
|
||||
hide-details
|
||||
/>
|
||||
|
||||
<v-alert closable v-if="status === 'error'" type="error">
|
||||
<div v-for="(err, i) in errors" :key="i">{{ err }}</div>
|
||||
</v-alert>
|
||||
<div
|
||||
v-else-if="status === 'uploading'"
|
||||
class="d-flex flex-column align-center justify-center ga-3 py-4"
|
||||
>
|
||||
<v-progress-circular indeterminate color="primary" />
|
||||
<span>Importing your flights…</span>
|
||||
</div>
|
||||
|
||||
<v-btn :href="route('reconcile')" v-if="status === 'success'" size="x-large" block >Reconcile Your Data</v-btn>
|
||||
<v-btn
|
||||
v-else-if="status === 'success'"
|
||||
:href="route('reconcile')"
|
||||
size="x-large"
|
||||
block
|
||||
>
|
||||
Reconcile Your Data
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<!-- Errors (independent of the above) -->
|
||||
<v-col v-if="status === 'error'" cols="12">
|
||||
<v-alert closable type="error">
|
||||
<div v-for="(err, i) in errors" :key="i">{{ err }}</div>
|
||||
</v-alert>
|
||||
</v-col>
|
||||
|
||||
</v-row>
|
||||
</GlassBox>
|
||||
</template>
|
||||
<style scoped>
|
||||
h2{
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
p{
|
||||
text-align: center;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -195,11 +195,17 @@ function submit() {
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Submit -->
|
||||
<v-row>
|
||||
<v-col cols="12" class="d-flex justify-end">
|
||||
<v-btn block size="large" :loading="form.processing" :disabled="form.processing" @click="submit">
|
||||
Save Flight
|
||||
<v-btn
|
||||
block
|
||||
size="large"
|
||||
:loading="submitForm.processing"
|
||||
:disabled="submitForm.processing"
|
||||
@click="submit"
|
||||
>
|
||||
<v-progress-circular v-if="submitForm.processing" indeterminate size="24" />
|
||||
<span v-else>Save Flight</span>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
Reference in New Issue
Block a user