Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -23,9 +23,9 @@ export const useUserDetailStore = defineStore('userDetail', {
|
|||||||
is_active: true,
|
is_active: true,
|
||||||
address: '',
|
address: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
departments: [],
|
departments: null,
|
||||||
piyasalar: [],
|
piyasalar: [],
|
||||||
nebim_users: []
|
nebim_users: null
|
||||||
},
|
},
|
||||||
|
|
||||||
/* ================= LOOKUPS ================= */
|
/* ================= LOOKUPS ================= */
|
||||||
@@ -49,9 +49,9 @@ export const useUserDetailStore = defineStore('userDetail', {
|
|||||||
is_active: true,
|
is_active: true,
|
||||||
address: '',
|
address: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
departments: [],
|
departments: null,
|
||||||
piyasalar: [],
|
piyasalar: [],
|
||||||
nebim_users: []
|
nebim_users: null
|
||||||
}
|
}
|
||||||
this.error = null
|
this.error = null
|
||||||
this.hasPassword = false
|
this.hasPassword = false
|
||||||
@@ -91,6 +91,14 @@ export const useUserDetailStore = defineStore('userDetail', {
|
|||||||
📦 PAYLOAD BUILDER (BACKEND SÖZLEŞMESİYLE UYUMLU)
|
📦 PAYLOAD BUILDER (BACKEND SÖZLEŞMESİYLE UYUMLU)
|
||||||
===================================================== */
|
===================================================== */
|
||||||
buildPayload () {
|
buildPayload () {
|
||||||
|
const departmentCodes = Array.isArray(this.form.departments)
|
||||||
|
? this.form.departments
|
||||||
|
: (this.form.departments ? [this.form.departments] : [])
|
||||||
|
|
||||||
|
const nebimUsernames = Array.isArray(this.form.nebim_users)
|
||||||
|
? this.form.nebim_users
|
||||||
|
: (this.form.nebim_users ? [this.form.nebim_users] : [])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code: this.form.code,
|
code: this.form.code,
|
||||||
full_name: this.form.full_name,
|
full_name: this.form.full_name,
|
||||||
@@ -101,14 +109,11 @@ export const useUserDetailStore = defineStore('userDetail', {
|
|||||||
|
|
||||||
roles: this.form.roles,
|
roles: this.form.roles,
|
||||||
|
|
||||||
// ✅ TEK DEPARTMAN (string → backend array)
|
departments: departmentCodes.map(code => ({ code })),
|
||||||
departments: this.form.departments
|
|
||||||
? [{ code: this.form.departments }]
|
|
||||||
: [],
|
|
||||||
|
|
||||||
piyasalar: (this.form.piyasalar || []).map(code => ({ code })),
|
piyasalar: (this.form.piyasalar || []).map(code => ({ code })),
|
||||||
|
|
||||||
nebim_users: (this.form.nebim_users || []).map(username => {
|
nebim_users: nebimUsernames.map(username => {
|
||||||
const opt = (this.nebimUserOptions || []).find(x => x.value === username)
|
const opt = (this.nebimUserOptions || []).find(x => x.value === username)
|
||||||
return {
|
return {
|
||||||
username,
|
username,
|
||||||
@@ -137,9 +142,9 @@ export const useUserDetailStore = defineStore('userDetail', {
|
|||||||
this.form.address = data.address || ''
|
this.form.address = data.address || ''
|
||||||
|
|
||||||
this.form.roles = data.roles || []
|
this.form.roles = data.roles || []
|
||||||
this.form.departments = (data.departments || []).map(x => x.code)
|
this.form.departments = (data.departments || []).map(x => x.code)[0] || null
|
||||||
this.form.piyasalar = (data.piyasalar || []).map(x => x.code)
|
this.form.piyasalar = (data.piyasalar || []).map(x => x.code)
|
||||||
this.form.nebim_users = (data.nebim_users || []).map(x => x.username)
|
this.form.nebim_users = (data.nebim_users || []).map(x => x.username)[0] || null
|
||||||
|
|
||||||
this.hasPassword = !!data.has_password
|
this.hasPassword = !!data.has_password
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user