Changed usenextnumber from supabase to fs
This commit is contained in:
@@ -23,5 +23,20 @@ export const useFunctions = () => {
|
|||||||
})).data
|
})).data
|
||||||
}
|
}
|
||||||
|
|
||||||
return {getWorkingTimesEvaluationData}
|
const useNextNumber = async (numberRange) => {
|
||||||
|
const {data:{session:{access_token}}} = await supabase.auth.getSession()
|
||||||
|
|
||||||
|
return (await axios({
|
||||||
|
method: "POST",
|
||||||
|
url: `${baseURL}/functions/usenextnumber`,
|
||||||
|
data: {
|
||||||
|
numberRange: numberRange,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${access_token}`
|
||||||
|
}
|
||||||
|
})).data.usedNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
return {getWorkingTimesEvaluationData, useNextNumber}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import Handlebars from "handlebars"
|
import Handlebars from "handlebars"
|
||||||
import {useNumberRange} from "~/composables/useNumberRange.js";
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import {useFunctions} from "~/composables/useFunctions.js";
|
||||||
|
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const profileStore = useProfileStore()
|
const profileStore = useProfileStore()
|
||||||
@@ -804,14 +804,7 @@ const saveDocument = async (state,resetup = false) => {
|
|||||||
type = itemInfo.value.type
|
type = itemInfo.value.type
|
||||||
}
|
}
|
||||||
|
|
||||||
const {data,error} = await supabase.functions.invoke("use_next_number",{
|
itemInfo.value.documentNumber = await useFunctions().useNextNumber(type) //data.usedNumber
|
||||||
body: {
|
|
||||||
tenant: profileStore.currentTenant,
|
|
||||||
numberRange: type
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
itemInfo.value.documentNumber = data.usedNumber
|
|
||||||
|
|
||||||
setDocumentTypeConfig(false)
|
setDocumentTypeConfig(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import serviceCategories from "~/components/columnRenderings/serviceCategories.v
|
|||||||
|
|
||||||
import quantity from "~/components/helpRenderings/quantity.vue"
|
import quantity from "~/components/helpRenderings/quantity.vue"
|
||||||
import {useZipCheck} from "~/composables/useZipCheck.js";
|
import {useZipCheck} from "~/composables/useZipCheck.js";
|
||||||
|
import {useFunctions} from "~/composables/useFunctions.js";
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const useDataStore = defineStore('data', () => {
|
export const useDataStore = defineStore('data', () => {
|
||||||
@@ -2192,19 +2193,8 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
console.log(dataType)
|
console.log(dataType)
|
||||||
if(dataTypes[dataType].numberRangeHolder) {
|
if(dataTypes[dataType].numberRangeHolder) {
|
||||||
|
|
||||||
const {data:numberRangeData,error} = await supabase.functions.invoke("use_next_number",{
|
|
||||||
body: {
|
|
||||||
tenant: profileStore.currentTenant,
|
|
||||||
numberRange: dataType
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if(error){
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!data[dataTypes[dataType].numberRangeHolder]) {
|
if(!data[dataTypes[dataType].numberRangeHolder]) {
|
||||||
data[dataTypes[dataType].numberRangeHolder] = numberRangeData.usedNumber
|
data[dataTypes[dataType].numberRangeHolder] = await useFunctions().useNextNumber(dataType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user