Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-03-16 01:13:26 +03:00
parent daa7893d3d
commit 3df69a3278
2 changed files with 114 additions and 6 deletions

View File

@@ -253,7 +253,7 @@
</div>
</div>
<q-dialog v-model="productCardDialog" maximized>
<q-dialog v-model="productCardDialog" maximized @hide="onProductCardDialogHide">
<q-card class="product-card-dialog">
<q-card-section class="row items-center q-pb-sm">
<div class="text-h6">Urun Karti</div>
@@ -275,6 +275,7 @@
arrows
height="100%"
class="product-card-carousel rounded-borders"
@update:model-value="onProductCardSlideChange"
>
<q-carousel-slide
v-for="(img, idx) in productCardImages"
@@ -322,7 +323,7 @@
</q-card>
</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-section class="row items-center q-pb-sm">
<div class="text-h6">Urun Fotografi</div>
@@ -665,6 +666,43 @@ function sortImagesForDisplay(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) {
const resolved = resolveProductImageUrl(item)
const contentUrl = String(resolved.contentUrl || '').trim()
@@ -1320,7 +1358,8 @@ async function openProductCard(grp1, grp2) {
}
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 = {
productCode,
colorCode,
@@ -1345,6 +1384,7 @@ function openProductImageFullscreen(src) {
productImageFullscreenSrc.value = value
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
productImageFullscreenSlide.value = idx
setGalleryQueryIndex(idx)
productImageFullscreenZoom.value = 1
productImageFullscreenOffsetX.value = 0
productImageFullscreenOffsetY.value = 0
@@ -1403,12 +1443,26 @@ function onFullscreenMouseUp() {
}
function onFullscreenSlideChange() {
setGalleryQueryIndex(productImageFullscreenSlide.value)
productImageFullscreenZoom.value = 1
productImageFullscreenOffsetX.value = 0
productImageFullscreenOffsetY.value = 0
productImageFullscreenDragging.value = false
}
function onProductCardSlideChange() {
setGalleryQueryIndex(productCardSlide.value)
}
function onProductCardDialogHide() {
productImageFullscreenDialog.value = false
clearGalleryQueryIndex()
}
function onFullscreenDialogHide() {
onFullscreenMouseUp()
}
function resetForm() {
filters.value = createEmptyFilters()
rawRows.value = []

View File

@@ -238,7 +238,7 @@
</div>
</div>
<q-dialog v-model="productCardDialog" maximized>
<q-dialog v-model="productCardDialog" maximized @hide="onProductCardDialogHide">
<q-card class="product-card-dialog">
<q-card-section class="row items-center q-pb-sm">
<div class="text-h6">Urun Karti</div>
@@ -260,6 +260,7 @@
arrows
height="100%"
class="product-card-carousel rounded-borders"
@update:model-value="onProductCardSlideChange"
>
<q-carousel-slide
v-for="(img, idx) in productCardImages"
@@ -307,7 +308,7 @@
</q-card>
</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-section class="row items-center q-pb-sm">
<div class="text-h6">Urun Fotografi</div>
@@ -644,6 +645,43 @@ function sortImagesForDisplay(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) {
const resolved = resolveProductImageUrl(item)
const contentUrl = String(resolved.contentUrl || '').trim()
@@ -1130,7 +1168,8 @@ async function openProductCard(grp1, grp2) {
}
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 = {
productCode,
colorCode,
@@ -1155,6 +1194,7 @@ function openProductImageFullscreen(src) {
productImageFullscreenSrc.value = value
const idx = Math.max(0, fullscreenImages.value.findIndex((x) => String(x || '').trim() === value))
productImageFullscreenSlide.value = idx
setGalleryQueryIndex(idx)
productImageFullscreenZoom.value = 1
productImageFullscreenOffsetX.value = 0
productImageFullscreenOffsetY.value = 0
@@ -1213,12 +1253,26 @@ function onFullscreenMouseUp() {
}
function onFullscreenSlideChange() {
setGalleryQueryIndex(productImageFullscreenSlide.value)
productImageFullscreenZoom.value = 1
productImageFullscreenOffsetX.value = 0
productImageFullscreenOffsetY.value = 0
productImageFullscreenDragging.value = false
}
function onProductCardSlideChange() {
setGalleryQueryIndex(productCardSlide.value)
}
function onProductCardDialogHide() {
productImageFullscreenDialog.value = false
clearGalleryQueryIndex()
}
function onFullscreenDialogHide() {
onFullscreenMouseUp()
}
function resetForm() {
selectedProductCode.value = ''
rawRows.value = []