<%# (C) COPYRIGHT HELP/SYSTEMS, L.L.C. 2009 %> <% fields_for @job do |fields| %>
<%= fields.check_box :conditional, :disabled=>@view_only %>

<%= t('jobs.conditions.enable_caption') %>

<%= fields.check_box :cond_retry, :disabled=>@view_only %>

<%= t('.retry_if_not_met_caption') %>

<%= fields.label :cond_retry_count, t_label('.condition_retry_count'), :class => "x-form-item label run-every-label" %>
<%= fields.hidden_field :cond_retry_count, :name => "", :disabled => true %>

<%= t('.condition_retry_count_caption') %>

<%= fields.label :cond_retry_delay, t_label('.condition_retry_interval'), :class => "x-form-item label run-every-label" %>
<%= fields.hidden_field :cond_retry_delay %>

<%= t('.condition_retry_interval_caption') %>

<% retry_type = (@job.cond_retry_delay_type == Job::COND_DELAY_HOURS || @job.cond_retry_delay_type == Job::COND_DELAY_MINUTES || @job.cond_retry_delay_type == Job::COND_DELAY_SECONDS) ? @job.cond_retry_delay_type : Job::COND_DELAY_HOURS %>
<%= radio_button_tag("job[cond_retry_delay_type]", Job::COND_DELAY_HOURS, retry_type == Job::COND_DELAY_HOURS, :disabled => @view_only) %> <%=t "jobs.conditions.hours" %>
<%= radio_button_tag("job[cond_retry_delay_type]", Job::COND_DELAY_MINUTES, retry_type == Job::COND_DELAY_MINUTES, :disabled => @view_only) %> <%=t "jobs.conditions.minutes" %>
<%= radio_button_tag("job[cond_retry_delay_type]", Job::COND_DELAY_SECONDS, retry_type == Job::COND_DELAY_SECONDS, :disabled => @view_only) %> <%=t "jobs.conditions.seconds" %>
<%= fields.label :schedule_type, t_label('.condition_fail_action'), :class => "x-form-item label schedule-type-label" %>
<% cond_status = (@job.condition_fail_status == Job::COND_STATUS_FAIL || @job.condition_fail_status == Job::COND_STATUS_CANCEL || @job.condition_fail_status == Job::COND_STATUS_RUN_ANYWAY ) ? @job.condition_fail_status : Job::COND_STATUS_FAIL %>
<%= radio_button_tag("job[condition_fail_status]", Job::COND_STATUS_FAIL, cond_status == Job::COND_STATUS_FAIL, :disabled => @view_only) %> <%=t ".job_status_fail" %>
<%= radio_button_tag("job[condition_fail_status]", Job::COND_STATUS_CANCEL, cond_status == Job::COND_STATUS_CANCEL, :disabled => @view_only) %> <%=t ".job_status_cancel" %>
<%= radio_button_tag("job[condition_fail_status]", Job::COND_STATUS_RUN_ANYWAY, cond_status == Job::COND_STATUS_RUN_ANYWAY, :disabled => @view_only) %> <%=t "jobs.edit_condition_options.condition_run_anyway" %>

<%= t('.condition_fail_action_caption') %>

<% end %>