refactor: dashboard indicator when SLA is on hold
This commit is contained in:
parent
2c9f7cf371
commit
8d39928418
@ -38,12 +38,23 @@ frappe.ui.form.on("Issue", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
|
|
||||||
if (frm.doc.status !== "Closed" && frm.doc.agreement_fulfilled === "Ongoing") {
|
if (frm.doc.status !== "Closed" && frm.doc.agreement_fulfilled === "Ongoing") {
|
||||||
if (frm.doc.service_level_agreement) {
|
if (frm.doc.service_level_agreement) {
|
||||||
if (frm.doc.status == "Replied") {
|
frappe.call({
|
||||||
|
'method': 'frappe.client.get',
|
||||||
|
args: {
|
||||||
|
doctype: 'Support Settings',
|
||||||
|
name: 'Support Settings'
|
||||||
|
},
|
||||||
|
callback: function(data) {
|
||||||
|
let statuses = data.message.pause_sla_on_status;
|
||||||
|
const hold_statuses = [];
|
||||||
|
$.each(statuses, (_i, entry) => {
|
||||||
|
hold_statuses.push(entry.status);
|
||||||
|
});
|
||||||
|
if (hold_statuses.includes(frm.doc.status)) {
|
||||||
frm.dashboard.clear_headline();
|
frm.dashboard.clear_headline();
|
||||||
let message = {"indicator": "orange", "msg": __("Replied {0}", [frappe.datetime.comment_when(frm.doc.on_hold_since)])};
|
let message = {"indicator": "orange", "msg": __("SLA is on hold since {0}", [moment(frm.doc.on_hold_since).fromNow(true)])};
|
||||||
frm.dashboard.set_headline_alert(
|
frm.dashboard.set_headline_alert(
|
||||||
'<div class="row">' +
|
'<div class="row">' +
|
||||||
'<div class="col-xs-12">' +
|
'<div class="col-xs-12">' +
|
||||||
@ -55,6 +66,8 @@ frappe.ui.form.on("Issue", {
|
|||||||
set_time_to_resolve_and_response(frm);
|
set_time_to_resolve_and_response(frm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__("Close"), function () {
|
frm.add_custom_button(__("Close"), function () {
|
||||||
frm.set_value("status", "Closed");
|
frm.set_value("status", "Closed");
|
||||||
@ -67,6 +80,7 @@ frappe.ui.form.on("Issue", {
|
|||||||
frm: frm
|
frm: frm
|
||||||
});
|
});
|
||||||
}, __("Make"));
|
}, __("Make"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (frm.doc.service_level_agreement) {
|
if (frm.doc.service_level_agreement) {
|
||||||
frm.dashboard.clear_headline();
|
frm.dashboard.clear_headline();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user