mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 13:38:27 +00:00
* ci: add prettier to pre-commit
(cherry picked from commit 2c16036ef3)
* style: format js files
---------
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -1,40 +1,47 @@
|
||||
frappe.ui.form.on("Issue", {
|
||||
onload: function(frm) {
|
||||
onload: function (frm) {
|
||||
frm.email_field = "raised_by";
|
||||
|
||||
frappe.db.get_value("Support Settings", {name: "Support Settings"},
|
||||
["allow_resetting_service_level_agreement", "track_service_level_agreement"], (r) => {
|
||||
frappe.db.get_value(
|
||||
"Support Settings",
|
||||
{ name: "Support Settings" },
|
||||
["allow_resetting_service_level_agreement", "track_service_level_agreement"],
|
||||
(r) => {
|
||||
if (r && r.track_service_level_agreement == "0") {
|
||||
frm.set_df_property("service_level_section", "hidden", 1);
|
||||
}
|
||||
if (r && r.allow_resetting_service_level_agreement == "0") {
|
||||
frm.set_df_property("reset_service_level_agreement", "hidden", 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// buttons
|
||||
if (frm.doc.status !== "Closed") {
|
||||
frm.add_custom_button(__("Close"), function() {
|
||||
frm.add_custom_button(__("Close"), function () {
|
||||
frm.set_value("status", "Closed");
|
||||
frm.save();
|
||||
});
|
||||
|
||||
frm.add_custom_button(__("Task"), function() {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.support.doctype.issue.issue.make_task",
|
||||
frm: frm
|
||||
});
|
||||
}, __("Create"));
|
||||
|
||||
frm.add_custom_button(
|
||||
__("Task"),
|
||||
function () {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.support.doctype.issue.issue.make_task",
|
||||
frm: frm,
|
||||
});
|
||||
},
|
||||
__("Create")
|
||||
);
|
||||
} else {
|
||||
frm.add_custom_button(__("Reopen"), function() {
|
||||
frm.add_custom_button(__("Reopen"), function () {
|
||||
frm.set_value("status", "Open");
|
||||
frm.save();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
reset_service_level_agreement: function(frm) {
|
||||
reset_service_level_agreement: function (frm) {
|
||||
let reset_sla = new frappe.ui.Dialog({
|
||||
title: __("Reset Service Level Agreement"),
|
||||
fields: [
|
||||
@@ -42,8 +49,8 @@ frappe.ui.form.on("Issue", {
|
||||
fieldtype: "Data",
|
||||
fieldname: "reason",
|
||||
label: __("Reason"),
|
||||
reqd: 1
|
||||
}
|
||||
reqd: 1,
|
||||
},
|
||||
],
|
||||
primary_action_label: __("Reset"),
|
||||
primary_action: (values) => {
|
||||
@@ -53,39 +60,42 @@ frappe.ui.form.on("Issue", {
|
||||
|
||||
frappe.show_alert({
|
||||
indicator: "green",
|
||||
message: __("Resetting Service Level Agreement.")
|
||||
message: __("Resetting Service Level Agreement."),
|
||||
});
|
||||
|
||||
frappe.call("erpnext.support.doctype.service_level_agreement.service_level_agreement.reset_service_level_agreement", {
|
||||
reason: values.reason,
|
||||
user: frappe.session.user_email,
|
||||
doctype: frm.doc.doctype,
|
||||
docname: frm.doc.name,
|
||||
}, () => {
|
||||
reset_sla.enable_primary_action();
|
||||
frm.refresh();
|
||||
frappe.msgprint(__("Service Level Agreement was reset."));
|
||||
});
|
||||
}
|
||||
frappe.call(
|
||||
"erpnext.support.doctype.service_level_agreement.service_level_agreement.reset_service_level_agreement",
|
||||
{
|
||||
reason: values.reason,
|
||||
user: frappe.session.user_email,
|
||||
doctype: frm.doc.doctype,
|
||||
docname: frm.doc.name,
|
||||
},
|
||||
() => {
|
||||
reset_sla.enable_primary_action();
|
||||
frm.refresh();
|
||||
frappe.msgprint(__("Service Level Agreement was reset."));
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
reset_sla.show();
|
||||
},
|
||||
|
||||
|
||||
timeline_refresh: function(frm) {
|
||||
timeline_refresh: function (frm) {
|
||||
if (!frm.timeline.wrapper.find(".btn-split-issue").length) {
|
||||
let split_issue_btn = $(`
|
||||
<a class="action-btn btn-split-issue" title="${__("Split Issue")}">
|
||||
${frappe.utils.icon('branch', 'sm')}
|
||||
${frappe.utils.icon("branch", "sm")}
|
||||
</a>
|
||||
`);
|
||||
|
||||
let communication_box = frm.timeline.wrapper.find('.timeline-item[data-doctype="Communication"]');
|
||||
communication_box.find('.actions').prepend(split_issue_btn);
|
||||
communication_box.find(".actions").prepend(split_issue_btn);
|
||||
|
||||
if (!frm.timeline.wrapper.data("split-issue-event-attached")) {
|
||||
frm.timeline.wrapper.on('click', '.btn-split-issue', (e) => {
|
||||
frm.timeline.wrapper.on("click", ".btn-split-issue", (e) => {
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
title: __("Split Issue"),
|
||||
fields: [
|
||||
@@ -94,20 +104,30 @@ frappe.ui.form.on("Issue", {
|
||||
fieldtype: "Data",
|
||||
reqd: 1,
|
||||
label: __("Subject"),
|
||||
description: __("All communications including and above this shall be moved into the new Issue")
|
||||
}
|
||||
description: __(
|
||||
"All communications including and above this shall be moved into the new Issue"
|
||||
),
|
||||
},
|
||||
],
|
||||
primary_action_label: __("Split"),
|
||||
primary_action: () => {
|
||||
frm.call("split_issue", {
|
||||
subject: dialog.fields_dict.subject.value,
|
||||
communication_id: e.currentTarget.closest(".timeline-item").getAttribute("data-name")
|
||||
}, (r) => {
|
||||
frappe.msgprint(`New issue created: <a href="/app/issue/${r.message}">${r.message}</a>`);
|
||||
frm.reload_doc();
|
||||
dialog.hide();
|
||||
});
|
||||
}
|
||||
frm.call(
|
||||
"split_issue",
|
||||
{
|
||||
subject: dialog.fields_dict.subject.value,
|
||||
communication_id: e.currentTarget
|
||||
.closest(".timeline-item")
|
||||
.getAttribute("data-name"),
|
||||
},
|
||||
(r) => {
|
||||
frappe.msgprint(
|
||||
`New issue created: <a href="/app/issue/${r.message}">${r.message}</a>`
|
||||
);
|
||||
frm.reload_doc();
|
||||
dialog.hide();
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
dialog.show();
|
||||
});
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
frappe.listview_settings['Issue'] = {
|
||||
colwidths: {"subject": 6},
|
||||
add_fields: ['priority'],
|
||||
frappe.listview_settings["Issue"] = {
|
||||
colwidths: { subject: 6 },
|
||||
add_fields: ["priority"],
|
||||
filters: [["status", "=", "Open"]],
|
||||
onload: function(listview) {
|
||||
onload: function (listview) {
|
||||
var method = "erpnext.support.doctype.issue.issue.set_multiple_status";
|
||||
|
||||
listview.page.add_action_item(__("Set as Open"), function() {
|
||||
listview.call_for_selected_items(method, {"status": "Open"});
|
||||
listview.page.add_action_item(__("Set as Open"), function () {
|
||||
listview.call_for_selected_items(method, { status: "Open" });
|
||||
});
|
||||
|
||||
listview.page.add_action_item(__("Set as Closed"), function() {
|
||||
listview.call_for_selected_items(method, {"status": "Closed"});
|
||||
listview.page.add_action_item(__("Set as Closed"), function () {
|
||||
listview.call_for_selected_items(method, { status: "Closed" });
|
||||
});
|
||||
},
|
||||
get_indicator: function(doc) {
|
||||
if (doc.status === 'Open') {
|
||||
get_indicator: function (doc) {
|
||||
if (doc.status === "Open") {
|
||||
const color = {
|
||||
'Low': 'yellow',
|
||||
'Medium': 'orange',
|
||||
'High': 'red'
|
||||
Low: "yellow",
|
||||
Medium: "orange",
|
||||
High: "red",
|
||||
};
|
||||
return [__(doc.status), color[doc.priority] || 'red', `status,=,Open`];
|
||||
} else if (doc.status === 'Closed') {
|
||||
return [__(doc.status), color[doc.priority] || "red", `status,=,Open`];
|
||||
} else if (doc.status === "Closed") {
|
||||
return [__(doc.status), "green", "status,=," + doc.status];
|
||||
} else {
|
||||
return [__(doc.status), "gray", "status,=," + doc.status];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Issue Priority', {
|
||||
frappe.ui.form.on("Issue Priority", {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Issue Type', {
|
||||
refresh: function(frm) {
|
||||
|
||||
}
|
||||
frappe.ui.form.on("Issue Type", {
|
||||
refresh: function (frm) {},
|
||||
});
|
||||
|
||||
@@ -1,121 +1,145 @@
|
||||
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Service Level Agreement', {
|
||||
setup: function(frm) {
|
||||
frappe.ui.form.on("Service Level Agreement", {
|
||||
setup: function (frm) {
|
||||
if (cint(frm.doc.apply_sla_for_resolution) === 1) {
|
||||
frm.get_field('priorities').grid.editable_fields = [
|
||||
{fieldname: 'default_priority', columns: 1},
|
||||
{fieldname: 'priority', columns: 2},
|
||||
{fieldname: 'response_time', columns: 2},
|
||||
{fieldname: 'resolution_time', columns: 2}
|
||||
frm.get_field("priorities").grid.editable_fields = [
|
||||
{ fieldname: "default_priority", columns: 1 },
|
||||
{ fieldname: "priority", columns: 2 },
|
||||
{ fieldname: "response_time", columns: 2 },
|
||||
{ fieldname: "resolution_time", columns: 2 },
|
||||
];
|
||||
} else {
|
||||
frm.get_field('priorities').grid.editable_fields = [
|
||||
{fieldname: 'default_priority', columns: 1},
|
||||
{fieldname: 'priority', columns: 2},
|
||||
{fieldname: 'response_time', columns: 3},
|
||||
frm.get_field("priorities").grid.editable_fields = [
|
||||
{ fieldname: "default_priority", columns: 1 },
|
||||
{ fieldname: "priority", columns: 2 },
|
||||
{ fieldname: "response_time", columns: 3 },
|
||||
];
|
||||
}
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.trigger('fetch_status_fields');
|
||||
frm.trigger('toggle_resolution_fields');
|
||||
frm.trigger('default_service_level_agreement');
|
||||
frm.trigger('entity');
|
||||
refresh: function (frm) {
|
||||
frm.trigger("fetch_status_fields");
|
||||
frm.trigger("toggle_resolution_fields");
|
||||
frm.trigger("default_service_level_agreement");
|
||||
frm.trigger("entity");
|
||||
},
|
||||
|
||||
default_service_level_agreement: function(frm) {
|
||||
const field = frm.get_field('default_service_level_agreement');
|
||||
default_service_level_agreement: function (frm) {
|
||||
const field = frm.get_field("default_service_level_agreement");
|
||||
if (frm.doc.default_service_level_agreement) {
|
||||
field.set_description(__('SLA will be applied on every {0}', [frm.doc.document_type]));
|
||||
field.set_description(__("SLA will be applied on every {0}", [frm.doc.document_type]));
|
||||
} else {
|
||||
field.set_description(__('Enable to apply SLA on every {0}', [frm.doc.document_type]));
|
||||
field.set_description(__("Enable to apply SLA on every {0}", [frm.doc.document_type]));
|
||||
}
|
||||
},
|
||||
|
||||
document_type: function(frm) {
|
||||
frm.trigger('fetch_status_fields');
|
||||
frm.trigger('default_service_level_agreement');
|
||||
document_type: function (frm) {
|
||||
frm.trigger("fetch_status_fields");
|
||||
frm.trigger("default_service_level_agreement");
|
||||
},
|
||||
|
||||
entity_type: function(frm) {
|
||||
frm.set_value('entity', undefined);
|
||||
entity_type: function (frm) {
|
||||
frm.set_value("entity", undefined);
|
||||
},
|
||||
|
||||
entity: function(frm) {
|
||||
const field = frm.get_field('entity');
|
||||
entity: function (frm) {
|
||||
const field = frm.get_field("entity");
|
||||
if (frm.doc.entity) {
|
||||
const and_descendants = frm.doc.entity_type != 'Customer' ? ' ' + __('or its descendants') : '';
|
||||
const and_descendants = frm.doc.entity_type != "Customer" ? " " + __("or its descendants") : "";
|
||||
field.set_description(
|
||||
__('SLA will be applied if {1} is set as {2}{3}', [
|
||||
frm.doc.document_type, frm.doc.entity_type,
|
||||
frm.doc.entity, and_descendants
|
||||
__("SLA will be applied if {1} is set as {2}{3}", [
|
||||
frm.doc.document_type,
|
||||
frm.doc.entity_type,
|
||||
frm.doc.entity,
|
||||
and_descendants,
|
||||
])
|
||||
);
|
||||
} else {
|
||||
field.set_description('');
|
||||
field.set_description("");
|
||||
}
|
||||
},
|
||||
|
||||
fetch_status_fields: function(frm) {
|
||||
fetch_status_fields: function (frm) {
|
||||
let allow_statuses = [];
|
||||
let exclude_statuses = [];
|
||||
|
||||
if (frm.doc.document_type) {
|
||||
frappe.model.with_doctype(frm.doc.document_type, () => {
|
||||
let statuses = frappe.meta.get_docfield(frm.doc.document_type, 'status', frm.doc.name).options;
|
||||
statuses = statuses.split('\n');
|
||||
let statuses = frappe.meta.get_docfield(
|
||||
frm.doc.document_type,
|
||||
"status",
|
||||
frm.doc.name
|
||||
).options;
|
||||
statuses = statuses.split("\n");
|
||||
|
||||
exclude_statuses = ['Open', 'Closed'];
|
||||
exclude_statuses = ["Open", "Closed"];
|
||||
allow_statuses = statuses.filter((status) => !exclude_statuses.includes(status));
|
||||
|
||||
frm.fields_dict.pause_sla_on.grid.update_docfield_property(
|
||||
'status', 'options', [''].concat(allow_statuses)
|
||||
"status",
|
||||
"options",
|
||||
[""].concat(allow_statuses)
|
||||
);
|
||||
|
||||
exclude_statuses = ['Open'];
|
||||
exclude_statuses = ["Open"];
|
||||
allow_statuses = statuses.filter((status) => !exclude_statuses.includes(status));
|
||||
frm.fields_dict.sla_fulfilled_on.grid.update_docfield_property(
|
||||
'status', 'options', [''].concat(allow_statuses)
|
||||
"status",
|
||||
"options",
|
||||
[""].concat(allow_statuses)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
frm.refresh_field('pause_sla_on');
|
||||
frm.refresh_field("pause_sla_on");
|
||||
},
|
||||
|
||||
apply_sla_for_resolution: function(frm) {
|
||||
frm.trigger('toggle_resolution_fields');
|
||||
apply_sla_for_resolution: function (frm) {
|
||||
frm.trigger("toggle_resolution_fields");
|
||||
},
|
||||
|
||||
toggle_resolution_fields: function(frm) {
|
||||
toggle_resolution_fields: function (frm) {
|
||||
if (cint(frm.doc.apply_sla_for_resolution) === 1) {
|
||||
frm.fields_dict.priorities.grid.update_docfield_property('resolution_time', 'hidden', 0);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property('resolution_time', 'reqd', 1);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property("resolution_time", "hidden", 0);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property("resolution_time", "reqd", 1);
|
||||
} else {
|
||||
frm.fields_dict.priorities.grid.update_docfield_property('resolution_time', 'hidden', 1);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property('resolution_time', 'reqd', 0);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property("resolution_time", "hidden", 1);
|
||||
frm.fields_dict.priorities.grid.update_docfield_property("resolution_time", "reqd", 0);
|
||||
}
|
||||
|
||||
frm.refresh_field('priorities');
|
||||
frm.refresh_field("priorities");
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
frm.set_query("document_type", function() {
|
||||
onload: function (frm) {
|
||||
frm.set_query("document_type", function () {
|
||||
let invalid_doctypes = frappe.model.core_doctypes_list;
|
||||
invalid_doctypes.push(frm.doc.doctype, 'Cost Center', 'Company');
|
||||
invalid_doctypes.push(frm.doc.doctype, "Cost Center", "Company");
|
||||
|
||||
return {
|
||||
filters: [
|
||||
['DocType', 'issingle', '=', 0],
|
||||
['DocType', 'istable', '=', 0],
|
||||
['DocType', 'is_submittable', '=', 0],
|
||||
['DocType', 'name', 'not in', invalid_doctypes],
|
||||
['DocType', 'module', 'not in', ["Email", "Core", "Custom", "Event Streaming", "Social", "Data Migration", "Geo", "Desk"]]
|
||||
]
|
||||
["DocType", "issingle", "=", 0],
|
||||
["DocType", "istable", "=", 0],
|
||||
["DocType", "is_submittable", "=", 0],
|
||||
["DocType", "name", "not in", invalid_doctypes],
|
||||
[
|
||||
"DocType",
|
||||
"module",
|
||||
"not in",
|
||||
[
|
||||
"Email",
|
||||
"Core",
|
||||
"Custom",
|
||||
"Event Streaming",
|
||||
"Social",
|
||||
"Data Migration",
|
||||
"Geo",
|
||||
"Desk",
|
||||
],
|
||||
],
|
||||
],
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Support Settings', {
|
||||
refresh: function(frm) {
|
||||
frappe.ui.form.on("Support Settings", {
|
||||
refresh: function (frm) {
|
||||
//
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -43,10 +43,7 @@ frappe.ui.form.on("Warranty Claim", {
|
||||
doctype: "Customer",
|
||||
};
|
||||
|
||||
if (
|
||||
!frm.doc.__islocal &&
|
||||
["Open", "Work In Progress"].includes(frm.doc.status)
|
||||
) {
|
||||
if (!frm.doc.__islocal && ["Open", "Work In Progress"].includes(frm.doc.status)) {
|
||||
frm.add_custom_button(__("Maintenance Visit"), () => {
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.support.doctype.warranty_claim.warranty_claim.make_maintenance_visit",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
frappe.listview_settings['Warranty Claim'] = {
|
||||
frappe.listview_settings["Warranty Claim"] = {
|
||||
add_fields: ["status", "customer", "item_code"],
|
||||
filters:[["status","=", "Open"]]
|
||||
filters: [["status", "=", "Open"]],
|
||||
};
|
||||
|
||||
@@ -1,43 +1,44 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
|
||||
frappe.query_reports["First Response Time for Issues"] = {
|
||||
"filters": [
|
||||
filters: [
|
||||
{
|
||||
"fieldname": "from_date",
|
||||
"label": __("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"reqd": 1,
|
||||
"default": frappe.datetime.add_days(frappe.datetime.nowdate(), -30)
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.add_days(frappe.datetime.nowdate(), -30),
|
||||
},
|
||||
{
|
||||
"fieldname": "to_date",
|
||||
"label": __("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"reqd": 1,
|
||||
"default":frappe.datetime.nowdate()
|
||||
}
|
||||
fieldname: "to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
reqd: 1,
|
||||
default: frappe.datetime.nowdate(),
|
||||
},
|
||||
],
|
||||
get_chart_data: function(_columns, result) {
|
||||
get_chart_data: function (_columns, result) {
|
||||
return {
|
||||
data: {
|
||||
labels: result.map(d => d.creation_date),
|
||||
datasets: [{
|
||||
name: 'First Response Time',
|
||||
values: result.map(d => d.first_response_time)
|
||||
}]
|
||||
labels: result.map((d) => d.creation_date),
|
||||
datasets: [
|
||||
{
|
||||
name: "First Response Time",
|
||||
values: result.map((d) => d.first_response_time),
|
||||
},
|
||||
],
|
||||
},
|
||||
type: "line",
|
||||
tooltipOptions: {
|
||||
formatTooltipY: d => {
|
||||
formatTooltipY: (d) => {
|
||||
let duration_options = {
|
||||
hide_days: 0,
|
||||
hide_seconds: 0
|
||||
hide_seconds: 0,
|
||||
};
|
||||
return frappe.utils.get_formatted_duration(d, duration_options);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
|
||||
frappe.query_reports["Issue Analytics"] = {
|
||||
"filters": [
|
||||
filters: [
|
||||
{
|
||||
fieldname: "company",
|
||||
label: __("Company"),
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: frappe.defaults.get_user_default("Company"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "based_on",
|
||||
@@ -18,125 +17,124 @@ frappe.query_reports["Issue Analytics"] = {
|
||||
fieldtype: "Select",
|
||||
options: ["Customer", "Issue Type", "Issue Priority", "Assigned To"],
|
||||
default: "Customer",
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_global_default("year_start_date"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
fieldname: "to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_global_default("year_end_date"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "range",
|
||||
label: __("Range"),
|
||||
fieldtype: "Select",
|
||||
options: [
|
||||
{ "value": "Weekly", "label": __("Weekly") },
|
||||
{ "value": "Monthly", "label": __("Monthly") },
|
||||
{ "value": "Quarterly", "label": __("Quarterly") },
|
||||
{ "value": "Yearly", "label": __("Yearly") }
|
||||
{ value: "Weekly", label: __("Weekly") },
|
||||
{ value: "Monthly", label: __("Monthly") },
|
||||
{ value: "Quarterly", label: __("Quarterly") },
|
||||
{ value: "Yearly", label: __("Yearly") },
|
||||
],
|
||||
default: "Monthly",
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "status",
|
||||
label: __("Status"),
|
||||
fieldtype: "Select",
|
||||
options:[
|
||||
options: [
|
||||
"",
|
||||
{label: __('Open'), value: 'Open'},
|
||||
{label: __('Replied'), value: 'Replied'},
|
||||
{label: __('Resolved'), value: 'Resolved'},
|
||||
{label: __('Closed'), value: 'Closed'}
|
||||
]
|
||||
{ label: __("Open"), value: "Open" },
|
||||
{ label: __("Replied"), value: "Replied" },
|
||||
{ label: __("Resolved"), value: "Resolved" },
|
||||
{ label: __("Closed"), value: "Closed" },
|
||||
],
|
||||
},
|
||||
{
|
||||
fieldname: "priority",
|
||||
label: __("Issue Priority"),
|
||||
fieldtype: "Link",
|
||||
options: "Issue Priority"
|
||||
options: "Issue Priority",
|
||||
},
|
||||
{
|
||||
fieldname: "customer",
|
||||
label: __("Customer"),
|
||||
fieldtype: "Link",
|
||||
options: "Customer"
|
||||
options: "Customer",
|
||||
},
|
||||
{
|
||||
fieldname: "project",
|
||||
label: __("Project"),
|
||||
fieldtype: "Link",
|
||||
options: "Project"
|
||||
options: "Project",
|
||||
},
|
||||
{
|
||||
fieldname: "assigned_to",
|
||||
label: __("Assigned To"),
|
||||
fieldtype: "Link",
|
||||
options: "User"
|
||||
}
|
||||
options: "User",
|
||||
},
|
||||
],
|
||||
after_datatable_render: function(datatable_obj) {
|
||||
$(datatable_obj.wrapper).find(".dt-row-0").find('input[type=checkbox]').click();
|
||||
after_datatable_render: function (datatable_obj) {
|
||||
$(datatable_obj.wrapper).find(".dt-row-0").find("input[type=checkbox]").click();
|
||||
},
|
||||
get_datatable_options(options) {
|
||||
return Object.assign(options, {
|
||||
checkboxColumn: true,
|
||||
events: {
|
||||
onCheckRow: function(data) {
|
||||
onCheckRow: function (data) {
|
||||
if (data && data.length) {
|
||||
let row_name = data[2].content;
|
||||
let row_values = data.slice(3).map(function(column) {
|
||||
let row_values = data.slice(3).map(function (column) {
|
||||
return column.content;
|
||||
})
|
||||
let entry = {
|
||||
'name': row_name,
|
||||
'values': row_values
|
||||
}
|
||||
});
|
||||
let entry = {
|
||||
name: row_name,
|
||||
values: row_values,
|
||||
};
|
||||
|
||||
let raw_data = frappe.query_report.chart.data;
|
||||
let new_datasets = raw_data.datasets;
|
||||
|
||||
var found = false;
|
||||
|
||||
for(var i=0; i < new_datasets.length; i++){
|
||||
if (new_datasets[i].name == row_name){
|
||||
for (var i = 0; i < new_datasets.length; i++) {
|
||||
if (new_datasets[i].name == row_name) {
|
||||
found = true;
|
||||
new_datasets.splice(i,1);
|
||||
new_datasets.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found){
|
||||
if (!found) {
|
||||
new_datasets.push(entry);
|
||||
}
|
||||
|
||||
let new_data = {
|
||||
labels: raw_data.labels,
|
||||
datasets: new_datasets
|
||||
}
|
||||
datasets: new_datasets,
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
frappe.query_report.chart.update(new_data)
|
||||
},500)
|
||||
|
||||
frappe.query_report.chart.update(new_data);
|
||||
}, 500);
|
||||
|
||||
setTimeout(() => {
|
||||
frappe.query_report.chart.draw(true);
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
|
||||
frappe.query_report.raw_chart_data = new_data;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
|
||||
frappe.query_reports["Issue Summary"] = {
|
||||
"filters": [
|
||||
filters: [
|
||||
{
|
||||
fieldname: "company",
|
||||
label: __("Company"),
|
||||
fieldtype: "Link",
|
||||
options: "Company",
|
||||
default: frappe.defaults.get_user_default("Company"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "based_on",
|
||||
@@ -18,58 +17,58 @@ frappe.query_reports["Issue Summary"] = {
|
||||
fieldtype: "Select",
|
||||
options: ["Customer", "Issue Type", "Issue Priority", "Assigned To"],
|
||||
default: "Customer",
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "from_date",
|
||||
label: __("From Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_global_default("year_start_date"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname:"to_date",
|
||||
fieldname: "to_date",
|
||||
label: __("To Date"),
|
||||
fieldtype: "Date",
|
||||
default: frappe.defaults.get_global_default("year_end_date"),
|
||||
reqd: 1
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
fieldname: "status",
|
||||
label: __("Status"),
|
||||
fieldtype: "Select",
|
||||
options:[
|
||||
options: [
|
||||
"",
|
||||
{label: __('Open'), value: 'Open'},
|
||||
{label: __('Replied'), value: 'Replied'},
|
||||
{label: __('On Hold'), value: 'On Hold'},
|
||||
{label: __('Resolved'), value: 'Resolved'},
|
||||
{label: __('Closed'), value: 'Closed'}
|
||||
]
|
||||
{ label: __("Open"), value: "Open" },
|
||||
{ label: __("Replied"), value: "Replied" },
|
||||
{ label: __("On Hold"), value: "On Hold" },
|
||||
{ label: __("Resolved"), value: "Resolved" },
|
||||
{ label: __("Closed"), value: "Closed" },
|
||||
],
|
||||
},
|
||||
{
|
||||
fieldname: "priority",
|
||||
label: __("Issue Priority"),
|
||||
fieldtype: "Link",
|
||||
options: "Issue Priority"
|
||||
options: "Issue Priority",
|
||||
},
|
||||
{
|
||||
fieldname: "customer",
|
||||
label: __("Customer"),
|
||||
fieldtype: "Link",
|
||||
options: "Customer"
|
||||
options: "Customer",
|
||||
},
|
||||
{
|
||||
fieldname: "project",
|
||||
label: __("Project"),
|
||||
fieldtype: "Link",
|
||||
options: "Project"
|
||||
options: "Project",
|
||||
},
|
||||
{
|
||||
fieldname: "assigned_to",
|
||||
label: __("Assigned To"),
|
||||
fieldtype: "Link",
|
||||
options: "User"
|
||||
}
|
||||
]
|
||||
options: "User",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
|
||||
frappe.query_reports["Support Hour Distribution"] = {
|
||||
"filters": [
|
||||
filters: [
|
||||
{
|
||||
'lable': __("From Date"),
|
||||
'fieldname': 'from_date',
|
||||
'fieldtype': 'Date',
|
||||
'default': frappe.datetime.nowdate(),
|
||||
'reqd': 1
|
||||
lable: __("From Date"),
|
||||
fieldname: "from_date",
|
||||
fieldtype: "Date",
|
||||
default: frappe.datetime.nowdate(),
|
||||
reqd: 1,
|
||||
},
|
||||
{
|
||||
'lable': __("To Date"),
|
||||
'fieldname': 'to_date',
|
||||
'fieldtype': 'Date',
|
||||
'default': frappe.datetime.nowdate(),
|
||||
'reqd': 1
|
||||
}
|
||||
]
|
||||
}
|
||||
lable: __("To Date"),
|
||||
fieldname: "to_date",
|
||||
fieldtype: "Date",
|
||||
default: frappe.datetime.nowdate(),
|
||||
reqd: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
frappe.ready(function() {
|
||||
frappe.ready(function () {
|
||||
// bind events here
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user