Skip to content

Commit

Permalink
Added partial files and corrected before acgtion
Browse files Browse the repository at this point in the history
  • Loading branch information
ErinClaudio committed Oct 27, 2023
1 parent 6422aba commit 3fcee7e
Show file tree
Hide file tree
Showing 8 changed files with 297 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/organizations/tasks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Organizations::TasksController < Organizations::BaseController
before_action :set_pet, only: [:new, :create, :edit, :update]
before_action :set_pet, only: [:new, :create, :edit, :update, :destroy]
before_action :set_task, only: [:edit, :update]

def new
Expand Down
33 changes: 33 additions & 0 deletions app/views/organizations/tasks/_applications.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="col-md-12 col-xl-8 col-12">
<div class="row">
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="mb-0">Summary</h4>
</div>
<!-- dropdown -->
<div>
<span class="dropdown dropstart">
<a class="btn-icon btn btn-ghost btn-sm rounded-circle" href="#" role="button" id="DropdownTen" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fe fe-more-vertical"></i>
</a>
<span class="dropdown-menu" aria-labelledby="DropdownTen">
<span class="dropdown-header">Settings</span>
<%= link_to t('general.edit'), edit_pet_path(@pet), class: 'dropdown-item' %>
<%= link_to t('general.delete'), pet_path(@pet), class: 'dropdown-item',
data:
{
turbo_method: :delete,
turbo_confirm: t('organization_pets.show.are_you_sure_delete')
} %>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
15 changes: 15 additions & 0 deletions app/views/organizations/tasks/_edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%= form_with(model: [@pet, @task], local: true) do |form| %>
<div class="form-group">
<%= form.label :name %>
<%= form.text_field :name, class: 'form-control', placeholder: 'Enter task name' %>
</div>

<div class="form-group">
<%= form.label :description %>
<%= form.text_area :description, class: 'form-control', placeholder: 'Enter task description' %>
</div>

<div class="actions">
<%= form.submit 'Update Task', class: 'btn btn-primary' %>
</div>
<% end %>
34 changes: 34 additions & 0 deletions app/views/organizations/tasks/_files.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<div class="col-md-12 col-xl-8 col-12">
<div class="row">
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="mb-0">Summary</h4>
</div>
<!-- dropdown -->
<div>
<span class="dropdown dropstart">
<a class="btn-icon btn btn-ghost btn-sm rounded-circle" href="#" role="button" id="DropdownTen" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fe fe-more-vertical"></i>
</a>
<span class="dropdown-menu" aria-labelledby="DropdownTen">
<span class="dropdown-header">Settings</span>
<%= link_to t('general.edit'), edit_pet_path(@pet), class: 'dropdown-item' %>
<%= link_to t('general.delete'), pet_path(@pet), class: 'dropdown-item',
data:
{
turbo_method: :delete,
turbo_confirm: t('organization_pets.show.are_you_sure_delete')
} %>
</span>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

9 changes: 9 additions & 0 deletions app/views/organizations/tasks/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="col-md-12 col-xl-8 col-12">
<div class="card">
<div class="card-header">
<h4 class="mb-0">Add New Task?????????</h4>
</div>
<div class="card-body">
</div>
</div>
</div>
111 changes: 111 additions & 0 deletions app/views/organizations/tasks/_overview.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<div class="col-md-12 col-xl-8 col-12">
<div class="row">
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between
align-items-center">
<div>
<h4 class="mb-0">Summary</h4>
</div>
<!-- dropdown -->
<div>
<span class="dropdown dropstart">
<a class="btn-icon btn btn-ghost btn-sm rounded-circle" href="#" role="button" id="DropdownTen" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fe fe-more-vertical"></i>
</a>
<span class="dropdown-menu" aria-labelledby="DropdownTen">
<span class="dropdown-header">Settings</span>
<%= link_to t('general.edit'), edit_pet_path(@pet), class: 'dropdown-item' %>
<%= link_to t('general.delete'), pet_path(@pet), class: 'dropdown-item',
data:
{
turbo_method: :delete,
turbo_confirm: t('organization_pets.show.are_you_sure_delete')
} %>
</span>
</span>
</div>
</div>


</div>
<div class="card-body">
<p><%= @pet.description %> </p>

<ul class="list-group list-group-flush">
<li class="list-group-item px-0">
<div class="d-flex justify-content-between
align-items-center">
<div class="d-flex align-items-center">
<i class="fe fe-book me-2"></i>
<div class="ms-2">
<h5 class="mb-0 text-body">Sex</h5>
</div>
</div>
<div>
<div>
<p class="text-dark mb-0 fw-semibold"><%= @pet.sex %></p>
</div>
</div>
</div>
</li>
<li class="list-group-item px-0">
<div class="d-flex justify-content-between
align-items-center">
<div class="d-flex align-items-center">
<i class="fe fe-book me-2"></i>
<div class="ms-2">
<h5 class="mb-0 text-body">Breed</h5>
</div>
</div>
<div>
<div>
<p class="text-dark mb-0 fw-semibold"><%= @pet.breed %></p>
</div>
</div>
</div>
</li>
<li class="list-group-item px-0">
<div class="d-flex justify-content-between
align-items-center">
<div class="d-flex align-items-center">
<i class="fe fe-book me-2"></i>
<div class="ms-2">
<h5 class="mb-0 text-body">Weight</h5>
</div>
</div>
<div>
<div>
<p class="text-dark mb-0 fw-semibold"><%= "#{@pet.weight_from} - #{@pet.weight_to} #{@pet.weight_unit}" %></p>
</div>
</div>
</div>
</li>
<li class="list-group-item px-0 pb-0">
<div class="d-flex
justify-content-between
align-items-center">
<div class="d-flex
align-items-center">
<i class="fe fe-book me-2"></i>
<div class="ms-2">
<h5 class="mb-0 text-body">Application Status</h5>
</div>
</div>
<div>
<div>
<p class="text-dark mb-0 fw-semibold">
<%= @pet.application_paused == false ? t('.application.active') : t('.application.paused') %>
</p>
</div>
</div>
</div>
</li>

</ul>
</div>
</div>
</div>
</div>
</div>
76 changes: 76 additions & 0 deletions app/views/organizations/tasks/_tasks.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<div class="col-md-12 col-xl-8 col-12">
<div class="row">
<div class="col-12 mb-4">
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<div>
<h4 class="mb-0">Summary</h4>
</div>
<!-- dropdown -->
<div>
<span class="dropdown dropstart">
<a class="btn-icon btn btn-ghost btn-sm rounded-circle" href="#" role="button" id="DropdownTen" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fe fe-more-vertical"></i>
</a>
<span class="dropdown-menu" aria-labelledby="DropdownTen">
<span class="dropdown-header">Settings</span>
<%= link_to t('general.edit'), edit_pet_path(@pet), class: 'dropdown-item' %>
<%= link_to t('general.delete'), pet_path(@pet), class: 'dropdown-item',
data: {
turbo_method: :delete,
turbo_confirm: t('organization_pets.show.are_you_sure_delete')
} %>
</span>
</span>
</div>
</div>
</div>

<div class="card-body">
<h5>Tasks</h5> <!-- Task header -->

<ul class="list-group list-group-flush">
<% @pet.tasks.each do |task| %>
<li class="list-group-item px-0">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<i class="fe fe-check-square me-2"></i> <!-- A generic icon for tasks; change as needed -->
<div class="ms-2">
<h6 class="mb-0 text-body"><%= task.name %></h6> <!-- Task title -->
</div>
</div>
<div class="d-flex align-items-center">
<p class="text-dark mb-0 fw-semibold mr-3">
<%= task.completed? ? "Completed" : "Pending" %> <!-- Task status -->
</p>
<%= link_to 'Edit', edit_pet_task_path(@pet, task), class: 'btn btn-warning mr-4' %>
<%= link_to 'Delete', pet_task_path(@pet, task), class: 'btn btn-danger', data: { turbo_method: "delete", turbo_confirm: 'Are you sure?' } %>
</div>
</div>
</li>
<% end %>

</ul>
<button type="button" class="add-new-task-button btn btn-primary" data-bs-toggle="modal" data-bs-target="#newTaskModal">Add New Task</button>
<div class="modal" tabindex="-1" id="newTaskModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="taskModalTitle">New Task</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<%= render 'nice_partials/new_task_form', pet: @pet, task: @pet.tasks.build %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
18 changes: 18 additions & 0 deletions app/views/organizations/tasks/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<h1>Edit Task!!</h1>


<%= form_with(model: [@pet, @task], local: true) do |form| %>
<div class="form-group">
<%= form.label :name, class: 'form-label' %>
<%= form.text_field :name, class: 'form-control', placeholder: 'Enter task name' %>
</div>

<div class="form-group">
<%= form.label :description, class: 'form-label' %>
<%= form.text_area :description, class: 'form-control', placeholder: 'Enter task description' %>
</div>

<%= form.submit 'Update Task', class: 'btn btn-primary' %>
<% end %>

<%= link_to 'Back to Task List', pet_path(@pet), class: 'btn btn-secondary' %>

0 comments on commit 3fcee7e

Please sign in to comment.