added Co Author
This commit is contained in:
		| @ -2,8 +2,13 @@ | ||||
|  | ||||
| import { ref } from "vue"; | ||||
| import {onClickOutside} from '@vueuse/core' | ||||
| import {uploadPdf,postResearch} from "@/rest/ScientificPublications/ManageResearch.js"; | ||||
| let toPost = Object.assign({}, {}); | ||||
| import {uploadFile, postResearch, fetchAllResearchers} from "@/rest/ScientificPublications/ManageResearch.js"; | ||||
| const allResearcher = ref(await fetchAllResearchers()) | ||||
|  | ||||
| const coAuthors = ref([]) | ||||
|  | ||||
| let toPost = Object.assign({}, {coAuthors:[]}); | ||||
|  | ||||
|  | ||||
| const props = defineProps({ | ||||
|   isOpen: Boolean, | ||||
| @ -12,19 +17,20 @@ const props = defineProps({ | ||||
|  | ||||
|  | ||||
| async function uploadResearchPdf(pdf){ | ||||
|   const data = await uploadPdf(pdf); | ||||
|   const data = await uploadFile(pdf); | ||||
|   toPost.pdfLocation = data.url; | ||||
| } | ||||
| async function uploadBibTex(pdf){ | ||||
|   const data = await uploadPdf(pdf); | ||||
|   const data = await uploadFile(pdf); | ||||
|   toPost.bibTexLocation = data.url; | ||||
| } | ||||
|  | ||||
| // Date when sent!! | ||||
|  | ||||
| async function postNewResearch(){ | ||||
|   toPost.releaseDate = new Date() | ||||
|   toPost.author = props.researcher | ||||
|   toPost.coAuthors = coAuthors.value | ||||
|   console.log() | ||||
|   //the Pdf and a title are required | ||||
|   if (toPost.pdfLocation == null || toPost.title == null || toPost.title === "") { | ||||
|     emit("modal-close") | ||||
| @ -32,6 +38,7 @@ async function postNewResearch(){ | ||||
|   } | ||||
|   await postResearch(toPost) | ||||
|   toPost = Object.assign({}, {}); | ||||
|   coAuthors.value = [] | ||||
|   emit("modal-close") | ||||
|   emit("posted") | ||||
| } | ||||
| @ -69,6 +76,8 @@ onClickOutside(target, ()=>emit('modal-close')) | ||||
|             <option value="Restricted">Restricted</option> | ||||
|             <option value="Private">Private</option> | ||||
|           </select></li> | ||||
|  | ||||
|  | ||||
|           <li> Research Pdf : | ||||
|             <form novalidate enctype="multipart/form-data" class="inputBox"> | ||||
|             <input type="file" @change="uploadResearchPdf($event.target.files);" accept="application/pdf"> | ||||
| @ -79,11 +88,19 @@ onClickOutside(target, ()=>emit('modal-close')) | ||||
|           </form></li> | ||||
|         </ul> | ||||
|         </div> | ||||
|         <div id="CoAuthorList"> Co-Authors List: | ||||
|         <ul style="list-style-type: none;" v-for="n in allResearcher"> | ||||
|           <li v-if="n.id !== props.researcher.id"> <input type="checkbox" :value=n v-model="coAuthors"> {{n.id}} : {{n.user.firstName}} {{n.user.lastName}}</li> | ||||
|         </ul> | ||||
|  | ||||
|       </div> | ||||
|         <div></div> | ||||
|         <div> | ||||
|           <button id="confirmButton" @click="postNewResearch">Confirm Publish</button> | ||||
|           <button id="cancelButton" @click="cancelPost">Cancel Publish</button> | ||||
|         </div> | ||||
|       </div> | ||||
|  | ||||
|     </div> | ||||
|   </div> | ||||
|  | ||||
| @ -101,6 +118,8 @@ onClickOutside(target, ()=>emit('modal-close')) | ||||
| } | ||||
|  | ||||
| .modal-container { | ||||
|   display: grid; | ||||
|   grid-template-columns: 40% 60%; | ||||
|   width: 70%; | ||||
|   margin: 150px auto; | ||||
|   padding: 20px 30px; | ||||
| @ -113,6 +132,12 @@ onClickOutside(target, ()=>emit('modal-close')) | ||||
|   margin-top: 9px; | ||||
| } | ||||
|  | ||||
| #coAuthorList{ | ||||
|   overflow: scroll; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| #downloads button { | ||||
|   align-self: center; | ||||
|   margin-left: 2px; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user