No UI option to mark a pipeline stage as Won or Lost, causing silent JavaScript crash
Bug Report
Title
No UI option to mark a pipeline stage as Won or Lost, causing silent JavaScript crash
Issue Description
When creating or editing a pipeline, there is no option to mark a stage as "Won" or "Lost". The Ganho/Perdido button on the lead view requires stages with code = 'won' and code = 'lost' to exist in the pipeline, but there is no way to set this through the UI.
The only workaround is to create stages with the exact names won and lost, which causes the system to automatically assign the matching codes. However, this forces non-English stage names to break the feature, and there is no documentation or UI hint about this requirement.
When the user clicks the Won/Lost button without these stages configured, the application throws a silent JavaScript crash with no user-friendly error message.
Preconditions
- Krayin CRM version: 2.1.5 (image: webkul/krayin:2.1.5)
- Browser: Chrome 148
- A pipeline created through the UI with custom stage names (not named exactly
wonandlost)
Steps to Reproduce
- Create a new pipeline through Settings → Pipelines
- Add stages with custom names (e.g. "Cadastro", "Compra Concluída", "Ganho", "Perdido")
- Save the pipeline
- Open any lead that uses this pipeline
- Click the Won/Lost button in the top stage bar
Expected Result
- The pipeline builder should have an explicit option to mark a stage as Won or Lost, independent of the stage name
- Or at minimum, a clear error message should be shown when Won/Lost stages are missing
- Users should not be required to name stages in English for the feature to work
Actual Result
The button crashes silently with a JavaScript error:
TypeError: Cannot read properties of undefined (reading 'code')
at Proxy.openModalThis happens because this.stages.find(stage => stage.code == 'won') returns undefined when the stage name (and therefore its code) is not exactly won.
The only workaround is to create stages named exactly won and lost, which is not intuitive and forces English names on non-English pipelines.
Source: krayin/laravel-crm