1 parent
6b2bb44814
commit
1d4749b194
1 file changed
+4
-4
@@ -2,12 +2,12 @@
|
||||
{
|
||||
"docstatus": 0,
|
||||
"doctype": "Custom HTML Block",
|
||||
"html": "<h3>Hello from the frontend</h3><div class=\"manufacturing-overview\">\n <div class=\"manufacturing-overview-content\">\n Loading...\n </div>\n</div>",
|
||||
"modified": "2026-10-17 14:58:45.689239",
|
||||
"html": "<div class=\"manufacturing-overview\">\n <div class=\"manufacturing-overview-list\">\n Loading...\n </div>\n</div>",
|
||||
"modified": "2026-10-24 15:30:08.275864",
|
||||
"name": "Manufacturing Overview",
|
||||
"private": 0,
|
||||
"roles": [],
|
||||
"script": "frappe.call({\n method: \"manufacturing_utilities.manufacturing_overview.api.hello_world\",\n type: \"GET\"\n}).then((r) => {\n const container = root_element.querySelector(\n \".manufacturing-overview-content\"\n );\n\n container.textContent = r.message;\n});",
|
||||
"style": null
|
||||
"script": "const OVERVIEW_METHOD =\n \"manufacturing_utilities.manufacturing_overview.api.get_manufacturing_overview\";\n\nconst REALTIME_EVENT = \"manufacturing_overview_updated\";\nconst REFRESH_INTERVAL = 60 * 1000;\n\nconst container = root_element.querySelector(\n \".manufacturing-overview-list\"\n);\n\nlet isLoading = false;\n\n\n/*\n * --------------------------------------------------------------------------\n * Helpers\n * --------------------------------------------------------------------------\n */\n\nfunction formatQty(value) {\n const number = Number(value || 0);\n\n return Number.isInteger(number)\n ? number.toString()\n : number.toLocaleString(undefined, {\n maximumFractionDigits: 3,\n });\n}\n\n\nfunction formatDate(value) {\n if (!value) {\n return \"\";\n }\n\n return frappe.datetime.str_to_user(value);\n}\n\n\nfunction getDeliveryDateClass(value) {\n if (!value) {\n return \"\";\n }\n\n const deliveryDate =\n frappe.datetime.str_to_obj(value);\n\n const today =\n frappe.datetime.str_to_obj(\n frappe.datetime.get_today()\n );\n\n deliveryDate.setHours(0, 0, 0, 0);\n today.setHours(0, 0, 0, 0);\n\n if (deliveryDate < today) {\n return \"mo-date-overdue\";\n }\n\n if (\n deliveryDate.getTime() ===\n today.getTime()\n ) {\n return \"mo-date-today\";\n }\n\n return \"\";\n}\n\n\nfunction getDateGroup(value) {\n if (!value) {\n return \"upcoming\";\n }\n\n const deliveryDate =\n frappe.datetime.str_to_obj(value);\n\n const today =\n frappe.datetime.str_to_obj(\n frappe.datetime.get_today()\n );\n\n deliveryDate.setHours(0, 0, 0, 0);\n today.setHours(0, 0, 0, 0);\n\n if (deliveryDate < today) {\n return \"behind_schedule\";\n }\n\n if (\n deliveryDate.getTime() ===\n today.getTime()\n ) {\n return \"today\";\n }\n\n return \"upcoming\";\n}\n\n\nfunction escape(value) {\n return frappe.utils.escape_html(\n value == null ? \"\" : String(value)\n );\n}\n\n\n/*\n * --------------------------------------------------------------------------\n * Manufacturing card\n * --------------------------------------------------------------------------\n */\n\nfunction renderManufacturingCard(item) {\n const status =\n item.status || \"unknown\";\n\n const statusLabels = {\n partially_delivered:\n \"Partially Delivered\",\n in_warehouse:\n \"In Warehouse\",\n to_produce:\n \"To Produce\",\n no_work_order:\n \"No Work Order\",\n };\n\n let statusLabel =\n statusLabels[status] || status;\n\n if (\n status ===\n \"partially_delivered\"\n ) {\n statusLabel +=\n ` (${formatQty(item.delivered_qty)}/${formatQty(item.qty)})`;\n }\n\n const salesOrder =\n escape(item.sales_order);\n\n const workOrder =\n escape(item.work_order);\n\n const itemCode =\n escape(item.item_code);\n\n const itemName =\n escape(item.item_name);\n\n const customer =\n escape(item.customer);\n\n const deliveryDate =\n escape(\n formatDate(\n item.delivery_date\n )\n );\n\n const deliveryDateClass =\n getDeliveryDateClass(\n item.delivery_date\n );\n\n return `\n <div\n class=\"\n mo-row\n mo-manufacturing-card\n ${item.work_order\n ? \"mo-row-clickable\"\n : \"\"}\n \"\n data-work-order=\"${workOrder}\"\n >\n <div\n class=\"\n mo-status\n mo-status-${status}\n \"\n ></div>\n\n <div class=\"mo-main\">\n\n <div class=\"mo-title-row\">\n\n <div class=\"mo-title\">\n\n <span class=\"mo-qty\">\n ${formatQty(item.remaining_qty)} ×\n </span>\n\n <a\n href=\"/app/item/${encodeURIComponent(item.item_code)}\"\n class=\"mo-link mo-item-link\"\n >\n ${itemName}\n </a>\n\n </div>\n\n <div\n class=\"\n mo-date\n ${deliveryDateClass}\n \"\n >\n ${deliveryDate}\n </div>\n\n </div>\n\n <div class=\"mo-meta\">\n\n <span>\n ${customer}\n </span>\n\n Line truncated
|
||||
"style": ".manufacturing-overview {\n width: 100%;\n}\n\n.manufacturing-overview-list {\n display: flex;\n flex-direction: column;\n}\n\n\n/* -------------------------------------------------------------------------\n * Sections\n * ---------------------------------------------------------------------- */\n\n.mo-section {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.mo-section + .mo-section {\n margin-top: 28px;\n}\n\n.mo-section-header {\n padding:\n 0 2px 6px;\n\n font-size:\n var(--text-sm);\n\n font-weight: 600;\n\n color:\n var(--text-muted);\n\n border-bottom:\n 1px solid\n var(--border-color);\n}\n\n.mo-section-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n\n/* -------------------------------------------------------------------------\n * Two-column overview layout\n * ---------------------------------------------------------------------- */\n\n.mo-overview-entry {\n display: grid;\n\n grid-template-columns:\n minmax(0, 1fr)\n minmax(0, 1fr);\n\n gap: 10px;\n\n align-items: start;\n}\n\n.mo-manufacturing-column,\n.mo-subcontracting-column {\n min-width: 0;\n}\n\n.mo-subcontracting-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n\n/* -------------------------------------------------------------------------\n * Base card\n * ---------------------------------------------------------------------- */\n\n.mo-row {\n display: flex;\n gap: 12px;\n\n padding:\n 12px 14px;\n\n border:\n 1px solid\n var(--border-color);\n\n border-radius:\n 12px;\n\n background:\n var(--card-bg);\n\n box-shadow:\n none;\n\n transition:\n background 0.15s ease,\n border-color 0.15s ease,\n box-shadow 0.15s ease,\n transform 0.15s ease;\n}\n\n.mo-row-clickable {\n cursor: pointer;\n}\n\n.mo-row-clickable:hover {\n background:\n var(--control-bg);\n\n border-color:\n var(--gray-300);\n\n box-shadow:\n 0 1px 2px\n rgba(0, 0, 0, 0.06),\n 0 3px 8px\n rgba(0, 0, 0, 0.05);\n}\n\n.mo-row-clickable:active {\n transform:\n translateY(1px);\n\n box-shadow:\n 0 1px 2px\n rgba(0, 0, 0, 0.08);\n}\n\n\n/* -------------------------------------------------------------------------\n * Status bars\n * ---------------------------------------------------------------------- */\n\n.mo-status {\n width: 6px;\n min-width: 6px;\n\n border-radius:\n 999px;\n\n background:\n var(--gray-400);\n}\n\n.mo-status-in_warehouse {\n background:\n var(--green-500);\n}\n\n.mo-status-to_produce {\n background:\n var(--yellow-500);\n}\n\n.mo-status-no_work_order {\n background:\n var(--red-500);\n}\n\n.mo-status-partially_delivered {\n background:\n var(--blue-500);\n}\n\n.mo-status-subcontracting {\n background:\n var(--purple-500);\n}\n\n\n/* -------------------------------------------------------------------------\n * Card content\n * ---------------------------------------------------------------------- */\n\n.mo-main {\n flex: 1;\n min-width: 0;\n}\n\n.mo-title-row {\n display: flex;\n\n justify-content:\n space-between;\n\n align-items:\n flex-start;\n\n gap: 16px;\n}\n\n.mo-title {\n min-width: 0;\n\n font-size:\n var(--text-base);\n\n font-weight: 600;\n\n color:\n var(--text-color);\n}\n\n.mo-qty {\n margin-right:\n 4px;\n\n color:\n var(--text-muted);\n}\n\n.mo-item-link {\n font-weight: 600;\n}\n\n\n/* -------------------------------------------------------------------------\n * Delivery date\n * ---------------------------------------------------------------------- */\n\n.mo-date {\n white-space: nowrap;\n\n font-size:\n var(--text-sm);\n\n color:\n var(--text-muted);\n}\n\n.mo-date-today {\n font-weight: 700;\n\n color:\n var(--text-color);\n}\n\n.mo-date-overdue {\n font-weight: 700;\n\n color:\n var(--red-600);\n}\n\n\n/* -------------------------------------------------------------------------\n * Meta / footer\n * ---------------------------------------------------------------------- */\n\n.mo-meta,\n.mo-footer {\n display: flex;\n\n align-items: center;\n\n gap: 6px;\n\n margin-top: 4px;\n\n font-size:\n var(--text-sm);\n\n color:\n var(--text-muted);\n}\n\n.mo-footer {\n justify-content:\n space-between;\n}\n\n.mo-separator {\n opacity: 0.5;\n}\n\n.mo-status-label {\n font-size:\n var(--text-xs);\n\n font-weight: 500;\n}\n\n\n/* -------------------------------------------------------------------------\n * Links\n * ---------------------------------------------------------------------- */\n\n.mo-link {\n color: inherit;\n\n Line truncated
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user