Merge pull request 'Üye/Profil-Resim-Silme-Özelliği' (#6) from Üye/Profil-Resim-Silme-Özelliği into main

Reviewed-on: #6
This commit is contained in:
2025-08-14 07:10:36 +00:00

View File

@ -1,49 +1,64 @@
<template>
<div class='form-part'>
<div class='form-part-title'>
<div class="form-part">
<div class="form-part-title">
<h4>Profil Resmi</h4>
</div>
<div class='form-part-content'>
<div class="form-part-content">
<template v-if="file.filePath !== '' && file.filePath !== null">
<file-list-item
:data='file'
@click='ReplaceImage'
:data="file"
@click="ReplaceImage"
onlyPreview
:filePath='file.filePath' />
:filePath="file.filePath">
<template
#actionButtons
v-if="
route.name === 'Profil' ||
(route.name === 'Profil' && !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 v-else>
<template v-if="route.name === 'Profil' || (route.name === 'Profil' && !usersStore.isPanelUser)">
<div class='form-item form-item-picture clickable' @click='picturePanel = true'>
<div class='image-c'>
<i class='ico-c'>
<template
v-if="
route.name === 'Profil' ||
(route.name === 'Profil' && !usersStore.isPanelUser)
">
<div class="form-item form-item-picture clickable" @click="picturePanel = true">
<div class="image-c">
<i class="ico-c">
<svg>
<use href='@/assets/images/icons.svg#plus'></use>
<use href="@/assets/images/icons.svg#plus"></use>
</svg>
</i>
</div>
</div>
</template>
<template v-else>
<div class='form-inner-comment'>
Eklenmiş resim bulunamadı.
</div>
<div class="form-inner-comment">Eklenmiş resim bulunamadı.</div>
</template>
</template>
</div>
</div>
<panel-wrapper
v-if='picturePanel'
v-model='picturePanel'
panel-title='Profil Resmi Ekle'>
v-if="picturePanel"
v-model="picturePanel"
panel-title="Profil Resmi Ekle">
<template #panelContent>
<panel-user-picture />
</template>
<template #footerButton>
<div class='button-c button-save' @click='FileUpload'>Ekle</div>
<div class="button-c button-save" @click="FileUpload">Ekle</div>
</template>
</panel-wrapper>
</template>
<script setup lang='ts'>
<script setup lang="ts">
import { ref, reactive, onBeforeMount } from 'vue'
import PanelUserPicture from '../panel/PanelUserPicture.vue'
import PanelWrapper from '@/components/PanelWrapper.vue'
@ -52,20 +67,13 @@
const route = useRoute()
import { useDataStore } from '@/stores/dataStore'
const dataStore = useDataStore()
import { useGlobalStore } from '@/stores/globalStore'
const globalStore = useGlobalStore()
import { useValidationStore } from '@/stores/validationStore'
const validationStore = useValidationStore()
import { useUsersStore } from '@/stores/usersStore'
const usersStore = useUsersStore()
import { useCustomerStore } from '@/module/uyeler/stores/customerStore'
const customerStore = useCustomerStore()
import { useDialogStore } from '@/components/global/dialogStore'
const dialogStore = useDialogStore()
const picturePanel = ref<boolean>(false)
const isUpdate = ref<boolean>(false)
@ -82,7 +90,9 @@
}
const GetData = async () => {
let dt = await dataStore.dataGet('AppUserResim/AppUserId/' + usersStore.selectedUserId())
let dt = await dataStore.dataGet(
'AppUserResim/AppUserId/' + usersStore.selectedUserId()
)
if (dt !== 'errorfalse') {
Object.assign(file, dt)
if (usersStore.selectedUserId() === usersStore.userId)
@ -126,6 +136,32 @@
}
}
}
const DeleteImagePop = (data: Record<string, any>) => {
dialogStore.CreateDialog({
title: 'Resim Sil',
id: 'deleteimage',
content: 'Resmi silmek istediğinize emin misiniz? Bu işlem geri alınamaz.',
closeText: 'Vazgeç',
buttons: [
{
label: 'Resim Sil',
type: 'alert',
function: () => DeleteImage(data.id)
}
]
})
}
const DeleteImage = async (id: number | string) => {
var dt = await dataStore.dataDelete('AppUserResim/' + id)
if (dt !== 'errorfalse') {
dialogStore.CloseDialog('deleteimage')
await GetData()
}
}
onBeforeMount(async () => {
await GetData()
})