Included Tenant Value in Creation
Added Fields to Customer Info Data
This commit is contained in:
@@ -21,7 +21,9 @@ let currentItem = ref(null)
|
||||
const mode = ref(route.params.mode || "show")
|
||||
const itemInfo = ref({
|
||||
name: "",
|
||||
infoData: {},
|
||||
infoData: {
|
||||
country: "Deutschland"
|
||||
},
|
||||
active: true
|
||||
})
|
||||
|
||||
@@ -228,6 +230,13 @@ setupPage()
|
||||
v-model="itemInfo.infoData.street"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Adresszusatz"
|
||||
>
|
||||
<UInput
|
||||
v-model="itemInfo.infoData.special"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Postleitzahl"
|
||||
>
|
||||
@@ -242,6 +251,14 @@ setupPage()
|
||||
v-model="itemInfo.infoData.city"
|
||||
/>
|
||||
</UFormGroup>
|
||||
<UFormGroup
|
||||
label="Land"
|
||||
>
|
||||
<USelectMenu
|
||||
:options="['Deutschland','Niederlande','Belgien']"
|
||||
v-model="itemInfo.infoData.country"
|
||||
/>
|
||||
</UFormGroup>
|
||||
|
||||
<UFormGroup
|
||||
label="Telefon:"
|
||||
|
||||
@@ -358,11 +358,27 @@ export const useDataStore = defineStore('data', () => {
|
||||
.subscribe()
|
||||
|
||||
async function createNewItem (dataType,data){
|
||||
if(typeOf(data) === 'object') {
|
||||
data = {...data, tenant: currentTenant.value}
|
||||
} else if(typeOf(data) === 'array') {
|
||||
data.map(i => {
|
||||
return {
|
||||
...i,
|
||||
tenant: currentTenant.value
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//console.log(dataType)
|
||||
if(dataTypes[dataType].numberRangeHolder) {
|
||||
|
||||
const numberRange = useNumberRange(dataType)
|
||||
if(!dataTypes[dataType].numberRangeHolder) {
|
||||
data[dataTypes[dataType].numberRangeHolder] = await numberRange.useNextNumber()
|
||||
}
|
||||
|
||||
|
||||
} else if(dataType === "createddocuments") {
|
||||
console.log(data.type)
|
||||
@@ -373,7 +389,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
|
||||
const {data:supabaseData,error:supabaseError} = await supabase
|
||||
.from(dataType)
|
||||
.insert(typeOf(data) === 'Object' ? [data] : data)
|
||||
.insert(data)
|
||||
.select()
|
||||
|
||||
if(supabaseError) {
|
||||
|
||||
Reference in New Issue
Block a user