Add step type support for work order profiles and steps, update database schema, APIs, and UI components to handle configurable step types.
This commit is contained in:
@@ -41,11 +41,14 @@ func (h *StepHandler) Create(w http.ResponseWriter, r *http.Request) {
|
||||
var maxOrder int
|
||||
h.db.QueryRow(`SELECT ISNULL(MAX(step_order),0) FROM wo_steps WHERE wo_id=@p1`, woID).Scan(&maxOrder)
|
||||
|
||||
if body.StepType == "" {
|
||||
body.StepType = "work_step"
|
||||
}
|
||||
var sid int
|
||||
err = h.db.QueryRow(`
|
||||
INSERT INTO wo_steps (wo_id,step_order,title,description,required)
|
||||
OUTPUT INSERTED.id VALUES (@p1,@p2,@p3,@p4,@p5)`,
|
||||
woID, maxOrder+1, body.Title, body.Description, body.Required,
|
||||
INSERT INTO wo_steps (wo_id,step_order,title,description,required,step_type,type_config)
|
||||
OUTPUT INSERTED.id VALUES (@p1,@p2,@p3,@p4,@p5,@p6,@p7)`,
|
||||
woID, maxOrder+1, body.Title, body.Description, body.Required, body.StepType, body.TypeConfig,
|
||||
).Scan(&sid)
|
||||
if err != nil {
|
||||
respondError(w, http.StatusInternalServerError, err.Error())
|
||||
|
||||
Reference in New Issue
Block a user