// Copyright (c) 2016, JINGROW
// For license information, please see license.txt

jingrow.query_reports["Addresses And Contacts"] = {
	filters: [
		{
			reqd: 1,
			fieldname: "reference_pagetype",
			label: __("Entity Type"),
			fieldtype: "Link",
			options: "PageType",
			get_query: function () {
				return {
					filters: {
						name: ["in", "Contact, Address"],
					},
				};
			},
		},
		{
			fieldname: "reference_name",
			label: __("Entity Name"),
			fieldtype: "Dynamic Link",
			get_options: function () {
				let reference_pagetype = jingrow.query_report.get_filter_value("reference_pagetype");
				if (!reference_pagetype) {
					jingrow.throw(__("Please select Entity Type first"));
				}
				return reference_pagetype;
			},
		},
	],
};
