Skip to content

Commit

Permalink
feat/ocr-editor gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroito committed Jul 14, 2022
1 parent 451a273 commit 986c068
Show file tree
Hide file tree
Showing 14 changed files with 872 additions and 11 deletions.
13 changes: 13 additions & 0 deletions frontend/api/class-interfaces/ocr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { BaseAPI } from "~/api/_base";

const prefix = "/api";

export class OcrAPI extends BaseAPI {

async tsv(file: File) {
const formData = new FormData();
formData.append("file", file);
return await this.requests.post(`${prefix}/ocr/tsv`, formData);
}

}
5 changes: 5 additions & 0 deletions frontend/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { MultiPurposeLabelsApi } from "./class-interfaces/group-multiple-purpose
import { GroupEventNotifierApi } from "./class-interfaces/group-event-notifier";
import { MealPlanRulesApi } from "./class-interfaces/group-mealplan-rules";
import { GroupDataSeederApi } from "./class-interfaces/group-seeder";
import {OcrAPI} from "./class-interfaces/ocr";
import { ApiRequestInstance } from "~/types/api";

class Api {
Expand Down Expand Up @@ -52,6 +53,7 @@ class Api {
public groupEventNotifier: GroupEventNotifierApi;
public upload: UploadFile;
public seeders: GroupDataSeederApi;
public ocr: OcrAPI;

constructor(requests: ApiRequestInstance) {
// Recipes
Expand Down Expand Up @@ -90,6 +92,9 @@ class Api {
this.bulk = new BulkActionsAPI(requests);
this.groupEventNotifier = new GroupEventNotifierApi(requests);

// ocr
this.ocr = new OcrAPI(requests);

Object.freeze(this);
}
}
Expand Down
13 changes: 10 additions & 3 deletions frontend/components/Domain/Recipe/RecipeDialogBulkAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="text-center">
<v-dialog v-model="dialog" width="800">
<template #activator="{ on, attrs }">
<BaseButton v-bind="attrs" v-on="on" @click="inputText = ''">
<BaseButton v-bind="attrs" v-on="on" @click="inputText = inputTextProp">
{{ $t("new-recipe.bulk-add") }}
</BaseButton>
</template>
Expand Down Expand Up @@ -58,10 +58,17 @@
<script lang="ts">
import { reactive, toRefs, defineComponent, useContext } from "@nuxtjs/composition-api";
export default defineComponent({
setup(_, context) {
props: {
inputTextProp: {
type: String,
required: false,
default: "",
},
},
setup(props, context) {
const state = reactive({
dialog: false,
inputText: "",
inputText: props.inputTextProp,
});
function splitText() {
Expand Down
Loading

0 comments on commit 986c068

Please sign in to comment.