Merge pull request #141 from foodcoop-rostock/improve-delivery-workflow-further
Improve delivery workflow
This commit is contained in:
commit
ebe93e292b
31 changed files with 597 additions and 153 deletions
1
Gemfile
1
Gemfile
|
@ -17,6 +17,7 @@ group :assets do
|
||||||
end
|
end
|
||||||
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
gem 'select2-rails'
|
||||||
gem 'bootstrap-datepicker-rails'
|
gem 'bootstrap-datepicker-rails'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,9 @@ GEM
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
sass (>= 3.1.10)
|
sass (>= 3.1.10)
|
||||||
tilt (~> 1.3)
|
tilt (~> 1.3)
|
||||||
|
select2-rails (3.4.2)
|
||||||
|
sass-rails
|
||||||
|
thor (~> 0.14)
|
||||||
simple-navigation (3.9.0)
|
simple-navigation (3.9.0)
|
||||||
activesupport (>= 2.3.2)
|
activesupport (>= 2.3.2)
|
||||||
simple-navigation-bootstrap (0.0.4)
|
simple-navigation-bootstrap (0.0.4)
|
||||||
|
@ -285,6 +288,7 @@ DEPENDENCIES
|
||||||
resque
|
resque
|
||||||
ruby-prof
|
ruby-prof
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
select2-rails
|
||||||
simple-navigation
|
simple-navigation
|
||||||
simple-navigation-bootstrap
|
simple-navigation-bootstrap
|
||||||
simple_form
|
simple_form
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery-ui
|
//= require jquery-ui
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
|
//= require select2
|
||||||
//= require twitter/bootstrap
|
//= require twitter/bootstrap
|
||||||
//= require jquery.tokeninput
|
//= require jquery.tokeninput
|
||||||
//= require bootstrap-datepicker/core
|
//= require bootstrap-datepicker/core
|
||||||
|
@ -24,6 +25,34 @@ $.fn.extend({
|
||||||
}()),
|
}()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// function for sorting DOM elements
|
||||||
|
$.fn.sorter = (function(){
|
||||||
|
// Thanks to James Padolsey and Avi Deitcher
|
||||||
|
// http://james.padolsey.com/javascript/sorting-elements-with-jquery/#comment-29400
|
||||||
|
var sort = [].sort;
|
||||||
|
|
||||||
|
return function(comparator, getSortable) {
|
||||||
|
getSortable = getSortable || function(){return this;};
|
||||||
|
|
||||||
|
var sorted = sort.call(this, comparator); // sort all elements in memory
|
||||||
|
var prevElmt = null;
|
||||||
|
for(i=sorted.length-1; i>=0; --i) { // loop starting from last
|
||||||
|
var criterionElmt = sorted[i];
|
||||||
|
var curElmt = ( 'function' === typeof getSortable ) ? ( getSortable.call(criterionElmt) ) : ( criterionElmt );
|
||||||
|
var parent = curElmt.parentNode;
|
||||||
|
if (!prevElmt) {
|
||||||
|
parent.appendChild(curElmt); // place last element to the end
|
||||||
|
} else {
|
||||||
|
parent.insertBefore(curElmt, prevElmt); // move each element before the previous one
|
||||||
|
}
|
||||||
|
prevElmt = curElmt;
|
||||||
|
}
|
||||||
|
return sorted;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
// Load following statements, when DOM is ready
|
// Load following statements, when DOM is ready
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
@ -114,17 +143,64 @@ $(function() {
|
||||||
|
|
||||||
// Use bootstrap datepicker for dateinput
|
// Use bootstrap datepicker for dateinput
|
||||||
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
|
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
|
||||||
|
|
||||||
|
// Init table sorting
|
||||||
|
var myTriggerers = $('.dom-sort-triggerer');
|
||||||
|
myTriggerers.wrapInner('<a href="#" class="dom-sort-link"></a>');
|
||||||
|
$('.dom-sort-link', myTriggerers).click(function(e) {sortTable(e); e.preventDefault();});
|
||||||
|
// A title attribute ('sort ascending/descending') would be nice here.
|
||||||
|
// However, for a tiny detail like that it is not worth to translate everything:
|
||||||
|
// http://foodsoft.51229.x6.nabble.com/How-to-I18n-content-which-is-dynamically-loaded-via-javascript-assets-td75.html#a76
|
||||||
|
|
||||||
|
// Sort tables with a default sort
|
||||||
|
$('.dom-sort-link', '.default-sort').trigger('click');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// compare two elements interpreted as text
|
||||||
|
function compareText(a, b) {
|
||||||
|
return $.trim(a.textContent).toLowerCase() < $.trim(b.textContent).toLowerCase() ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wrapper for $.fn.sorter (see above) for sorting tables
|
||||||
|
function sortTable(e) {
|
||||||
|
var sortLink = $(e.currentTarget);
|
||||||
|
|
||||||
|
var sign = ( sortLink.hasClass('sortup') ) ? ( -1 ) : ( 1 );
|
||||||
|
|
||||||
|
var options = sortLink.closest('.dom-sort-triggerer').data();
|
||||||
|
var sortCriterion = options.sortCriterion; // class name of (usually td) elements which define the order
|
||||||
|
var compareFunction = options.compareFunction; // function to compare two element contents for ordering
|
||||||
|
var sortElement = options.sortElement; // name of function which returns the movable element (default: 'thisParent')
|
||||||
|
var myTable = sortLink.closest('table'); // table to sort
|
||||||
|
|
||||||
|
sortElement = ( 'undefined' === typeof sortElement ) ? ( function() {return this.parentNode;} ) : ( window[sortElement] ); // is this dirty?
|
||||||
|
|
||||||
|
$('.' + sortCriterion, myTable).sorter(
|
||||||
|
function(a, b) {
|
||||||
|
return sign*window[compareFunction](a, b); // again dirty?
|
||||||
|
},
|
||||||
|
sortElement
|
||||||
|
);
|
||||||
|
|
||||||
|
$('.dom-sort-link', myTable).removeClass('sortup sortdown');
|
||||||
|
sortLink.addClass(
|
||||||
|
( sign == 1 ) ? ( 'sortup' ) : ( 'sortdown' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// retrigger last sort function for elements in a context (e.g. after DOM update)
|
||||||
|
function updateSort(context) {
|
||||||
|
$('.sortup, .sortdown', context).toggleClass('sortup sortdown').trigger('click');
|
||||||
|
}
|
||||||
|
|
||||||
// gives the row an yellow background
|
// gives the row an yellow background
|
||||||
function highlightRow(checkbox) {
|
function highlightRow(checkbox) {
|
||||||
var row = checkbox.closest('tr');
|
var row = checkbox.closest('tr');
|
||||||
if (checkbox.is(':checked')) {
|
if (checkbox.is(':checked')) {
|
||||||
row.addClass('selected');
|
row.addClass('selected');
|
||||||
} else {
|
} else {
|
||||||
row.removeClass('selected');
|
row.removeClass('selected');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use with auto_complete to set a unique id,
|
// Use with auto_complete to set a unique id,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
*= require bootstrap_and_overrides
|
*= require bootstrap_and_overrides
|
||||||
|
*= require select2
|
||||||
*= require token-input-bootstrappy
|
*= require token-input-bootstrappy
|
||||||
*= require bootstrap-datepicker
|
*= require bootstrap-datepicker
|
||||||
*/
|
*/
|
|
@ -38,6 +38,22 @@ body {
|
||||||
dd { .clearfix(); }
|
dd { .clearfix(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not use additional margin for input in table
|
||||||
|
.form-horizontal .control-group.control-group-intable,
|
||||||
|
.form-horizontal .controls.controls-intable {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Light tooltips without empty space below tables
|
||||||
|
.tooltip-inner {
|
||||||
|
color: #000;
|
||||||
|
background-color: rgb(245,245,245);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
.tooltip-inner .table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
@mainRedColor: #ED0606;
|
@mainRedColor: #ED0606;
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
|
|
@ -5,43 +5,25 @@ class DeliveriesController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@deliveries = @supplier.deliveries.all :order => 'delivered_on DESC'
|
@deliveries = @supplier.deliveries.all :order => 'delivered_on DESC'
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # index.html.erb
|
|
||||||
format.xml { render :xml => @deliveries }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@delivery = Delivery.find(params[:id])
|
@delivery = Delivery.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html # show.html.erb
|
|
||||||
format.xml { render :xml => @delivery }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@delivery = @supplier.deliveries.build
|
@delivery = @supplier.deliveries.build
|
||||||
|
@delivery.delivered_on = Date.today #TODO: move to model/database
|
||||||
respond_to do |format|
|
|
||||||
format.html # new.html.erb
|
|
||||||
format.xml { render :xml => @delivery }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@delivery = Delivery.new(params[:delivery])
|
@delivery = Delivery.new(params[:delivery])
|
||||||
|
|
||||||
respond_to do |format|
|
if @delivery.save
|
||||||
if @delivery.save
|
flash[:notice] = I18n.t('deliveries.create.notice')
|
||||||
flash[:notice] = I18n.t('deliveries.create.notice')
|
redirect_to [@supplier, @delivery]
|
||||||
format.html { redirect_to([@supplier,@delivery]) }
|
else
|
||||||
format.xml { render :xml => @delivery, :status => :created, :location => @delivery }
|
render :action => "new"
|
||||||
else
|
|
||||||
format.html { render :action => "new" }
|
|
||||||
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -52,15 +34,11 @@ class DeliveriesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@delivery = Delivery.find(params[:id])
|
@delivery = Delivery.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
if @delivery.update_attributes(params[:delivery])
|
||||||
if @delivery.update_attributes(params[:delivery])
|
flash[:notice] = I18n.t('deliveries.update.notice')
|
||||||
flash[:notice] = I18n.t('deliveries.update.notice')
|
redirect_to [@supplier,@delivery]
|
||||||
format.html { redirect_to([@supplier,@delivery]) }
|
else
|
||||||
format.xml { head :ok }
|
render :action => "edit"
|
||||||
else
|
|
||||||
format.html { render :action => "edit" }
|
|
||||||
format.xml { render :xml => @delivery.errors, :status => :unprocessable_entity }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,40 +47,60 @@ class DeliveriesController < ApplicationController
|
||||||
@delivery.destroy
|
@delivery.destroy
|
||||||
|
|
||||||
flash[:notice] = I18n.t('deliveries.destroy.notice')
|
flash[:notice] = I18n.t('deliveries.destroy.notice')
|
||||||
respond_to do |format|
|
redirect_to supplier_deliveries_url(@supplier)
|
||||||
format.html { redirect_to(supplier_deliveries_url(@supplier)) }
|
end
|
||||||
format.xml { head :ok }
|
|
||||||
|
# three possibilites to fill a new_stock_article form
|
||||||
|
# (1) start from blank or use params
|
||||||
|
def new_stock_article
|
||||||
|
@stock_article = @supplier.stock_articles.build(params[:stock_article])
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
# (2) StockArticle as template
|
||||||
|
def copy_stock_article
|
||||||
|
@stock_article = StockArticle.find(params[:old_stock_article_id]).dup
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
# (3) non-stock Article as template
|
||||||
|
def derive_stock_article
|
||||||
|
@stock_article = Article.find(params[:old_article_id]).becomes(StockArticle).dup
|
||||||
|
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_stock_article
|
||||||
|
@stock_article = StockArticle.new(params[:stock_article])
|
||||||
|
|
||||||
|
if @stock_article.valid? and @stock_article.save
|
||||||
|
render :layout => false
|
||||||
|
else
|
||||||
|
render :action => 'new_stock_article', :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_stock_article
|
def edit_stock_article
|
||||||
article = @supplier.stock_articles.build(params[:stock_article])
|
@stock_article = StockArticle.find(params[:stock_article_id])
|
||||||
render :update do |page|
|
render :layout => false
|
||||||
if article.save
|
end
|
||||||
logger.debug "new StockArticle: #{article.id}"
|
|
||||||
page.insert_html :bottom, 'stock_changes', :partial => 'stock_change',
|
|
||||||
:locals => {:stock_change => article.stock_changes.build, :supplier => @supplier}
|
|
||||||
|
|
||||||
page.replace_html 'new_stock_article', :partial => 'stock_article_form',
|
def update_stock_article
|
||||||
:locals => {:stock_article => @supplier.stock_articles.build}
|
@stock_article = StockArticle.find(params[:stock_article][:id])
|
||||||
else
|
|
||||||
page.replace_html 'new_stock_article', :partial => 'stock_article_form',
|
if @stock_article.update_attributes(params[:stock_article])
|
||||||
:locals => {:stock_article => article}
|
render :layout => false
|
||||||
end
|
else
|
||||||
|
render :action => 'edit_stock_article', :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_stock_change
|
def add_stock_change
|
||||||
|
@stock_change = StockChange.new
|
||||||
|
@stock_change.stock_article = StockArticle.find(params[:stock_article_id])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_new_stock_article_form
|
|
||||||
article = Article.find(params[:article_id])
|
|
||||||
@supplier = article.supplier
|
|
||||||
stock_article = @supplier.stock_articles.build(
|
|
||||||
article.attributes.reject { |attr| attr == ('id' || 'type')}
|
|
||||||
)
|
|
||||||
|
|
||||||
render :partial => 'stock_article_form', :locals => {:stock_article => stock_article}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -158,5 +158,13 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
flash_messages.join("\n").html_safe
|
flash_messages.join("\n").html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# render base errors in a form after failed validation
|
||||||
|
# http://railsapps.github.io/twitter-bootstrap-rails.html
|
||||||
|
def base_errors resource
|
||||||
|
return '' if (resource.errors.empty?) or (resource.errors[:base].empty?)
|
||||||
|
messages = resource.errors[:base].map { |msg| content_tag(:li, msg) }.join
|
||||||
|
render :partial => 'shared/base_errors', :locals => {:error_messages => messages}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module DeliveriesHelper
|
module DeliveriesHelper
|
||||||
|
|
||||||
def link_to_invoice(delivery)
|
def link_to_invoice(delivery)
|
||||||
if delivery.invoice
|
if delivery.invoice
|
||||||
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
link_to number_to_currency(delivery.invoice.amount), [:finance, delivery.invoice],
|
||||||
|
@ -9,9 +9,29 @@ module DeliveriesHelper
|
||||||
class: 'btn btn-mini'
|
class: 'btn btn-mini'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def stock_articles_for_select(supplier)
|
def articles_for_select2(supplier)
|
||||||
supplier.stock_articles.undeleted.reorder('articles.name ASC').map {|a| ["#{a.name} (#{number_to_currency a.price}/#{a.unit})", a.id] }
|
supplier.articles.undeleted.reorder('articles.name ASC').map {|a| {:id => a.id, :text => "#{a.name} (#{number_to_currency a.price}/#{a.unit})"} }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def stock_articles_for_table(supplier)
|
||||||
|
supplier.stock_articles.undeleted.reorder('articles.name ASC')
|
||||||
|
end
|
||||||
|
|
||||||
|
def stock_change_remove_link(stock_change_form)
|
||||||
|
return link_to t('.remove_article'), "#", :class => 'remove_new_stock_change btn btn-small' if stock_change_form.object.new_record?
|
||||||
|
output = stock_change_form.hidden_field :_destroy
|
||||||
|
output += link_to t('.remove_article'), "#", :class => 'destroy_stock_change btn btn-small'
|
||||||
|
return output.html_safe
|
||||||
|
end
|
||||||
|
|
||||||
|
def stock_article_price_hint(stock_article)
|
||||||
|
t('simple_form.hints.stock_article.edit_stock_article.price',
|
||||||
|
:stock_article_copy_link => link_to(t('.copy_stock_article'),
|
||||||
|
copy_stock_article_supplier_deliveries_path(@supplier, :old_stock_article_id => stock_article.id),
|
||||||
|
:remote => true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,11 +2,15 @@ class Delivery < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :supplier
|
belongs_to :supplier
|
||||||
has_one :invoice
|
has_one :invoice
|
||||||
has_many :stock_changes, :dependent => :destroy
|
has_many :stock_changes,
|
||||||
|
:dependent => :destroy,
|
||||||
|
:include => 'stock_article',
|
||||||
|
:order => 'articles.name ASC'
|
||||||
|
|
||||||
scope :recent, :order => 'created_at DESC', :limit => 10
|
scope :recent, :order => 'created_at DESC', :limit => 10
|
||||||
|
|
||||||
validates_presence_of :supplier_id
|
validates_presence_of :supplier_id, :delivered_on
|
||||||
|
validate :stock_articles_must_be_unique
|
||||||
|
|
||||||
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
accepts_nested_attributes_for :stock_changes, :allow_destroy => :true
|
||||||
|
|
||||||
|
@ -15,6 +19,18 @@ class Delivery < ActiveRecord::Base
|
||||||
stock_changes.build(attributes) unless attributes[:quantity].to_i == 0
|
stock_changes.build(attributes) unless attributes[:quantity].to_i == 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def includes_article?(article)
|
||||||
|
self.stock_changes.map{|stock_change| stock_change.stock_article.id}.include? article.id
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def stock_articles_must_be_unique
|
||||||
|
unless stock_changes.reject{|sc| sc.marked_for_destruction?}.map {|sc| sc.stock_article.id}.uniq!.nil?
|
||||||
|
errors.add(:base, I18n.t('model.delivery.each_stock_article_must_be_unique'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,136 @@
|
||||||
- content_for :javascript do
|
- content_for :javascript do
|
||||||
:javascript
|
:javascript
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.destroy_stock_change').live('click', function() {
|
$('#stock_changes').on('click', '.destroy_stock_change', function() {
|
||||||
$(this).prev('input').val('1').parent().hide();
|
$(this).prev('input').val('1'); // check for destruction
|
||||||
|
|
||||||
|
var stock_change = $(this).closest('tr');
|
||||||
|
stock_change.hide(); // do not remove (to ensure destruction)
|
||||||
|
stock_change.removeAttr('id'); // remove id to allow re-adding
|
||||||
|
mark_article_for_delivery( stock_change.data('id') );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.remove_new_stock_change').live('click', function() {
|
$('#stock_changes').on('click', '.remove_new_stock_change', function() {
|
||||||
$(this).parent().remove();
|
var stock_change = $(this).closest('tr');
|
||||||
|
stock_change.remove();
|
||||||
|
mark_article_for_delivery( stock_change.data('id') );
|
||||||
return false;
|
return false;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#new_stock_article').removeAttr('disabled').select2({
|
||||||
|
placeholder: '#{t '.create_stock_article'}',
|
||||||
|
data: #{articles_for_select2(@supplier).to_json},
|
||||||
|
createSearchChoice: function(term) {
|
||||||
|
return {
|
||||||
|
id: 'new',
|
||||||
|
text: term
|
||||||
|
};
|
||||||
|
},
|
||||||
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
|
if(result.id == 'new') {
|
||||||
|
return result.text + ' (#{t '.create_from_blank'})';
|
||||||
|
}
|
||||||
|
var markup=[];
|
||||||
|
Select2.util.markMatch(result.text, query.term, markup, escapeMarkup);
|
||||||
|
return markup.join("");
|
||||||
|
}
|
||||||
|
}).on('change', function(e) {
|
||||||
|
var selectedArticle = $(e.currentTarget).select2('data');
|
||||||
|
if(!selectedArticle) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if('new' == selectedArticle.id) {
|
||||||
|
$.ajax({
|
||||||
|
url: '#{new_stock_article_supplier_deliveries_path(@supplier)}',
|
||||||
|
type: 'get',
|
||||||
|
data: {stock_article: {name: selectedArticle.text}},
|
||||||
|
contentType: 'application/json; charset=UTF-8'
|
||||||
|
});
|
||||||
|
$('#new_stock_article').select2('data', null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if('' != selectedArticle.id) {
|
||||||
|
$.ajax({
|
||||||
|
url: '#{derive_stock_article_supplier_deliveries_path(@supplier)}',
|
||||||
|
type: 'get',
|
||||||
|
data: {old_article_id: selectedArticle.id},
|
||||||
|
contentType: 'application/json; charset=UTF-8'
|
||||||
|
});
|
||||||
|
$('#new_stock_article').select2('data', null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
enablePriceTooltips();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function mark_article_for_delivery(stock_article_id) {
|
||||||
|
var articleTr = $('#stock_article_' + stock_article_id);
|
||||||
|
if( is_article_available_for_delivery(stock_article_id) ) {
|
||||||
|
articleTr.removeClass('unavailable');
|
||||||
|
$('.button-add-stock-change', articleTr).removeAttr('disabled');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
articleTr.addClass('unavailable');
|
||||||
|
$('.button-add-stock-change', articleTr).attr('disabled', 'disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function is_article_available_for_delivery(stock_article_id) {
|
||||||
|
return ( 0 == $('#stock_change_stock_article_' + stock_article_id).length );
|
||||||
|
}
|
||||||
|
|
||||||
|
function enablePriceTooltips(context) {
|
||||||
|
$('[data-toggle~="tooltip"]', context).tooltip({
|
||||||
|
animation: false,
|
||||||
|
html: true,
|
||||||
|
placement: 'left'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||||
= f.hidden_field :supplier_id
|
= f.error_notification
|
||||||
#stock_changes
|
= base_errors f.object
|
||||||
= f.fields_for :stock_changes do |stock_change_form|
|
= f.association :supplier, :as => :hidden
|
||||||
%p
|
|
||||||
= stock_change_form.select :stock_article_id, stock_articles_for_select(@supplier)
|
%h2= t '.title_select_stock_articles'
|
||||||
Menge
|
%table.table.table-hover#stock_articles_for_adding
|
||||||
= stock_change_form.text_field :quantity, size: 5, autocomplete: 'off'
|
%thead
|
||||||
= stock_change_form.hidden_field :_destroy
|
%tr
|
||||||
= link_to t('.remove_article'), "#", class: 'destroy_stock_change'
|
%th.dom-sort-triggerer.default-sort{:data => {'compare-function' => 'compareText', 'sort-criterion' => 'sort-by-name'}}
|
||||||
%p
|
= t '.article'
|
||||||
= link_to t('.add_article'), {action: 'add_stock_change', supplier_id: @supplier.id}, remote: true
|
%th= t '.price'
|
||||||
%p
|
%th= t '.unit'
|
||||||
%small= t('.note_new_article', new_link: link_to(t('.note_new_article_link'), new_stock_article_path)).html_safe
|
%th= t '.category'
|
||||||
%hr/
|
%th= t '.actions'
|
||||||
|
%tfoot
|
||||||
|
%tr
|
||||||
|
%th{:colspan => 5}
|
||||||
|
- if articles_for_select2(@supplier).empty?
|
||||||
|
= link_to t('.create_stock_article'), new_stock_article_supplier_deliveries_path(@supplier), :remote => true, :class => 'btn'
|
||||||
|
- else
|
||||||
|
%input#new_stock_article{:style => 'width: 500px;'}
|
||||||
|
%tbody
|
||||||
|
- for article in stock_articles_for_table(@supplier)
|
||||||
|
= render :partial => 'stock_article_for_adding', :locals => {:article => article}
|
||||||
|
|
||||||
|
%h2= t '.title_fill_quantities'
|
||||||
|
%table.table#stock_changes
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th.dom-sort-triggerer.default-sort{:data => {'compare-function' => 'compareText', 'sort-criterion' => 'sort-by-name'}}
|
||||||
|
= t '.article'
|
||||||
|
%th= t '.price'
|
||||||
|
%th= t '.unit'
|
||||||
|
%th= t '.quantity'
|
||||||
|
%th= t '.actions'
|
||||||
|
%tbody
|
||||||
|
= f.simple_fields_for :stock_changes do |stock_change_form|
|
||||||
|
= render :partial => 'stock_change_fields', :locals => {:f => stock_change_form}
|
||||||
|
|
||||||
|
%h2= t '.title_finish_delivery'
|
||||||
= f.input :delivered_on, as: :date_picker
|
= f.input :delivered_on, as: :date_picker
|
||||||
= f.input :note, input_html: {size: '35x4'}
|
= f.input :note, input_html: {size: '35x4'}
|
||||||
.form-actions
|
.form-actions
|
||||||
= f.submit class: 'btn btn-primary'
|
= f.submit class: 'btn btn-primary'
|
||||||
= link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier)
|
= link_to t('ui.or_cancel'), supplier_deliveries_path(@supplier)
|
||||||
|
|
||||||
/
|
|
||||||
TODO: Fix this!!
|
|
||||||
.span6
|
|
||||||
%h2= t '.new_article.title'
|
|
||||||
%p
|
|
||||||
= t('.new_article.search', supplier: @supplier.name).html_safe + ': '
|
|
||||||
= text_field_tag 'article_name'
|
|
||||||
%hr/
|
|
||||||
#stock_article_form
|
|
||||||
= render 'stock_article_form', stock_article: @supplier.stock_articles.build
|
|
||||||
|
|
11
app/views/deliveries/_stock_article_for_adding.html.haml
Normal file
11
app/views/deliveries/_stock_article_for_adding.html.haml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- css_class = ( @delivery and @delivery.includes_article? article ) ? ( 'unavailable' ) : ( false )
|
||||||
|
%tr{:id => "stock_article_#{article.id}", :class => css_class}
|
||||||
|
%td.sort-by-name= article.name
|
||||||
|
%td{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => article})}}= number_to_currency article.price
|
||||||
|
%td= article.unit
|
||||||
|
%td.sort-by-category= article.article_category.name
|
||||||
|
%td
|
||||||
|
= link_to t('.action_edit'), edit_stock_article_supplier_deliveries_path(@supplier, :stock_article_id => article.id), remote: true, class: 'btn btn-mini'
|
||||||
|
= link_to t('.action_other_price'), copy_stock_article_supplier_deliveries_path(@supplier, :old_stock_article_id => article.id), remote: true, class: 'btn btn-mini'
|
||||||
|
- deliver_button_disabled = ( @delivery and @delivery.includes_article? article ) ? ( 'disabled' ) : ( false )
|
||||||
|
= link_to t('.action_add_to_delivery'), add_stock_change_supplier_deliveries_path(@supplier, :stock_article_id => article.id), :method => :post, remote: true, class: 'button-add-stock-change btn btn-mini btn-primary', disabled: deliver_button_disabled
|
|
@ -1,14 +1,23 @@
|
||||||
= simple_form_for stock_article, url: add_stock_article_supplier_deliveries_path(@supplier), remote: true,
|
- url = ( stock_article.new_record? ) ? ( create_stock_article_supplier_deliveries_path(@supplier) ) : ( update_stock_article_supplier_deliveries_path(@supplier) )
|
||||||
validate: true do |f|
|
= simple_form_for stock_article, url: url, remote: true, validate: true do |f|
|
||||||
= f.hidden_field :supplier_id
|
= f.association :supplier, :as => :hidden
|
||||||
= f.input :name
|
= f.hidden_field :id unless stock_article.new_record?
|
||||||
= f.input :unit
|
.modal-header
|
||||||
= f.input :note
|
= link_to t('ui.marks.close').html_safe, '#', class: 'close', data: {dismiss: 'modal'}
|
||||||
= f.input :price
|
%h3= t 'activerecord.models.stock_article'
|
||||||
= f.input :tax, :wrapper => :append do
|
.modal-body
|
||||||
= f.input_field :tax
|
= f.input :name
|
||||||
%span.add-on %
|
= f.input :unit
|
||||||
-# untested, because this view is currently not included (?)
|
= f.input :note
|
||||||
= f.input :deposit
|
- if stock_article.new_record?
|
||||||
= f.association :article_category
|
= f.input :price
|
||||||
= f.submit class: 'btn'
|
= f.input :tax, :wrapper => :append do
|
||||||
|
= f.input_field :tax
|
||||||
|
%span.add-on %
|
||||||
|
= f.input :deposit
|
||||||
|
- else
|
||||||
|
= f.input :price, :input_html => {:disabled => 'disabled'}, :hint => stock_article_price_hint(stock_article)
|
||||||
|
= f.association :article_category
|
||||||
|
.modal-footer
|
||||||
|
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||||
|
= f.submit :class => 'btn btn-primary', 'data-disable-with' => t('ui.please_wait')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
%p
|
- if stock_change.stock_article.new_record?
|
||||||
= fields_for "delivery[new_stock_changes][]", stock_change do |form|
|
= simple_fields_for "delivery[new_stock_changes_new_stock_article][]", stock_change do |f|
|
||||||
= form.select :stock_article_id, stock_articles_for_select(supplier)
|
= render :partial => 'stock_change_fields', :locals => {:f => f}
|
||||||
Menge
|
- else
|
||||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
= simple_fields_for "delivery[new_stock_changes][]", stock_change do |f|
|
||||||
= link_to t('.remove_article'), "#", :class => 'remove_new_stock_change'
|
= render :partial => 'stock_change_fields', :locals => {:f => f}
|
||||||
|
|
10
app/views/deliveries/_stock_change_fields.html.haml
Normal file
10
app/views/deliveries/_stock_change_fields.html.haml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
- stock_change = f.object
|
||||||
|
- stock_article = stock_change.stock_article
|
||||||
|
%tr{:id => "stock_change_stock_article_#{stock_article.id}", :data => {:id => stock_article.id}}
|
||||||
|
%td.sort-by-name
|
||||||
|
%span.stock_article_name= stock_change.stock_article.name
|
||||||
|
= f.association :stock_article, :as => :hidden
|
||||||
|
%td.price{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_article})}}= number_to_currency stock_article.price
|
||||||
|
%td.unit= stock_change.stock_article.unit
|
||||||
|
%td= f.input :quantity, :wrapper => :intable, :input_html => {:class => 'stock-change-quantity', :autocomplete => :off}
|
||||||
|
%td= stock_change_remove_link f
|
25
app/views/deliveries/add_stock_change.js.erb
Normal file
25
app/views/deliveries/add_stock_change.js.erb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
(function(w) {
|
||||||
|
if(!is_article_available_for_delivery(<%= @stock_change.stock_article.id %>)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#stock_changes tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_change = $(
|
||||||
|
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_change);
|
||||||
|
|
||||||
|
$('#stock_changes').append(stock_change);
|
||||||
|
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
|
||||||
|
updateSort('#stock_changes');
|
||||||
|
|
||||||
|
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>'); <%# how to properly escape here? %>
|
||||||
|
if(null === quantity) {
|
||||||
|
stock_change.remove();
|
||||||
|
mark_article_for_delivery(<%= @stock_change.stock_article.id %>);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('input.stock-change-quantity', stock_change).val(quantity);
|
||||||
|
|
||||||
|
})(window);
|
|
@ -1 +0,0 @@
|
||||||
$('#stock_changes').append('#{escape_javascript(render(:partial => 'stock_change', :locals => {:stock_change => StockChange.new, :supplier => @supplier}))}');
|
|
5
app/views/deliveries/copy_stock_article.js.erb
Normal file
5
app/views/deliveries/copy_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
17
app/views/deliveries/create_stock_article.js.erb
Normal file
17
app/views/deliveries/create_stock_article.js.erb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
$('div.container-fluid').prepend(
|
||||||
|
'<%= j(render(:partial => 'shared/alert_success', :locals => {:alert_message => t('.notice', :name => @stock_article.name)})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
$('#stock_articles_for_adding tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_article_for_adding = $(
|
||||||
|
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_article_for_adding);
|
||||||
|
|
||||||
|
$('#stock_articles_for_adding tbody').append(stock_article_for_adding);
|
||||||
|
updateSort('#stock_articles_for_adding');
|
||||||
|
})();
|
||||||
|
|
||||||
|
$('#modalContainer').modal('hide');
|
5
app/views/deliveries/derive_stock_article.js.erb
Normal file
5
app/views/deliveries/derive_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
5
app/views/deliveries/edit_stock_article.js.erb
Normal file
5
app/views/deliveries/edit_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
5
app/views/deliveries/new_stock_article.js.erb
Normal file
5
app/views/deliveries/new_stock_article.js.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
$('#modalContainer').html(
|
||||||
|
'<%= j(render(:partial => "stock_article_form", :locals => {:stock_article => @stock_article})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#modalContainer').modal();
|
33
app/views/deliveries/update_stock_article.js.erb
Normal file
33
app/views/deliveries/update_stock_article.js.erb
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
$('div.container-fluid').prepend(
|
||||||
|
'<%= j(render(:partial => 'shared/alert_success', :locals => {:alert_message => t('.notice', :name => @stock_article.name)})) %>'
|
||||||
|
);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// update entry in stock_article table
|
||||||
|
|
||||||
|
$('#stock_articles_for_adding tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_article_for_adding = $(
|
||||||
|
'<%= j(render(:partial => 'stock_article_for_adding', :locals => {:article => @stock_article, :delivery => @delivery})) %>'
|
||||||
|
).addClass('success');
|
||||||
|
enablePriceTooltips(stock_article_for_adding);
|
||||||
|
|
||||||
|
$('#stock_article_<%= @stock_article.id %>').replaceWith(stock_article_for_adding);
|
||||||
|
updateSort('#stock_articles_for_adding');
|
||||||
|
|
||||||
|
mark_article_for_delivery(<%= @stock_article.id %>);
|
||||||
|
|
||||||
|
// update entry in stock_changes table
|
||||||
|
|
||||||
|
$('#stock_changes tr').removeClass('success');
|
||||||
|
|
||||||
|
var stock_change_entry = $('#stock_change_stock_article_<%= @stock_article.id %>');
|
||||||
|
$('.stock_article_name', stock_change_entry).text('<%= j(@stock_article.name) %>');
|
||||||
|
$('.unit', stock_change_entry).text('<%= j(@stock_article.unit) %>');
|
||||||
|
|
||||||
|
stock_change_entry.addClass('success');
|
||||||
|
|
||||||
|
updateSort('#stock_changes');
|
||||||
|
})();
|
||||||
|
|
||||||
|
$('#modalContainer').modal('hide');
|
5
app/views/shared/_alert_success.haml
Normal file
5
app/views/shared/_alert_success.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.alert.fade.in.alert-success
|
||||||
|
%a.close{:href => '#', :data => {:dismiss => 'alert'}}
|
||||||
|
= t('ui.marks.close').html_safe
|
||||||
|
= t('ui.marks.success').html_safe
|
||||||
|
= alert_message
|
17
app/views/shared/_article_price_info.html.haml
Normal file
17
app/views/shared/_article_price_info.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
%table.table.table-condensed
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.price'
|
||||||
|
%td.numeric= number_to_currency article.price
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.deposit'
|
||||||
|
%td.numeric= number_to_currency article.deposit
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.tax'
|
||||||
|
%td.numeric= number_to_percentage article.tax
|
||||||
|
- unless article.fc_price == article.gross_price
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.fc_share'
|
||||||
|
%td.numeric= number_to_currency(article.fc_price-article.gross_price)
|
||||||
|
%tr
|
||||||
|
%th= t 'activerecord.attributes.article.fc_price'
|
||||||
|
%td.numeric= number_to_currency article.fc_price
|
5
app/views/shared/_base_errors.haml
Normal file
5
app/views/shared/_base_errors.haml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
.alert.alert-error.alert-block
|
||||||
|
%a.close{:href => '#', :data => {:dismiss => 'alert'}}
|
||||||
|
= t('ui.marks.close').html_safe
|
||||||
|
%ul
|
||||||
|
= error_messages.html_safe
|
|
@ -4,11 +4,5 @@ var successDiv = $('<div class="alert fade in alert-success"><a class="close" da
|
||||||
successDiv.append(document.createTextNode('#{escape_javascript(t('.notice', name: @article.name))}'));
|
successDiv.append(document.createTextNode('#{escape_javascript(t('.notice', name: @article.name))}'));
|
||||||
$('div.container-fluid').prepend(successDiv);
|
$('div.container-fluid').prepend(successDiv);
|
||||||
|
|
||||||
-# WARNING: If you try to use the escape j(...) here, an error occurs:
|
|
||||||
-# Ein Fehler ist aufgetreten: undefined method `gsub' for 50:Fixnum
|
|
||||||
-# However, it should work without without escaping.
|
|
||||||
-# Note that article names which are purely numeric, e.g. 12345, are escaped correctly (see above).
|
|
||||||
|
|
||||||
$('#stockArticle-#{@article.id}').remove();
|
$('#stockArticle-#{@article.id}').remove();
|
||||||
|
|
||||||
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.
|
-# WARNING: Do not use a simple .fadeOut() above, because it conflicts with the show/hide function of unavailable articles.
|
||||||
|
|
|
@ -36,7 +36,18 @@ SimpleForm.setup do |config|
|
||||||
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
input.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Do not use the label in tables
|
||||||
|
config.wrappers :intable, :tag => 'div', :class => 'control-group control-group-intable', :error_class => 'error' do |b|
|
||||||
|
b.use :html5
|
||||||
|
b.use :placeholder
|
||||||
|
b.wrapper :tag => 'div', :class => 'controls controls-intable' do |ba|
|
||||||
|
ba.use :input
|
||||||
|
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
|
||||||
|
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
# Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
|
||||||
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
# Check the Bootstrap docs (http://twitter.github.com/bootstrap)
|
||||||
# to learn about the different styles for forms and inputs,
|
# to learn about the different styles for forms and inputs,
|
||||||
|
|
|
@ -39,6 +39,8 @@ de:
|
||||||
article_category: Kategorie
|
article_category: Kategorie
|
||||||
availability: Artikel ist verfügbar?
|
availability: Artikel ist verfügbar?
|
||||||
deposit: Pfand
|
deposit: Pfand
|
||||||
|
fc_price: Endpreis
|
||||||
|
fc_share: FC-Aufschlag
|
||||||
gross_price: Bruttopreis
|
gross_price: Bruttopreis
|
||||||
price: Nettopreis
|
price: Nettopreis
|
||||||
tax: MwSt
|
tax: MwSt
|
||||||
|
@ -421,20 +423,28 @@ de:
|
||||||
second: Sekunden
|
second: Sekunden
|
||||||
year: Jahr
|
year: Jahr
|
||||||
deliveries:
|
deliveries:
|
||||||
|
add_stock_change:
|
||||||
|
how_many_units: Wie viele Einheiten (%{unit}) des Artikels »%{name}« liefern?
|
||||||
create:
|
create:
|
||||||
notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!
|
notice: Lieferung wurde erstellt. Bitte nicht vergessen die Rechnung anzulegen!
|
||||||
|
create_stock_article:
|
||||||
|
notice: Neuer Lagerartikel »%{name}« gespeichert.
|
||||||
destroy:
|
destroy:
|
||||||
notice: Lieferung wurde gelöscht.
|
notice: Lieferung wurde gelöscht.
|
||||||
edit:
|
edit:
|
||||||
title: Lieferung bearbeiten
|
title: Lieferung bearbeiten
|
||||||
form:
|
form:
|
||||||
add_article: Lagerartikel der Lieferung hinzufügen
|
actions: Optionen
|
||||||
new_article:
|
article: Artikel
|
||||||
search: Suche nach Artikeln aus dem <i>%{supplier}</i> Katalog
|
category: Kategorie
|
||||||
title: Neuen Lagerartikel anlegen
|
create_from_blank: Ohne Vorlage anlegen
|
||||||
note_new_article: Ist ein Artikel noch nicht in der Lagerverwaltung, muss er erst %{new_link} werden.
|
create_stock_article: Lagerartikel anlegen
|
||||||
note_new_article_link: neu angelegt
|
price: Nettopreis
|
||||||
remove_article: Artikel aus Lieferung entfernen
|
quantity: Menge
|
||||||
|
title_fill_quantities: 2. Liefermenge angeben
|
||||||
|
title_finish_delivery: 3. Lieferung abschließen
|
||||||
|
title_select_stock_articles: 1. Lagerartikel auswählen
|
||||||
|
unit: Einheit
|
||||||
index:
|
index:
|
||||||
confirm_delete: Bist Du sicher?
|
confirm_delete: Bist Du sicher?
|
||||||
new_delivery: Neue Lieferung für %{supplier} anlegen
|
new_delivery: Neue Lieferung für %{supplier} anlegen
|
||||||
|
@ -454,11 +464,19 @@ de:
|
||||||
title: Lieferung anzeigen
|
title: Lieferung anzeigen
|
||||||
title_articles: Artikel
|
title_articles: Artikel
|
||||||
unit: Einheit
|
unit: Einheit
|
||||||
stock_change:
|
stock_article_for_adding:
|
||||||
|
action_add_to_delivery: 'Liefern'
|
||||||
|
action_edit: 'Bearbeiten'
|
||||||
|
action_other_price: 'Kopieren'
|
||||||
|
stock_article_form:
|
||||||
|
copy_stock_article: 'Lagerartikel kopieren'
|
||||||
|
stock_change_fields:
|
||||||
remove_article: Artikel aus Lieferung entfernen
|
remove_article: Artikel aus Lieferung entfernen
|
||||||
suppliers_overview: Lieferantenübersicht
|
suppliers_overview: Lieferantenübersicht
|
||||||
update:
|
update:
|
||||||
notice: Lieferung wurde aktualisiert.
|
notice: Lieferung wurde aktualisiert.
|
||||||
|
update_stock_article:
|
||||||
|
notice: Lagerartikel »%{name}« aktualisiert.
|
||||||
documents:
|
documents:
|
||||||
order_by_articles:
|
order_by_articles:
|
||||||
filename: Bestellung %{name}-%{date} - Artikelsortierung
|
filename: Bestellung %{name}-%{date} - Artikelsortierung
|
||||||
|
@ -1151,6 +1169,8 @@ de:
|
||||||
subject: ! 'Betreff:'
|
subject: ! 'Betreff:'
|
||||||
title: Nachricht anzeigen
|
title: Nachricht anzeigen
|
||||||
model:
|
model:
|
||||||
|
delivery:
|
||||||
|
each_stock_article_must_be_unique: Lieferung darf jeden Lagerartikel höchstens einmal auflisten.
|
||||||
membership:
|
membership:
|
||||||
no_admin_delete: Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin
|
no_admin_delete: Mitgliedschaft kann nicht beendet werden. Du bist die letzte Administratorin
|
||||||
order_article:
|
order_article:
|
||||||
|
@ -1515,6 +1535,10 @@ de:
|
||||||
update_current_price: Ändert auch den Preis für aktuelle Bestellungen
|
update_current_price: Ändert auch den Preis für aktuelle Bestellungen
|
||||||
stock_article:
|
stock_article:
|
||||||
supplier:
|
supplier:
|
||||||
|
copy_stock_article:
|
||||||
|
name: Bitte ändern
|
||||||
|
edit_stock_article:
|
||||||
|
price: ! '<ul><li>Preisänderung gesperrt.</li><li>Bei Bedarf %{stock_article_copy_link}.</li></ul>'
|
||||||
supplier:
|
supplier:
|
||||||
min_order_quantity: Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren
|
min_order_quantity: Die Mindestbestellmenge wird während der Bestellung angezeigt und soll motivieren
|
||||||
task:
|
task:
|
||||||
|
@ -1834,7 +1858,9 @@ de:
|
||||||
history: Verlauf anzeigen
|
history: Verlauf anzeigen
|
||||||
marks:
|
marks:
|
||||||
close: ! '×'
|
close: ! '×'
|
||||||
|
success: ! '<i class="icon icon-ok"></i>'
|
||||||
or_cancel: oder abbrechen
|
or_cancel: oder abbrechen
|
||||||
|
please_wait: Bitte warten...
|
||||||
save: Speichern
|
save: Speichern
|
||||||
show: Anzeigen
|
show: Anzeigen
|
||||||
views:
|
views:
|
||||||
|
|
|
@ -39,6 +39,8 @@ en:
|
||||||
article_category: article category
|
article_category: article category
|
||||||
availability: Is article available?
|
availability: Is article available?
|
||||||
deposit: deposit
|
deposit: deposit
|
||||||
|
fc_price: FC price
|
||||||
|
fc_share: FC share
|
||||||
gross_price: gross price
|
gross_price: gross price
|
||||||
price: price
|
price: price
|
||||||
tax: VAT
|
tax: VAT
|
||||||
|
@ -423,20 +425,28 @@ en:
|
||||||
second: seconds
|
second: seconds
|
||||||
year: years
|
year: years
|
||||||
deliveries:
|
deliveries:
|
||||||
|
add_stock_change:
|
||||||
|
how_many_units: 'How many units (%{unit}) to deliver? Stock article name: %{name}.'
|
||||||
create:
|
create:
|
||||||
notice: Delivery was created. Please don’t forget to create invoice!
|
notice: Delivery was created. Please don’t forget to create invoice!
|
||||||
|
create_stock_article:
|
||||||
|
notice: The new stock article »%{name}« was saved.
|
||||||
destroy:
|
destroy:
|
||||||
notice: Delivery was deleted.
|
notice: Delivery was deleted.
|
||||||
edit:
|
edit:
|
||||||
title: Edit suppliers
|
title: Edit delivery
|
||||||
form:
|
form:
|
||||||
add_article: Add stock article to delivery
|
actions: Tasks
|
||||||
new_article:
|
article: Article
|
||||||
search: Search for articles in the <i>%{supplier}</i> catalogue
|
category: Category
|
||||||
title: Create new stock article
|
copy_order_article: Copy order article
|
||||||
note_new_article: When an article is not yet in the inventory, you have to %{new_link} it first.
|
new_stock_article: Create new stock article
|
||||||
note_new_article_link: create
|
price: Netprice
|
||||||
remove_article: Remove article from delivery
|
quantity: Quantity
|
||||||
|
title_fill_quantities: 2. Set delivery quantities
|
||||||
|
title_finish_delivery: 3. Finish delivery
|
||||||
|
title_select_stock_articles: 1. Select stock articles
|
||||||
|
unit: Unit
|
||||||
index:
|
index:
|
||||||
confirm_delete: Are you sure?
|
confirm_delete: Are you sure?
|
||||||
new_delivery: ! 'Create new delivery for %{supplier} '
|
new_delivery: ! 'Create new delivery for %{supplier} '
|
||||||
|
@ -456,11 +466,19 @@ en:
|
||||||
title: Show delivery
|
title: Show delivery
|
||||||
title_articles: Article
|
title_articles: Article
|
||||||
unit: Unit
|
unit: Unit
|
||||||
stock_change:
|
stock_article_for_adding:
|
||||||
remove_article: Remove articles from delivery
|
action_add_to_delivery: 'Add to delivery'
|
||||||
|
action_edit: 'Edit'
|
||||||
|
action_other_price: 'Copy'
|
||||||
|
stock_article_form:
|
||||||
|
copy_stock_article: 'Lagerartikel kopieren'
|
||||||
|
stock_change_fields:
|
||||||
|
remove_article: Remove article from delivery
|
||||||
suppliers_overview: Supplier overview
|
suppliers_overview: Supplier overview
|
||||||
update:
|
update:
|
||||||
notice: Delivery was updated.
|
notice: Delivery was updated.
|
||||||
|
update_stock_article:
|
||||||
|
notice: The stock article »%{name}« was updated.
|
||||||
documents:
|
documents:
|
||||||
order_by_articles:
|
order_by_articles:
|
||||||
filename: Order %{name}-%{date} - by articles
|
filename: Order %{name}-%{date} - by articles
|
||||||
|
@ -1153,6 +1171,8 @@ en:
|
||||||
subject: ! 'Subject:'
|
subject: ! 'Subject:'
|
||||||
title: Show message
|
title: Show message
|
||||||
model:
|
model:
|
||||||
|
delivery:
|
||||||
|
each_stock_article_must_be_unique: Each stock article must not be listed more than once.
|
||||||
membership:
|
membership:
|
||||||
no_admin_delete: Membership can not be withdrawn as you are the last administrator.
|
no_admin_delete: Membership can not be withdrawn as you are the last administrator.
|
||||||
order_article:
|
order_article:
|
||||||
|
@ -1517,6 +1537,10 @@ en:
|
||||||
update_current_price: Also update the price of the current order
|
update_current_price: Also update the price of the current order
|
||||||
stock_article:
|
stock_article:
|
||||||
supplier:
|
supplier:
|
||||||
|
copy_stock_article:
|
||||||
|
name: Please modify
|
||||||
|
edit_stock_article:
|
||||||
|
price: ! '<ul><li>Price changes are forbidden.</li><li>If necessary, %{stock_article_copy_link}.</li></ul>'
|
||||||
supplier:
|
supplier:
|
||||||
min_order_quantity: The minimum amount which has to be orderd will be shown during the order process and should motivate ordering
|
min_order_quantity: The minimum amount which has to be orderd will be shown during the order process and should motivate ordering
|
||||||
task:
|
task:
|
||||||
|
|
|
@ -104,8 +104,15 @@ Foodsoft::Application.routes.draw do
|
||||||
get :shared_suppliers, :on => :collection
|
get :shared_suppliers, :on => :collection
|
||||||
|
|
||||||
resources :deliveries do
|
resources :deliveries do
|
||||||
post :drop_stock_change, :on => :member
|
post :add_stock_change, :on => :collection
|
||||||
post :add_stock_article, :on => :collection
|
|
||||||
|
get :new_stock_article, :on => :collection
|
||||||
|
get :copy_stock_article, :on => :collection
|
||||||
|
get :derive_stock_article, :on => :collection
|
||||||
|
post :create_stock_article, :on => :collection
|
||||||
|
|
||||||
|
get :edit_stock_article, :on => :collection
|
||||||
|
put :update_stock_article, :on => :collection
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :articles do
|
resources :articles do
|
||||||
|
|
|
@ -55,10 +55,10 @@ fi
|
||||||
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
sed -i "s|^\\(\\s*gem\\s\\+'sqlite3'\\)|#\1|" Gemfile
|
||||||
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
sed -i "s|^\\(\\s*sqlite3\\b\)|#\1|" Gemfile.lock
|
||||||
# make sure postgresql db is present, as it is the default heroku db
|
# make sure postgresql db is present, as it is the default heroku db
|
||||||
echo "\ngem 'pg'" >>Gemfile
|
echo $'\ngem "pg"' >>Gemfile
|
||||||
echo "\ngem 'localeapp'" >>Gemfile
|
echo $'\ngem "localeapp"' >>Gemfile
|
||||||
# always use unicorn
|
# always use unicorn
|
||||||
echo "\ngem 'unicorn'" >>Gemfile
|
echo $'\ngem "unicorn"' >>Gemfile
|
||||||
echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >Procfile
|
echo 'web: bundle exec unicorn -p $PORT -E $RACK_ENV' >Procfile
|
||||||
bundle install --quiet # to update Gemfile.lock
|
bundle install --quiet # to update Gemfile.lock
|
||||||
# do not ignore deployment files
|
# do not ignore deployment files
|
||||||
|
|
Loading…
Reference in a new issue