Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Applied filter in 'job card' doctype. #187

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion aumms/public/js/job_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,63 @@ frappe.ui.form.on('Job Card', {
}
};
});
}
frm.remove_custom_button("Start Job");
},

prepare_timer_buttons: function(frm) {
frm.trigger("make_dashboard");

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.prompt({fieldtype: 'Table MultiSelect', label: __('Select Employees'),
options: "Job Card Time Log", fieldname: 'employees', get_query() {
return {
filters: {
"designation": "Smith"
}
};
}}, d => {
frm.events.start_job(frm, "Work In Progress", d.employees);
}, __("Assign Job to Employee"));
} else {
frm.events.start_job(frm, "Work In Progress", frm.doc.employee);
}
}).addClass("btn-primary");
} else if (frm.doc.status == "On Hold") {
frm.add_custom_button(__("Resume Job"), () => {
frm.events.start_job(frm, "Resume Job", frm.doc.employee);
}).addClass("btn-primary");
} else {
frm.add_custom_button(__("Pause Job"), () => {
frm.events.complete_job(frm, "On Hold");
});

frm.add_custom_button(__("Complete Job"), () => {
var sub_operations = frm.doc.sub_operations;

let set_qty = true;
if (sub_operations && sub_operations.length > 1) {
set_qty = false;
let last_op_row = sub_operations[sub_operations.length - 2];

if (last_op_row.status == 'Complete') {
set_qty = true;
}
}

if (set_qty) {
frappe.prompt({fieldtype: 'Float', label: __('Completed Quantity'),
fieldname: 'qty', default: frm.doc.for_quantity}, data => {
frm.events.complete_job(frm, "Complete", data.qty);
}, __("Enter Value"));
} else {
frm.events.complete_job(frm, "Complete", 0.0);
}
}).addClass("btn-primary");
}
},


})

Loading