Open sergeynilov opened 3 months ago
Hi, You can disabled "Submit" button/action as explains here (plugin: ringlesoft/laravel-process-approval): https://github.com/ringlesoft/laravel-process-approval?tab=readme-ov-file#model-submitting
Then the flow or process will be auto-submitted. "This provides the opportunity for editing and other actions on the model before the approval procedure commences."
Thank you for your feedback!
I modify my model :
class Doc extends ApprovableModel
{
protected $table = 'docs';
protected $primaryKey = 'id';
public $timestamps = true;
public bool $autoSubmit = true;
I edited Doc model Approval Flow with 2 steps :
https://img001.prntscr.com/file/img001/fza2wEZGRLCaRCMAwWIQcQ.png
Next when I create a new doc I see next sql in logs :
INSERT INTO `docs` (`branch_id`, `department_id`, `doc_code`, `employee_id`, `type`, `creator_id`, `notes`, `title`, `applied_from`, `status`, `doc_attributes`, `updated_at`, `created_at`)
VALUES (1, 1, 001000100002, 10, MD, 1, Sunt vero rerum est magnam. Qui libero architecto eum occaecati dolore voluptates.<br/> >>>>>> add some notes on 30 July, 2024 9:18 AM, Herman Schuster is moved to 30 July, 2024 9:18 AM in Web developers department, 2024-07-30 09:18:23, W, {"user_id":10}, 2024-07-30 09:18:23, 2024-07-30 09:18:23)
...
SELECT `process_approval_flow_steps`.*
FROM `process_approval_flow_steps`
INNER JOIN `process_approval_flows` on `process_approval_flows`.`id` = `process_approval_flow_steps`.`process_approval_flow_id`
WHERE `process_approval_flows`.`approvable_type` = App\Models\Doc
ORDER BY `order` asc, `id` asc
...
INSERT INTO `process_approval_statuses` (`steps`, `status`, `creator_id`, `approvable_id`, `approvable_type`, `updated_at`, `created_at`)
VALUES ([{"id":2,"action":"CHECK","process_approval_id":null,"role_id":5,"role_name":"MAIN_ACCOUNTANT","process_approval_action":null,"active":null},{"id":1,"action":"APPROVE","process_approval_id":null,"role_id":4,"role_name":"CEO","process_approval_action":null,"active":null}], Submitted, 1, 28, App\Models\Doc, 2024-07-30 09:18:23, 2024-07-30 09:18:23)
a) The 2nd request is just get options for Doc model Approval Flow b) 3rd request added status for my Doc model.
That is clear. What is unclear how now Docs resource page looks for newly added row :
https://img001.prntscr.com/file/img001/OC1CfcvBSua3ZCwd7cawow.png
c) Why no actions for new row?
d) I suppose I need to delete old docs with prior flow and $autoSubmit = false;
?
e) Have I to edit my resource page somehow ?
Thank you for your plugin!
I added "ringlesoft/laravel-process-approval": "^1.0" and "eightynine/filament-approvals": "^3.1" into Laravel 10.48.14/"filament/filament": "^3.2-stable" app, but it works a bit differently I need :
1) I added into Doc model
extends ApprovableModel
so when new model is added it has 1 rows in process_approval_statuses table withstatus = Created
2) in Docs Resources I added :