Skip to content

Commit

Permalink
🔥 Remove shipping options ui in book edition ui
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Feb 14, 2024
1 parent b4c0560 commit 0bdb4c1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 190 deletions.
95 changes: 0 additions & 95 deletions pages/nft-book-store/status/[classId]/edit/[editionIndex].vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,75 +108,6 @@
label="Includes physical good that requires shipping"
/>
</template>

<UCard
v-if="hasShipping"
:ui="{
header: { base: 'flex flex-wrap justify-between items-center gap-2' },
rounded: 'rounded-t-none',
}"
>
<template #header>
<h4 class="text-sm font-bold font-mono">
Shipping Options and Prices
</h4>

<UButton
label="Add Option"
variant="outline"
@click="addMoreShippingRate"
/>
</template>

<component :is="hasMultipleShippingRates ? 'ul' : 'div'" class="space-y-4">
<component :is="hasMultipleShippingRates ? 'li' : 'div'" v-for="s, index in shippingRates" :key="s.index">
<UCard
:ui="{
body: { base: 'space-y-4' },
footer: { base: 'flex justify-end items-center' },
}"
>
<UFormGroup
label="Name of this shipping option"
:ui="{ container: 'space-y-2' }"
>
<UInput
:value="s.nameEn"
placeholder="Shipping option name"
@input="e => updateShippingRate(e, 'nameEn', index)"
/>
<UInput
placeholder="運送選項名稱"
:value="s.nameZh"
@input="e => updateShippingRate(e, 'nameZh', index)"
/>
</UFormGroup>

<UFormGroup label="Price(USD) of this shipping option">
<UInput
:value="s.price"
type="number"
step="0.01"
:min="0"
@input="e => updateShippingRate(e, 'price', index)"
/>
</UFormGroup>

<template
v-if="hasMultipleShippingRates"
#footer
>
<UButton
label="Delete"
variant="outline"
color="red"
@click="deleteShippingRate(index)"
/>
</template>
</UCard>
</component>
</component>
</UCard>
</UCard>

<template #footer>
Expand All @@ -199,8 +130,6 @@ import { MdEditor, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { v4 as uuidv4 } from 'uuid'
import { LIKE_CO_API } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
Expand Down Expand Up @@ -238,13 +167,6 @@ const descriptionEn = ref('')
const descriptionZh = ref('')
const hasShipping = ref(false)
const isPhysicalOnly = ref(false)
const shippingRates = ref<any[]>([{
price: 10.0,
nameEn: 'Standard Shipping',
nameZh: '標準寄送'
}])
const hasMultipleShippingRates = computed(() => shippingRates.value.length > 1)
const oldStock = ref(0)
const oldIsAutoDeliver = ref(false)
Expand Down Expand Up @@ -345,23 +267,6 @@ onMounted(async () => {
}
})
function updateShippingRate (e: InputEvent, key: string, index: number) {
shippingRates.value[index][key] = (e.target as HTMLInputElement)?.value
}
function addMoreShippingRate () {
shippingRates.value.push({
index: uuidv4(),
price: 20,
nameEn: 'International Shipping',
nameZh: '國際寄送'
})
}
function deleteShippingRate (index: number) {
shippingRates.value.splice(index, 1)
}
function escapeHtml (text = '') {
return text
.replace(/&/g, '&amp;')
Expand Down
95 changes: 0 additions & 95 deletions pages/nft-book-store/status/[classId]/edit/new.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,75 +107,6 @@
label="Includes physical good that requires shipping"
/>
</template>

<UCard
v-if="hasShipping"
:ui="{
header: { base: 'flex flex-wrap justify-between items-center gap-2' },
rounded: 'rounded-t-none',
}"
>
<template #header>
<h4 class="text-sm font-bold font-mono">
Shipping Options and Prices
</h4>

<UButton
label="Add Option"
variant="outline"
@click="addMoreShippingRate"
/>
</template>

<component :is="hasMultipleShippingRates ? 'ul' : 'div'" class="space-y-4">
<component :is="hasMultipleShippingRates ? 'li' : 'div'" v-for="s, index in shippingRates" :key="s.index">
<UCard
:ui="{
body: { base: 'space-y-4' },
footer: { base: 'flex justify-end items-center' },
}"
>
<UFormGroup
label="Name of this shipping option"
:ui="{ container: 'space-y-2' }"
>
<UInput
:value="s.nameEn"
placeholder="Shipping option name"
@input="e => updateShippingRate(e, 'nameEn', index)"
/>
<UInput
placeholder="運送選項名稱"
:value="s.nameZh"
@input="e => updateShippingRate(e, 'nameZh', index)"
/>
</UFormGroup>

<UFormGroup label="Price(USD) of this shipping option">
<UInput
:value="s.price"
type="number"
step="0.01"
:min="0"
@input="e => updateShippingRate(e, 'price', index)"
/>
</UFormGroup>

<template
v-if="hasMultipleShippingRates"
#footer
>
<UButton
label="Delete"
variant="outline"
color="red"
@click="deleteShippingRate(index)"
/>
</template>
</UCard>
</component>
</component>
</UCard>
</UCard>

<template #footer>
Expand All @@ -198,8 +129,6 @@ import { MdEditor, config } from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import DOMPurify from 'dompurify'
import { v4 as uuidv4 } from 'uuid'
import { LIKE_CO_API } from '~/constant'
import { useBookStoreApiStore } from '~/stores/book-store-api'
Expand Down Expand Up @@ -236,13 +165,6 @@ const nameZh = ref('標準版')
const descriptionEn = ref('')
const descriptionZh = ref('')
const hasShipping = ref(false)
const shippingRates = ref<any[]>([{
price: 10.0,
nameEn: 'Standard Shipping',
nameZh: '標準寄送'
}])
const hasMultipleShippingRates = computed(() => shippingRates.value.length > 1)
const priceItemLabel = computed(() => hasMultiplePrices.value ? 'edition' : 'book')
const toolbarOptions = [
Expand Down Expand Up @@ -306,23 +228,6 @@ onMounted(async () => {
}
})
function updateShippingRate (e: InputEvent, key: string, index: number) {
shippingRates.value[index][key] = (e.target as HTMLInputElement)?.value
}
function addMoreShippingRate () {
shippingRates.value.push({
index: uuidv4(),
price: 20,
nameEn: 'International Shipping',
nameZh: '國際寄送'
})
}
function deleteShippingRate (index: number) {
shippingRates.value.splice(index, 1)
}
function escapeHtml (text = '') {
return text
.replace(/&/g, '&amp;')
Expand Down

0 comments on commit 0bdb4c1

Please sign in to comment.