diff --git a/backend/felicity_lims/felicity/api/gql/__init__.py b/backend/felicity_lims/felicity/api/gql/__init__.py
index 1384360e..76435c4c 100644
--- a/backend/felicity_lims/felicity/api/gql/__init__.py
+++ b/backend/felicity_lims/felicity/api/gql/__init__.py
@@ -1,5 +1,5 @@
import logging
-from typing import Optional, Tuple
+from typing import Optional, Tuple, Union
import strawberry # noqa
diff --git a/frontend/vite/src/graphql/instrument.mutations.ts b/frontend/vite/src/graphql/instrument.mutations.ts
index 6f07a144..a5a9e8b3 100644
--- a/frontend/vite/src/graphql/instrument.mutations.ts
+++ b/frontend/vite/src/graphql/instrument.mutations.ts
@@ -130,6 +130,14 @@ export const ADD_INSTRUMENT= gql`
name
description
keyword
+ instrumentType {
+ uid
+ name
+ }
+ manufacturer {
+ uid
+ name
+ }
supplier {
uid
name
@@ -154,6 +162,14 @@ export const EDIT_INSTRUMENT= gql`
name
description
keyword
+ instrumentType {
+ uid
+ name
+ }
+ manufacturer {
+ uid
+ name
+ }
supplier {
uid
name
diff --git a/frontend/vite/src/views/admin/instruments/Instruments.vue b/frontend/vite/src/views/admin/instruments/Instruments.vue
index 0fd54145..1c991411 100644
--- a/frontend/vite/src/views/admin/instruments/Instruments.vue
+++ b/frontend/vite/src/views/admin/instruments/Instruments.vue
@@ -10,86 +10,41 @@
-
-
+
+
+
+
+
+ Name |
+ Type |
+ Manufacturer |
+ Supplier |
+ |
+
+
+
+
+
+ {{ inst?.name }}
+ |
+
+ {{ inst?.instrumentType?.name }}
+ |
+
+ {{ inst?.manufacturer?.name }}
+ |
+
+ {{ inst?.supplier?.name }}
+ |
+
+
+ |
+
+
+
+
+
-
-
-
-
-
-
{{ instrument?.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -206,27 +161,33 @@
const { executeMutation: updateInstrument } = useMutation(EDIT_INSTRUMENT);
function addInstrument(): void {
- const payload = { name: instrument.name, keyword: instrument.keyword, description: instrument.description }
+ const payload = {
+ name: instrument.name,
+ keyword: instrument.keyword,
+ description: instrument.description,
+ instrumentTypeUid: instrument.instrumentTypeUid,
+ manufacturerUid: instrument.manufacturerUid,
+ supplierUid: instrument.supplierUid,
+ }
createInstrument({ payload }).then((result) => {
store.dispatch(ActionTypes.ADD_INSTRUMENT, result);
});
}
function editInstrument(): void {
- const payload = { name: instrument.name, keyword: instrument.keyword, description: instrument.description }
+ const payload = {
+ name: instrument.name,
+ keyword: instrument.keyword,
+ description: instrument.description,
+ instrumentTypeUid: instrument.instrumentTypeUid,
+ manufacturerUid: instrument.manufacturerUid,
+ supplierUid: instrument.supplierUid,
+ }
updateInstrument({ uid: instrument.uid, payload }).then((result) => {
store.dispatch(ActionTypes.UPDATE_INSTRUMENT, result);
});
}
- function selectInstrument(obj: IInstrument): void {
- Object.assign(instrument, { ...obj})
- }
-
- function resetInstrument(): void {
- Object.assign(instrument, { ...({} as IInstrument)})
- }
-
function FormManager(create: boolean, obj = {} as IInstrument): void {
formAction.value = create;
showModal.value = true;
diff --git a/frontend/vite/src/views/admin/instruments/MethodForm.vue b/frontend/vite/src/views/admin/instruments/MethodForm.vue
index 2618934d..a97ec2bb 100644
--- a/frontend/vite/src/views/admin/instruments/MethodForm.vue
+++ b/frontend/vite/src/views/admin/instruments/MethodForm.vue
@@ -72,7 +72,6 @@
import { useMutation } from '@urql/vue';
import { ref, reactive, computed, PropType, watch, toRefs } from 'vue';
import { useStore } from 'vuex';
- import { ActionTypes as AnalysisActionTypes} from '../../../store/modules/analysis';
import { ActionTypes } from '../../../store/modules/setup';
import { IInstrument, IMethod } from '../../../models/setup'
import { ADD_METHOD, EDIT_METHOD } from '../../../graphql/instrument.mutations';
diff --git a/frontend/vite/src/views/admin/instruments/Methods.vue b/frontend/vite/src/views/admin/instruments/Methods.vue
index 3860cdb5..3887bffc 100644
--- a/frontend/vite/src/views/admin/instruments/Methods.vue
+++ b/frontend/vite/src/views/admin/instruments/Methods.vue
@@ -16,85 +16,35 @@
-
-
-
-
+
+
+
+
+
+ Name |
+ Instruments |
+ Analyses |
+ |
+
+
+
+
+
+ {{ meth?.name }}
+ |
+
+ {{ meth?.instruments?.map(inst => inst?.name)?.join(",") }}
+ |
+
+ {{ getAnalyses(meth) }}
+ |
+
+
+ |
+
+
+
+
@@ -115,19 +65,14 @@
import modal from '../../../components/SimpleModal.vue';
import MethodForm from './MethodForm.vue';
- import { useMutation } from '@urql/vue';
import { ref, reactive, computed } from 'vue';
import { useStore } from 'vuex';
import { ActionTypes } from '../../../store/modules/setup';
import { ActionTypes as AnalysisActionTypes} from '../../../store/modules/analysis';
import { IMethod } from '../../../models/setup'
- import { ADD_METHOD, EDIT_METHOD } from '../../../graphql/instrument.mutations';
let store = useStore();
- // each tab if just gonna be forms with updatable values on button click
- let currentTab = ref('view');
- const tabs = ['view', 'configurations'];
let showModal = ref(false);
let formTitle = ref('');
@@ -138,35 +83,11 @@
const analysesParams = { first: 1000, after: "", text: "", sortBy: ["name"]}
store.dispatch(AnalysisActionTypes.FETCH_ANALYSES_SERVICES, analysesParams);
+ const analyses = computed(() => store.getters.getAnalysesServicesSimple)
store.dispatch(ActionTypes.FETCH_METHODS);
const methods = computed(() => store.getters.getMethods)
- const { executeMutation: createMethod } = useMutation(ADD_METHOD);
- const { executeMutation: updateMethod } = useMutation(EDIT_METHOD);
-
- function addMethod(): void {
- const payload = { name: method.name, keyword: method.keyword, description: method.description}
- createMethod({ payload }).then((result) => {
- store.dispatch(ActionTypes.ADD_METHOD, result);
- });
- }
-
- function editMethod(): void {
- const payload = { name: method.name, keyword: method.keyword, description: method.description }
- updateMethod({ uid: method.uid, payload }).then((result) => {
- store.dispatch(ActionTypes.UPDATE_METHOD, result);
- });
- }
-
- function selectMethod(obj: IMethod): void {
- Object.assign(method, { ...obj})
- }
-
- function resetMethod(): void {
- Object.assign(method, { ...({} as IMethod)})
- }
-
function FormManager(create: boolean, obj = {} as IMethod): void {
formAction.value = create;
showModal.value = true;
@@ -178,10 +99,15 @@
}
}
- function saveForm():void {
- if (formAction.value === true) addMethod();
- if (formAction.value === false) editMethod();
- showModal.value = false;
+ function getAnalyses(method :IMethod) {
+ let final: string[] = [];
+ analyses.value?.forEach(an => {
+ if(an?.methods?.some(m => m.uid == method?.uid)) {
+ final.push(an?.name)
+ }
+ })
+ return final.join(', ');
}
+
\ No newline at end of file