From 7f59b188cfabd447bb6d9c1a6a1538f573019fe8 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Mon, 8 Jun 2026 23:20:27 +0530 Subject: [PATCH] chore: fix conflicts --- .../doctype/job_card/job_card.js | 160 ------------------ 1 file changed, 160 deletions(-) diff --git a/erpnext/manufacturing/doctype/job_card/job_card.js b/erpnext/manufacturing/doctype/job_card/job_card.js index c0cabf50b04..e096c73cc61 100644 --- a/erpnext/manufacturing/doctype/job_card/job_card.js +++ b/erpnext/manufacturing/doctype/job_card/job_card.js @@ -298,169 +298,9 @@ frappe.ui.form.on("Job Card", { prepare_timer_buttons: function (frm) { frm.trigger("make_dashboard"); -<<<<<<< HEAD if (!frm.doc.started_time && !frm.doc.current_time) { frm.add_custom_button(__("Start Job"), () => { if ((frm.doc.employee && !frm.doc.employee.length) || !frm.doc.employee) { -======= - frappe.call({ - method: "erpnext.manufacturing.doctype.job_card.job_card.make_time_log", - args: { args }, - freeze: true, - callback() { - frm.reload_doc(); - frm.trigger("make_dashboard"); - }, - }); - }, - - update_sub_operation(frm, args) { - if (frm.doc.sub_operations?.length) { - const pending_sub_ops = frm.doc.sub_operations.filter((d) => d.status != "Complete"); - if (pending_sub_ops.length) { - args["sub_operation"] = pending_sub_ops[0].sub_operation; - } - } - }, - - make_dashboard(frm, has_items) { - if (frm.doc.__islocal) return false; - - frm.dashboard.refresh(); - - // Clear any previously running timer tick before re-rendering. - if (frm._jcd_timer_interval) { - clearInterval(frm._jcd_timer_interval); - frm._jcd_timer_interval = null; - } - - const wrapper = $(frm.fields_dict["job_card_dashboard"].wrapper); - wrapper.empty(); - - if (frm.doc.docstatus !== 0) { - return; - } - - const { doc } = frm; - const { time_logs, status } = doc; - - // ── Determine which action buttons to show ──────────────────────── - const has_remaining_qty = doc.for_quantity + doc.process_loss_qty > doc.total_completed_qty; - const materials_ready = - doc.skip_material_transfer || - doc.transferred_qty >= doc.for_quantity + doc.process_loss_qty || - !doc.finished_good || - !has_items?.length; - - let last_row = {}; - const has_sub_ops_or_pending_qty = doc.sub_operations?.length || doc.pending_qty > 0; - if (has_sub_ops_or_pending_qty && time_logs?.length) { - last_row = get_last_row(time_logs); - } - - const no_time_logs_yet = !time_logs?.length; - const pending_qty_cycle_done = flt(doc.pending_qty) > 0.0 && last_row?.to_time; - const sub_operation_cycle_done = doc.sub_operations?.length && last_row?.to_time; - const should_show_start = - (no_time_logs_yet || pending_qty_cycle_done || sub_operation_cycle_done) && !doc.is_paused; - - const last_log_complete = time_logs?.length && time_logs[time_logs.length - 1].to_time; - const is_on_hold = status === "On Hold"; - const is_actively_running = !!( - time_logs?.length && - !last_log_complete && - !is_on_hold && - !doc.is_paused - ); - - let show_start = false, - show_pause = false, - show_resume = false, - show_complete = false, - is_timer_running = false; - - if (has_remaining_qty && materials_ready) { - const manufactured_qty = doc.manufactured_qty || doc.total_completed_qty; - const qty_yet_to_manufacture = doc.for_quantity - (manufactured_qty + doc.process_loss_qty); - - if (should_show_start) { - show_start = true; - } else if (doc.is_paused) { - show_resume = true; - } else if (qty_yet_to_manufacture > 0) { - show_pause = true; - show_complete = true; - is_timer_running = true; - } - } - - // ── Timer color reflects job state ──────────────────────────────── - const [timer_color, timer_bg, timer_border] = [ - "var(--gray-600,#6b7280)", - "var(--gray-100,#f3f4f6)", - "var(--gray-300,#d1d5db)", - ]; - - // ── Action button HTML ──────────────────────────────────────────── - const btn = (cls, icon_path, label, icon_color) => ` - `; - - const icons = { - play: { d: '', fill: "currentColor", stroke: "none" }, - pause: { - d: '', - fill: "currentColor", - stroke: "none", - }, - check: { d: '', sw: 3 }, - }; - - const buttons_html = [ - show_start && btn("btn-primary jcd-btn-start", "play", __("Start Job")), - show_resume && btn("btn-primary jcd-btn-resume", "play", __("Resume Job")), - show_pause && btn("btn-default jcd-btn-pause", "pause", __("Pause Job")), - show_complete && btn("btn-primary jcd-btn-complete", "check", __("Complete Job"), "white"), - ] - .filter(Boolean) - .join(""); - - // ── Render widget ───────────────────────────────────────────────── - wrapper.append(` -
-
-
-
- ${__("Elapsed Time")} -
-
- ${frappe.utils.icon("clock-4", "md", "", "", "", "", timer_color)} - - 00:00:00 - -
-
-
- ${buttons_html} -
-
-
`); - - // ── Wire up button click handlers ───────────────────────────────── - if (show_start) { - wrapper.find(".jcd-btn-start").on("click", () => { - const from_time = frappe.datetime.now_datetime(); - const has_no_employee = !frm.doc.employee || !frm.doc.employee.length; - - if (has_no_employee) { ->>>>>>> 8db1eb0d27 (fix: allow specific methods to run) frappe.prompt( { fieldtype: "Table MultiSelect",