Merge branch 'develop'
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s

This commit is contained in:
Thanaphon Frappet 2025-08-20 16:28:33 +07:00
commit d44850a9ae
6 changed files with 37 additions and 49 deletions

View file

@ -159,42 +159,6 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
]"
for="input-name-en"
/>
<q-select
v-if="
typeBranch !== 'headOffice' &&
isRoleInclude(['head_of_admin', 'head_of_account'])
"
outlined
use-input
fill-input
emit-value
map-options
hide-selected
hide-bottom-space
input-debounce="0"
option-label="label"
option-value="value"
class="col-2"
dense
for="input-branch-status"
:readonly="readonly || isRoleInclude(['head_of_account'])"
:options="['Virtual', 'Branch']"
:hide-dropdown-icon="readonly"
:label="$t('general.branchStatus')"
:model-value="virtual ? 'Virtual' : 'Branch'"
@update:model-value="(v) => (virtual = v === 'Virtual')"
:rules="[(val) => val && val.length > 0]"
:error-message="$t('form.error.required')"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
{{ $t('general.noData') }}
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-12 row q-col-gutter-sm">

View file

@ -35,7 +35,13 @@ export const createSelect = <T extends Record<string, any>>(
let previousSearch = '';
watch(value, (v) => {
if (!v || (cache && cache.find((opt) => opt[valueField] === v))) return;
if (!v) return;
if (cache && cache.find((opt) => opt[valueField] === v)) {
valueOption.value = cache.find((opt) => opt[valueField] === v);
return;
}
getSelectedOption();
});
@ -63,7 +69,15 @@ export const createSelect = <T extends Record<string, any>>(
const currentValue = value.value;
if (!currentValue) return;
if (selectOptions.value.find((v) => v[valueField] === currentValue)) return;
const option = selectOptions.value.find(
(v) => v[valueField] === currentValue,
);
if (option) {
valueOption.value = option;
return;
}
if (valueOption.value && valueOption.value[valueField] === currentValue) {
return selectOptions.value.unshift(valueOption.value);
}

View file

@ -799,7 +799,7 @@ export default {
branch: 'สาขาที่ออกใบเสนอราคา',
branchVirtual: 'จุดรับบริการที่ออกใบเสนอราคา',
customer: 'ลูกค้า',
newCustomer: 'ลูกค้าใหม่',
newCustomer: 'แรงงานใหม่',
employeeList: 'รายชื่อแรงงาน',
employee: 'แรงงาน',
employeeName: 'ชื่อ-นามสกุล แรงงาน',

View file

@ -51,6 +51,8 @@ const emit = defineEmits<{
const selectedProductGroup = defineModel<string>('selectedProductGroup', {
default: '',
});
const selectedProductGroupOption = ref<ProductGroup | undefined>();
const model = defineModel<boolean>();
const inputSearch = defineModel<string>('inputSearch');
const productGroup = defineModel<ProductGroup[]>('productGroup', {
@ -569,14 +571,18 @@ watch(
{{
productGroup.find(
(g) => g.id === selectedProductGroup,
)?.name || '-'
)?.name ||
selectedProductGroupOption?.name ||
'-'
}}
</span>
<span class="text-caption app-text-muted">
{{
productGroup.find(
(g) => g.id === selectedProductGroup,
)?.code || '-'
)?.code ||
selectedProductGroupOption?.code ||
'-'
}}
</span>
</div>
@ -862,13 +868,13 @@ watch(
<span class="q-pr-sm">
{{ $t('productService.group.title') }}
</span>
<SelectProductGroup
class="col-md-4 col-12"
:class="{ 'q-mb-sm': $q.screen.lt.md }"
id="product-group-select"
clearable
v-model:value="selectedProductGroup"
v-model:value-option="selectedProductGroupOption"
:placeholder="
!selectedProductGroup
? $t('general.select', {

View file

@ -314,7 +314,7 @@ function handleCheckAll() {
/> -->
<AvatarGroup
:data="[
...responsiblePerson(props.row.quotation).user.map((v) => ({
...(responsiblePerson(props.row.quotation)?.user.map((v) => ({
name:
$i18n.locale === 'eng'
? `${v.firstNameEN} ${v.lastNameEN}`
@ -324,11 +324,11 @@ function handleCheckAll() {
? `/no-img-man.png`
: `/no-img-female.png`
: `${baseUrl}/user/${v.id}/profile-image/${v.selectedImage}`,
})),
...responsiblePerson(props.row.quotation).group.map((g) => ({
})) || []),
...(responsiblePerson(props.row.quotation)?.group.map((g) => ({
name: `${$t('general.group')} ${g.group}`,
imgUrl: '/img-group.png',
})),
})) || []),
]"
></AvatarGroup>
</q-td>

View file

@ -386,7 +386,7 @@ async function assignFormData(id: string) {
selectedProductGroup.value =
data.productServiceList[0]?.product.productGroup?.id || '';
((previousValue = {
(previousValue = {
id: data.id || undefined,
debitNoteQuotationId: data.debitNoteQuotationId || undefined,
productServiceList: structuredClone(
@ -412,7 +412,7 @@ async function assignFormData(id: string) {
quotationId: data.debitNoteQuotationId,
remark: data.remark || undefined,
}),
(currentFormData.value = structuredClone(previousValue)));
(currentFormData.value = structuredClone(previousValue));
assignProductServiceList();
assignSelectedWorker();
@ -1046,7 +1046,11 @@ async function submitAccepted() {
:status-active="i.active?.()"
:status-done="i.status === 'done'"
:status-waiting="i.status === 'waiting'"
@click="i.handler()"
@click="
() => {
if (pageState.mode !== 'create') i.handler();
}
"
/>
</nav>
<!-- #TODO add goToQuotation as @goto-quotation-->