Piyango Resimleri için silme butonu eklendi.

This commit is contained in:
M. Bestami
2025-08-13 16:55:41 +03:00
parent de3a1f549a
commit 2338cf04d8
2 changed files with 88 additions and 12 deletions

View File

@ -9,9 +9,19 @@
:data="file" :data="file"
onlyPreview onlyPreview
:editable="false" :editable="false"
:filePath="file.resimYolu" /> :filePath="file.resimYolu">
<template #actionButtons v-if="usersStore.isPanelUser">
<i
class="ico-c ico-btn ico-section back-grad-alert"
@click="DeleteImagePop(file)">
<svg><use href="/src/assets/images/icons.svg#trash"></use></svg>
</i>
</template>
</file-list-item>
</template> </template>
<div v-if="usersStore.isPanelUser && fileList.length === 0" class="form-inner-comment"> <div
v-if="usersStore.isPanelUser && fileList.length === 0"
class="form-inner-comment">
Eklenmiş resim bulunamadı. Eklenmiş resim bulunamadı.
</div> </div>
</div> </div>
@ -26,13 +36,43 @@
const usersStore = useUsersStore() const usersStore = useUsersStore()
import { usePiyangoStore } from '../../stores/piyangoStore' import { usePiyangoStore } from '../../stores/piyangoStore'
const piyangoStore = usePiyangoStore() const piyangoStore = usePiyangoStore()
import { useDialogStore } from '@/components/global/dialogStore'
const dialogStore = useDialogStore()
const fileList = ref<Record<string,any>[]>([]) const fileList = ref<Record<string, any>[]>([])
const GetData = async () => { const GetData = async () => {
let dt = await dataStore.dataGet('CekilisResim/Cekilis/' + piyangoStore.selectedLottery) let dt = await dataStore.dataGet(
'CekilisResim/Cekilis/' + piyangoStore.selectedLottery
)
if (dt !== 'errorfalse') fileList.value.splice(0, fileList.value.length, ...dt.data) if (dt !== 'errorfalse') fileList.value.splice(0, fileList.value.length, ...dt.data)
} }
const DeleteImagePop = (data: Record<string, any>) => {
dialogStore.CreateDialog({
title: 'Resim Sil',
id: 'deleteimage',
content: 'Resimi silmek istediğinize emin misiniz? Bu işlem geri alınamaz.',
closeText: 'Vazgeç',
buttons: [
{
label: 'Resmi Sil',
type: 'alert',
function: () => DeleteImage(data.id)
}
]
})
}
const DeleteImage = async (id: number | string) => {
var dt = await dataStore.dataDelete('Popup/' + id)
if (dt !== 'errorfalse') {
dialogStore.CloseDialog('deleteimage')
await GetData()
}
}
onBeforeMount(async () => { onBeforeMount(async () => {
await GetData() await GetData()
}) })

View File

@ -9,7 +9,17 @@
:data="file" :data="file"
@click="EditImage" @click="EditImage"
onlyPreview onlyPreview
:filePath="file.resimYolu" /> :filePath="file.resimYolu">
<template
#actionButtons
v-if="piyangoStore.lotteryApprove === 0 || piyangoStore.lotteryApprove === 3">
<i
class="ico-c ico-btn ico-section back-grad-alert"
@click="DeleteImagePop(file)">
<svg><use href="/src/assets/images/icons.svg#trash"></use></svg>
</i>
</template>
</file-list-item>
</template> </template>
<div <div
class="form-item form-item-picture clickable" class="form-item form-item-picture clickable"
@ -23,7 +33,9 @@
</i> </i>
</div> </div>
</div> </div>
<div v-if="usersStore.isPanelUser && fileList.length === 0" class="form-inner-comment"> <div
v-if="usersStore.isPanelUser && fileList.length === 0"
class="form-inner-comment">
Eklenmiş resim bulunamadı. Eklenmiş resim bulunamadı.
</div> </div>
</div> </div>
@ -57,16 +69,14 @@
const usersStore = useUsersStore() const usersStore = useUsersStore()
import { usePiyangoStore } from '../../stores/piyangoStore' import { usePiyangoStore } from '../../stores/piyangoStore'
const piyangoStore = usePiyangoStore() const piyangoStore = usePiyangoStore()
import { useDialogStore } from '@/components/global/dialogStore'
const dialogStore = useDialogStore()
const picturePanel = ref<boolean>(false) const picturePanel = ref<boolean>(false)
const isUpdate = ref<boolean>(false) const isUpdate = ref<boolean>(false)
const isFormValid = ref<boolean>(true) const isFormValid = ref<boolean>(true)
interface IFileList { const fileList = ref<Record<string, any>[]>([])
[key: string]: any
}
const fileList = ref<IFileList[]>([] as IFileList[])
const AddNewImage = () => { const AddNewImage = () => {
dataStore.panelData = { dataStore.panelData = {
@ -82,7 +92,9 @@
} }
const GetData = async () => { const GetData = async () => {
let dt = await dataStore.dataGet('CekilisResim/Cekilis/' + piyangoStore.selectedLottery) let dt = await dataStore.dataGet(
'CekilisResim/Cekilis/' + piyangoStore.selectedLottery
)
if (dt !== 'errorfalse') fileList.value.splice(0, fileList.value.length, ...dt.data) if (dt !== 'errorfalse') fileList.value.splice(0, fileList.value.length, ...dt.data)
} }
@ -129,6 +141,30 @@
} }
} }
} }
const DeleteImagePop = (data: Record<string, any>) => {
dialogStore.CreateDialog({
title: 'Resim Sil',
id: 'deleteimage',
content: 'Resimi silmek istediğinize emin misiniz? Bu işlem geri alınamaz.',
closeText: 'Vazgeç',
buttons: [
{
label: 'Resmi Sil',
type: 'alert',
function: () => DeleteImage(data.id)
}
]
})
}
const DeleteImage = async (id: number | string) => {
var dt = await dataStore.dataDelete('Popup/' + id)
if (dt !== 'errorfalse') {
dialogStore.CloseDialog('deleteimage')
await GetData()
}
}
onBeforeMount(async () => { onBeforeMount(async () => {
await GetData() await GetData()
}) })