diff --git a/babel.config.js b/babel.config.js index e955840..038c6ed 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,8 @@ module.exports = { presets: [ '@vue/cli-plugin-babel/preset' + ], + plugins: [ + '@babel/plugin-proposal-private-methods' ] } diff --git a/package-lock.json b/package-lock.json index 448e136..a67a69d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "core-js": "^3.8.3", "vue": "^3.2.13", + "vuex": "^4.1.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz" }, "devDependencies": { @@ -2914,6 +2915,11 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, + "node_modules/@vue/devtools-api": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" + }, "node_modules/@vue/reactivity": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.45.tgz", @@ -10789,6 +10795,17 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "node_modules/vuex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", + "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", + "dependencies": { + "@vue/devtools-api": "^6.0.0-beta.11" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -13697,6 +13714,11 @@ } } }, + "@vue/devtools-api": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" + }, "@vue/reactivity": { "version": "3.2.45", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.45.tgz", @@ -19559,6 +19581,14 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "vuex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.1.0.tgz", + "integrity": "sha512-hmV6UerDrPcgbSy9ORAtNXDr9M4wlNP4pEFKye4ujJF8oqgFFuxDCdOLS3eNoRTtq5O3hoBDh9Doj1bQMYHRbQ==", + "requires": { + "@vue/devtools-api": "^6.0.0-beta.11" + } + }, "watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", diff --git a/package.json b/package.json index 2bc413a..702dcd6 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dependencies": { "core-js": "^3.8.3", "vue": "^3.2.13", + "vuex": "^4.1.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz" }, "devDependencies": { diff --git a/src/App.vue b/src/App.vue index 099decc..4d8e85e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,26 @@ + +// + diff --git a/src/components/FileUpload.vue b/src/components/FileUpload.vue index 36951f1..7a0f1c0 100644 --- a/src/components/FileUpload.vue +++ b/src/components/FileUpload.vue @@ -1,3 +1,4 @@ +// TODO Add submit button to link with file upload @@ -7,6 +8,8 @@ + + + \ No newline at end of file diff --git a/src/components/ItemBlock.vue b/src/components/ItemBlock.vue new file mode 100644 index 0000000..7a56f5e --- /dev/null +++ b/src/components/ItemBlock.vue @@ -0,0 +1,69 @@ + + + {{topMessage}} + + + + Submit Corrections + + + + + + + \ No newline at end of file diff --git a/src/components/ItemReplace.vue b/src/components/ItemReplace.vue new file mode 100644 index 0000000..8be6d9a --- /dev/null +++ b/src/components/ItemReplace.vue @@ -0,0 +1,80 @@ + + + + {{itemText}} + + + + {{firstValue}} + {{headerObj.header.documentHeader}} + + Confirm Choice + + + + + + + + + \ No newline at end of file diff --git a/src/components/Missing.vue b/src/components/Missing.vue deleted file mode 100644 index 40d135f..0000000 --- a/src/components/Missing.vue +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/helpers.js b/src/helpers.js new file mode 100644 index 0000000..b8e5588 --- /dev/null +++ b/src/helpers.js @@ -0,0 +1,52 @@ +export class HeaderAssociator { + /* + This class is used to track the headers of the excel file + uploaded by the user. The header can then be assoicate with a + header from our specified template. The cell address of the + document header is also tracked. + */ + + // The users excel header they want to associate with our template + // type: (string) + documentHeader; + // The excel address of the document header + // This will be a string in A1 notation for Excel + docHeaderAddress; + + // The template excel header they want to associate + // the document header with + // type: (string) + templateHeader = null; + + isValidData = false; + + constructor(documentHeader, address) { + this.documentHeader = documentHeader + this.docHeaderAddress = address + } + + set isValidData(newValidData) { + if (typeof newValidData !== 'boolean') { + console.error(`${this.documentHeader} | HeaderAssociator.validData must be a boolean: ${newValidData}`); + this.isValidData = false; + } + else this.isValidData = newValidData; + } + + swapTemplateHeader(newTemplateHeader) { + // Set the template header and return the previous template header + // May return null if nothing has been set + let oldTemplateHeader = this.templateHeader + // Convert blank string to null + this.templateHeader = newTemplateHeader === '' ? null : newTemplateHeader + return oldTemplateHeader + } + + toString(){ + return `${this.documentHeader} (${this.docHeaderAddress}) : ${this.templateHeader}` + } + + isSet() { + return this.templateHeader !== null + } +} \ No newline at end of file diff --git a/src/store.js b/src/store.js new file mode 100644 index 0000000..f698a31 --- /dev/null +++ b/src/store.js @@ -0,0 +1,16 @@ +// store.js +import { reactive } from 'vue' + +export const store = reactive({ + // Template headers missing from the document (strings) + // regex did not match on any headers found in the document + missingHeaders: [], + + // Headers found by scanning the document (HeaderAssociator) + // Contains the following data: + // - docuemnt header + // - document header address (excel A1 string) + // - template header (or null) + // - isValidDate : whether the excel row data is valid + documentHeaders: [], +})