Skip to content

Commit

Permalink
Merge pull request #7515 from ehuelsmann/fix/master/reload-config-table
Browse files Browse the repository at this point in the history
Reload GIFI/SIC table after successful csv import
  • Loading branch information
ehuelsmann committed Jul 16, 2023
2 parents 998cff0 + 26aab22 commit f842830
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
8 changes: 6 additions & 2 deletions UI/src/components/ImportCSV-Base.vue
Expand Up @@ -18,7 +18,8 @@ export default {
default: true
}
},
setup() {
emits: [ "upload-success", "upload-error" ],
setup(props, { emit }) {
const { t } = useI18n();
let notify = inject("notify");
let form = ref(null);
Expand All @@ -32,7 +33,10 @@ export default {
dismissReceiver
});
},
"success": () => { notify({ title: t("Uploaded") }); },
"success": () => {
notify({ title: t("Uploaded") });
emit("upload-success");
},
"submitError": (ctx, { event }) => {
notify({
title: t("Failure sending CSV"),
Expand Down
2 changes: 1 addition & 1 deletion UI/src/views/GIFI.vue
Expand Up @@ -27,7 +27,7 @@ const store = useGIFIsStore();
createRole="gifi_create" />
<div class="import-section">
<h2 class="listheading">{{ $t("Import") }}</h2>
<ImportCsvGifi />
<ImportCsvGifi @upload-success="store.initialize()" />
</div>
</template>

Expand Down
13 changes: 8 additions & 5 deletions UI/src/views/ImportCSV-GIFI.vue
Expand Up @@ -5,20 +5,23 @@ import ImportCSVBase from "@/components/ImportCSV-Base";
export default {
components: {
"import-csv": ImportCSVBase
"import-csv": ImportCSVBase
},
emits: [ "upload-success", "upload-error" ],
data() {
return {
};
}
return {
};
},
};
</script>

<template>
<div id="import-gifi">
<import-csv type="gifi"
:heading="false"
:transactionFields="false" >
:transactionFields="false"
@upload-success="$emit('upload-success')"
@upload-error="$emit('upload-error')">
<template #title>Import
<abbr
title="General Index of Financial Information">GIFI</abbr> codes
Expand Down
9 changes: 6 additions & 3 deletions UI/src/views/ImportCSV-SIC.vue
Expand Up @@ -5,10 +5,11 @@ import ImportCSVBase from "@/components/ImportCSV-Base";
export default {
components: {
"import-csv": ImportCSVBase
"import-csv": ImportCSVBase
},
emits: [ "upload-success", "upload-error" ],
data() {
return {
return {
};
}
};
Expand All @@ -18,7 +19,9 @@ export default {
<div id="import-sic">
<import-csv type="sic"
:heading="false"
:transactionFields="false" >
:transactionFields="false"
@upload-success="$emit('upload-success')"
@upload-error="$emit('upload-error')">
<template #title>Import
<abbr
title="Standard Industrial Classification">SIC</abbr> codes</template>
Expand Down
2 changes: 1 addition & 1 deletion UI/src/views/SIC.vue
Expand Up @@ -26,7 +26,7 @@ const store = useSICsStore();
createRole="sic_create" />
<div class="import-section">
<h2 class="listheading">{{ t("Import") }}</h2>
<ImportCsvSic />
<ImportCsvSic @upload-success="store.initialize()" />
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion lib/LedgerSMB/Scripts/import_csv.pm
Expand Up @@ -596,7 +596,7 @@ sub begin_import {
if (ref($template_setup->{$request->{type}}) eq 'CODE') {
$template_setup->{$request->{type}}($request);
}
return [ 200, [ 'Content-Type' => 'text/plain' ], [ '' ] ];
return [ 200, [ 'Content-Type' => 'application/json' ], [ '{}' ] ];
}


Expand Down

0 comments on commit f842830

Please sign in to comment.