@bilfenyazilimekibi/bilpack 1.3.35 → 1.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bilpack.common.js +1 -1
- package/dist/bilpack.umd.js +1 -1
- package/dist/bilpack.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/bilpack.common.js
CHANGED
|
@@ -731,7 +731,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
731
731
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
732
732
|
|
|
733
733
|
"use strict";
|
|
734
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n const sort = sortBy?.length === 0 ? \"id\" : sortBy[0];\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [{\n columnName: sort,\n type: desc,\n }];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://@bilfenyazilimekibi/bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
734
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n // Vuetify v-data-table ilk render / bazı durumlarda `options.sortBy` boş gelebilir.\n // Bu boşlukta \"id desc\" basmak, props ile gelen `queryJsonProps.order` değerini ezmiş oluyor.\n // Bu yüzden sadece gerçekten bir kolon seçildiğinde order güncelliyoruz.\n if (!Array.isArray(sortBy) || sortBy.length === 0) return;\n\n // sortDesc da yoksa type ezmeyelim (props'tan gelen order korunur).\n if (sortDesc === undefined || sortDesc === null) return;\n\n const sort = sortBy[0];\n // Vuetify bazı durumlarda header'da olmasa bile itemKey (genelde `id`) üzerinden sort başlatabiliyor.\n // Props ile custom order verildiyse `id`'ye zorla geçmeyelim.\n const currentOrderColumn = this.queryJson?.order?.[0]?.columnName;\n if (sort === \"id\" && currentOrderColumn && currentOrderColumn !== \"id\") return;\n\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n if (descValue === undefined || descValue === null) return;\n\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [\n {\n columnName: sort,\n type: desc,\n },\n ];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://@bilfenyazilimekibi/bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
735
735
|
|
|
736
736
|
/***/ }),
|
|
737
737
|
|
package/dist/bilpack.umd.js
CHANGED
|
@@ -741,7 +741,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
741
741
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
742
742
|
|
|
743
743
|
"use strict";
|
|
744
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n const sort = sortBy?.length === 0 ? \"id\" : sortBy[0];\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [{\n columnName: sort,\n type: desc,\n }];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
744
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n // Vuetify v-data-table ilk render / bazı durumlarda `options.sortBy` boş gelebilir.\n // Bu boşlukta \"id desc\" basmak, props ile gelen `queryJsonProps.order` değerini ezmiş oluyor.\n // Bu yüzden sadece gerçekten bir kolon seçildiğinde order güncelliyoruz.\n if (!Array.isArray(sortBy) || sortBy.length === 0) return;\n\n // sortDesc da yoksa type ezmeyelim (props'tan gelen order korunur).\n if (sortDesc === undefined || sortDesc === null) return;\n\n const sort = sortBy[0];\n // Vuetify bazı durumlarda header'da olmasa bile itemKey (genelde `id`) üzerinden sort başlatabiliyor.\n // Props ile custom order verildiyse `id`'ye zorla geçmeyelim.\n const currentOrderColumn = this.queryJson?.order?.[0]?.columnName;\n if (sort === \"id\" && currentOrderColumn && currentOrderColumn !== \"id\") return;\n\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n if (descValue === undefined || descValue === null) return;\n\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [\n {\n columnName: sort,\n type: desc,\n },\n ];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
745
745
|
|
|
746
746
|
/***/ }),
|
|
747
747
|
|
package/dist/bilpack.umd.min.js
CHANGED
|
@@ -741,7 +741,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
741
741
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
742
742
|
|
|
743
743
|
"use strict";
|
|
744
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n const sort = sortBy?.length === 0 ? \"id\" : sortBy[0];\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [{\n columnName: sort,\n type: desc,\n }];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
744
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-advanced-cropper */ \"./node_modules/vue-advanced-cropper/dist/index.es.js\");\n/* harmony import */ var vue_advanced_cropper_dist_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-advanced-cropper/dist/style.css */ \"./node_modules/vue-advanced-cropper/dist/style.css\");\n/* harmony import */ var _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../dev/project.settings */ \"./dev/project.settings.js\");\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n components: { Cropper: vue_advanced_cropper__WEBPACK_IMPORTED_MODULE_0__.Cropper },\n\n props: {\n isSingleSelect: {\n default: false,\n },\n bottomScroll: {\n default: true,\n },\n topScroll: {\n type: Boolean,\n default: false\n },\n customSwitch: {\n default: false,\n },\n cropImg: {\n default: false,\n },\n imgChangeApi: {\n default: \"\",\n },\n isImageChange: {\n default: false,\n },\n coloredRows: {\n default: () => [],\n },\n schoolNameTooltip: {\n default: false,\n },\n queryPrefix: {\n default: null,\n },\n queryCallback: {\n default: null,\n },\n isClickableColumn: {\n default: false,\n },\n withoutActions: {\n default: false,\n },\n hasActivePassive: {\n default: false,\n },\n isExpandable: {\n default: false,\n },\n isSelectable: {\n default: false,\n },\n filterRange: {\n default: false,\n },\n pagination: {\n default: true,\n },\n searchableList: {\n default: true,\n },\n customizeActions: {\n default: false,\n },\n colorColumns: {\n default: false,\n },\n stickyColumns: {\n type: Array,\n default: () => [],\n },\n multiSelectSettings: {\n default: () => ({\n action: false,\n }),\n },\n isImage: {\n default: false,\n },\n // perPage: {\n // default: 10\n // },\n isAllItems: {\n default: false\n },\n filterPerPage: {\n default: true,\n },\n isTopArea: {\n default: true,\n },\n headers: {\n default: () => [],\n },\n colorChangeItems: {\n default: () => [],\n },\n noDataTitle: {\n default: () => [],\n },\n filterFields: {\n default: () => [],\n },\n // hiddenColumns: {\n // default: () => []\n // },\n apiUrl: {\n type: String,\n default: null,\n },\n viewConditionFunction: {\n type: Function,\n },\n queryJsonProps: {\n type: Object,\n default: () => ({\n limit: { start: 0, stop: 100 },\n order: [{ columnName: \"id\", type: \"desc\" }],\n columns: null,\n }),\n },\n customParams: {\n default: null,\n },\n tableTitle: {\n default: true,\n },\n tabs: {\n default: () => ({ visible: false }),\n },\n isColumnFilter: {\n default: false,\n },\n isColumnDownload: {\n default: false,\n },\n isRemoveEmptyForExcel: {\n default: false,\n },\n downloadButtonText: {\n default: () => ({\n title: \"İndir\",\n color: \"#ffff\",\n }),\n },\n isAddButtonOptions: {\n default: null,\n },\n title: {\n type: String,\n },\n info: {\n default: true,\n },\n deleteOptions: {\n default: null,\n },\n updateOptions: {\n default: null,\n },\n initAuto: {\n default: true,\n },\n newItem: {\n default: false,\n },\n loading: {\n default: false,\n },\n switchKey: {\n default: \"\",\n },\n isFirstRun: {\n default: true,\n },\n },\n data() {\n return {\n imgFileLoader: false,\n cropDialog: false,\n currentImgSelectedItem: null,\n currentImgChangeType: \"Student\",\n aspectRatio: false,\n stencilProps: {\n movable: true,\n resizable: true,\n handlers: { corners: true },\n round: true,\n },\n cropShape: \"rectangle-stencil\",\n selectedImage: null,\n croppedImage: null,\n generalSettings: _dev_project_settings__WEBPACK_IMPORTED_MODULE_2__.generalSettings,\n tab: 0,\n isDownloadFilter: false,\n columnIsActive: false,\n isMobile: null,\n perPage: 10,\n excelOptions: {\n active: true,\n json_data: [],\n json_fields: {},\n excelFileName: \"\",\n json_meta: [\n [\n {\n key: \"charset\",\n value: \"utf-8\",\n },\n ],\n ],\n },\n deleteItem: null,\n options: {},\n sortBy: \"fat\",\n sortDesc: false,\n search: \"\",\n page: 1,\n pageCount: 0,\n skeletonLoader: true,\n mainLoader: true,\n queryJson: null,\n items: [],\n // perPageItems: [5, 10, 15, 20, 25],\n perPageItems: [],\n week: 10,\n weekItems: [5, 10, 15],\n currentPageNumber: 0,\n sortType: \"desc\",\n columnName: \"\",\n filterColumns: \"\",\n totalCount: \"\",\n listItemSelected: [],\n expanded: [],\n selectedHeaders: [],\n copyHeaders: [],\n checkBoxDisabled: false,\n switchKeyData: \"\",\n isDisabled: false,\n // Dinamik olarak oluşturulan hex renk sınıflarını izlemek için\n createdRowColorClasses: new Set(),\n };\n },\n watch: {\n totalCount(val) {\n if (this.isAllItems) {\n this.perPage = val\n }\n },\n cropDialog(val) {\n if (!val) {\n this.selectedImage = null;\n this.croppedImage = null;\n }\n },\n options: {\n handler() {\n this.fetchData();\n },\n deep: true,\n },\n tab(value) {\n // // query json tamamen güncelleyerek işlem yap\n\n // if (this.tabs.type === 'query') {\n //\n // let prefix = {}\n // prefix = {\n // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // }\n // this.queryPrefix = JSON.stringify(prefix)\n //\n // // let queryObj = {}\n // // queryObj = {\n // // \"limit\": { \"start\": 0, \"stop\": 10 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": column !== null ? { [column]: { \"value1\": val, \"operator\": \"like\" } } : null\n // // }\n //\n // setTimeout(() => this.fetchData())\n // // let queryObj = {}\n // // if (type === 'error') {\n //\n // // } else if (type === 'success') {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": { \"studentData\": { \"value1\": \"1\", \"operator\": \"like\" } }\n // // }\n // // } else {\n // // queryObj = {\n // // \"limit\": { \"start\": -1, \"stop\": -1 },\n // // \"order\": [{ \"columnName\": \"id\", \"type\": \"desc\" }],\n // // \"columns\": null\n // // }\n // // }\n\n // queryJson ile search işlemi yap\n\n // let column = this.tabs.content[value].column\n // let val = this.tabs.content[value].value\n\n this.showHeaders.forEach((item, index) => {\n // : Todo geçici çözüm. Bu alan düzenlencek\n if (item.value === \"studentData\") {\n if (this.tabs.content[value].key === \"success\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"1\";\n } else if (this.tabs.content[value].key === \"error\") {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"0\";\n } else {\n this.showHeaders.find((x) => x.value === \"studentData\").searchValue = \"\";\n }\n }\n\n if (item.value === this.tabs.content[value].key) {\n this.showHeaders[index].searchValue = this.tabs.content[value].value;\n }\n });\n setTimeout(() => this.searchData());\n\n // this.fetchData()\n },\n page(value) {\n if (value > 0) {\n let startVal = this.page === 1 ? 0 : this.perPage * (value - 1);\n this.queryJson.limit.start = startVal;\n this.queryJson.limit.stop = this.perPage;\n this.fetchData();\n }\n },\n perPage(value) {\n const self = this;\n this.queryJson.limit.stop = value;\n setTimeout(() => {\n self.perPage = value;\n });\n this.fetchData();\n },\n selectedHeaders: {\n handler() {\n this.initExcel();\n },\n deep: true,\n },\n expanded(value) {\n this.$emit(\"expandAction\", value);\n },\n listItemSelected(value) {\n const self = this;\n self.$emit(\"listItemSelected\", value);\n },\n items(val) {\n const self = this;\n // eğer listedeki itemslar değişirse excel listesini init etmek için // \n self.initExcel()\n }\n },\n created() {\n\n this.queryJsonProps.limit.stop = this.perPage;\n // this.queryJsonProps.order.type = 'desc';\n\n // this.queryJson = this.queryJsonProps;\n this.queryJson = JSON.parse(JSON.stringify(this.queryJsonProps));\n\n this.selectedHeaders = this.headers;\n this.selectedHeaders.forEach((header, index) => {\n header.searchValue = \"\";\n header.selected = true;\n this.copyHeaders.push(header);\n });\n },\n mounted() {\n if (this.initAuto) {\n this.initExcel();\n if (this.apiUrl !== null) {\n this.hasActivePassive ? this.setActivePassive(\"active\") : this.fetchData();\n }\n this.dataSelectInit();\n }\n\n // Sticky kolonları ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupStickyColumns();\n }, 500);\n });\n }\n this.setupScrollSync();\n },\n updated() {\n // Tablo güncellendiğinde sticky kolonları tekrar ayarla\n if (this.stickyColumns.length > 0) {\n this.$nextTick(() => {\n this.setupStickyColumns();\n });\n }\n this.checkForHorizontalScroll();\n },\n beforeDestroy() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n wrapper.removeEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n },\n methods: {\n checkboxIsDisabled(val) {\n const self = this;\n if (val == 'true') {\n self.isDisabled = true\n } else {\n self.isDisabled = false\n }\n },\n findAutoSelectItems(keyValue) {\n const self = this;\n let resultArray = [];\n\n self.items.forEach((item) => {\n if (item.hasOwnProperty(keyValue)) {\n // Eğer bu değer daha önce array'e eklenmemişse ekle\n if (!resultArray.includes(item[keyValue])) {\n const searchObject = {\n name: item[keyValue],\n val: item[keyValue],\n };\n resultArray.push(searchObject);\n }\n }\n });\n return resultArray;\n },\n async onFileSelected(event, item) {\n const file = event.target.files[0];\n\n if (this.cropImg) {\n if (file) {\n this.selectedImage = URL.createObjectURL(file);\n setTimeout(() => (this.cropDialog = true));\n }\n } else {\n this.saveImage(file);\n }\n },\n async saveImage(file, fileName = null) {\n try {\n if (file) {\n this.imgFileLoader = true;\n // this.selectedImage = URL.createObjectURL(file);\n const formData = new FormData();\n formData.append(\"studentId\", this.currentImgSelectedItem.studentId);\n formData.append(\"type\", this.currentImgChangeType);\n if (fileName) {\n formData.append(\"image\", file, `${fileName}`);\n } else {\n formData.append(\"image\", file);\n }\n\n const { status, message } = await this.$axios.post(this.imgChangeApi, formData);\n\n if (status) {\n this.fetchData();\n this.$refs.fileInput.value = null;\n this.currentImgSelectedItem = null;\n this.cropDialog = false;\n this.currentImgSelectedItem = null;\n } else {\n this.$refs.tableAlert.error(message);\n }\n }\n } catch (e) {\n console.error(\"Error updating image:\", e);\n const msg = e.message ? e.message : \"Bir Hata Oluştu!\";\n this.$refs.tableAlert.error(msg);\n } finally {\n this.imgFileLoader = false;\n }\n },\n createCircularCanvas(canvas) {\n const size = Math.min(canvas.width, canvas.height);\n const circularCanvas = document.createElement(\"canvas\");\n circularCanvas.width = size;\n circularCanvas.height = size;\n\n const ctx = circularCanvas.getContext(\"2d\");\n\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.clip();\n\n ctx.drawImage(\n canvas,\n (canvas.width - size) / 2,\n (canvas.height - size) / 2,\n size,\n size,\n 0,\n 0,\n size,\n size\n );\n\n return circularCanvas;\n },\n cropImage() {\n const { canvas } = this.$refs.cropper.getResult();\n\n const finalCanvas =\n this.cropShape === \"circle-stencil\" ? this.createCircularCanvas(canvas) : canvas;\n\n finalCanvas.toBlob((imageBlob) => {\n const fileType = imageBlob.type.split(\"/\")[1];\n this.saveImage(imageBlob, `${imageBlob.size}.${fileType}`);\n }, \"image/jpeg\");\n },\n imageChange(item, type = \"Student\") {\n if (!this.isImageChange) return;\n this.currentImgSelectedItem = item;\n this.currentImgChangeType = type;\n this.$refs.fileInput.click();\n },\n formatDate(date) {\n if (!date) return null;\n const d = new Date(date);\n const day = String(d.getDate()).padStart(2, \"0\");\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const year = d.getFullYear();\n return `${day}-${month}-${year}`;\n },\n parseDate(date) {\n if (!date) return null;\n const [day, month, year] = date.split(\"-\");\n return new Date(year, month - 1, day).toISOString().substr(0, 10);\n },\n // istenilen row'un backgrounduna renk vermek için kullanılan function\n itemRowBackground(item) {\n const self = this;\n let coloredName = \"\";\n\n // Yeni kurallar: coloredRowValue bir ifade olabilir: \"{a}+{b}\"\n // Eski kurallar: direkt değer eşitliği\n self.coloredRows.map((rule) => {\n const leftRaw = item[rule.coloredRowKey];\n const rightRaw = rule.coloredRowValue;\n\n const leftVal = (typeof leftRaw === \"number\")\n ? leftRaw\n : (typeof leftRaw === \"string\" && leftRaw.trim() !== \"\" && !isNaN(Number(leftRaw)))\n ? Number(leftRaw)\n : leftRaw;\n\n const rightVal =\n typeof rightRaw === \"string\" && rightRaw.includes(\"{\")\n ? self.evaluateExpression(rightRaw, item)\n : ((typeof rightRaw === \"number\")\n ? rightRaw\n : (typeof rightRaw === \"string\" && rightRaw.trim() !== \"\" && !isNaN(Number(rightRaw)))\n ? Number(rightRaw)\n : rightRaw);\n\n let isEqual;\n if (typeof leftVal === \"number\" && typeof rightVal === \"number\") {\n isEqual = leftVal === rightVal;\n } else {\n isEqual = String(leftVal) === String(rightVal);\n }\n\n const condition = rule.equalValue ? isEqual : !isEqual;\n if (condition) {\n const cls = self.getRowClassForColor(rule.coloredRowColor);\n if (cls) coloredName = cls;\n }\n });\n\n return coloredName;\n },\n\n // \"{a}+{b}-{c}\" gibi ifadeleri değerlendirir (yalnızca 0-9, + - * / ( ) ve nokta)\n evaluateExpression(expr, item) {\n try {\n let replaced = expr.replace(/\\{([^}]+)\\}/g, (match, key) => {\n const val = item[key.trim()];\n const num = (typeof val === \"number\") ? val : Number(val);\n return isNaN(num) ? 0 : num;\n });\n // Güvenlik: sadece izinli karakterler\n if (/^[0-9+\\-*/().\\s]+$/.test(replaced) === false) return 0;\n // eslint-disable-next-line no-new-func\n const fn = new Function(`return (${replaced});`);\n const result = fn();\n return typeof result === \"number\" && isFinite(result) ? result : 0;\n } catch (e) {\n return 0;\n }\n },\n\n // Renk adına göre sınıf döndürür. Hex verilirse dinamik sınıf üretir.\n getRowClassForColor(color) {\n if (typeof color !== \"string\") return \"\";\n const lower = color.toLowerCase();\n const named = [\"red\", \"blue\", \"white\", \"yellow\", \"green\"];\n if (named.includes(lower)) return `table-${lower}`;\n\n // Hex renk desteği\n if (color.startsWith(\"#\") && (color.length === 7 || color.length === 4)) {\n const sanitized = color.replace('#', '').toUpperCase();\n const className = `table-hex-${sanitized}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n }\n\n // Diğer geçerli css renkleri için de dinamik sınıf oluşturmayı deneyelim\n const className = `table-color-${btoa(unescape(encodeURIComponent(color))).replace(/=/g, '')}`;\n if (!this.createdRowColorClasses.has(className)) {\n this.injectRowColorStyle(className, color);\n this.createdRowColorClasses.add(className);\n }\n return className;\n },\n\n // Verilen sınıf adı için style tag inject eder\n injectRowColorStyle(className, color) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.textContent = `.v-application .${className} .text-start { background-color: ${color} !important; }`;\n document.head.appendChild(style);\n },\n openModal(item, name) {\n this.$emit(\"openModal\", item, name);\n },\n changeDateInput(item) {\n this.$emit(\"changeDateInput\", item);\n // Tarih seçimi yapıldığı zaman o öğrencinin checkboxını true yapmak için\n const exists = this.listItemSelected.some(\n (student) => student.studentClassroomId === item.studentClassroomId\n );\n if (!exists) {\n this.listItemSelected.push(item);\n }\n },\n changeInput(item, date) {\n item.vaccineDate = date;\n this.$emit(\"changeInput\", item);\n },\n getImage(type) {\n if (type === \"no-result\") {\n return this.$bilpack.settings.images.table.noResult;\n } else {\n return this.$bilpack.settings.images.noData;\n }\n },\n switchAction(item) {\n this.$emit(\"switchAction\", item);\n },\n onResize() {\n if (window.innerWidth < 769) this.isMobile = true;\n else this.isMobile = false;\n },\n selectFilter(item) {\n const self = this;\n if (item.selected) {\n self.copyHeaders.push(item)\n } else {\n self.copyHeaders = self.copyHeaders.filter(val => val.value !== item.value)\n }\n if (self.headers.some(item => item.value === \"action\")) {\n if (self.copyHeaders.length === 2) {\n self.checkboxIsDisabled('true')\n }\n else {\n self.checkboxIsDisabled('false')\n }\n\n } else {\n if (self.copyHeaders.length === 1) {\n self.checkboxIsDisabled('true')\n } else {\n self.checkboxIsDisabled('false')\n }\n }\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n // filter input her değiştiğinde excel listesini init ediyoruz //\n setTimeout(() => {\n self.initExcel()\n })\n },\n setActivePassive(method) {\n const self = this;\n\n if (self.queryJson.columns === null) {\n self.queryJson.columns = {\n status: {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n },\n };\n } else {\n if (typeof self.queryJson.columns === \"object\") {\n self.queryJson.columns.status = {\n value1: method === \"active\" ? \"1\" : \"0\",\n operator: \"equal\",\n };\n }\n }\n\n self.queryJson.limit.start = \"0\";\n\n self.columnIsActive = method === \"active\";\n\n self.fetchData();\n },\n filterHandle(headers) {\n headers.forEach((val, key) => {\n if (val.value === \"action\") {\n headers.splice(key, 1);\n }\n });\n return headers;\n },\n initExcel() {\n const self = this;\n self.excelOptions.json_fields = {};\n // isRemoveEmptyForExcel değerine göre filtrelenmiş listeyi ya da başlangıçtaki listeyi eşitliyoruz // \n const excelListItems = self.isRemoveEmptyForExcel ? self.copyHeaders : self.selectedHeaders;\n\n // excel çıktısındaki listede eğer filterFields propsunun key değerlerinin hiçbiri yok ise o öğrenciyi listeden çıkarmak için //\n const activeHealthFields = self.filterFields.filter(item => self.copyHeaders.some(h => h.value === item && h.selected)).map(item => item);\n const filteredStudents = activeHealthFields.length > 0 ? self.items.filter(student => {\n // filter içindeki alanlardan en az biri dolu mu?\n const hasAnyValue = activeHealthFields.some(key => {\n const val = student[key];\n return val !== null && val !== \"\" && val !== undefined;\n });\n return hasAnyValue; // dolu varsa öğrenci listede kalır\n }) : self.convertAlternateValues(self.items, self.copyHeaders);\n self.excelOptions.json_data = filteredStudents\n\n // Not: `download-excel` `fields` prop'u obje bekliyor. Obje key'leri (kolon başlıkları)\n // aynı olursa üstüne yazıldığı için bazı sütunlar Excel'de eksik görünebilir.\n // Bu yüzden başlıkları unique hale getiriyoruz.\n const usedTitles = new Map();\n excelListItems.forEach((header) => {\n if (!header || header.value === \"action\") return;\n\n const rawTitle = (header.text ?? header.value ?? \"\").toString().trim();\n const baseTitle = rawTitle.length > 0 ? rawTitle : (header.value ?? \"\").toString();\n if (!baseTitle) return;\n\n const seenCount = usedTitles.get(baseTitle) ?? 0;\n usedTitles.set(baseTitle, seenCount + 1);\n const uniqueTitle = seenCount === 0 ? baseTitle : `${baseTitle} (${seenCount + 1})`;\n\n self.excelOptions.json_fields[uniqueTitle] = header.value;\n });\n\n self.excelOptions.excelFileName =\n self.title !== undefined ? self.title : \"Excel Listesi\";\n },\n dataSelectInit() {\n const self = this;\n self.headers.forEach((item) => {\n if (\n item.searchOptions !== undefined &&\n item.searchOptions.type === \"select-data\"\n ) {\n // item.loader = true;\n if (item.searchOptions.endpoint !== \"\") {\n item.searchOptions.selectItems = [];\n self.$axios.get(item.searchOptions.endpoint).then((res) => {\n item.searchOptions.selectItems = res.data.data;\n });\n }\n }\n });\n },\n openDeleteConfirm(item) {\n this.$emit(\"deleteItem\", item);\n const self = this;\n self.deleteItem = item;\n if (self.deleteOptions.confirmText !== undefined) {\n this.$refs.tableAlert.confirm({\n text: self.deleteOptions.confirmText,\n });\n } else {\n this.$refs.tableAlert.confirm();\n }\n },\n deleteTableItem() {\n const self = this;\n const obj = {};\n\n self.deleteOptions.postParams.forEach((val) => {\n obj[val.param] = this.isSelectable\n ? JSON.stringify([this.deleteItem[val.value]]).replace(/\"/g, \"\")\n : this.deleteItem[val.value];\n });\n\n if (self.deleteOptions.customPostParams !== undefined) {\n self.deleteOptions.customPostParams.forEach((val) => {\n obj[val.param] = val.value;\n });\n }\n\n setTimeout(() => {\n self.$axios.post(self.deleteOptions.endpoint, obj).then((res) => {\n if (res.data.status) {\n self.$refs.tableAlert.success();\n self.fetchData();\n\n this.$emit(\"deleteAfterFunction\");\n } else {\n let text =\n res.data.message !== undefined ? res.data.message : \"Bir hata oluştu\";\n self.$refs.tableAlert.error({\n text: text,\n });\n }\n });\n });\n },\n searchData(customSearchValue) {\n let columns = {};\n\n if (this.queryPrefix !== null) {\n if (this.queryPrefix.columns !== undefined)\n columns = JSON.parse(JSON.stringify(this.queryPrefix.columns));\n }\n this.headers.forEach((value, key) => {\n if (value.searchValue) {\n let pushObject = {\n value1: value.searchValue,\n operator: value.operator,\n };\n customSearchValue\n ? customSearchValue?.length > 0\n ? (columns[customSearchValue] = pushObject)\n : (columns[value.value] = pushObject)\n : (columns[value.value] = pushObject);\n }\n });\n this.queryJson.columns = columns;\n this.$forceUpdate();\n this.page = 1;\n this.fetchData();\n },\n // searchData() {\n // let columns = {};\n // this.headers.forEach((value, key) => {\n // // todo: Bu alan tekrar düzenlenecek.\n // if (value.searchValue) {\n // if (value.value === 'preRegistrationStatus' && value.searchValue === '4') {\n // let pushObject = {\"value1\": 'true', \"operator\": value.operator}\n // columns['registrationStatus'] = pushObject\n // } else {\n // let pushObject = {\"value1\": value.searchValue, \"operator\": value.operator}\n // columns[value.value] = pushObject\n // }\n // }\n // })\n //\n // this.queryJson.columns = columns\n // this.page = 1;\n //\n // this.fetchData();\n // },\n customSorting(sortBy, sortDesc) {\n // Vuetify v-data-table ilk render / bazı durumlarda `options.sortBy` boş gelebilir.\n // Bu boşlukta \"id desc\" basmak, props ile gelen `queryJsonProps.order` değerini ezmiş oluyor.\n // Bu yüzden sadece gerçekten bir kolon seçildiğinde order güncelliyoruz.\n if (!Array.isArray(sortBy) || sortBy.length === 0) return;\n\n // sortDesc da yoksa type ezmeyelim (props'tan gelen order korunur).\n if (sortDesc === undefined || sortDesc === null) return;\n\n const sort = sortBy[0];\n // Vuetify bazı durumlarda header'da olmasa bile itemKey (genelde `id`) üzerinden sort başlatabiliyor.\n // Props ile custom order verildiyse `id`'ye zorla geçmeyelim.\n const currentOrderColumn = this.queryJson?.order?.[0]?.columnName;\n if (sort === \"id\" && currentOrderColumn && currentOrderColumn !== \"id\") return;\n\n // v-data-table sortDesc: true = azalan, false = artan -> backend 'desc' | 'asc'\n // sortDesc array olarak gelir (örn: [true] veya [false]), ilk elemanı alıyoruz\n const descValue = Array.isArray(sortDesc) ? sortDesc[0] : sortDesc;\n if (descValue === undefined || descValue === null) return;\n\n const desc = typeof descValue === \"boolean\" ? (descValue ? \"desc\" : \"asc\") : (descValue || \"desc\");\n this.queryJson.order = [\n {\n columnName: sort,\n type: desc,\n },\n ];\n },\n resetAndFetch() {\n const self = this;\n self.showHeaders.forEach((item) => {\n item.searchValue = \"\";\n });\n self.queryJson = JSON.stringify(this.queryJsonProps);\n self.fetchData();\n },\n checkListItems() {\n try {\n const localSelectedItem = JSON.parse(localStorage.getItem(\"selectData\"));\n if (localSelectedItem) {\n this.listItemSelected = localSelectedItem;\n } else {\n this.listItemSelected = [];\n }\n } catch (error) {\n this.listItemSelected = [];\n }\n },\n fetchData(customQueryJson = null, refreshQuery = false) {\n const self = this;\n self.mainLoader = true;\n self.checkListItems();\n const { sortBy, sortDesc, page, itemsPerPage } = this.options;\n\n this.customSorting(sortBy, sortDesc);\n\n setTimeout(async () => {\n let queryJsonString =\n customQueryJson !== null ? customQueryJson : JSON.stringify(this.queryJson);\n\n let params = {\n queryJson: queryJsonString,\n };\n\n if (self.customParams !== null) Object.assign(params, self.customParams);\n\n if (self.queryCallback !== null && typeof self.queryCallback === \"function\") {\n params = await self.queryCallback(params);\n }\n // İstek atılmadan önce dışarıya event gönderiyoruz\n this.$emit('beforeRequest', {\n queryJsonProps: this.queryJson,\n timestamp: new Date().toLocaleString()\n });\n\n self.$axios.post(self.apiUrl, params).then((res) => {\n if (res.data.data.result !== undefined) {\n self.totalCount = res.data.data.totalCount;\n if (res.data.status) {\n self.initPerPageItems(this.totalCount);\n self.pageCount = Math.ceil(res.data.data.filterCount / self.perPage);\n self.items = res.data.data.result;\n self.items.map((val, index) => {\n if (val.createdAt) {\n const dateString = val.createdAt;\n const dateParts = dateString.split(\" \")[0].split(\"-\");\n const formattedDate = `${dateParts[1]}-${dateParts[2]}-${dateParts[0]}`;\n self.items[index].createdAt = formattedDate;\n self.items[index].fullSchollName = val.schoolNames;\n if (val.schoolNames) {\n if (val.schoolNames.includes(\",\")) {\n const arraySchoolName = val.schoolNames.split(\",\");\n self.items[index].schoolNames =\n arraySchoolName[0] + \"... +\" + (arraySchoolName?.length - 1);\n }\n }\n }\n });\n self.dateHandle(self.items, self.showHeaders);\n self.itemsCallback(self.items, self.showHeaders);\n self.items.map((val, index) => {\n if (val.registerPercentage) {\n self.items[index].registerPercentage = val.registerPercentage.replace(/\\./g, \",\");\n }\n });\n\n // Tablo gösterimi için değerleri dönüştür\n self.convertTableValues(self.items, self.headers);\n\n // Excel için ayrı bir veri seti oluştur ve dönüştür\n const excelItems = self.convertAlternateValues(self.items, self.headers);\n self.excelOptions.json_data = excelItems;\n\n self.$emit(\"onFetch\", self.items);\n\n if (self.stickyColumns.length > 0) {\n self.$nextTick(() => {\n setTimeout(() => {\n self.setupStickyColumns();\n }, 100);\n });\n }\n }\n }\n self.mainLoader = false;\n self.skeletonLoader = false;\n\n this.$nextTick(() => {\n setTimeout(() => {\n this.setupScrollSync();\n }, 100);\n });\n });\n });\n },\n itemsCallback(items, headers) {\n const self = this;\n const callbacks = headers.filter((x) => x.callback);\n if (callbacks) {\n callbacks.forEach((x) => {\n items.forEach((i, index) => {\n const fetchVal = i[x.value];\n if (fetchVal !== undefined && typeof x.callback === \"function\") {\n self.items[index][x.value] = x.callback(fetchVal);\n }\n });\n });\n }\n },\n dateHandle(items, headers) {\n let dateItems = [];\n headers.forEach((headerItem, index) => {\n if (headerItem.searchOptions !== undefined) {\n if (headerItem.searchOptions.type === \"date\") {\n dateItems.push(headerItem.value);\n }\n }\n });\n this.items.forEach((item, index) => {\n dateItems.forEach((val) => {\n if (item[val] !== null) {\n item[val] = this.convertDate(item[val]);\n }\n });\n });\n },\n convertDate(inputDate) {\n const dateObj = new Date(inputDate);\n const year = dateObj.getFullYear();\n const month = String(dateObj.getMonth() + 1).padStart(2, \"0\");\n const day = String(dateObj.getDate()).padStart(2, \"0\");\n return `${day}.${month}.${year}`;\n },\n initPerPageItems(totalCount = 0) {\n const self = this;\n let array = [];\n const defaultItems = [5, 10, 15, 20, 25];\n\n defaultItems.forEach((numb) =>\n totalCount > numb ? array.push({ text: numb, value: numb }) : \"\"\n );\n array.push({\n text: \"Tümü\",\n value: totalCount,\n });\n\n self.perPageItems = array;\n },\n getColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#FEE2E2\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DBEAFE\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#FEE2E2\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#FEE2E2\" : \"#DBEAFE\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#DCFCE7\";\n else if (item === \"1\") return \"#DBEAFE\";\n else if (item === \"2\") return \"#DCFCE7\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#DBEAFE\";\n else if (item === \"NAKİL\") return \"#DCFCE7\";\n else if (item === \"KAYITYENİLEME\") return \"#FEE2E2\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#DCFCE7\";\n else if (item === \"Geçmiş\") return \"#D9D9D9\";\n else if (item === \"Beklemede\") return \"#FEE2E2\";\n }\n if (name === \"topicStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"unitStatus\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#16A34A\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#DBEAFE\";\n else if (item === \"1\") return \"#DCFCE7\";\n else if (item === \"2\") return \"#FEE2E2\";\n else if (item === \"3\") return \"#FEE2E2\";\n else if (item === \"4\") return \"#DCFCE7\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#DCFCE7\" : \"#DBEAFE\";\n }\n },\n getTextColor(item, name) {\n if (name === \"repetition\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"transfer\") {\n if (item === \"0\") return \"#DC2626\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#2563EB\";\n }\n if (name === \"register\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"payment\" || name === \"working\") {\n return item === \"1\" ? \"#16A34A\" : \"#DC2626\";\n }\n if (name === \"leaving\") {\n return item === \"1\" ? \"#DC2626\" : \"#2563EB\";\n }\n if (name === \"graduated\") {\n return item === \"1\" ? \"#16A34A\" : \"#2563EB\";\n }\n if (name === \"lastBranch\") {\n if (item === \"ÖNKAYIT\") return \"#2563EB\";\n else if (item === \"NAKİL\") return \"#16A34A\";\n else if (item === \"KAYITYENİLEME\") return \"#DC2626\";\n }\n if (name === \"registrationStatus\") {\n if (item === \"0\") return \"#16A34A\";\n else if (item === \"1\") return \"#2563EB\";\n else if (item === \"2\") return \"#16A34A\";\n }\n if (name === \"announcementProcess\") {\n if (item === \"Güncel\") return \"#00D095\";\n else if (item === \"Beklemede\") return \"#FE550D\";\n else if (item === \"Geçmiş\") return \"#464646\";\n }\n if (name === \"preRegistrationStatus\") {\n if (item === \"0\") return \"#2563EB\";\n else if (item === \"1\") return \"#16A34A\";\n else if (item === \"2\") return \"#DC2626\";\n else if (item === \"3\") return \"#DC2626\";\n else if (item === \"4\") return \"#16A34A\";\n }\n if (name === \"registerButton\") {\n return item === \"true\" ? \"#16A34A\" : \"#2563EB\";\n }\n },\n clickNewItem() {\n this.$emit(\"clickNewItem\");\n },\n clickMultiSelectAction(clickItem) {\n this.$emit(\"clickMultiSelectAction\", this.listItemSelected, clickItem);\n },\n stringToCode(str, name, value, selfItem) {\n const func = new Function(\"item\", `return ${str}`);\n const item = { [name]: value };\n return func(item);\n },\n setupStickyColumns() {\n const table = document.querySelector(\"#v-data-table\");\n if (!table) return;\n\n const headerCells = table.querySelectorAll(\"thead th\");\n const rows = table.querySelectorAll(\"tbody tr\");\n\n // Önce tüm sticky stilleri temizle\n headerCells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n cells.forEach((cell) => {\n cell.style.position = \"\";\n cell.style.left = \"\";\n cell.style.zIndex = \"\";\n cell.style.backgroundColor = \"\";\n cell.style.boxShadow = \"\";\n });\n });\n\n // Sticky kolonları ayarla\n let leftOffset = 0;\n\n this.stickyColumns.forEach((columnValue, index) => {\n // Header hücresini bul\n const headerIndex = this.showHeaders.findIndex(\n (header) => header.value === columnValue\n );\n if (headerIndex === -1) return;\n\n const headerCell = headerCells[headerIndex];\n if (!headerCell) return;\n\n // Sticky stil uygula\n headerCell.style.position = \"sticky\";\n headerCell.style.left = leftOffset + \"px\";\n headerCell.style.zIndex = \"2\";\n headerCell.style.backgroundColor = \"white\";\n headerCell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n\n // Tüm satırlar için aynı işlemi yap\n rows.forEach((row) => {\n const cells = row.querySelectorAll(\"td\");\n if (cells.length > headerIndex) {\n const cell = cells[headerIndex];\n cell.style.position = \"sticky\";\n cell.style.left = leftOffset + \"px\";\n cell.style.zIndex = \"1\";\n cell.style.backgroundColor = \"white\";\n cell.style.boxShadow = \"2px 0 5px rgba(0,0,0,0.1)\";\n }\n });\n\n // Bir sonraki kolon için offset güncelle\n leftOffset += headerCell.offsetWidth;\n });\n },\n checkForHorizontalScroll() {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (this.bottomScroll) {\n wrapper.classList.add(\"active\");\n }\n this.hasHorizontalScroll = wrapper.scrollWidth > wrapper.clientWidth;\n }\n },\n handleTopScroll(e) {\n const table = this.$refs.dataTable.$el.querySelector(\".v-data-table__wrapper\");\n table.scrollLeft = e.target.scrollLeft;\n },\n handleMainTableScroll(e) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n topScrollBar.scrollLeft = e.target.scrollLeft;\n }\n },\n setupScrollSync() {\n this.$nextTick(() => {\n const table = this.$refs.dataTable;\n if (table) {\n const wrapper = table.$el.querySelector(\".v-data-table__wrapper\");\n if (wrapper) {\n const topScrollBar = this.$refs.topScrollBar;\n if (topScrollBar) {\n // Clear existing content\n topScrollBar.innerHTML = \"\";\n // Create and append the spacer div with exact width\n const spacerDiv = document.createElement(\"div\");\n spacerDiv.style.width = `${wrapper.scrollWidth}px`;\n spacerDiv.style.height = \"1px\";\n spacerDiv.style.minWidth = `${wrapper.scrollWidth + 120}px`; // Add min-width to ensure full width\n topScrollBar.appendChild(spacerDiv);\n\n // Set the wrapper width to match the table\n topScrollBar.style.width = `${wrapper.clientWidth + 100}px`;\n }\n wrapper.addEventListener(\"scroll\", this.handleMainTableScroll);\n }\n }\n });\n },\n isScrollable() {\n return this.hasHorizontalScroll\n },\n convertAlternateValues(items, headers) {\n const tempItems = JSON.parse(JSON.stringify(items));\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n tempItems.forEach(item => {\n if (item[header.value]) {\n // Excel için özel sembol dönüşümü yapılacaksa\n if (header.excelSymbols) {\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n if (found && header.excelSymbols[found.key]) {\n const symbol = header.excelSymbols[found.key];\n // Excel XML formatında stil tanımlaması\n return `<html><font size=\"10\" color=\"${symbol.color}\">${symbol.char}</font></html>`;\n }\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(' ');\n } else {\n // Normal metin dönüşümü\n const values = item[header.value].split(',');\n const convertedValues = values.map(val => {\n const found = header.alternateValues.find(av => av.key === val.trim());\n return found ? found.value : val.trim();\n });\n item[header.value] = convertedValues.join(', ');\n }\n }\n });\n }\n });\n return tempItems;\n },\n\n convertTableValues(items, headers) {\n headers.forEach(header => {\n if (header.alternateValues && header.alternateValues.length > 0) {\n items.forEach(item => {\n // Risk dereceleri ve diğer tekil değerler için\n if (item[header.value] && !item[header.value].includes(',')) {\n const found = header.alternateValues.find(av => av.key === item[header.value]);\n if (found) {\n item[header.value] = found.value;\n }\n }\n });\n }\n });\n },\n },\n computed: {\n changedDate() {\n return (date) => {\n return this.formatDate(date);\n };\n },\n showHeaders() {\n return this.headers.filter((item) => this.copyHeaders.includes(item));\n },\n headerTemplates() {\n return this.headers.filter((x) => x.custom);\n },\n // visibleHeaders() {\n // return this.showHeaders.filter(header => !this.hiddenColumns.includes(header.value));\n // },\n // visibleColumns() {\n // return this.showHeaders.map(header => header.value).filter(column => !this.hiddenColumns.includes(column));\n // }\n\n },\n});\n\n\n//# sourceURL=webpack://bilpack/./src/components/bf-table/index.vue?./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options");
|
|
745
745
|
|
|
746
746
|
/***/ }),
|
|
747
747
|
|