Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -253,7 +253,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-dialog v-model="productCardDialog" maximized>
|
<q-dialog v-model="productCardDialog" maximized @hide="onProductCardDialogHide">
|
||||||
<q-card class="product-card-dialog">
|
<q-card class="product-card-dialog">
|
||||||
<q-card-section class="row items-center q-pb-sm">
|
<q-card-section class="row items-center q-pb-sm">
|
||||||
<div class="text-h6">Urun Karti</div>
|
<div class="text-h6">Urun Karti</div>
|
||||||
@@ -275,6 +275,7 @@
|
|||||||
arrows
|
arrows
|
||||||
height="100%"
|
height="100%"
|
||||||
class="product-card-carousel rounded-borders"
|
class="product-card-carousel rounded-borders"
|
||||||
|
@update:model-value="onProductCardSlideChange"
|
||||||
>
|
>
|
||||||
<q-carousel-slide
|
<q-carousel-slide
|
||||||
v-for="(img, idx) in productCardImages"
|
v-for="(img, idx) in productCardImages"
|
||||||
@@ -322,7 +323,7 @@
|
|||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
<q-dialog v-model="productImageFullscreenDialog" maximized @hide="onFullscreenMouseUp">
|
<q-dialog v-model="productImageFullscreenDialog" maximized @hide="onFullscreenDialogHide">
|
||||||
<q-card class="image-fullscreen-dialog">
|
<q-card class="image-fullscreen-dialog">
|
||||||
<q-card-section class="row items-center q-pb-sm">
|
<q-card-section class="row items-center q-pb-sm">
|
||||||
<div class="text-h6">Urun Fotografi</div>
|
<div class="text-h6">Urun Fotografi</div>
|
||||||
@@ -665,6 +666,43 @@ function sortImagesForDisplay(list) {
|
|||||||
return Array.isArray(list) ? [...list] : []
|
return Array.isArray(list) ? [...list] : []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getHashRouteParts() {
|
||||||
|
if (typeof window === 'undefined') return { path: '', params: new URLSearchParams() }
|
||||||
|
const rawHash = String(window.location.hash || '')
|
||||||
|
const hashBody = rawHash.startsWith('#') ? rawHash.slice(1) : rawHash
|
||||||
|
const qPos = hashBody.indexOf('?')
|
||||||
|
const path = qPos >= 0 ? hashBody.slice(0, qPos) : hashBody
|
||||||
|
const query = qPos >= 0 ? hashBody.slice(qPos + 1) : ''
|
||||||
|
return { path, params: new URLSearchParams(query) }
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceHashRouteQuery(key, value) {
|
||||||
|
if (typeof window === 'undefined') return
|
||||||
|
const { path, params } = getHashRouteParts()
|
||||||
|
if (!path) return
|
||||||
|
if (value === null || value === undefined || String(value).trim() === '') params.delete(key)
|
||||||
|
else params.set(key, String(value).trim())
|
||||||
|
const nextQuery = params.toString()
|
||||||
|
const nextHash = `#${path}${nextQuery ? `?${nextQuery}` : ''}`
|
||||||
|
if (window.location.hash === nextHash) return
|
||||||
|
window.history.replaceState(null, '', `${window.location.pathname}${window.location.search}${nextHash}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGalleryQueryIndex() {
|
||||||
|
const { params } = getHashRouteParts()
|
||||||
|
const n = Number(params.get('g') || 1)
|
||||||
|
if (!Number.isFinite(n) || n < 1) return 0
|
||||||
|
return n - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function setGalleryQueryIndex(index) {
|
||||||
|
replaceHashRouteQuery('g', Math.max(1, Number(index || 0) + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearGalleryQueryIndex() {
|
||||||
|
replaceHashRouteQuery('g', null)
|
||||||
|
}
|
||||||
|
|
||||||
async function resolveProductImageUrlForCarousel(item) {
|
async function resolveProductImageUrlForCarousel(item) {
|
||||||
const resolved = resolveProductImageUrl(item)
|
const resolved = resolveProductImageUrl(item)
|
||||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||||
@@ -1320,7 +1358,8 @@ async function openProductCard(grp1, grp2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
productCardImages.value = uniqueImages
|
productCardImages.value = uniqueImages
|
||||||
productCardSlide.value = 0
|
productCardSlide.value = Math.min(Math.max(getGalleryQueryIndex(), 0), Math.max(uniqueImages.length - 1, 0))
|
||||||
|
setGalleryQueryIndex(productCardSlide.value)
|
||||||
productCardData.value = {
|
productCardData.value = {
|
||||||
productCode,
|
productCode,
|
||||||
colorCode,
|
colorCode,
|
||||||
@@ -1345,6 +1384,7 @@ function openProductImageFullscreen(src) {
|
|||||||
productImageFullscreenSrc.value = value
|
productImageFullscreenSrc.value = value
|
||||||
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
||||||
productImageFullscreenSlide.value = idx
|
productImageFullscreenSlide.value = idx
|
||||||
|
setGalleryQueryIndex(idx)
|
||||||
productImageFullscreenZoom.value = 1
|
productImageFullscreenZoom.value = 1
|
||||||
productImageFullscreenOffsetX.value = 0
|
productImageFullscreenOffsetX.value = 0
|
||||||
productImageFullscreenOffsetY.value = 0
|
productImageFullscreenOffsetY.value = 0
|
||||||
@@ -1403,12 +1443,26 @@ function onFullscreenMouseUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onFullscreenSlideChange() {
|
function onFullscreenSlideChange() {
|
||||||
|
setGalleryQueryIndex(productImageFullscreenSlide.value)
|
||||||
productImageFullscreenZoom.value = 1
|
productImageFullscreenZoom.value = 1
|
||||||
productImageFullscreenOffsetX.value = 0
|
productImageFullscreenOffsetX.value = 0
|
||||||
productImageFullscreenOffsetY.value = 0
|
productImageFullscreenOffsetY.value = 0
|
||||||
productImageFullscreenDragging.value = false
|
productImageFullscreenDragging.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onProductCardSlideChange() {
|
||||||
|
setGalleryQueryIndex(productCardSlide.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onProductCardDialogHide() {
|
||||||
|
productImageFullscreenDialog.value = false
|
||||||
|
clearGalleryQueryIndex()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFullscreenDialogHide() {
|
||||||
|
onFullscreenMouseUp()
|
||||||
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
filters.value = createEmptyFilters()
|
filters.value = createEmptyFilters()
|
||||||
rawRows.value = []
|
rawRows.value = []
|
||||||
|
|||||||
@@ -238,7 +238,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-dialog v-model="productCardDialog" maximized>
|
<q-dialog v-model="productCardDialog" maximized @hide="onProductCardDialogHide">
|
||||||
<q-card class="product-card-dialog">
|
<q-card class="product-card-dialog">
|
||||||
<q-card-section class="row items-center q-pb-sm">
|
<q-card-section class="row items-center q-pb-sm">
|
||||||
<div class="text-h6">Urun Karti</div>
|
<div class="text-h6">Urun Karti</div>
|
||||||
@@ -260,6 +260,7 @@
|
|||||||
arrows
|
arrows
|
||||||
height="100%"
|
height="100%"
|
||||||
class="product-card-carousel rounded-borders"
|
class="product-card-carousel rounded-borders"
|
||||||
|
@update:model-value="onProductCardSlideChange"
|
||||||
>
|
>
|
||||||
<q-carousel-slide
|
<q-carousel-slide
|
||||||
v-for="(img, idx) in productCardImages"
|
v-for="(img, idx) in productCardImages"
|
||||||
@@ -307,7 +308,7 @@
|
|||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
<q-dialog v-model="productImageFullscreenDialog" maximized @hide="onFullscreenMouseUp">
|
<q-dialog v-model="productImageFullscreenDialog" maximized @hide="onFullscreenDialogHide">
|
||||||
<q-card class="image-fullscreen-dialog">
|
<q-card class="image-fullscreen-dialog">
|
||||||
<q-card-section class="row items-center q-pb-sm">
|
<q-card-section class="row items-center q-pb-sm">
|
||||||
<div class="text-h6">Urun Fotografi</div>
|
<div class="text-h6">Urun Fotografi</div>
|
||||||
@@ -644,6 +645,43 @@ function sortImagesForDisplay(list) {
|
|||||||
return Array.isArray(list) ? [...list] : []
|
return Array.isArray(list) ? [...list] : []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getHashRouteParts() {
|
||||||
|
if (typeof window === 'undefined') return { path: '', params: new URLSearchParams() }
|
||||||
|
const rawHash = String(window.location.hash || '')
|
||||||
|
const hashBody = rawHash.startsWith('#') ? rawHash.slice(1) : rawHash
|
||||||
|
const qPos = hashBody.indexOf('?')
|
||||||
|
const path = qPos >= 0 ? hashBody.slice(0, qPos) : hashBody
|
||||||
|
const query = qPos >= 0 ? hashBody.slice(qPos + 1) : ''
|
||||||
|
return { path, params: new URLSearchParams(query) }
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceHashRouteQuery(key, value) {
|
||||||
|
if (typeof window === 'undefined') return
|
||||||
|
const { path, params } = getHashRouteParts()
|
||||||
|
if (!path) return
|
||||||
|
if (value === null || value === undefined || String(value).trim() === '') params.delete(key)
|
||||||
|
else params.set(key, String(value).trim())
|
||||||
|
const nextQuery = params.toString()
|
||||||
|
const nextHash = `#${path}${nextQuery ? `?${nextQuery}` : ''}`
|
||||||
|
if (window.location.hash === nextHash) return
|
||||||
|
window.history.replaceState(null, '', `${window.location.pathname}${window.location.search}${nextHash}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGalleryQueryIndex() {
|
||||||
|
const { params } = getHashRouteParts()
|
||||||
|
const n = Number(params.get('g') || 1)
|
||||||
|
if (!Number.isFinite(n) || n < 1) return 0
|
||||||
|
return n - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function setGalleryQueryIndex(index) {
|
||||||
|
replaceHashRouteQuery('g', Math.max(1, Number(index || 0) + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearGalleryQueryIndex() {
|
||||||
|
replaceHashRouteQuery('g', null)
|
||||||
|
}
|
||||||
|
|
||||||
async function resolveProductImageUrlForCarousel(item) {
|
async function resolveProductImageUrlForCarousel(item) {
|
||||||
const resolved = resolveProductImageUrl(item)
|
const resolved = resolveProductImageUrl(item)
|
||||||
const contentUrl = String(resolved.contentUrl || '').trim()
|
const contentUrl = String(resolved.contentUrl || '').trim()
|
||||||
@@ -1130,7 +1168,8 @@ async function openProductCard(grp1, grp2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
productCardImages.value = uniqueImages
|
productCardImages.value = uniqueImages
|
||||||
productCardSlide.value = 0
|
productCardSlide.value = Math.min(Math.max(getGalleryQueryIndex(), 0), Math.max(uniqueImages.length - 1, 0))
|
||||||
|
setGalleryQueryIndex(productCardSlide.value)
|
||||||
productCardData.value = {
|
productCardData.value = {
|
||||||
productCode,
|
productCode,
|
||||||
colorCode,
|
colorCode,
|
||||||
@@ -1155,6 +1194,7 @@ function openProductImageFullscreen(src) {
|
|||||||
productImageFullscreenSrc.value = value
|
productImageFullscreenSrc.value = value
|
||||||
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
|
||||||
productImageFullscreenSlide.value = idx
|
productImageFullscreenSlide.value = idx
|
||||||
|
setGalleryQueryIndex(idx)
|
||||||
productImageFullscreenZoom.value = 1
|
productImageFullscreenZoom.value = 1
|
||||||
productImageFullscreenOffsetX.value = 0
|
productImageFullscreenOffsetX.value = 0
|
||||||
productImageFullscreenOffsetY.value = 0
|
productImageFullscreenOffsetY.value = 0
|
||||||
@@ -1213,12 +1253,26 @@ function onFullscreenMouseUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onFullscreenSlideChange() {
|
function onFullscreenSlideChange() {
|
||||||
|
setGalleryQueryIndex(productImageFullscreenSlide.value)
|
||||||
productImageFullscreenZoom.value = 1
|
productImageFullscreenZoom.value = 1
|
||||||
productImageFullscreenOffsetX.value = 0
|
productImageFullscreenOffsetX.value = 0
|
||||||
productImageFullscreenOffsetY.value = 0
|
productImageFullscreenOffsetY.value = 0
|
||||||
productImageFullscreenDragging.value = false
|
productImageFullscreenDragging.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onProductCardSlideChange() {
|
||||||
|
setGalleryQueryIndex(productCardSlide.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onProductCardDialogHide() {
|
||||||
|
productImageFullscreenDialog.value = false
|
||||||
|
clearGalleryQueryIndex()
|
||||||
|
}
|
||||||
|
|
||||||
|
function onFullscreenDialogHide() {
|
||||||
|
onFullscreenMouseUp()
|
||||||
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
selectedProductCode.value = ''
|
selectedProductCode.value = ''
|
||||||
rawRows.value = []
|
rawRows.value = []
|
||||||
|
|||||||
Reference in New Issue
Block a user