diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-02-06 11:27:03 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-02-06 11:27:03 +0700 |
| commit | 137737e4c215f5a9a6aae78cafbefe5b4cf7793d (patch) | |
| tree | 325b429f5fae6ecca2de177c537d237191fb3dc5 | |
| parent | 38db9dbede5ee9d99068fb9a98941fd15c2730bf (diff) | |
<iman> update scanner and add value
| -rw-r--r-- | prisma/migrations/20250206040903_add_value_column/migration.sql | 2 | ||||
| -rw-r--r-- | prisma/schema.prisma | 1 | ||||
| -rw-r--r-- | src/app/api/product/import/route.tsx | 3 | ||||
| -rw-r--r-- | src/common/components/Scanner/index.tsx | 7 |
4 files changed, 8 insertions, 5 deletions
diff --git a/prisma/migrations/20250206040903_add_value_column/migration.sql b/prisma/migrations/20250206040903_add_value_column/migration.sql new file mode 100644 index 0000000..0dd8b8b --- /dev/null +++ b/prisma/migrations/20250206040903_add_value_column/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Product" ADD COLUMN "value" FLOAT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ef78e48..68bc387 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -39,6 +39,7 @@ model Location { model Product { id Int @id @default(autoincrement()) externalId String? + value Float? barcode String itemCode String name String diff --git a/src/app/api/product/import/route.tsx b/src/app/api/product/import/route.tsx index 3f11def..37b4690 100644 --- a/src/app/api/product/import/route.tsx +++ b/src/app/api/product/import/route.tsx @@ -25,7 +25,8 @@ export async function POST(request: NextRequest) { onhandQty: row[3] || 0, // Handle undefined values differenceQty: row[4] || 0, // Handle undefined values companyId: intCompanyId, // Use the parsed company ID - externalId: row[6] ? row[6].toString() : null // Handle undefined values + externalId: row[6] ? row[6].toString() : null, // Handle undefined values + value: row[7] != null ? Number(row[7]) || 0 : null, })); const whereCompany = { companyId: intCompanyId } diff --git a/src/common/components/Scanner/index.tsx b/src/common/components/Scanner/index.tsx index 56d2495..c21633f 100644 --- a/src/common/components/Scanner/index.tsx +++ b/src/common/components/Scanner/index.tsx @@ -29,10 +29,9 @@ const Scanner = (props: Props) => { } return ( - <div className={styles.wrapper}> - <video ref={ref} onClick={restartCam} className={styles.video} /> - <div className={styles.videoFrame} /> - </div> + <div className="relative w-full h-[125px] overflow-hidden"> + <video ref={ref} className="w-full h-full object-cover" /> + </div> ) } |
