# Checklist: Store and Product Management (Big 3 & Multiple Managers) ## 📦 Database & Models - [x] **Migration**: Create `store_managers` table with standard fields (`hashkey`, `created_by`, `updated_by`, `is_active`). - [x] **Model**: Create `app/Models/Market/StoreManager.php`. - [x] **Model**: Add `managers()` relationship to `app/Models/Market/Store.php`. - [x] **Dictionary**: Update `ai-docs/dictionary.md` with "Big 3" definition. ## 🔐 Permissions & Hierarchy - [x] **UserPermissions**: Ensure `ULTIMATE`, `SUPER_OPERATOR`, `OPERATOR` are identified as "Big 3". - [x] **ProductPermissions**: Add `UserActions::ModifyAllProducts` to `OPERATOR` role in `ProductPermissionsDefinition`. - [x] **ProductPermissions**: Extend `isActionAllowed` to check if current user is a parent of any of the store's managers (not just the owner). - [x] **Permissions Helper**: Add `isParentOfTargetUser` recursive check for Store Owner and all Store Managers. ## 🏪 Store Management - [x] **StoreController**: Refactor `listStores_Admin` to filter by "Big 3" OR "Parent of Owner" OR "Parent of any Manager". - [x] **StoreController**: Ensure `update` and `deleteStore_Admin` enforce the same hierarchy checks. - [x] **StoreController**: Update `canUserAccessPos` to include a check against the `store_managers` table. - [x] **StoreController**: Support saving multiple managers in `store` and `update` methods (input should be an array of user hashkeys). ## 🍎 Product Management - [x] **ProductController**: Refactor `editProductAdmin` - Only "Big 3" can perform global edits (updating `prd_items` table fields). Non-Big 3 can only update their own store's pivot data if they are a manager/owner. - [x] **ProductController**: Ensure `createNew_Admin` requires Big 3 or ownership/parentship of the target store. - [x] **ProductController**: Update `AssignProductToOwnStore` to support the new `store_managers` lookup. ## 🖥️ Frontend Changes - [x] **CreateStore.vue / EditStore.vue**: Implement a multi-select for managers. - [x] **ManageProductAdmin.vue**: Only show global edit fields to Big 3 users. - [x] **StoreDetail.vue**: Ensure correct action buttons (Edit, POS) are visible only based on the new permission logic.