<commit_before>{% extends "site_base.html" %}

{% load staticfiles %}
{% load i18n %}
{% load bootstrap_tags %}

{% block head_title %}{% trans "Process" %}: {{ process }}{% endblock %}

{% block extra_head %}

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="{% static 'css/chosen.css' %}" />

<style>

.use {
    margin-left: 4em;
    font-style: italic;
}

.event {
    margin-left: 2em; 
    margin-bottom: 4px;
}

.commitment {
    margin-top: 4px;
}

.notes {
    margin-left: 1em;
    font-style: italic;
}

.error {
    color: red;
}

.reskedForm {
    display: inline;
}
#addCiteModal textarea, #addConsumableModal textarea, #addUsableModal textarea, #addWorkModal textarea, #addOutputModal textarea, .item-description, #resourceModal textarea {
  width: 500px;
  height: 100px;
}

.workEventModal textarea, .unplannedWorkModal textarea {
  width: 500px;
  height: 400px;
}

.btn {
    margin-left: 10px;
}
h3, h4 {
    color: firebrick;
}
li {
    list-style-type: none;
}
.proc-notes {
    font-style: italic;
    font-weight: normal;
    border: solid 1px gainsboro;
    background-color: honeydew;
    padding: 4px;
    margin: 4px 0 10px 0;
}
.log-section {
    border: solid 1px gainsboro;
    background-color: beige; 
    padding: 4px;
    margin-bottom: 7px;   
}
.modal {
    width: 600px;
}
.subsection-label {
    font-weight: bold;
}
.detail-line {
    margin: 0 0 0 2em;
}
.taken {
    font-style: italic;
    font-weight: bold;
    color: #5C8A8A;
}
.unplanned {
    color: 	#7D1818;
}
.event-label {
    color: green;
    font-weight: bold;
    font-style: normal;
}
.indent {
    margin-left: 3em;
}

.onhand {
    margin-left: 2em;
}

</style>

{% endblock %}

{% block body_class %}work{% endblock %}

{% block body_base %}
    <div class="container">
        {% include "_messages.html" %}
	<div>
	<legend>
		{% trans "Process" %}: <span class="process" >{{ process }} {% if process.started %} - {% trans "Started" %} {{ process.started }}{% endif %} </span>
		{% if agent %}
            <a class="btn btn-info" href="{% url change_process process_id=process.id %}">{% trans "Change" %}</a>
            {% if logger %}
                <a class="btn btn-primary" href="{% url process_finished process_id=process.id %}">
                    {% if process.finished %}
                        {% trans "Unfinish" %}
                    {% else %}
                        {% trans "Finish" %}
                    {% endif %}
                </a>
            {% endif %}
		{% endif %}
	</legend>

	<div class="row-fluid">

		<div class="span8">
          <div class="log-section">
		    <h3 style="margin-bottom: 4px;" >
		        {% trans "Outputs" %}:  
		        {% if logger %}
		            <a href="#addOutputModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add an output requirement">
		                {% trans "Add an output requirement" %}
	                </a>
	             {% endif %}

	        </h3>
		    {% for item in process.outgoing_commitments %}
			    <div>
				    <b>{% trans "Scheduled" %}: 
			        <span class="output-requirement" >
			            {{ item.resource_type.name }}</b> {{ item.quantity }} {{ item.unit_of_quantity }} {% trans "due" %} {{ item.due_date }} 
		            </span>
		            {% if logger %}

                        <a href="#commitmentModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Change output requirement">
			               <i class="icon-edit"></i>
		                </a>
	
		                <div class="modal hide fade commitmentModal" id="commitmentModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
			                <div class="modal-header">
				                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				                <h3 id="commitment-label">{% trans "Change Requirement" %}</h3>
			                </div>
			                <div class="modal-body">
				                <form class="commitmentForm{{ item.id }}" enctype="multipart/form-data" action="{% url change_commitment commitment_id=item.id %}" method="POST" >
					                {% csrf_token %}
					                {{ item.change_form|as_bootstrap }}
					                <input type="hidden" id="next" name="next" value="process" />
                                    <div class="modal-footer">
                                        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                        <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                    </div>
				                </form>
			                </div>
		                </div>

		                <form
		                    style="display: inline;" 
                            class="delete-commitment-form" 
                            id="deleteCommitmentForm{{ item.id }}" 
                            action="{% url delete_process_commitment commitment_id=item.id %}" 
                            method="POST" >
                            {% csrf_token %}
                        	<input type="hidden" id="next" name="next" value="process" />
                            <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete output requirement" >X</button>
                        </form>
		                
		                <a href="#resourceModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Create a Resource" >{% trans "Log Resource" %}</a>
        
                        <div class="modal hide fade resourceModal" id="resourceModal" tabindex="-1" role="dialog" aria-labelledby="resource-label" aria-hidden="true">
	                        <div class="modal-header">
		                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		                        <h3 id="resource-label">{% trans "Create" %} {{ item.resource_type.name }} {% trans "Resource" %}</h3>
	                        </div>
	                        <div class="modal-body">
		                        <form class="resource-form" id="resourceForm" enctype="multipart/form-data" action="{% url log_resource_for_commitment commitment_id=item.id %}" method="POST" >
			                        {% csrf_token %}
			                        {{ item.resource_create_form|as_bootstrap }}
		                          <div class="modal-footer">
			                        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
			                        <button class="btn btn-primary">{% trans "Save" %}</button>
		                          </div>


		                        </form>
                            </div>
                        </div>
			        {% endif %}
			    </div>
			    
			    {% if item.description %}
		           <div class="notes"> {{ item.description|urlize|linebreaks }}</div>
	            {% endif %}
			
			    {% for event in item.fulfilling_events %}
				    <div class="event" >
					    <span class="event-label">{% trans "Completed" %}:</span> <span class="event" >{{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }} </span>
					    {% if logger %}
					        {% comment %}
					        <a href="" class="btn btn-info btn-mini" title="Change" ><i class="icon-edit"></i></a>
					        {% endcomment %}
					        <form
					            style="display: inline;" 
                                class="delete-form" 
                                id="deleteForm{{ event.id }}" 
                                action="{% url delete_event event_id=event.id %}" 
                                method="POST" >
                                {% csrf_token %}
                            	<input type="hidden" id="next" name="next" value="process" />
                                <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete production event" >X</button>
                            </form>
					    {% endif %}
					    </br>
					    &nbsp;&nbsp;{% trans "Resource" %}: <a href="{% url resource resource_id=event.resource.id  %}">{{ event.resource }}</a>
					
				    </div>
			    {% endfor %}
		    {% endfor %}
          </div>

          <div class="log-section">
		    {% for event in process.uncommitted_production_events %}
			    <div class="event" >
				    <b>{% trans "Created" %}: <span class="event" >{{ event.resource_type.name }}</b> {{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }}</span>
				    {% if logger %}
				        {% comment %}
				        <a href="" class="btn btn-info btn-mini" title="Change" ><i class="icon-edit"></i></a>
				        {% endcomment %}
		                <form
				            style="display: inline;" 
                            class="delete-form" 
                            id="deleteForm{{ event.id }}" 
                            action="{% url delete_event event_id=event.id %}" 
                            method="POST" >
                            {% csrf_token %}
                        	<input type="hidden" id="next" name="next" value="process" />
                            <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete production event" >X</button>
                        </form>
		            {% endif %}
			    </div>
		    {% endfor %}

		    {% if work_reqs or process.uncommitted_work_events or "work" in slots %}
		        <h3 style="margin-bottom: 4px;" >
		            {% trans "Work" %}: 
		            {% if logger %}
			            <a href="#addWorkModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add a work requirement">
		                    {% trans "Add a work requirement" %}
	                    </a>
                    {% endif %}
		            {% if agent %}
		                <a href="#unplannedWorkModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log unplanned work" >
			                {% trans "Log unplanned work" %}
		                </a>
	                {% endif %}
	            </h3>
            
		        {% for item in work_reqs %}
			        <div class="commitment">
				        <span class="work-requirement" ><b>{{ item.resource_type.name }}:</b> {{ item.quantity }} {{ item.unit_of_quantity }} {% trans "due" %} {{ item.due_date }}</span>
                        {% if logger %}
				            <a href="#commitmentModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Change work requirement">
			                       <i class="icon-edit"></i>
	                        </a>

	                        <div class="modal hide fade commitmentModal" id="commitmentModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
		                        <div class="modal-header">
			                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			                        <h3 id="commitment-label">{% trans "Change Requirement" %}</h3>
		                        </div>
		                        <div class="modal-body">
			                        <form class="commitmentForm{{ item.id }}" enctype="multipart/form-data" action="{% url change_commitment commitment_id=item.id %}" method="POST" >
				                        {% csrf_token %}
				                        {{ item.changeform|as_bootstrap }}
				                        <input type="hidden" id="next" name="next" value="process" />
                                        <div class="modal-footer">
                                            <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                            <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                        </div>
			                        </form>
		                        </div>
	                        </div>
                        {% endif %}

                    {% if item.from_agent %}
				        <span class="taken">{% trans "Taken by" %}<span class="agent" > {{ item.from_agent.nick }}</span></span>
				        {% with item.fulfilling_events as work_events %}
				            {% if agent == item.from_agent %} 

				                {% if not work_events %}
				                    <form
	                                    style="display: inline;" 
                                        class="uncommit-form" 
                                        id="uncommitForm{{ item.id }}" 
                                        action="{% url uncommit commitment_id=item.id %}" 
                                        method="POST" >
                                        {% csrf_token %}
                                    	<input type="hidden" id="next" name="next" value="process" />
                                        <button style="display: inline;"  class="btn btn-warning btn-mini" title="Uncommit" >X</button>
                                    </form>
				                {% endif %}

				                <a href="#eventModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log your work" >
					                {% trans "Log work" %}
				                </a>
			
				                <div class="modal hide fade workEventModal" id="eventModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
					                <div class="modal-header">
						                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						                <h3 id="event-label">{% trans "Add Time Contribution" %}</h3>
					                </div>
					                <div class="modal-body">
						                <form class="eventForm{{ item.id }}" enctype="multipart/form-data" action="{% url add_work_event commitment_id=item.id %}" method="POST" >
							                {% csrf_token %}
							                {{ item.work_event_form|as_bootstrap }}
						                  <div class="modal-footer">
							                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
							                <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
						                  </div>
						                </form>
					                </div>
				                </div>
			                {% comment %}
			                {% elif super_logger %}
			                    <button class="btn btn-info btn-mini" title="Log work for {{ item.from_agent }}" >{% trans "Log work" %}</button>
		                    {% endcomment %}
			                {% endif %}
			                {% if work_events %}
			                    <div class="event">
			                        <div class="subsection-label event-label" >{% trans "Work events" %}:</div>
				                    {% for event in work_events %}
					                
					                    {{ event.event_date }} {{ event.quantity }} {{ event.unit_of_quantity.name  }}
					                    
					                    {% if agent == item.from_agent  %}
					                        
							                <a href="#eventModal{{ event.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
								               <i class="icon-edit"></i>
							                </a>
						
							                <div class="modal hide fade workEventModal" id="eventModal{{ event.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
								                <div class="modal-header">
									                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
									                <h3 id="event-label">{% trans "Change Time Contribution" %}</h3>
								                </div>
								                <div class="modal-body">
									                <form class="eventForm{{ event.id }}" enctype="multipart/form-data" action="{% url change_work_event event_id=event.id %}" method="POST" >
										                {% csrf_token %}
										                {{ event.work_event_change_form|as_bootstrap }}
										                <input type="hidden" id="next" name="next" value="process" />
                                                        <div class="modal-footer">
                                                            <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                                            <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                                        </div>
									                </form>
								                </div>
							                </div>

							                <form
				                                style="display: inline;" 
                                                class="delete-form" 
                                                id="deleteForm{{ event.id }}" 
                                                action="{% url delete_event event_id=event.id %}" 
                                                method="POST" >
                                                {% csrf_token %}
                                            	<input type="hidden" id="next" name="next" value="process" />
                                                <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work contribution!" >X</button>
                                            </form>
					                    {% endif %}
					                    {% if event.description %}
			                               <div class="notes"> {{ event.description|urlize|linebreaks }}</div>
		                                {% endif %}
				                    {% endfor %}
				                </div>
				            {% endif %}
		                {% endwith %}
			            
				        </div>
			        {% else %}
					        <span class="taken">{% trans "Unassigned" %} </span>
					        {% if logger %}
				                <form
				                    style="display: inline;" 
                                    class="delete-commitment-form" 
                                    id="deleteCommitmentForm{{ item.id }}" 
                                    action="{% url delete_process_commitment commitment_id=item.id %}" 
                                    method="POST" >
                                    {% csrf_token %}
                                	<input type="hidden" id="next" name="next" value="process" />
                                    <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work requirement" >X</button>
                                </form>
                            {% endif %}

                            {% if agent %}                           
						        <a href="#commitmentForm{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
							        {% trans "Take this task" %}
						        </a>

						        <div class="modal hide fade commitmentForm" id="commitmentForm{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
							        <div class="modal-header">
								        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						        <h3 id="commitment-label">{% trans "Take this task" %}: {{ item.resource_type.name }}</h3>
							        </div>
							        <div class="modal-body">

								        <form class="commitmentForm" enctype="multipart/form-data" action="{% url commit_to_task commitment_id=item.id %}" method="POST" >
									        {% csrf_token %}
									        {{ item.commitment_form|as_bootstrap }}
									        <input type="hidden" name="next" value="{{ process.get_absolute_url }}" />
								          <div class="modal-footer">
									        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
									        <input type="submit" class="btn btn-primary" name="commit" value='{% trans "Commit to this task" %}' />
									        {% comment %}
									        <input type="submit" class="btn btn-primary" name="start" value='{% trans "Start now" %}' />
									        {% endcomment %}
								          </div>
								        </form>
							        </div>
						        </div>
					        {% endif %}
				        </div>
			        {% endif %}
			        {% if item.description and not item.fulfilling_events %}
		               <div class="notes"> {{ item.description|urlize|linebreaks }}</div>
	                {% endif %}
	                {% if not item.from_agent %}
			            {% for source in item.resource_type.producing_agent_relationships %}
				            <p class="detail-line">
					            <b>{% trans "Possible source" %}:</b><span class="agent" > {{ source.agent.name }}</span>
				            </p>
			            {% endfor %}
			        {% endif %}
		        {% endfor %}
		        
                {% if unplanned_work %}
                    <h4 class="unplanned">{% trans "Unplanned Work Events" %}:</h4>
		            {% for event in unplanned_work %}
			            <div >
				            <span class="event" ><span class="event-label">{% trans "Work event" %}: </span><b> {{ event.resource_type.name }}</b> {{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }} <span class="taken">{% trans "Done by" %} {{ event.from_agent.nick }}</span></span>
                            
			                {% if agent == event.from_agent  %}
		                        
				                <a href="#eventModal{{ event.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
					               <i class="icon-edit"></i>
				                </a>
			
				                <div class="modal hide fade workEventModal" id="eventModal{{ event.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
					                <div class="modal-header">
						                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						                <h3 id="event-label">{% trans "Change Time Contribution" %}</h3>
					                </div>
					                <div class="modal-body">
						                <form class="eventForm{{ event.id }}" enctype="multipart/form-data" action="{% url change_unplanned_work_event event_id=event.id %}" method="POST" >
							                {% csrf_token %}
							                {{ event.changeform|as_bootstrap }}
							                <input type="hidden" id="next" name="next" value="process" />
                                            <div class="modal-footer">
                                                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                                <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                            </div>
						                </form>
					                </div>
				                </div>

				                <form
	                                style="display: inline;" 
                                    class="delete-form" 
                                    id="deleteForm{{ event.id }}" 
                                    action="{% url delete_event event_id=event.id %}" 
                                    method="POST" >
                                    {% csrf_token %}
                                	<input type="hidden" id="next" name="next" value="process" />
                                    <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work contribution!" >X</button>
                                </form>
		                    {% endif %}

			                {% if event.description %}
		                       <div class="notes indent"> {{ event.description|urlize|linebreaks }}</div>
	                        {% endif %}
				            
			            </div>
		            {% endfor %}
		        {% endif %}

		    {% endif %}
          </div>

		  {% if process.citation_requirements or process.uncommitted_citation_events or "cite" in slots %}
            <div class="log-section">
			    <h3>
			        {% trans "Citations" %}: 
			        {% if logger %}
			            <a href="#addCiteModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add a citation requirement">
		                    {% trans "Add a citation requirement" %}
	                    </a>
                    {% endif %}
                    {% if agent %}
		                <a href="#unplannedCiteModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log unplanned citation" ><commit_msg>fix div bug for unplanned production in output section<commit_after>{% extends "site_base.html" %}

{% load staticfiles %}
{% load i18n %}
{% load bootstrap_tags %}

{% block head_title %}{% trans "Process" %}: {{ process }}{% endblock %}

{% block extra_head %}

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="{% static 'css/chosen.css' %}" />

<style>

.use {
    margin-left: 4em;
    font-style: italic;
}

.event {
    margin-left: 2em; 
    margin-bottom: 4px;
}

.commitment {
    margin-top: 4px;
}

.notes {
    margin-left: 1em;
    font-style: italic;
}

.error {
    color: red;
}

.reskedForm {
    display: inline;
}
#addCiteModal textarea, #addConsumableModal textarea, #addUsableModal textarea, #addWorkModal textarea, #addOutputModal textarea, .item-description, #resourceModal textarea {
  width: 500px;
  height: 100px;
}

.workEventModal textarea, .unplannedWorkModal textarea {
  width: 500px;
  height: 400px;
}

.btn {
    margin-left: 10px;
}
h3, h4 {
    color: firebrick;
}
li {
    list-style-type: none;
}
.proc-notes {
    font-style: italic;
    font-weight: normal;
    border: solid 1px gainsboro;
    background-color: honeydew;
    padding: 4px;
    margin: 4px 0 10px 0;
}
.log-section {
    border: solid 1px gainsboro;
    background-color: beige; 
    padding: 4px;
    margin-bottom: 7px;   
}
.modal {
    width: 600px;
}
.subsection-label {
    font-weight: bold;
}
.detail-line {
    margin: 0 0 0 2em;
}
.taken {
    font-style: italic;
    font-weight: bold;
    color: #5C8A8A;
}
.unplanned {
    color: 	#7D1818;
}
.event-label {
    color: green;
    font-weight: bold;
    font-style: normal;
}
.indent {
    margin-left: 3em;
}

.onhand {
    margin-left: 2em;
}

</style>

{% endblock %}

{% block body_class %}work{% endblock %}

{% block body_base %}
    <div class="container">
        {% include "_messages.html" %}
	<div>
	<legend>
		{% trans "Process" %}: <span class="process" >{{ process }} {% if process.started %} - {% trans "Started" %} {{ process.started }}{% endif %} </span>
		{% if agent %}
            <a class="btn btn-info" href="{% url change_process process_id=process.id %}">{% trans "Change" %}</a>
            {% if logger %}
                <a class="btn btn-primary" href="{% url process_finished process_id=process.id %}">
                    {% if process.finished %}
                        {% trans "Unfinish" %}
                    {% else %}
                        {% trans "Finish" %}
                    {% endif %}
                </a>
            {% endif %}
		{% endif %}
	</legend>

	<div class="row-fluid">

		<div class="span8">
          <div class="log-section">
		    <h3 style="margin-bottom: 4px;" >
		        {% trans "Outputs" %}:  
		        {% if logger %}
		            <a href="#addOutputModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add an output requirement">
		                {% trans "Add an output requirement" %}
	                </a>
	             {% endif %}

	        </h3>
		    {% for item in process.outgoing_commitments %}
			    <div>
				    <b>{% trans "Scheduled" %}: 
			        <span class="output-requirement" >
			            {{ item.resource_type.name }}</b> {{ item.quantity }} {{ item.unit_of_quantity }} {% trans "due" %} {{ item.due_date }} 
		            </span>
		            {% if logger %}

                        <a href="#commitmentModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Change output requirement">
			               <i class="icon-edit"></i>
		                </a>
	
		                <div class="modal hide fade commitmentModal" id="commitmentModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
			                <div class="modal-header">
				                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				                <h3 id="commitment-label">{% trans "Change Requirement" %}</h3>
			                </div>
			                <div class="modal-body">
				                <form class="commitmentForm{{ item.id }}" enctype="multipart/form-data" action="{% url change_commitment commitment_id=item.id %}" method="POST" >
					                {% csrf_token %}
					                {{ item.change_form|as_bootstrap }}
					                <input type="hidden" id="next" name="next" value="process" />
                                    <div class="modal-footer">
                                        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                        <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                    </div>
				                </form>
			                </div>
		                </div>

		                <form
		                    style="display: inline;" 
                            class="delete-commitment-form" 
                            id="deleteCommitmentForm{{ item.id }}" 
                            action="{% url delete_process_commitment commitment_id=item.id %}" 
                            method="POST" >
                            {% csrf_token %}
                        	<input type="hidden" id="next" name="next" value="process" />
                            <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete output requirement" >X</button>
                        </form>
		                
		                <a href="#resourceModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Create a Resource" >{% trans "Log Resource" %}</a>
        
                        <div class="modal hide fade resourceModal" id="resourceModal" tabindex="-1" role="dialog" aria-labelledby="resource-label" aria-hidden="true">
	                        <div class="modal-header">
		                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		                        <h3 id="resource-label">{% trans "Create" %} {{ item.resource_type.name }} {% trans "Resource" %}</h3>
	                        </div>
	                        <div class="modal-body">
		                        <form class="resource-form" id="resourceForm" enctype="multipart/form-data" action="{% url log_resource_for_commitment commitment_id=item.id %}" method="POST" >
			                        {% csrf_token %}
			                        {{ item.resource_create_form|as_bootstrap }}
		                          <div class="modal-footer">
			                        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
			                        <button class="btn btn-primary">{% trans "Save" %}</button>
		                          </div>


		                        </form>
                            </div>
                        </div>
			        {% endif %}
			    </div>
			    
			    {% if item.description %}
		           <div class="notes"> {{ item.description|urlize|linebreaks }}</div>
	            {% endif %}
			
			    {% for event in item.fulfilling_events %}
				    <div class="event" >
					    <span class="event-label">{% trans "Completed" %}:</span> <span class="event" >{{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }} </span>
					    {% if logger %}
					        {% comment %}
					        <a href="" class="btn btn-info btn-mini" title="Change" ><i class="icon-edit"></i></a>
					        {% endcomment %}
					        <form
					            style="display: inline;" 
                                class="delete-form" 
                                id="deleteForm{{ event.id }}" 
                                action="{% url delete_event event_id=event.id %}" 
                                method="POST" >
                                {% csrf_token %}
                            	<input type="hidden" id="next" name="next" value="process" />
                                <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete production event" >X</button>
                            </form>
					    {% endif %}
					    </br>
					    &nbsp;&nbsp;{% trans "Resource" %}: <a href="{% url resource resource_id=event.resource.id  %}">{{ event.resource }}</a>
					
				    </div>
			    {% endfor %}
		    {% endfor %}


            {% if process.uncommitted_production_events %}
                <h4 class="unplanned">{% trans "Unplanned Production" %}:</h4>
		        {% for event in process.uncommitted_production_events %}
			        <div class="event" >
				        <b>{% trans "Created" %}: <span class="event" >{{ event.resource_type.name }}</b> {{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }}</span>
				        {% if logger %}
				            {% comment %}
				            <a href="" class="btn btn-info btn-mini" title="Change" ><i class="icon-edit"></i></a>
				            {% endcomment %}
		                    <form
				                style="display: inline;" 
                                class="delete-form" 
                                id="deleteForm{{ event.id }}" 
                                action="{% url delete_event event_id=event.id %}" 
                                method="POST" >
                                {% csrf_token %}
                            	<input type="hidden" id="next" name="next" value="process" />
                                <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete production event" >X</button>
                            </form>
		                {% endif %}
			        </div>
		        {% endfor %}
	        {% endif %}
        </div>

        
	    {% if work_reqs or process.uncommitted_work_events or "work" in slots %}
		    <div class="log-section">
		        <h3 style="margin-bottom: 4px;" >
		            {% trans "Work" %}: 
		            {% if logger %}
			            <a href="#addWorkModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add a work requirement">
		                    {% trans "Add a work requirement" %}
	                    </a>
                    {% endif %}
		            {% if agent %}
		                <a href="#unplannedWorkModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log unplanned work" >
			                {% trans "Log unplanned work" %}
		                </a>
	                {% endif %}
	            </h3>
            
		        {% for item in work_reqs %}
			        <div class="commitment">
				        <span class="work-requirement" ><b>{{ item.resource_type.name }}:</b> {{ item.quantity }} {{ item.unit_of_quantity }} {% trans "due" %} {{ item.due_date }}</span>
                        {% if logger %}
				            <a href="#commitmentModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Change work requirement">
			                       <i class="icon-edit"></i>
	                        </a>

	                        <div class="modal hide fade commitmentModal" id="commitmentModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
		                        <div class="modal-header">
			                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			                        <h3 id="commitment-label">{% trans "Change Requirement" %}</h3>
		                        </div>
		                        <div class="modal-body">
			                        <form class="commitmentForm{{ item.id }}" enctype="multipart/form-data" action="{% url change_commitment commitment_id=item.id %}" method="POST" >
				                        {% csrf_token %}
				                        {{ item.changeform|as_bootstrap }}
				                        <input type="hidden" id="next" name="next" value="process" />
                                        <div class="modal-footer">
                                            <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                            <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                        </div>
			                        </form>
		                        </div>
	                        </div>
                        {% endif %}

                    {% if item.from_agent %}
				        <span class="taken">{% trans "Taken by" %}<span class="agent" > {{ item.from_agent.nick }}</span></span>
				        {% with item.fulfilling_events as work_events %}
				            {% if agent == item.from_agent %} 

				                {% if not work_events %}
				                    <form
	                                    style="display: inline;" 
                                        class="uncommit-form" 
                                        id="uncommitForm{{ item.id }}" 
                                        action="{% url uncommit commitment_id=item.id %}" 
                                        method="POST" >
                                        {% csrf_token %}
                                    	<input type="hidden" id="next" name="next" value="process" />
                                        <button style="display: inline;"  class="btn btn-warning btn-mini" title="Uncommit" >X</button>
                                    </form>
				                {% endif %}

				                <a href="#eventModal{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log your work" >
					                {% trans "Log work" %}
				                </a>
			
				                <div class="modal hide fade workEventModal" id="eventModal{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
					                <div class="modal-header">
						                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						                <h3 id="event-label">{% trans "Add Time Contribution" %}</h3>
					                </div>
					                <div class="modal-body">
						                <form class="eventForm{{ item.id }}" enctype="multipart/form-data" action="{% url add_work_event commitment_id=item.id %}" method="POST" >
							                {% csrf_token %}
							                {{ item.work_event_form|as_bootstrap }}
						                  <div class="modal-footer">
							                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
							                <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
						                  </div>
						                </form>
					                </div>
				                </div>
			                {% comment %}
			                {% elif super_logger %}
			                    <button class="btn btn-info btn-mini" title="Log work for {{ item.from_agent }}" >{% trans "Log work" %}</button>
		                    {% endcomment %}
			                {% endif %}
			                {% if work_events %}
			                    <div class="event">
			                        <div class="subsection-label event-label" >{% trans "Work events" %}:</div>
				                    {% for event in work_events %}
					                
					                    {{ event.event_date }} {{ event.quantity }} {{ event.unit_of_quantity.name  }}
					                    
					                    {% if agent == item.from_agent  %}
					                        
							                <a href="#eventModal{{ event.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
								               <i class="icon-edit"></i>
							                </a>
						
							                <div class="modal hide fade workEventModal" id="eventModal{{ event.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
								                <div class="modal-header">
									                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
									                <h3 id="event-label">{% trans "Change Time Contribution" %}</h3>
								                </div>
								                <div class="modal-body">
									                <form class="eventForm{{ event.id }}" enctype="multipart/form-data" action="{% url change_work_event event_id=event.id %}" method="POST" >
										                {% csrf_token %}
										                {{ event.work_event_change_form|as_bootstrap }}
										                <input type="hidden" id="next" name="next" value="process" />
                                                        <div class="modal-footer">
                                                            <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                                            <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                                        </div>
									                </form>
								                </div>
							                </div>

							                <form
				                                style="display: inline;" 
                                                class="delete-form" 
                                                id="deleteForm{{ event.id }}" 
                                                action="{% url delete_event event_id=event.id %}" 
                                                method="POST" >
                                                {% csrf_token %}
                                            	<input type="hidden" id="next" name="next" value="process" />
                                                <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work contribution!" >X</button>
                                            </form>
					                    {% endif %}
					                    {% if event.description %}
			                               <div class="notes"> {{ event.description|urlize|linebreaks }}</div>
		                                {% endif %}
				                    {% endfor %}
				                </div>
				            {% endif %}
		                {% endwith %}
			            
				        </div>
			        {% else %}
					        <span class="taken">{% trans "Unassigned" %} </span>
					        {% if logger %}
				                <form
				                    style="display: inline;" 
                                    class="delete-commitment-form" 
                                    id="deleteCommitmentForm{{ item.id }}" 
                                    action="{% url delete_process_commitment commitment_id=item.id %}" 
                                    method="POST" >
                                    {% csrf_token %}
                                	<input type="hidden" id="next" name="next" value="process" />
                                    <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work requirement" >X</button>
                                </form>
                            {% endif %}

                            {% if agent %}                           
						        <a href="#commitmentForm{{ item.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
							        {% trans "Take this task" %}
						        </a>

						        <div class="modal hide fade commitmentForm" id="commitmentForm{{ item.id }}" tabindex="-1" role="dialog" aria-labelledby="commitment-label" aria-hidden="true">
							        <div class="modal-header">
								        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						        <h3 id="commitment-label">{% trans "Take this task" %}: {{ item.resource_type.name }}</h3>
							        </div>
							        <div class="modal-body">

								        <form class="commitmentForm" enctype="multipart/form-data" action="{% url commit_to_task commitment_id=item.id %}" method="POST" >
									        {% csrf_token %}
									        {{ item.commitment_form|as_bootstrap }}
									        <input type="hidden" name="next" value="{{ process.get_absolute_url }}" />
								          <div class="modal-footer">
									        <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
									        <input type="submit" class="btn btn-primary" name="commit" value='{% trans "Commit to this task" %}' />
									        {% comment %}
									        <input type="submit" class="btn btn-primary" name="start" value='{% trans "Start now" %}' />
									        {% endcomment %}
								          </div>
								        </form>
							        </div>
						        </div>
					        {% endif %}
				        </div>
			        {% endif %}
			        {% if item.description and not item.fulfilling_events %}
		               <div class="notes"> {{ item.description|urlize|linebreaks }}</div>
	                {% endif %}
	                {% if not item.from_agent %}
			            {% for source in item.resource_type.producing_agent_relationships %}
				            <p class="detail-line">
					            <b>{% trans "Possible source" %}:</b><span class="agent" > {{ source.agent.name }}</span>
				            </p>
			            {% endfor %}
			        {% endif %}
		        {% endfor %}
		        
                {% if unplanned_work %}
                    <h4 class="unplanned">{% trans "Unplanned Work Events" %}:</h4>
		            {% for event in unplanned_work %}
			            <div >
				            <span class="event" ><span class="event-label">{% trans "Work event" %}: </span><b> {{ event.resource_type.name }}</b> {{ event.quantity }} {{ event.unit_of_quantity }} {{ event.event_date }} <span class="taken">{% trans "Done by" %} {{ event.from_agent.nick }}</span></span>
                            
			                {% if agent == event.from_agent  %}
		                        
				                <a href="#eventModal{{ event.id }}" role="button" class="btn btn-info btn-mini" data-toggle="modal">
					               <i class="icon-edit"></i>
				                </a>
			
				                <div class="modal hide fade workEventModal" id="eventModal{{ event.id }}" tabindex="-1" role="dialog" aria-labelledby="event-label" aria-hidden="true">
					                <div class="modal-header">
						                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
						                <h3 id="event-label">{% trans "Change Time Contribution" %}</h3>
					                </div>
					                <div class="modal-body">
						                <form class="eventForm{{ event.id }}" enctype="multipart/form-data" action="{% url change_unplanned_work_event event_id=event.id %}" method="POST" >
							                {% csrf_token %}
							                {{ event.changeform|as_bootstrap }}
							                <input type="hidden" id="next" name="next" value="process" />
                                            <div class="modal-footer">
                                                <button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>
                                                <input type="submit" class="btn btn-primary" name="submit" value='{% trans "Save" %}' />
                                            </div>
						                </form>
					                </div>
				                </div>

				                <form
	                                style="display: inline;" 
                                    class="delete-form" 
                                    id="deleteForm{{ event.id }}" 
                                    action="{% url delete_event event_id=event.id %}" 
                                    method="POST" >
                                    {% csrf_token %}
                                	<input type="hidden" id="next" name="next" value="process" />
                                    <button style="display: inline;"  class="btn btn-warning btn-mini" title="Delete work contribution!" >X</button>
                                </form>
		                    {% endif %}

			                {% if event.description %}
		                       <div class="notes indent"> {{ event.description|urlize|linebreaks }}</div>
	                        {% endif %}
				            
			            </div>
		            {% endfor %}
		        {% endif %}
            </div>
	    {% endif %}
          

		  {% if process.citation_requirements or process.uncommitted_citation_events or "cite" in slots %}
            <div class="log-section">
			    <h3>
			        {% trans "Citations" %}: 
			        {% if logger %}
			            <a href="#addCiteModal" role="button" class="btn btn-primary btn-mini" data-toggle="modal" title="Add a citation requirement">
		                    {% trans "Add a citation requirement" %}
	                    </a>
                    {% endif %}
                    {% if agent %}
		                <a href="#unplannedCiteModal" role="button" class="btn btn-info btn-mini" data-toggle="modal" title="Log unplanned citation" >
{'fraction_non_alphanumeric': 0.1442038417544275, 'fraction_numerical': 0.0033526604346625646, 'mean_word_length': 1.3374821370949155, 'pattern_counts': {'":': 0, '<': 589, '<?xml version=': 0, '>': 589, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 137, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6079540', 'n_tokens_mistral': 15933, 'n_tokens_neox': 12377, 'n_words': 2767}