Merge remote-tracking branch 'origin/master'

This commit is contained in:
M_Kececi
2026-06-19 15:44:21 +03:00
parent da9d7c2fd5
commit 1054a15547
13 changed files with 828 additions and 62 deletions
+15 -5
View File
@@ -26,14 +26,16 @@ export const useUserDetailStore = defineStore('userDetail', {
roles: [],
departments: null,
piyasalar: [],
nebim_users: null
nebim_users: null,
order_price_list_price_groups: []
},
/* ================= LOOKUPS ================= */
roleOptions: [],
departmentOptions: [],
piyasaOptions: [],
nebimUserOptions: []
nebimUserOptions: [],
orderPriceListPriceGroupOptions: []
}),
actions: {
@@ -52,7 +54,8 @@ export const useUserDetailStore = defineStore('userDetail', {
roles: [],
departments: null,
piyasalar: [],
nebim_users: null
nebim_users: null,
order_price_list_price_groups: []
}
this.error = null
this.hasPassword = false
@@ -113,6 +116,7 @@ export const useUserDetailStore = defineStore('userDetail', {
departments: departmentCodes.map(code => ({ code })),
piyasalar: (this.form.piyasalar || []).map(code => ({ code })),
order_price_list_price_groups: this.form.order_price_list_price_groups || [],
nebim_users: nebimUsernames.map(username => {
const opt = (this.nebimUserOptions || []).find(x => x.value === username)
@@ -146,6 +150,7 @@ export const useUserDetailStore = defineStore('userDetail', {
this.form.departments = (data.departments || []).map(x => x.code)[0] || null
this.form.piyasalar = (data.piyasalar || []).map(x => x.code)
this.form.nebim_users = (data.nebim_users || []).map(x => x.username)[0] || null
this.form.order_price_list_price_groups = data.order_price_list_price_groups || []
this.hasPassword = !!data.has_password
} catch (e) {
@@ -237,17 +242,22 @@ export const useUserDetailStore = defineStore('userDetail', {
===================================================== */
async fetchLookups () {
// token otomatik
const [roles, depts, piyasalar, nebims] = await Promise.all([
const [roles, depts, piyasalar, nebims, priceGroups] = await Promise.all([
api.get('/lookups/roles'),
api.get('/lookups/departments'),
api.get('/lookups/piyasalar'),
api.get('/lookups/nebim-users')
api.get('/lookups/nebim-users'),
api.get('/users/order-price-list-price-groups/lookups')
])
this.roleOptions = roles?.data || roles || []
this.departmentOptions = depts?.data || depts || []
this.piyasaOptions = piyasalar?.data || piyasalar || []
this.nebimUserOptions = nebims?.data || nebims || []
this.orderPriceListPriceGroupOptions = (priceGroups?.data?.price_groups || []).map(x => ({
label: x.label || x.value,
value: x.value
}))
}
}
})
@@ -0,0 +1,42 @@
import { defineStore } from 'pinia'
import api from 'src/services/api'
export const useOrderPriceListUserPriceGroupStore = defineStore('orderPriceListUserPriceGroup', {
state: () => ({
loading: false,
saving: false,
rows: [],
priceGroupOptions: []
}),
actions: {
async fetchLookups () {
const res = await api.get('/system/order-price-list-user-price-groups/lookups')
this.priceGroupOptions = (res?.data?.price_groups || []).map((x) => ({
label: x.label || x.value,
value: x.value
}))
},
async fetchRows () {
this.loading = true
try {
const res = await api.get('/system/order-price-list-user-price-groups')
this.rows = Array.isArray(res?.data) ? res.data : []
} finally {
this.loading = false
}
},
async saveUserPriceGroups (userId, priceGroups) {
this.saving = true
try {
await api.put(`/system/order-price-list-user-price-groups/${encodeURIComponent(String(userId))}`, {
price_groups: Array.isArray(priceGroups) ? priceGroups : []
})
} finally {
this.saving = false
}
}
}
})