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?
|
||||
streetEN String?
|
||||
|
||||
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
||||
provinceId String?
|
||||
addressForeign Boolean @default(false)
|
||||
|
||||
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
|
||||
districtId String?
|
||||
provinceText String?
|
||||
provinceTextEN String?
|
||||
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
|
||||
provinceId String?
|
||||
|
||||
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
|
||||
subDistrictId String?
|
||||
districtText 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
|
||||
telephoneNo String
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@ function replaceEmptyField<T>(data: T): T {
|
|||
}
|
||||
|
||||
type FullAddress = {
|
||||
addressForeign?: boolean;
|
||||
address: string;
|
||||
addressEN: string;
|
||||
moo?: string;
|
||||
|
|
@ -296,8 +297,14 @@ type FullAddress = {
|
|||
soiEN?: string;
|
||||
street?: string;
|
||||
streetEN?: string;
|
||||
provinceText?: string | null;
|
||||
provinceTextEN?: string | null;
|
||||
province?: Province | null;
|
||||
districtText?: string | null;
|
||||
districtTextEN?: string | null;
|
||||
district?: District | null;
|
||||
subDistrictText?: string | null;
|
||||
subDistrictTextEN?: string | null;
|
||||
subDistrict?: SubDistrict | null;
|
||||
en?: boolean;
|
||||
};
|
||||
|
|
@ -331,13 +338,22 @@ function addressFull(addr: FullAddress, lang: "th" | "en" = "en") {
|
|||
if (addr.soi) fragments.push(`ซอย ${addr.soi},`);
|
||||
if (addr.street) fragments.push(`ถนน${addr.street},`);
|
||||
|
||||
if (addr.subDistrict) {
|
||||
fragments.push(`${addr.province?.id === "10" ? "แขวง" : "ตำบล"}${addr.subDistrict.name},`);
|
||||
if (!addr.addressForeign && addr.subDistrict) {
|
||||
fragments.push(`${addr.province?.id === "10" ? "แขวง" : "ตำบล"}${addr.subDistrict.name}`);
|
||||
}
|
||||
if (addr.district) {
|
||||
fragments.push(`${addr.province?.id === "10" ? "เขต" : "อำเภอ"}${addr.district.name},`);
|
||||
if (addr.addressForeign && addr.subDistrictText) {
|
||||
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;
|
||||
default:
|
||||
|
|
@ -346,11 +362,26 @@ function addressFull(addr: FullAddress, lang: "th" | "en" = "en") {
|
|||
if (addr.soiEN) fragments.push(`Soi ${addr.soiEN},`);
|
||||
if (addr.streetEN) fragments.push(`${addr.streetEN} Rd.`);
|
||||
|
||||
if (addr.subDistrict) {
|
||||
if (!addr.addressForeign && addr.subDistrict) {
|
||||
fragments.push(`${addr.subDistrict.nameEN} sub-district,`);
|
||||
}
|
||||
if (addr.district) fragments.push(`${addr.district.nameEN} district,`);
|
||||
if (addr.province) fragments.push(`${addr.province.nameEN},`);
|
||||
if (addr.addressForeign && addr.subDistrictTextEN) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ type UserCreate = {
|
|||
responsibleArea?: string[] | null;
|
||||
birthDate?: Date | null;
|
||||
|
||||
addressForeign?: boolean;
|
||||
address: string;
|
||||
addressEN: string;
|
||||
soi?: string | null;
|
||||
|
|
@ -122,9 +123,16 @@ type UserCreate = {
|
|||
email: string;
|
||||
telephoneNo: string;
|
||||
|
||||
subDistrictText?: string | null;
|
||||
subDistrictTextEN?: string | null;
|
||||
subDistrictId?: string | null;
|
||||
districtText?: string | null;
|
||||
districtTextEN?: string | null;
|
||||
districtId?: string | null;
|
||||
provinceText?: string | null;
|
||||
provinceTextEN?: string | null;
|
||||
provinceId?: string | null;
|
||||
zipCodeText?: string | null;
|
||||
|
||||
selectedImage?: string;
|
||||
|
||||
|
|
@ -173,6 +181,7 @@ type UserUpdate = {
|
|||
responsibleArea?: string[] | null;
|
||||
birthDate?: Date | null;
|
||||
|
||||
addressForeign?: boolean;
|
||||
address?: string;
|
||||
addressEN?: string;
|
||||
soi?: string | null;
|
||||
|
|
@ -186,9 +195,16 @@ type UserUpdate = {
|
|||
|
||||
selectedImage?: string;
|
||||
|
||||
subDistrictText?: string | null;
|
||||
subDistrictTextEN?: string | null;
|
||||
subDistrictId?: string | null;
|
||||
districtText?: string | null;
|
||||
districtTextEN?: string | null;
|
||||
districtId?: string | null;
|
||||
provinceText?: string | null;
|
||||
provinceTextEN?: string | null;
|
||||
provinceId?: string | null;
|
||||
zipCodeText?: string | null;
|
||||
|
||||
branchId?: string | string[];
|
||||
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ export class QuotationPayment extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
if (quotation.quotationStatus === "PaymentPending") {
|
||||
if (quotation.quotationStatus === "PaymentInProcess") {
|
||||
await prisma.notification.create({
|
||||
data: {
|
||||
title: "รายการคำขอใหม่ / New Request",
|
||||
|
|
|
|||
|
|
@ -664,7 +664,14 @@ export class QuotationController extends Controller {
|
|||
title: "ใบเสนอราคาใหม่ / New Quotation",
|
||||
detail: "รหัส / code : " + ret.code,
|
||||
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