feat: search quotation now cover customer name and code

This commit is contained in:
Methapon Metanipat 2024-10-24 15:29:09 +07:00
parent 8da915b868
commit 447a99e4f7

View file

@ -183,7 +183,22 @@ export class QuotationController extends Controller {
@Query() query = "",
) {
const where = {
OR: [{ code: { contains: query, mode: "insensitive" } }, { workName: { contains: query } }],
OR: [
{ code: { contains: query, mode: "insensitive" } },
{ workName: { contains: query } },
{
customerBranch: {
OR: [
{ code: { contains: query, mode: "insensitive" } },
{ customerName: { contains: query } },
{ firstName: { contains: query } },
{ firstNameEN: { contains: query } },
{ lastName: { contains: query } },
{ lastNameEN: { contains: query } },
],
},
},
],
payCondition,
registeredBranch: isSystem(req.user) ? undefined : { OR: permissionCond(req.user) },
} satisfies Prisma.QuotationWhereInput;