Skip to content

Commit

Permalink
Fix landscape import button visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvaisetroupe committed Oct 31, 2023
1 parent ffa4edf commit ca886f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default defineComponent({
const flowImportService = inject('flowImportService', () => new FlowImportService());
const excelFile = ref();
const isFetching = ref(false);
const fileToBeSubmited = ref(false);
const fileSubmited = ref(false);
const analyseToBeImported = ref(false);
const rowsLoaded = ref(false);
const excelFileName = ref('Browse File');

Expand All @@ -29,6 +31,7 @@ export default defineComponent({

function handleFileUpload(): void {
excelFileName.value = excelFile.value.files[0].name;
fileToBeSubmited.value = true;
}

// STEP 1 - Upload file and retreive all sheet with name starting with FLW
Expand All @@ -50,20 +53,19 @@ export default defineComponent({
}

function selectAll() {
if (!fileSubmited.value) {
checkedNames.value = [];
checkedNames.value.push(...summary.value.map(sum => sum.sheetName));
}
checkedNames.value = [];
checkedNames.value.push(...summary.value.map(sum => sum.sheetName));
}

function selectNone() {
if (!fileSubmited.value) checkedNames.value = [];
checkedNames.value = [];
}

// Step 2 - Submit de file and selected sheet names

function submitFile(): void {
isFetching.value = true;
analyseToBeImported.value = true;
// send file n times, sheet by sheet
// this is not optimal, but it's the easier way to have a reactive behavior and avoid time out
// serialized to avoid database transactional problem
Expand Down Expand Up @@ -129,6 +131,8 @@ export default defineComponent({
dtos,
excelFileName,
filterErrors,
fileToBeSubmited,
analyseToBeImported,
};
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>

<div class="form-group" v-if="excelFile && summary.length == 0">
<button type="submit" class="btn btn-primary mb-2" v-on:click="getSheetnames()" :disabled="fileSubmited">Submit File</button>
<button type="submit" class="btn btn-primary mb-2" v-on:click="getSheetnames()" :disabled="!fileToBeSubmited">Submit File</button>
</div>

<div v-if="summary.length > 0" class="col-md-12">
Expand All @@ -42,7 +42,7 @@
v-model="checkedNames"
:value="row.sheetName"
:id="'CHK-' + row.sheetName"
:disabled="fileSubmited"
:disabled="analyseToBeImported"
checked="false"
/>
<label :for="'CHK-' + row.sheetName" class="">{{ row.sheetName }} </label>
Expand All @@ -57,9 +57,9 @@
</div>
<div class="col-2"></div>
</template>
</div>
<div class="form-group col-md-12" v-if="excelFile">
<button type="submit" class="btn btn-primary mb-2" v-on:click="submitFile()" v-if="!fileSubmited">Submit File</button>
<div class="form-group col-md-12" v-if="!analyseToBeImported">
<button type="submit" class="btn btn-primary mb-2" v-on:click="submitFile()">Submit File</button>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit ca886f7

Please sign in to comment.