{
	"info": {
		"_postman_id": "supply-order-unavailable-items-2026",
		"name": "Supply Order - Unavailable Items & Additional Costs",
		"description": "Collection for managing unavailable items and additional costs in supply orders. Includes endpoints for supervisors to mark items as unavailable and manage additional costs, and for sales managers to view this information when creating quotations.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Item Availability",
			"item": [
				{
					"name": "Mark Item as Unavailable",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"notes\": \"Item is out of stock and needs to be ordered from supplier\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/items/{{item_id}}/mark-unavailable",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"items",
								"{{item_id}}",
								"mark-unavailable"
							]
						},
						"description": "Mark a supply order item as unavailable. Requires permission: supply-orders.items.mark-unavailable (supervisor only)."
					},
					"response": []
				},
				{
					"name": "Mark Item as Available",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/items/{{item_id}}/mark-available",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"items",
								"{{item_id}}",
								"mark-available"
							]
						},
						"description": "Mark a supply order item as available again. Requires permission: supply-orders.items.mark-unavailable (supervisor only)."
					},
					"response": []
				},
				{
					"name": "Get Unavailable Items",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/unavailable-items",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"unavailable-items"
							]
						},
						"description": "Get all unavailable items for a supply order. Available to sales managers and supervisors."
					},
					"response": []
				}
			],
			"description": "Endpoints for managing item availability status. Only supervisors can mark items as unavailable/available."
		},
		{
			"name": "Additional Costs",
			"item": [
				{
					"name": "Get Additional Costs",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/additional-costs",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"additional-costs"
							]
						},
						"description": "Get all additional costs for a supply order. Available to all authenticated users."
					},
					"response": []
				},
				{
					"name": "Create Additional Cost",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"cost_type\": \"shipping\",\n    \"cost_name\": \"Express Delivery\",\n    \"cost_amount\": 150.00,\n    \"is_visible_to_client\": true,\n    \"notes\": \"Express shipping to meet urgent delivery deadline\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/additional-costs",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"additional-costs"
							]
						},
						"description": "Create a new additional cost for a supply order. Requires permission: supply-orders.additional-costs.manage (supervisor only).\n\nCost types: shipping, tax, labor, insurance, other"
					},
					"response": []
				},
				{
					"name": "Update Additional Cost",
					"request": {
						"method": "PUT",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"cost_type\": \"shipping\",\n    \"cost_name\": \"Express Delivery - Updated\",\n    \"cost_amount\": 175.00,\n    \"is_visible_to_client\": true,\n    \"notes\": \"Updated shipping cost due to fuel surcharge\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/additional-costs/{{cost_id}}",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"additional-costs",
								"{{cost_id}}"
							]
						},
						"description": "Update an existing additional cost. Requires permission: supply-orders.additional-costs.manage (supervisor only)."
					},
					"response": []
				},
				{
					"name": "Delete Additional Cost",
					"request": {
						"method": "DELETE",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/additional-costs/{{cost_id}}",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"additional-costs",
								"{{cost_id}}"
							]
						},
						"description": "Delete an additional cost. Requires permission: supply-orders.additional-costs.manage (supervisor only)."
					},
					"response": []
				},
				{
					"name": "Get Cost Breakdown",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/additional-costs/breakdown",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"additional-costs",
								"breakdown"
							]
						},
						"description": "Get cost breakdown by type (shipping, tax, labor, insurance, other) with totals."
					},
					"response": []
				}
			],
			"description": "Endpoints for managing additional costs. Only supervisors can create, update, or delete additional costs."
		},
		{
			"name": "Quotations",
			"item": [
				{
					"name": "Get Approved Items for Quotation",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/approved-items",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"approved-items"
							]
						},
						"description": "Get approved items, unavailable items, and additional costs for creating a quotation. This endpoint now returns:\n- available_items: Items with approved supplier quotes\n- unavailable_items: Items marked as unavailable by supervisor\n- additional_costs: Additional costs defined by supervisor (visible to client only)\n\nAvailable to sales managers."
					},
					"response": []
				},
				{
					"name": "Create Quotation (with auto-included unavailable items & costs)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"items\": [\n        {\n            \"supply_order_item_id\": 1,\n            \"quote_id\": 5,\n            \"quantity\": 10\n        },\n        {\n            \"supply_order_item_id\": 2,\n            \"quote_id\": 8,\n            \"quantity\": 5\n        }\n    ],\n    \"discount_percentage\": 5,\n    \"validity_date\": \"2026-03-15\",\n    \"notes\": \"Quotation includes unavailable items and additional costs automatically\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}/quotations",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}",
								"quotations"
							]
						},
						"description": "Create a quotation. The system automatically includes:\n1. All unavailable items from the order (with 0 price)\n2. All additional costs marked as visible to client\n3. Calculates totals including additional costs\n\nNote: Unavailable items and additional costs are added automatically - you don't need to include them in the request."
					},
					"response": []
				},
				{
					"name": "Get Quotation (with unavailable items & costs)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"quotations",
								"{{quotation_id}}"
							]
						},
						"description": "Get quotation details including:\n- items: Available items with pricing\n- unavailable_items: Items marked as unavailable (with note)\n- additional_costs: Additional costs included in quotation\n- total_amount: Includes items subtotal + additional costs"
					},
					"response": []
				}
			],
			"description": "Quotation endpoints that now include unavailable items and additional costs automatically."
		},
		{
			"name": "Supply Order Details",
			"item": [
				{
					"name": "Get Supply Order (with unavailable items)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Authorization",
								"value": "Bearer {{access_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/orders/{{supply_order_id}}",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
							
								"supply",
								"orders",
								"{{supply_order_id}}"
							]
						},
						"description": "Get supply order details. Response now includes:\n- unavailable_items: Collection of items marked as unavailable\n- unavailable_items_count: Count in KPIs\n- additional_costs: All additional costs\n- total_additional_costs: Total of all costs\n- visible_additional_costs_total: Total of costs visible to client"
					},
					"response": []
				}
			],
			"description": "Supply order endpoints that include unavailable items information."
		}
	],
	"variable": [
		{
			"key": "BASE_URL",
			"value": "http://localhost:8000",
			"type": "string"
		},
		{
			"key": "access_token",
			"value": "",
			"type": "string"
		},
		{
			"key": "supply_order_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "item_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "cost_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "quotation_id",
			"value": "1",
			"type": "string"
		}
	]
}
