-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Outerpacking to change status to packed
- Loading branch information
1 parent
3389afe
commit a9915e5
Showing
19 changed files
with
160 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class Client::OuterpackingsController < ApplicationController | ||
skip_before_action :authenticate_user! | ||
|
||
def new | ||
@outerpacking = Outerpacking.new | ||
end | ||
|
||
def create | ||
@outerpacking = Outerpacking.new(outerpacking_params) | ||
@outerpacking.order = Order.find(params[:order_id]) | ||
if @outerpacking.save! | ||
redirect_to client_order_path(@outerpacking.order.id) | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
def index | ||
@outeperackings = Outerpacking.all | ||
end | ||
|
||
|
||
private | ||
|
||
def outerpacking_params | ||
params.require(:outerpacking).permit(:outer_id, :quantity) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,37 @@ | ||
class OuterpackingsController < ApplicationController | ||
def index | ||
end | ||
|
||
def new | ||
before_action :set_outerpacking, only: [:show, :edit, :update, :destroy] | ||
skip_before_action :authenticate_user! | ||
|
||
def show | ||
end | ||
|
||
def edit | ||
end | ||
|
||
def update | ||
if @outerpacking.update(outerpacking_params) | ||
redirect_to client_order_path(@outerpacking.order.id) | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
def destroy | ||
o = Order.find(params[:order]) | ||
@outerpacking.destroy | ||
redirect_to client_order_path(o) | ||
end | ||
|
||
|
||
private | ||
|
||
def set_outerpacking | ||
@outerpacking = Outerpacking.find(params[:id]) | ||
end | ||
|
||
def outerpacking_params | ||
params.require(:outerpacking).permit(:outer_id, :quantity) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Outer < ApplicationRecord | ||
has_many :outerpackings | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<% @outerpackings.each do |o| %> | ||
<%= o.quantity %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<%= simple_form_for @outerpacking, client_order_outerpackings_path do |f| %> | ||
<%= f.error_notification %> | ||
<%= f.input :outer_id, collection: Outer.all %> | ||
<%= f.input :quantity %> | ||
<%= f.button :submit %> | ||
<% end %> | ||
|
||
<%= link_to "Go back", root_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
<h1>Outerpackings#edit</h1> | ||
<p>Find me in app/views/outerpackings/edit.html.erb</p> | ||
<div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 form-default"> | ||
<%= simple_form_for @outerpacking do |f| %> | ||
<%= f.error_notification %> | ||
<%= f.input :outer_id, collection: Outer.all %> | ||
<%= f.input :quantity %> | ||
<%= f.button :submit, class: "btn-submit" %> | ||
<% end %> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 form-default"> | ||
<% unless order.outerpackings.length == 0 %> | ||
<%= link_to "Packing Done", client_order_path(@order, status_up: @order.status), class: "btn btn-success" %> | ||
<% end %> | ||
</div> | ||
<div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 form-default"> | ||
<% Outerpacking.all.each do |o| %> | ||
<h6> | ||
<%= o.outer.name %> - <%= o.quantity %> | ||
<%= link_to '<i class="fas fa-edit"></i>'.html_safe, edit_outerpacking_path(o), order: o.order.id %> ||| <%= link_to '<i class="fas fa-trash-alt"></i>'.html_safe, outerpacking_path(o, order: o.order.id), data: { confirm: "Are you sure?" }, method: :delete %> | ||
</h6> | ||
<% end %> | ||
</div> | ||
<div class="col-xs-10 col-xs-offset-1 col-md-4 col-md-offset-4 form-default"> | ||
<%= simple_form_for Outerpacking.new, url: client_order_outerpackings_path(order) do |f| %> | ||
<%= f.error_notification %> | ||
<%= f.input :outer_id, collection: Outer.all %> | ||
<%= f.input :quantity %> | ||
<div class="hidden"> | ||
<%= f.input_field "Pass Params", name: "status", value: order.status %> | ||
</div> | ||
<%= f.button :submit, class: "btn-submit" %> | ||
<% end %> | ||
</div> | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'test_helper' | ||
|
||
class Client::OuterpackingsControllerTest < ActionDispatch::IntegrationTest | ||
test "should get new" do | ||
get client_outerpackings_new_url | ||
assert_response :success | ||
end | ||
|
||
test "should get index" do | ||
get client_outerpackings_index_url | ||
assert_response :success | ||
end | ||
|
||
end |