diff --git a/src/views/AddPriceSingle.vue b/src/views/AddPriceSingle.vue index cfa5817f92c..52575b7bf2b 100644 --- a/src/views/AddPriceSingle.vue +++ b/src/views/AddPriceSingle.vue @@ -412,18 +412,28 @@ export default { showUserRecentProofs() { this.userRecentProofsDialog = true }, - handleProofSelected(proofId) { - this.addPriceSingleForm.proof_id = proofId + handleProofSelected(proof) { + this.addPriceSingleForm.proof_id = proof.id + this.addPriceSingleForm.date = new Date(proof.created).toISOString().split('T')[0] + this.proofImagePreview = this.getProofUrl(proof) this.proofSelectedSuccessMessage = true this.proofSelectedMessage = true }, handleRecentProofSelected(selectedProof) { - this.handleProofSelected(selectedProof.id) + this.handleProofSelected(selectedProof) this.proofImagePreview = this.getProofUrl(selectedProof) }, getProofUrl(proof) { return `${import.meta.env.VITE_OPEN_PRICES_APP_URL}/img/${proof.file_path}` }, + getProofById(proofId) { + this.loading = true; + api.getProofById(proofId) + .then(proof => { + this.handleProofSelected(proof); + this.loading = false; + }); + }, newProof(source) { if (source === 'gallery') { ExifReader.load(this.proofImage[0]).then((tags) => {