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

jingrow.ui.form.on("Deleted Page", {
	refresh: function (frm) {
		if (frm.pg.restored) {
			frm.add_custom_button(__("Open"), function () {
				jingrow.set_route("Form", frm.pg.deleted_pagetype, frm.pg.new_name);
			});
		} else {
			frm.add_custom_button(__("Restore"), function () {
				jingrow.call({
					method: "jingrow.core.pagetype.deleted_document.deleted_document.restore",
					args: { name: frm.pg.name },
					callback: function (r) {
						frm.reload_pg();
					},
				});
			});
		}
	},
});
