{% if operation %}
<div class="panel panel-default" data-operation="{{ operation_row }}">
	
	<div class="panel-heading" role="tab" id="heading-{{ file_row }}-{{ operation_row }}">
		<h4 class="panel-title">
			
			{% if operation.attributes.info %}<div style="margin-bottom: 10px;" class="alert alert-info" role="alert">{{ operation.attributes.info }}</div>{% endif %}
			<div class="input-group">
				
				<select class="form-control select-operation" name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][action]" data-id-text="#title-operation-{{ file_row }}-{{ operation_row }}">
					
					<option value="replace" {% if operation.add.attributes.position == "replace" %}selected{% endif %}>{{ select_action_replace }}</option>
					<option value="before"{% if operation.add.attributes.position == "before" %}selected{% endif %}>{{ select_action_before }}</option>
					<option value="after"{% if operation.add.attributes.position == "after" %}selected{% endif %}>{{ select_action_after }}</option>
				</select>
				<a class="input-group-addon" role="button" class="btn btn-primary" data-toggle="collapse" href="#accordion-modification-operations-{{ file_row }}-{{ operation_row }}" aria-expanded="false" aria-controls="collapse-{{ file_row }}-{{ operation_row }}">{{ text_collapse }}</a>
				<a type="button" class="btn btn-danger input-group-addon" onclick="(confirm('{{ text_remove_1 }}')) ? OperationRemove({{ operation_row }}, {{ file_row }}) : ''"><i class="fa fa-trash-o"></i></a>
			</div>
		</h4>
	</div>
		<div id="accordion-modification-operations-{{ file_row }}-{{ operation_row }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-{{ file_row }}-{{ operation_row }}">
		<div class="panel-body">
			<div class="form-group col-sm-12">
				{{ entry_comment }}
				<input type="text" name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][info]" class="form-control" value="{{ operation.attributes.info }}" placeholder="{{ entry_comment }}">
			</div>
			
			<div class="form-group col-sm-12">
				{{ text_help_search }}
				<textarea name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][search]" placeholder="{{ entry_xml }}" id="input-xml-{{ file_row }}-{{ operation_row }}-search" class="form-control php_editor_{{ file_row }}_{{ operation_row }}">{{ operation.search|escape  }}</textarea>
			</div>
			
			<div class="form-group col-sm-12">
				
				<span id="title-operation-{{ file_row }}-{{ operation_row }}">{{ text_help_replace }}</span>
				<textarea name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][replace]" placeholder="{{ entry_xml }}" id="input-xml-{{ file_row }}-{{ operation_row }}-replace" class="form-control php_editor_{{ file_row }}_{{ operation_row }}">{{ operation.add|escape  }}</textarea>
			</div>
			<div class="form-group">
					
					<div class="col-sm-3">
						{{ text_search_index }}
						<input name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][index]" type="number"  class="form-control" value="{{ (operation.search.attributes.index is defined ) ? operation.search.attributes.index|number_format  : '' }}" placeholder="{{ text_search_index }}">
					</div>
					<div class="col-sm-3">
						{{ text_search_offset }}
						<input name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][offset]" type="text"  class="form-control" value="{{ (operation.add.attributes.offset is defined ) ? operation.add.attributes.offset|number_format  : '' }}" placeholder="{{ text_search_offset }}">
					</div>
					<div class="col-sm-3">
						{{ text_search_limit }}
						<input name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][limit]" type="number"  class="form-control" value="{{ (operation.search.attributes.limit is defined ) ? operation.search.attributes.limit|number_format  : '' }}" placeholder="{{ text_search_limit }}">
					</div>
					<div class="col-sm-3">
						{{ text_select_error }}
						<select class="form-control" name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][error]" placeholder="{{ entry_xml }}" id="input-xml-{{ file_row }}-{{ operation_row }}-search" class="form-control php_editor_{{ file_row }}_{{ operation_row }}">
							
							<option value="log" {% if operation.attributes.error == "log" %}selected{% endif %}>{{ text_select_error_log }}</option>
							<option value="skip"{% if operation.attributes.error == "skip" %}selected{% endif %}>{{ text_select_error_skip }}</option>
							<option value="error"{% if operation.attributes.error == "error" %}selected{% endif %}>{{ text_select_error_error }}</option>
						</select>
					</div>
				
				
			</div>
			<div class="form-group col-sm-12">
				
					<label>
					<input type="checkbox" name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][regex]" value="1" {{ operation.search.attributes.regex == 'true' ? 'checked' : '' }}>
					{{ text_access_regex }}
					</label>
					<label>
					<input type="checkbox" name="newxml[files][{{ file_row }}][operations][{{ operation_row }}][trim]" value="1" {{ operation.add.attributes.trim == 'true' ? 'checked' : '' }}>
					{{ text_access_trim }}
					</label>
					
			</div>
			
		</div>
		</div>
		<script>
			$(".php_editor_{{ file_row }}_{{ operation_row }}").each(function() {
				var editor = CodeMirror.fromTextArea( this, {
					mode: "text/x-php",
					dragDrop: false,
					autoRefresh: true,
					viewportMargin: Infinity
				  });
			
				
			
				$(this).on('change', updateTextArea);
			});
		
		</script>
	</div>
	

{% endif %}