mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
Co-authored-by: Diptanil Saha <diptanil@frappe.io>
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
{% extends "templates/web.html" %}
|
{% extends "templates/web.html" %}
|
||||||
{% block title %} {{ doc.name }} {% endblock %}
|
{% block title %} {{ doc.name|e }} {% endblock %}
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
<div class="page-breadcrumbs" data-html-block="breadcrumbs">
|
<div class="page-breadcrumbs container" data-html-block="breadcrumbs">
|
||||||
<ul class="breadcrumb">
|
<ul class="breadcrumb">
|
||||||
<li>
|
<li>
|
||||||
<span class="fa fa-angle-left"></span>
|
<span class="fa fa-angle-left"></span>
|
||||||
<a href="/projects?project={{ doc.project }}">{{ doc.project }}</a>
|
<a href="/projects?project={{ doc.project|e }}">{{ doc.project|e }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,16 +13,7 @@
|
|||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class=" col-sm-8 ">
|
<div class=" col-sm-8 ">
|
||||||
<h1> {{ doc.subject }} </h1>
|
<h1> {{ doc.subject|e }} </h1>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm-4">
|
|
||||||
<div class="page-header-actions-block" data-html-block="header-actions">
|
|
||||||
<button type="submit" class="btn btn-primary btn-sm btn-form-submit">
|
|
||||||
{{ __("Update") }}</button>
|
|
||||||
<a href="tasks" class="btn btn-light btn-sm">
|
|
||||||
{{ __("Cancel") }}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -31,50 +22,44 @@
|
|||||||
|
|
||||||
<input type="hidden" name="web_form" value="tasks">
|
<input type="hidden" name="web_form" value="tasks">
|
||||||
<input type="hidden" name="doctype" value="Task">
|
<input type="hidden" name="doctype" value="Task">
|
||||||
<input type="hidden" name="name" value="TASK00056">
|
<input type="hidden" name="name" value="{{ doc.name|e }}">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12" style="max-width: 500px;">
|
<div class="col-sm-12" style="max-width: 500px;">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="project" class="control-label text-muted small">{{ __("Project") }}</label>
|
<label for="project" class="control-label text-muted small">{{ _("Project") }}</label>
|
||||||
<input type="text" class="form-control" name="project" readonly value= "{{ doc.project }}">
|
<input type="text" class="form-control" name="project" readonly value= "{{ doc.project or ""|e }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="subject" class="control-label text-muted small">{{ __("Subject") }}</label>
|
<label for="subject" class="control-label text-muted small">{{ _("Subject") }}</label>
|
||||||
<input type="text" class="form-control" name="subject" readonly value="{{ doc.subject }}">
|
<input type="text" class="form-control" name="subject" readonly value="{{ doc.subject or ""|e }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description" class="control-label text-muted small">{{ __("Details") }}</label>
|
<label for="description" class="control-label text-muted small">{{ _("Details") }}</label>
|
||||||
<textarea class="form-control" style="height: 200px;" name="description">{{ doc.description }}</textarea>
|
<textarea class="form-control" style="height: 200px;" name="description" readonly>{{ doc.description or ""|e }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="priority" class="control-label text-muted small">{{ __("Priority") }}</label>
|
<label for="priority" class="control-label text-muted small">{{ _("Priority") }}</label>
|
||||||
<input type="text" class="form-control" name="priority" readonly value="{{ doc.priority }}">
|
<input type="text" class="form-control" name="priority" readonly value="{{ doc.priority or ""|e }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exp_start_date" class="control-label text-muted small">{{ __("Expected Start Date") }}</label>
|
<label for="exp_start_date" class="control-label text-muted small">{{ _("Expected Start Date") }}</label>
|
||||||
<input type="text" class="form-control hasDatepicker" name="exp_start_date" readonly value="{{ doc.exp_start_date }}">
|
<input type="text" class="form-control hasDatepicker" name="exp_start_date" readonly value="{{ doc.exp_start_date or ""|e }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exp_end_date" class="control-label text-muted small">{{ __("Expected End Date") }}</label>
|
<label for="exp_end_date" class="control-label text-muted small">{{ _("Expected End Date") }}</label>
|
||||||
<input type="text" class="form-control hasDatepicker" name="exp_end_date" readonly value="{{ doc.exp_end_date }}">
|
<input type="text" class="form-control hasDatepicker" name="exp_end_date" readonly value="{{ doc.exp_end_date or ""|e }}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="status" class="control-label text-muted small">{{ __("Status") }}</label>
|
<label for="status" class="control-label text-muted small">{{ _("Status") }}</label>
|
||||||
<select class="form-control" name="status" id="status" data-label="Status" data-fieldtype="Select">
|
<select class="form-control" name="status" id="status" data-label="Status" data-fieldtype="Select" disabled>
|
||||||
<option value="Open" selected="selected">
|
<option value="{{ doc.status|e }}" selected="selected">{{ doc.status|e }}</option>
|
||||||
{{ __("Open") }}</option><option value="Working">
|
|
||||||
{{ __("Working") }}</option><option value="Pending Review">
|
|
||||||
{{ __("Pending Review") }}</option><option value="Overdue">
|
|
||||||
{{ __("Overdue") }}</option><option value="Closed">
|
|
||||||
{{ __("Closed") }}</option><option value="Cancelled">
|
|
||||||
{{ __("Cancelled") }}</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,68 +68,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="comments">
|
<div class="comments">
|
||||||
<h3>{{ __("Comments") }}</h3>
|
<h3>{{ _("Comments") }}</h3>
|
||||||
<div class="no-comment">
|
<div class="no-comment">
|
||||||
{% for comment in comments %}
|
{% for comment in comments %}
|
||||||
<p class="text-muted">{{comment.sender_full_name}}:
|
<p class="text-muted">{{comment.comment_email}}:
|
||||||
{{comment.subject}} {{ __("on") }} {{comment.creation.strftime('%Y-%m-%d')}}</p>
|
{{comment.content|e}} {{ _("on") }} {{comment.creation.strftime('%Y-%m-%d')}}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-form-wrapper">
|
|
||||||
<a class="add-comment btn btn-light btn-sm">{{ __("Add Comment") }}</a>
|
|
||||||
<div style="display: none;" id="comment-form">
|
|
||||||
<p>{{ __("Add Comment") }}</p>
|
|
||||||
<form>
|
|
||||||
<fieldset>
|
|
||||||
<textarea class="form-control" name="comment" rows="5" placeholder="Comment"></textarea>
|
|
||||||
<p>
|
|
||||||
<button class="btn btn-primary btn-sm" id="submit-comment">{{ __("Submit") }}</button>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
frappe.ready(function() {
|
|
||||||
var n_comments = $(".comment-row").length;
|
|
||||||
$(".add-comment").click(function() {
|
|
||||||
$(this).toggle(false);
|
|
||||||
$("#comment-form").toggle();
|
|
||||||
$("#comment-form textarea").val("");
|
|
||||||
})
|
|
||||||
$("#submit-comment").click(function() {
|
|
||||||
var args = {
|
|
||||||
comment_by_fullname: "test",
|
|
||||||
comment_by: "admin@localhost.com",
|
|
||||||
comment: $("[name='comment']").val(),
|
|
||||||
reference_doctype: "Task",
|
|
||||||
reference_name: "TASK00069",
|
|
||||||
comment_type: "Comment",
|
|
||||||
route: "tasks",
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.call({
|
|
||||||
btn: this,
|
|
||||||
type: "POST",
|
|
||||||
method: "frappe.templates.includes.comments.comments.add_comment",
|
|
||||||
args: args,
|
|
||||||
callback: function(r) {
|
|
||||||
if(r.exc) {
|
|
||||||
if(r._server_messages)
|
|
||||||
frappe.msgprint(r._server_messages);
|
|
||||||
} else {
|
|
||||||
$(r.message).appendTo("#comment-list");
|
|
||||||
$(".no-comment, .add-comment").toggle(false);
|
|
||||||
$("#comment-form")
|
|
||||||
.replaceWith('<div class="text-muted">Thank you for your comment!</div>')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ def get_context(context):
|
|||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
|
|
||||||
task = frappe.get_doc("Task", frappe.form_dict.task)
|
task = frappe.get_doc("Task", frappe.form_dict.task)
|
||||||
|
task.check_permission()
|
||||||
|
|
||||||
context.comments = frappe.get_all(
|
context.comments = frappe.get_all(
|
||||||
"Communication",
|
"Comment",
|
||||||
filters={"reference_name": task.name, "comment_type": "comment"},
|
filters={"reference_doctype": "Task", "reference_name": task.name, "comment_type": "Comment"},
|
||||||
fields=["subject", "sender_full_name", "communication_date"],
|
fields=["content", "comment_email", "creation"],
|
||||||
)
|
)
|
||||||
|
|
||||||
context.doc = task
|
context.doc = task
|
||||||
|
|||||||
Reference in New Issue
Block a user