Repository navigation
fix(import): creating the IR issues one per factory at once; lead-time popup - #1199
Merged
Merged
Conversation
…e popup Owner rulings 2026-10-29: no DRAFT step for a new import request. สร้างใบขอซื้อ (IR) now creates AND issues one IR per factory in a single transaction, so the deal moves to ขั้น 12 and every factory shows on the import fulfilment page right away, in sync with the deal's จัดซื้อ-ส่งมอบ tab. - createDrafts checks every new factory before any write (items, lead time, deposit gate) and issues each through the extracted issueStoredDraft; a failure writes nothing. - A factory with no lead time from the quotation or country default gets a popup (like the new-factory country popup) asking min-max days; the 409 lists only those factories and the retry carries the values (1-365, min<=max). - Revisions keep their edit DRAFT; leftover DRAFT rows still issue as before. - Button and toast wording now says ออกใบขอซื้อ (IR). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…or the deposit Code review of #1199: - createDrafts checks requireImportRequestIssuable right after the stage check, so an unpaid deal is refused at the first press instead of after the country and lead-time popups. - The deal tab's ออกใบขอซื้อ (IR) button is disabled with the hint "ออกใบขอซื้อ (IR) ได้หลังรับชำระมัดจำแล้ว" until the deal is deposit-ready (depositReadyForIr mirrors TicketService#requireImportRequestIssuable); the imperative entry point refuses early with the same message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ploy's rulings from 2026-10-29: a new import request has no DRAFT step any more. สร้างใบขอซื้อ (IR) now creates and issues one IR per factory in a single step. The deal moves to ขั้น 12, and every factory shows up on the import team's งานนำเข้า page straight away, in sync with the deal's จัดซื้อ-ส่งมอบ tab.
Why: with several factories, the deal reached ขั้น 12 on the first ออกเลข. The main button then disappeared while the other factories were still DRAFT, and nothing reminded sales of them.
Rulings
Changes
ImportRequestService.createDrafts:issueStoredDraft, which was extracted fromissue().issue()keeps all its checks.@Transactionalalso rolls back an auto-created factory and the factory picks from fix(import): dashboard = issued IRs only, direct deals get factories + IR-draft picker, legacy one-click chain removed #1194.leadTimesin the create request:[{factoryName, minDays, maxDays}], matched by the same factory-name normalisation the country flow uses.กรุณาระบุระยะเวลานำเข้าให้กับโรงงาน: …and lists only the factories still missing one.DealFulfilmentPanel:FactoryLeadTimeModal. The country popup comes first, then the lead-time popup, and the final retry carries both answers. A retry guard stops it looping.mockApimirrors the backend.Test coverage (written first, shown red)
StoredImportRequestIntegrationTest:createDrafts_issuesEveryFactoryInOneStep_andMovesTheDealToProcurement: 2 factories, both ISSUED, distinct doc numbers, step CONTACTED, fulfilment status IR_ISSUED, stage PROCUREMENT.createDrafts_isAllOrNothing_whenOneNewFactoryHasNoLeadTime.ImportRequestPaymentGateIntegrationTest.createDrafts_isRefused409_andWritesNothing_onADealWithNoDepositYet.ImportRequestLeadTimeIntegrationTest:DealFulfilmentPanel.test.jsx:DraftSeedhelper.Not covered:
requestCreateIrDraftspath);Verification
🤖 Generated with Claude Code