Merge branch 'develop'
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
commit
fa8aa8c9b6
7 changed files with 90 additions and 16 deletions
|
|
@ -0,0 +1,6 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "User" ADD COLUMN "addressForeign" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
ADD COLUMN "districtText" TEXT,
|
||||||
|
ADD COLUMN "provinceText" TEXT,
|
||||||
|
ADD COLUMN "subDistrictText" TEXT,
|
||||||
|
ADD COLUMN "zipCodeText" TEXT;
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "User" ADD COLUMN "districtTextEN" TEXT,
|
||||||
|
ADD COLUMN "provinceTextEN" TEXT,
|
||||||
|
ADD COLUMN "subDistrictTextEN" TEXT;
|
||||||
|
|
@ -398,14 +398,24 @@ model User {
|
||||||
street String?
|
street String?
|
||||||
streetEN String?
|
streetEN String?
|
||||||
|
|
||||||
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
addressForeign Boolean @default(false)
|
||||||
provinceId String?
|
|
||||||
|
|
||||||
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
provinceText String?
|
||||||
districtId String?
|
provinceTextEN String?
|
||||||
|
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
||||||
|
provinceId String?
|
||||||
|
|
||||||
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
districtText String?
|
||||||
subDistrictId String?
|
districtTextEN String?
|
||||||
|
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
||||||
|
districtId String?
|
||||||
|
|
||||||
|
subDistrictText String?
|
||||||
|
subDistrictTextEN String?
|
||||||
|
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
||||||
|
subDistrictId String?
|
||||||
|
|
||||||
|
zipCodeText String?
|
||||||
|
|
||||||
email String
|
email String
|
||||||
telephoneNo String
|
telephoneNo String
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,7 @@ function replaceEmptyField<T>(data: T): T {
|
||||||
}
|
}
|
||||||
|
|
||||||
type FullAddress = {
|
type FullAddress = {
|
||||||
|
addressForeign?: boolean;
|
||||||
address: string;
|
address: string;
|
||||||
addressEN: string;
|
addressEN: string;
|
||||||
moo?: string;
|
moo?: string;
|
||||||
|
|
@ -296,8 +297,14 @@ type FullAddress = {
|
||||||
soiEN?: string;
|
soiEN?: string;
|
||||||
street?: string;
|
street?: string;
|
||||||
streetEN?: string;
|
streetEN?: string;
|
||||||
|
provinceText?: string | null;
|
||||||
|
provinceTextEN?: string | null;
|
||||||
province?: Province | null;
|
province?: Province | null;
|
||||||
|
districtText?: string | null;
|
||||||
|
districtTextEN?: string | null;
|
||||||
district?: District | null;
|
district?: District | null;
|
||||||
|
subDistrictText?: string | null;
|
||||||
|
subDistrictTextEN?: string | null;
|
||||||
subDistrict?: SubDistrict | null;
|
subDistrict?: SubDistrict | null;
|
||||||
en?: boolean;
|
en?: boolean;
|
||||||
};
|
};
|
||||||
|
|
@ -331,13 +338,22 @@ function addressFull(addr: FullAddress, lang: "th" | "en" = "en") {
|
||||||
if (addr.soi) fragments.push(`ซอย ${addr.soi},`);
|
if (addr.soi) fragments.push(`ซอย ${addr.soi},`);
|
||||||
if (addr.street) fragments.push(`ถนน${addr.street},`);
|
if (addr.street) fragments.push(`ถนน${addr.street},`);
|
||||||
|
|
||||||
if (addr.subDistrict) {
|
if (!addr.addressForeign && addr.subDistrict) {
|
||||||
fragments.push(`${addr.province?.id === "10" ? "แขวง" : "ตำบล"}${addr.subDistrict.name},`);
|
fragments.push(`${addr.province?.id === "10" ? "แขวง" : "ตำบล"}${addr.subDistrict.name}`);
|
||||||
}
|
}
|
||||||
if (addr.district) {
|
if (addr.addressForeign && addr.subDistrictText) {
|
||||||
fragments.push(`${addr.province?.id === "10" ? "เขต" : "อำเภอ"}${addr.district.name},`);
|
fragments.push(`ตำบล${addr.subDistrictText}`);
|
||||||
}
|
}
|
||||||
if (addr.province) fragments.push(`จังหวัด${addr.province.name},`);
|
|
||||||
|
if (!addr.addressForeign && addr.district) {
|
||||||
|
fragments.push(`${addr.province?.id === "10" ? "เขต" : "อำเภอ"}${addr.district.name}`);
|
||||||
|
}
|
||||||
|
if (addr.addressForeign && addr.districtText) {
|
||||||
|
fragments.push(`อำเภอ${addr.districtText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!addr.addressForeign && addr.province) fragments.push(`จังหวัด${addr.province.name}`);
|
||||||
|
if (addr.addressForeign && addr.provinceText) fragments.push(`จังหวัด${addr.provinceText}`);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -346,11 +362,26 @@ function addressFull(addr: FullAddress, lang: "th" | "en" = "en") {
|
||||||
if (addr.soiEN) fragments.push(`Soi ${addr.soiEN},`);
|
if (addr.soiEN) fragments.push(`Soi ${addr.soiEN},`);
|
||||||
if (addr.streetEN) fragments.push(`${addr.streetEN} Rd.`);
|
if (addr.streetEN) fragments.push(`${addr.streetEN} Rd.`);
|
||||||
|
|
||||||
if (addr.subDistrict) {
|
if (!addr.addressForeign && addr.subDistrict) {
|
||||||
fragments.push(`${addr.subDistrict.nameEN} sub-district,`);
|
fragments.push(`${addr.subDistrict.nameEN} sub-district,`);
|
||||||
}
|
}
|
||||||
if (addr.district) fragments.push(`${addr.district.nameEN} district,`);
|
if (addr.addressForeign && addr.subDistrictTextEN) {
|
||||||
if (addr.province) fragments.push(`${addr.province.nameEN},`);
|
fragments.push(`${addr.subDistrictTextEN} sub-district,`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!addr.addressForeign && addr.district) {
|
||||||
|
fragments.push(`${addr.district.nameEN} district,`);
|
||||||
|
}
|
||||||
|
if (addr.addressForeign && addr.districtTextEN) {
|
||||||
|
fragments.push(`${addr.districtTextEN} district,`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!addr.addressForeign && addr.province) {
|
||||||
|
fragments.push(`${addr.province.nameEN},`);
|
||||||
|
}
|
||||||
|
if (addr.addressForeign && addr.provinceTextEN) {
|
||||||
|
fragments.push(`${addr.provinceTextEN} district,`);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ type UserCreate = {
|
||||||
responsibleArea?: string[] | null;
|
responsibleArea?: string[] | null;
|
||||||
birthDate?: Date | null;
|
birthDate?: Date | null;
|
||||||
|
|
||||||
|
addressForeign?: boolean;
|
||||||
address: string;
|
address: string;
|
||||||
addressEN: string;
|
addressEN: string;
|
||||||
soi?: string | null;
|
soi?: string | null;
|
||||||
|
|
@ -122,9 +123,16 @@ type UserCreate = {
|
||||||
email: string;
|
email: string;
|
||||||
telephoneNo: string;
|
telephoneNo: string;
|
||||||
|
|
||||||
|
subDistrictText?: string | null;
|
||||||
|
subDistrictTextEN?: string | null;
|
||||||
subDistrictId?: string | null;
|
subDistrictId?: string | null;
|
||||||
|
districtText?: string | null;
|
||||||
|
districtTextEN?: string | null;
|
||||||
districtId?: string | null;
|
districtId?: string | null;
|
||||||
|
provinceText?: string | null;
|
||||||
|
provinceTextEN?: string | null;
|
||||||
provinceId?: string | null;
|
provinceId?: string | null;
|
||||||
|
zipCodeText?: string | null;
|
||||||
|
|
||||||
selectedImage?: string;
|
selectedImage?: string;
|
||||||
|
|
||||||
|
|
@ -173,6 +181,7 @@ type UserUpdate = {
|
||||||
responsibleArea?: string[] | null;
|
responsibleArea?: string[] | null;
|
||||||
birthDate?: Date | null;
|
birthDate?: Date | null;
|
||||||
|
|
||||||
|
addressForeign?: boolean;
|
||||||
address?: string;
|
address?: string;
|
||||||
addressEN?: string;
|
addressEN?: string;
|
||||||
soi?: string | null;
|
soi?: string | null;
|
||||||
|
|
@ -186,9 +195,16 @@ type UserUpdate = {
|
||||||
|
|
||||||
selectedImage?: string;
|
selectedImage?: string;
|
||||||
|
|
||||||
|
subDistrictText?: string | null;
|
||||||
|
subDistrictTextEN?: string | null;
|
||||||
subDistrictId?: string | null;
|
subDistrictId?: string | null;
|
||||||
|
districtText?: string | null;
|
||||||
|
districtTextEN?: string | null;
|
||||||
districtId?: string | null;
|
districtId?: string | null;
|
||||||
|
provinceText?: string | null;
|
||||||
|
provinceTextEN?: string | null;
|
||||||
provinceId?: string | null;
|
provinceId?: string | null;
|
||||||
|
zipCodeText?: string | null;
|
||||||
|
|
||||||
branchId?: string | string[];
|
branchId?: string | string[];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ export class QuotationPayment extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (quotation.quotationStatus === "PaymentPending") {
|
if (quotation.quotationStatus === "PaymentInProcess") {
|
||||||
await prisma.notification.create({
|
await prisma.notification.create({
|
||||||
data: {
|
data: {
|
||||||
title: "รายการคำขอใหม่ / New Request",
|
title: "รายการคำขอใหม่ / New Request",
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,14 @@ export class QuotationController extends Controller {
|
||||||
title: "ใบเสนอราคาใหม่ / New Quotation",
|
title: "ใบเสนอราคาใหม่ / New Quotation",
|
||||||
detail: "รหัส / code : " + ret.code,
|
detail: "รหัส / code : " + ret.code,
|
||||||
registeredBranchId: ret.registeredBranchId,
|
registeredBranchId: ret.registeredBranchId,
|
||||||
groupReceiver: { create: [{ name: "sale" }, { name: "head_of_sale" }] },
|
groupReceiver: {
|
||||||
|
create: [
|
||||||
|
{ name: "sale" },
|
||||||
|
{ name: "head_of_sale" },
|
||||||
|
{ name: "accountant" },
|
||||||
|
{ name: "branch_accountant" },
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue