Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* THIS FILE IS GENERATED AUTOMATICALLY.
|
||||
* DO NOT EDIT.
|
||||
*
|
||||
* You are probably looking on adding startup/initialization code.
|
||||
* Use "quasar new boot <name>" and add it there.
|
||||
* One boot file per concern. Then reference the file(s) in quasar.config file > boot:
|
||||
* boot: ['file', ...] // do not add ".js" extension to it.
|
||||
*
|
||||
* Boot files are your "main.js"
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import { Quasar } from 'quasar'
|
||||
import { markRaw } from 'vue'
|
||||
import RootComponent from 'app/src/App.vue'
|
||||
|
||||
import createStore from 'app/src/stores/index'
|
||||
import createRouter from 'app/src/router/index'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default async function (createAppFn, quasarUserOptions) {
|
||||
|
||||
|
||||
// Create the app instance.
|
||||
// Here we inject into it the Quasar UI, the router & possibly the store.
|
||||
const app = createAppFn(RootComponent)
|
||||
|
||||
|
||||
|
||||
app.use(Quasar, quasarUserOptions)
|
||||
|
||||
|
||||
|
||||
|
||||
const store = typeof createStore === 'function'
|
||||
? await createStore({})
|
||||
: createStore
|
||||
|
||||
|
||||
app.use(store)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const router = markRaw(
|
||||
typeof createRouter === 'function'
|
||||
? await createRouter({store})
|
||||
: createRouter
|
||||
)
|
||||
|
||||
|
||||
// make router instance available in store
|
||||
|
||||
store.use(({ store }) => { store.router = router })
|
||||
|
||||
|
||||
|
||||
// Expose the app, the router and the store.
|
||||
// Note that we are not mounting the app here, since bootstrapping will be
|
||||
// different depending on whether we are in a browser or on the server.
|
||||
return {
|
||||
app,
|
||||
store,
|
||||
router
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* THIS FILE IS GENERATED AUTOMATICALLY.
|
||||
* DO NOT EDIT.
|
||||
*
|
||||
* You are probably looking on adding startup/initialization code.
|
||||
* Use "quasar new boot <name>" and add it there.
|
||||
* One boot file per concern. Then reference the file(s) in quasar.config file > boot:
|
||||
* boot: ['file', ...] // do not add ".js" extension to it.
|
||||
*
|
||||
* Boot files are your "main.js"
|
||||
**/
|
||||
|
||||
|
||||
import { createApp } from 'vue'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import '@quasar/extras/roboto-font/roboto-font.css'
|
||||
|
||||
import '@quasar/extras/material-icons/material-icons.css'
|
||||
|
||||
|
||||
|
||||
|
||||
// We load Quasar stylesheet file
|
||||
import 'quasar/dist/quasar.sass'
|
||||
|
||||
|
||||
|
||||
|
||||
import 'src/css/app.css'
|
||||
|
||||
|
||||
import createQuasarApp from './app.js'
|
||||
import quasarUserOptions from './quasar-user-options.js'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const publicPath = `/`
|
||||
|
||||
|
||||
async function start ({
|
||||
app,
|
||||
router
|
||||
, store
|
||||
}, bootFiles) {
|
||||
|
||||
let hasRedirected = false
|
||||
const getRedirectUrl = url => {
|
||||
try { return router.resolve(url).href }
|
||||
catch (err) {}
|
||||
|
||||
return Object(url) === url
|
||||
? null
|
||||
: url
|
||||
}
|
||||
const redirect = url => {
|
||||
hasRedirected = true
|
||||
|
||||
if (typeof url === 'string' && /^https?:\/\//.test(url)) {
|
||||
window.location.href = url
|
||||
return
|
||||
}
|
||||
|
||||
const href = getRedirectUrl(url)
|
||||
|
||||
// continue if we didn't fail to resolve the url
|
||||
if (href !== null) {
|
||||
window.location.href = href
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
|
||||
const urlPath = window.location.href.replace(window.location.origin, '')
|
||||
|
||||
for (let i = 0; hasRedirected === false && i < bootFiles.length; i++) {
|
||||
try {
|
||||
await bootFiles[i]({
|
||||
app,
|
||||
router,
|
||||
store,
|
||||
ssrContext: null,
|
||||
redirect,
|
||||
urlPath,
|
||||
publicPath
|
||||
})
|
||||
}
|
||||
catch (err) {
|
||||
if (err && err.url) {
|
||||
redirect(err.url)
|
||||
return
|
||||
}
|
||||
|
||||
console.error('[Quasar] boot error:', err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (hasRedirected === true) return
|
||||
|
||||
|
||||
app.use(router)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
app.mount('#q-app')
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
createQuasarApp(createApp, quasarUserOptions)
|
||||
|
||||
.then(app => {
|
||||
// eventually remove this when Cordova/Capacitor/Electron support becomes old
|
||||
const [ method, mapFn ] = Promise.allSettled !== void 0
|
||||
? [
|
||||
'allSettled',
|
||||
bootFiles => bootFiles.map(result => {
|
||||
if (result.status === 'rejected') {
|
||||
console.error('[Quasar] boot error:', result.reason)
|
||||
return
|
||||
}
|
||||
return result.value.default
|
||||
})
|
||||
]
|
||||
: [
|
||||
'all',
|
||||
bootFiles => bootFiles.map(entry => entry.default)
|
||||
]
|
||||
|
||||
return Promise[ method ]([
|
||||
|
||||
import(/* webpackMode: "eager" */ 'boot/dayjs'),
|
||||
|
||||
import(/* webpackMode: "eager" */ 'boot/locale'),
|
||||
|
||||
import(/* webpackMode: "eager" */ 'boot/resizeObserverGuard')
|
||||
|
||||
]).then(bootFiles => {
|
||||
const boot = mapFn(bootFiles).filter(entry => typeof entry === 'function')
|
||||
start(app, boot)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* THIS FILE IS GENERATED AUTOMATICALLY.
|
||||
* DO NOT EDIT.
|
||||
*
|
||||
* You are probably looking on adding startup/initialization code.
|
||||
* Use "quasar new boot <name>" and add it there.
|
||||
* One boot file per concern. Then reference the file(s) in quasar.config file > boot:
|
||||
* boot: ['file', ...] // do not add ".js" extension to it.
|
||||
*
|
||||
* Boot files are your "main.js"
|
||||
**/
|
||||
|
||||
|
||||
|
||||
import App from 'app/src/App.vue'
|
||||
let appPrefetch = typeof App.preFetch === 'function'
|
||||
? App.preFetch
|
||||
: (
|
||||
// Class components return the component options (and the preFetch hook) inside __c property
|
||||
App.__c !== void 0 && typeof App.__c.preFetch === 'function'
|
||||
? App.__c.preFetch
|
||||
: false
|
||||
)
|
||||
|
||||
|
||||
function getMatchedComponents (to, router) {
|
||||
const route = to
|
||||
? (to.matched ? to : router.resolve(to).route)
|
||||
: router.currentRoute.value
|
||||
|
||||
if (!route) { return [] }
|
||||
|
||||
const matched = route.matched.filter(m => m.components !== void 0)
|
||||
|
||||
if (matched.length === 0) { return [] }
|
||||
|
||||
return Array.prototype.concat.apply([], matched.map(m => {
|
||||
return Object.keys(m.components).map(key => {
|
||||
const comp = m.components[key]
|
||||
return {
|
||||
path: m.path,
|
||||
c: comp
|
||||
}
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
export function addPreFetchHooks ({ router, store, publicPath }) {
|
||||
// Add router hook for handling preFetch.
|
||||
// Doing it after initial route is resolved so that we don't double-fetch
|
||||
// the data that we already have. Using router.beforeResolve() so that all
|
||||
// async components are resolved.
|
||||
router.beforeResolve((to, from, next) => {
|
||||
const
|
||||
urlPath = window.location.href.replace(window.location.origin, ''),
|
||||
matched = getMatchedComponents(to, router),
|
||||
prevMatched = getMatchedComponents(from, router)
|
||||
|
||||
let diffed = false
|
||||
const preFetchList = matched
|
||||
.filter((m, i) => {
|
||||
return diffed || (diffed = (
|
||||
!prevMatched[i] ||
|
||||
prevMatched[i].c !== m.c ||
|
||||
m.path.indexOf('/:') > -1 // does it has params?
|
||||
))
|
||||
})
|
||||
.filter(m => m.c !== void 0 && (
|
||||
typeof m.c.preFetch === 'function'
|
||||
// Class components return the component options (and the preFetch hook) inside __c property
|
||||
|| (m.c.__c !== void 0 && typeof m.c.__c.preFetch === 'function')
|
||||
))
|
||||
.map(m => m.c.__c !== void 0 ? m.c.__c.preFetch : m.c.preFetch)
|
||||
|
||||
|
||||
if (appPrefetch !== false) {
|
||||
preFetchList.unshift(appPrefetch)
|
||||
appPrefetch = false
|
||||
}
|
||||
|
||||
|
||||
if (preFetchList.length === 0) {
|
||||
return next()
|
||||
}
|
||||
|
||||
let hasRedirected = false
|
||||
const redirect = url => {
|
||||
hasRedirected = true
|
||||
next(url)
|
||||
}
|
||||
const proceed = () => {
|
||||
|
||||
if (hasRedirected === false) { next() }
|
||||
}
|
||||
|
||||
|
||||
|
||||
preFetchList.reduce(
|
||||
(promise, preFetch) => promise.then(() => hasRedirected === false && preFetch({
|
||||
store,
|
||||
currentRoute: to,
|
||||
previousRoute: from,
|
||||
redirect,
|
||||
urlPath,
|
||||
publicPath
|
||||
})),
|
||||
Promise.resolve()
|
||||
)
|
||||
.then(proceed)
|
||||
.catch(e => {
|
||||
console.error(e)
|
||||
proceed()
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* THIS FILE IS GENERATED AUTOMATICALLY.
|
||||
* DO NOT EDIT.
|
||||
*
|
||||
* You are probably looking on adding startup/initialization code.
|
||||
* Use "quasar new boot <name>" and add it there.
|
||||
* One boot file per concern. Then reference the file(s) in quasar.config file > boot:
|
||||
* boot: ['file', ...] // do not add ".js" extension to it.
|
||||
*
|
||||
* Boot files are your "main.js"
|
||||
**/
|
||||
|
||||
import lang from 'quasar/lang/tr.js'
|
||||
|
||||
|
||||
|
||||
import {Loading,Dialog,Notify} from 'quasar'
|
||||
|
||||
|
||||
|
||||
export default { config: {"notify":{"position":"top","timeout":2500}},lang,plugins: {Loading,Dialog,Notify} }
|
||||
|
||||
@@ -375,6 +375,16 @@ const menuItems = [
|
||||
label: 'Piyasa Mail Eşleştirme',
|
||||
to: '/app/market-mail-mapping',
|
||||
permission: 'system:update'
|
||||
},
|
||||
{
|
||||
label: 'Maliyet Mail Eşleştirme',
|
||||
to: '/app/costing-mail-mapping',
|
||||
permission: 'system:update'
|
||||
},
|
||||
{
|
||||
label: 'Fiyatlandırma Mail Eşleştirme',
|
||||
to: '/app/pricing-mail-mapping',
|
||||
permission: 'system:update'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
172
ui/src/pages/CostingMailMapping.vue
Normal file
172
ui/src/pages/CostingMailMapping.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<q-page v-if="canUpdateSystem" class="q-pa-md">
|
||||
<div class="row justify-end q-mb-md">
|
||||
<q-btn
|
||||
color="primary"
|
||||
icon="save"
|
||||
label="Degisiklikleri Kaydet"
|
||||
:loading="store.saving"
|
||||
:disable="!hasChanges"
|
||||
@click="saveChanges"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-table
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
row-key="urun_ilk_grubu"
|
||||
:loading="store.loading"
|
||||
:rows="store.rows"
|
||||
:columns="columns"
|
||||
:rows-per-page-options="[0]"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
<template #body-cell-mail_selector="props">
|
||||
<q-td :props="props">
|
||||
<q-select
|
||||
:model-value="editableByGroup[props.row.urun_ilk_grubu] || []"
|
||||
:options="mailOptionsByGroup[props.row.urun_ilk_grubu] || allMailOptions"
|
||||
option-value="id"
|
||||
option-label="label"
|
||||
emit-value
|
||||
map-options
|
||||
multiple
|
||||
use-chips
|
||||
use-input
|
||||
input-debounce="0"
|
||||
clearable
|
||||
dense
|
||||
outlined
|
||||
label="Mail ara ve sec"
|
||||
@filter="(val, update) => filterMailOptions(props.row.urun_ilk_grubu, val, update)"
|
||||
@update:model-value="(val) => updateRowSelection(props.row.urun_ilk_grubu, val)"
|
||||
/>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-page>
|
||||
|
||||
<q-page v-else class="q-pa-md flex flex-center">
|
||||
<div class="text-negative text-subtitle1">
|
||||
Bu module erisim yetkiniz yok.
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { usePermission } from 'src/composables/usePermission'
|
||||
import { useCostingMailMappingStore } from 'src/stores/costingMailMappingStore'
|
||||
|
||||
const $q = useQuasar()
|
||||
const store = useCostingMailMappingStore()
|
||||
|
||||
const { canUpdate } = usePermission()
|
||||
const canUpdateSystem = canUpdate('system')
|
||||
|
||||
const editableByGroup = ref({})
|
||||
const originalByGroup = ref({})
|
||||
const mailOptionsByGroup = ref({})
|
||||
|
||||
const columns = [
|
||||
{ name: 'urun_ilk_grubu', label: 'Urun Ilk Grubu', field: 'urun_ilk_grubu', align: 'left' },
|
||||
{ name: 'mail_selector', label: 'Maliyet Mail Eslestirme', field: 'mail_selector', align: 'left' }
|
||||
]
|
||||
|
||||
const allMailOptions = computed(() =>
|
||||
(store.mails || []).map((m) => ({ id: m.id, label: m.display_name || m.email }))
|
||||
)
|
||||
|
||||
const changedGroups = computed(() => {
|
||||
return (store.rows || [])
|
||||
.map((r) => String(r.urun_ilk_grubu || '').trim())
|
||||
.filter(Boolean)
|
||||
.filter((g) => {
|
||||
const current = normalizeList(editableByGroup.value[g] || [])
|
||||
const original = normalizeList(originalByGroup.value[g] || [])
|
||||
return !isEqualList(current, original)
|
||||
})
|
||||
})
|
||||
|
||||
const hasChanges = computed(() => changedGroups.value.length > 0)
|
||||
|
||||
function normalizeList (list) {
|
||||
return Array.from(
|
||||
new Set(
|
||||
(Array.isArray(list) ? list : [])
|
||||
.map((x) => String(x).trim())
|
||||
.filter(Boolean)
|
||||
)
|
||||
).sort()
|
||||
}
|
||||
|
||||
function isEqualList (a, b) {
|
||||
if (a.length !== b.length) return false
|
||||
for (let i = 0; i < a.length; i += 1) {
|
||||
if (a[i] !== b[i]) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function initEditableState () {
|
||||
const editable = {}
|
||||
const original = {}
|
||||
|
||||
;(store.rows || []).forEach((row) => {
|
||||
const g = String(row.urun_ilk_grubu || '').trim()
|
||||
const selected = normalizeList(row.mail_ids || [])
|
||||
editable[g] = [...selected]
|
||||
original[g] = [...selected]
|
||||
})
|
||||
|
||||
editableByGroup.value = editable
|
||||
originalByGroup.value = original
|
||||
mailOptionsByGroup.value = {}
|
||||
}
|
||||
|
||||
function updateRowSelection (group, newValue) {
|
||||
const g = String(group || '').trim()
|
||||
editableByGroup.value = { ...editableByGroup.value, [g]: normalizeList(newValue) }
|
||||
}
|
||||
|
||||
function filterMailOptions (group, search, update) {
|
||||
const g = String(group || '').trim()
|
||||
update(() => {
|
||||
const q = String(search || '').trim().toLowerCase()
|
||||
const filtered = !q
|
||||
? allMailOptions.value
|
||||
: allMailOptions.value.filter((opt) => String(opt.label || '').toLowerCase().includes(q))
|
||||
|
||||
mailOptionsByGroup.value = { ...mailOptionsByGroup.value, [g]: filtered }
|
||||
})
|
||||
}
|
||||
|
||||
async function init () {
|
||||
try {
|
||||
await Promise.all([store.fetchLookups(), store.fetchRows()])
|
||||
initEditableState()
|
||||
} catch (err) {
|
||||
$q.notify({ type: 'negative', message: err?.message || 'Maliyet mail eslestirmeleri yuklenemedi' })
|
||||
}
|
||||
}
|
||||
|
||||
async function saveChanges () {
|
||||
if (!hasChanges.value) return
|
||||
|
||||
try {
|
||||
for (const g of changedGroups.value) {
|
||||
await store.saveGroupMails(g, editableByGroup.value[g] || [])
|
||||
}
|
||||
await store.fetchRows()
|
||||
initEditableState()
|
||||
$q.notify({ type: 'positive', message: 'Degisiklikler kaydedildi' })
|
||||
} catch (err) {
|
||||
$q.notify({ type: 'negative', message: err?.message || 'Kayit hatasi' })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => { init() })
|
||||
</script>
|
||||
|
||||
172
ui/src/pages/PricingMailMapping.vue
Normal file
172
ui/src/pages/PricingMailMapping.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<q-page v-if="canUpdateSystem" class="q-pa-md">
|
||||
<div class="row justify-end q-mb-md">
|
||||
<q-btn
|
||||
color="primary"
|
||||
icon="save"
|
||||
label="Degisiklikleri Kaydet"
|
||||
:loading="store.saving"
|
||||
:disable="!hasChanges"
|
||||
@click="saveChanges"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-table
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
row-key="urun_ilk_grubu"
|
||||
:loading="store.loading"
|
||||
:rows="store.rows"
|
||||
:columns="columns"
|
||||
:rows-per-page-options="[0]"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
<template #body-cell-mail_selector="props">
|
||||
<q-td :props="props">
|
||||
<q-select
|
||||
:model-value="editableByGroup[props.row.urun_ilk_grubu] || []"
|
||||
:options="mailOptionsByGroup[props.row.urun_ilk_grubu] || allMailOptions"
|
||||
option-value="id"
|
||||
option-label="label"
|
||||
emit-value
|
||||
map-options
|
||||
multiple
|
||||
use-chips
|
||||
use-input
|
||||
input-debounce="0"
|
||||
clearable
|
||||
dense
|
||||
outlined
|
||||
label="Mail ara ve sec"
|
||||
@filter="(val, update) => filterMailOptions(props.row.urun_ilk_grubu, val, update)"
|
||||
@update:model-value="(val) => updateRowSelection(props.row.urun_ilk_grubu, val)"
|
||||
/>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-page>
|
||||
|
||||
<q-page v-else class="q-pa-md flex flex-center">
|
||||
<div class="text-negative text-subtitle1">
|
||||
Bu module erisim yetkiniz yok.
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { usePermission } from 'src/composables/usePermission'
|
||||
import { usePricingMailMappingStore } from 'src/stores/pricingMailMappingStore'
|
||||
|
||||
const $q = useQuasar()
|
||||
const store = usePricingMailMappingStore()
|
||||
|
||||
const { canUpdate } = usePermission()
|
||||
const canUpdateSystem = canUpdate('system')
|
||||
|
||||
const editableByGroup = ref({})
|
||||
const originalByGroup = ref({})
|
||||
const mailOptionsByGroup = ref({})
|
||||
|
||||
const columns = [
|
||||
{ name: 'urun_ilk_grubu', label: 'Urun Ilk Grubu', field: 'urun_ilk_grubu', align: 'left' },
|
||||
{ name: 'mail_selector', label: 'Fiyatlandirma Mail Eslestirme', field: 'mail_selector', align: 'left' }
|
||||
]
|
||||
|
||||
const allMailOptions = computed(() =>
|
||||
(store.mails || []).map((m) => ({ id: m.id, label: m.display_name || m.email }))
|
||||
)
|
||||
|
||||
const changedGroups = computed(() => {
|
||||
return (store.rows || [])
|
||||
.map((r) => String(r.urun_ilk_grubu || '').trim())
|
||||
.filter(Boolean)
|
||||
.filter((g) => {
|
||||
const current = normalizeList(editableByGroup.value[g] || [])
|
||||
const original = normalizeList(originalByGroup.value[g] || [])
|
||||
return !isEqualList(current, original)
|
||||
})
|
||||
})
|
||||
|
||||
const hasChanges = computed(() => changedGroups.value.length > 0)
|
||||
|
||||
function normalizeList (list) {
|
||||
return Array.from(
|
||||
new Set(
|
||||
(Array.isArray(list) ? list : [])
|
||||
.map((x) => String(x).trim())
|
||||
.filter(Boolean)
|
||||
)
|
||||
).sort()
|
||||
}
|
||||
|
||||
function isEqualList (a, b) {
|
||||
if (a.length !== b.length) return false
|
||||
for (let i = 0; i < a.length; i += 1) {
|
||||
if (a[i] !== b[i]) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function initEditableState () {
|
||||
const editable = {}
|
||||
const original = {}
|
||||
|
||||
;(store.rows || []).forEach((row) => {
|
||||
const g = String(row.urun_ilk_grubu || '').trim()
|
||||
const selected = normalizeList(row.mail_ids || [])
|
||||
editable[g] = [...selected]
|
||||
original[g] = [...selected]
|
||||
})
|
||||
|
||||
editableByGroup.value = editable
|
||||
originalByGroup.value = original
|
||||
mailOptionsByGroup.value = {}
|
||||
}
|
||||
|
||||
function updateRowSelection (group, newValue) {
|
||||
const g = String(group || '').trim()
|
||||
editableByGroup.value = { ...editableByGroup.value, [g]: normalizeList(newValue) }
|
||||
}
|
||||
|
||||
function filterMailOptions (group, search, update) {
|
||||
const g = String(group || '').trim()
|
||||
update(() => {
|
||||
const q = String(search || '').trim().toLowerCase()
|
||||
const filtered = !q
|
||||
? allMailOptions.value
|
||||
: allMailOptions.value.filter((opt) => String(opt.label || '').toLowerCase().includes(q))
|
||||
|
||||
mailOptionsByGroup.value = { ...mailOptionsByGroup.value, [g]: filtered }
|
||||
})
|
||||
}
|
||||
|
||||
async function init () {
|
||||
try {
|
||||
await Promise.all([store.fetchLookups(), store.fetchRows()])
|
||||
initEditableState()
|
||||
} catch (err) {
|
||||
$q.notify({ type: 'negative', message: err?.message || 'Fiyatlandirma mail eslestirmeleri yuklenemedi' })
|
||||
}
|
||||
}
|
||||
|
||||
async function saveChanges () {
|
||||
if (!hasChanges.value) return
|
||||
|
||||
try {
|
||||
for (const g of changedGroups.value) {
|
||||
await store.saveGroupMails(g, editableByGroup.value[g] || [])
|
||||
}
|
||||
await store.fetchRows()
|
||||
initEditableState()
|
||||
$q.notify({ type: 'positive', message: 'Degisiklikler kaydedildi' })
|
||||
} catch (err) {
|
||||
$q.notify({ type: 'negative', message: err?.message || 'Kayit hatasi' })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => { init() })
|
||||
</script>
|
||||
|
||||
@@ -239,6 +239,18 @@ const routes = [
|
||||
component: () => import('../pages/MarketMailMapping.vue'),
|
||||
meta: { permission: 'system:update' }
|
||||
},
|
||||
{
|
||||
path: 'costing-mail-mapping',
|
||||
name: 'costing-mail-mapping',
|
||||
component: () => import('../pages/CostingMailMapping.vue'),
|
||||
meta: { permission: 'system:update' }
|
||||
},
|
||||
{
|
||||
path: 'pricing-mail-mapping',
|
||||
name: 'pricing-mail-mapping',
|
||||
component: () => import('../pages/PricingMailMapping.vue'),
|
||||
meta: { permission: 'system:update' }
|
||||
},
|
||||
{
|
||||
path: 'language/translations',
|
||||
name: 'translation-table',
|
||||
|
||||
48
ui/src/stores/costingMailMappingStore.js
Normal file
48
ui/src/stores/costingMailMappingStore.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import api from 'src/services/api'
|
||||
|
||||
export const useCostingMailMappingStore = defineStore('costingMailMapping', {
|
||||
state: () => ({
|
||||
loading: false,
|
||||
saving: false,
|
||||
firstGroups: [],
|
||||
mails: [],
|
||||
rows: []
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async fetchLookups () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await api.get('/system/costing-mail-mappings/lookups')
|
||||
const payload = res?.data || {}
|
||||
this.firstGroups = Array.isArray(payload.first_groups) ? payload.first_groups : []
|
||||
this.mails = Array.isArray(payload.mails) ? payload.mails : []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async fetchRows () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await api.get('/system/costing-mail-mappings')
|
||||
this.rows = Array.isArray(res?.data) ? res.data : []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async saveGroupMails (urunIlkGrubu, mailIds) {
|
||||
this.saving = true
|
||||
try {
|
||||
await api.put(`/system/costing-mail-mappings/${encodeURIComponent(String(urunIlkGrubu || '').trim())}`, {
|
||||
mail_ids: Array.isArray(mailIds) ? mailIds : []
|
||||
})
|
||||
} finally {
|
||||
this.saving = false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
48
ui/src/stores/pricingMailMappingStore.js
Normal file
48
ui/src/stores/pricingMailMappingStore.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import api from 'src/services/api'
|
||||
|
||||
export const usePricingMailMappingStore = defineStore('pricingMailMapping', {
|
||||
state: () => ({
|
||||
loading: false,
|
||||
saving: false,
|
||||
firstGroups: [],
|
||||
mails: [],
|
||||
rows: []
|
||||
}),
|
||||
|
||||
actions: {
|
||||
async fetchLookups () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await api.get('/system/pricing-mail-mappings/lookups')
|
||||
const payload = res?.data || {}
|
||||
this.firstGroups = Array.isArray(payload.first_groups) ? payload.first_groups : []
|
||||
this.mails = Array.isArray(payload.mails) ? payload.mails : []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async fetchRows () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await api.get('/system/pricing-mail-mappings')
|
||||
this.rows = Array.isArray(res?.data) ? res.data : []
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
|
||||
async saveGroupMails (urunIlkGrubu, mailIds) {
|
||||
this.saving = true
|
||||
try {
|
||||
await api.put(`/system/pricing-mail-mappings/${encodeURIComponent(String(urunIlkGrubu || '').trim())}`, {
|
||||
mail_ids: Array.isArray(mailIds) ? mailIds : []
|
||||
})
|
||||
} finally {
|
||||
this.saving = false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user