Merge branch 'master' into allow-no-nickname
Conflicts: app/views/foodcoop/users/_users.html.haml
This commit is contained in:
commit
c37ed74942
84 changed files with 1712 additions and 2579 deletions
|
|
@ -1,5 +1,4 @@
|
|||
//= require jquery
|
||||
//= require jquery-ui
|
||||
//= require jquery_ujs
|
||||
//= require select2
|
||||
//= require twitter/bootstrap
|
||||
|
|
@ -7,8 +6,16 @@
|
|||
//= require bootstrap-datepicker/core
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.de
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.nl
|
||||
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr
|
||||
//= require jquery.observe_field
|
||||
//= require list
|
||||
//= require list.unlist
|
||||
//= require list.delay
|
||||
//= require list.reset
|
||||
//= require rails.validations
|
||||
//= require rails.validations.simple_form
|
||||
//= require i18n
|
||||
//= require i18n/translations
|
||||
//= require_self
|
||||
//= require ordering
|
||||
//= require stupidtable
|
||||
|
|
@ -30,19 +37,19 @@ $.fn.extend({
|
|||
$(function() {
|
||||
|
||||
// Show/Hide a specific DOM element
|
||||
$('a[data-toggle-this]').live('click', function() {
|
||||
$(document).on('click', 'a[data-toggle-this]', function() {
|
||||
$($(this).data('toggle-this')).toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Remove this item from DOM
|
||||
$('a[data-remove-this]').live('click', function() {
|
||||
$(document).on('click', 'a[data-remove-this]', function() {
|
||||
$($(this).data('remove-this')).remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Check/Uncheck a single checkbox
|
||||
$('[data-check-this]').live('click', function() {
|
||||
$(document).on('click', '[data-check-this]', function() {
|
||||
var checkbox = $($(this).data('check-this'));
|
||||
checkbox.attr('checked', !checkbox.is(':checked'));
|
||||
highlightRow(checkbox);
|
||||
|
|
@ -50,7 +57,7 @@ $(function() {
|
|||
});
|
||||
|
||||
// Check/Uncheck all checkboxes for a specific form
|
||||
$('input[data-check-all]').live('click', function() {
|
||||
$(document).on('click', 'input[data-check-all]', function() {
|
||||
var status = $(this).is(':checked');
|
||||
var context = $(this).data('check-all');
|
||||
var elms = $('input[type="checkbox"]', context);
|
||||
|
|
@ -62,7 +69,7 @@ $(function() {
|
|||
});
|
||||
|
||||
// Submit form when changing a select menu.
|
||||
$('form[data-submit-onchange] select').live('change', function() {
|
||||
$(document).on('change', 'form[data-submit-onchange] select', function() {
|
||||
var confirmMessage = $(this).children(':selected').data('confirm');
|
||||
if (confirmMessage) {
|
||||
if (confirm(confirmMessage)) {
|
||||
|
|
@ -95,7 +102,7 @@ $(function() {
|
|||
});
|
||||
|
||||
// Remote paginations
|
||||
$('div.pagination[data-remote] a').live('click', function() {
|
||||
$(document).on('click', 'div.pagination[data-remote] a', function() {
|
||||
$.getScript($(this).attr('href'));
|
||||
return false;
|
||||
});
|
||||
|
|
@ -116,6 +123,20 @@ $(function() {
|
|||
|
||||
// Use bootstrap datepicker for dateinput
|
||||
$('.datepicker').datepicker({format: 'yyyy-mm-dd', language: I18n.locale});
|
||||
|
||||
// bootstrap tooltips (for price)
|
||||
// Extra options don't work when using selector, so override defaults
|
||||
// https://github.com/twbs/bootstrap/issues/3875 . These can still be
|
||||
// overridden per tooltip using data-placement attributes and the like.
|
||||
$.extend($.fn.tooltip.defaults, {
|
||||
html: true,
|
||||
animation: false,
|
||||
placement: 'left',
|
||||
container: 'body'
|
||||
});
|
||||
$(document).tooltip({
|
||||
selector: '[data-toggle~="tooltip"]',
|
||||
});
|
||||
|
||||
// See stupidtable.js for initialization of local table sorting
|
||||
});
|
||||
|
|
@ -142,3 +163,5 @@ function highlightRow(checkbox) {
|
|||
function setHiddenId(text, li) {
|
||||
$('hidden_id').value = li.id;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
jQuery ->
|
||||
$("a[rel=popover]").popover()
|
||||
$(".tooltip").tooltip()
|
||||
$("a[rel=tooltip]").tooltip()
|
||||
$("a[rel~=popover], .has-popover").popover()
|
||||
$("a[rel~=tooltip], .has-tooltip").tooltip()
|
||||
|
|
|
|||
50
app/assets/javascripts/list.delay.js
Normal file
50
app/assets/javascripts/list.delay.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
(function(window, undefined) {
|
||||
|
||||
window.List.prototype.plugins.delay = function(locals, options) {
|
||||
var list = this;
|
||||
|
||||
this.searchTimeout = undefined;
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
this.onload(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.delayedSearchClass = options.delayedSearchClass || 'delayed-search';
|
||||
options.delayedSearchTime = options.delayedSearchTime || 500;
|
||||
},
|
||||
callbacks: function(options) {
|
||||
$('.' + options.delayedSearchClass, list.listContainer).keyup(list.searchDelayStart);
|
||||
},
|
||||
onload: function(options) {
|
||||
var initialSearchTerm = $('.' + options.delayedSearchClass, list.listContainer).val();
|
||||
if('' != initialSearchTerm) {
|
||||
list.search(initialSearchTerm);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.searchDelayStart = function(searchString, columns) {
|
||||
// TODO: if keycode corresponds to 'ENTER' ? skip delay
|
||||
clearTimeout(list.searchTimeout);
|
||||
list.searchTimeout = window.setTimeout(
|
||||
function() {list.searchDelayEnd(searchString, columns)},
|
||||
options.delayedSearchTime
|
||||
);
|
||||
|
||||
$(list.listContainer).trigger('updateComing');
|
||||
};
|
||||
|
||||
this.searchDelayEnd = function(searchString, columns) {
|
||||
list.search(searchString, columns);
|
||||
};
|
||||
|
||||
init.start(options);
|
||||
}
|
||||
|
||||
})(window);
|
||||
42
app/assets/javascripts/list.reset.js
Normal file
42
app/assets/javascripts/list.reset.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
(function(window, undefined) {
|
||||
|
||||
window.List.prototype.plugins.reset = function(locals, options) {
|
||||
var list = this;
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.highlightClass = options.highlightClass || 'btn-primary';
|
||||
options.resetSearchClass = options.resetSearchClass || 'reset-search';
|
||||
options.resettableClass = options.resettableClass || 'resettable';
|
||||
},
|
||||
callbacks: function(options) {
|
||||
$('.' + options.resetSearchClass, list.listContainer).click(list.resetSearch);
|
||||
list.on('updated', list.highlightResetButton);
|
||||
|
||||
$(list.listContainer).on('updateComing', function() {
|
||||
list.highlightResetButton(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.highlightResetButton = function(highlightEnabled) {
|
||||
highlightEnabled = (undefined === highlightEnabled) ? (list.searched) : (highlightEnabled);
|
||||
$('.' + options.resetSearchClass, list.listContainer).toggleClass(options.highlightClass, highlightEnabled);
|
||||
};
|
||||
|
||||
this.resetSearch = function() {
|
||||
$('.' + options.resettableClass, list.listContainer).val('');
|
||||
list.search('');
|
||||
};
|
||||
|
||||
init.start(options);
|
||||
}
|
||||
|
||||
})(window);
|
||||
124
app/assets/javascripts/list.unlist.js
Normal file
124
app/assets/javascripts/list.unlist.js
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
// for use with listjs 0.2.0
|
||||
// https://github.com/javve/list.js
|
||||
|
||||
/*******************************************************************************
|
||||
********************************************************************************
|
||||
|
||||
The following code is a modification of list.js. It was created by copy-pasting
|
||||
the original code with the copyright notice below.
|
||||
|
||||
********************************************************************************
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Begin copyright notice of the original code
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
ListJS Beta 0.2.0
|
||||
By Jonny Strömberg (www.jonnystromberg.com, www.listjs.com)
|
||||
|
||||
OBS. The API is not frozen. It MAY change!
|
||||
|
||||
License (MIT)
|
||||
|
||||
Copyright (c) 2011 Jonny Strömberg http://jonnystromberg.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
End copyright notice of the original code
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
|
||||
(function(w, undefined) {
|
||||
/*******************************************************************************
|
||||
Begin copy-pasted and modified code
|
||||
*******************************************************************************/
|
||||
|
||||
// * template engine which adds class 'unlisted' instead of removing from DOM
|
||||
// * especially useful in case of formulars
|
||||
// * uses jQuery's $
|
||||
w.List.prototype.templateEngines.unlist = function(list, settings) {
|
||||
var h = w.ListJsHelpers;
|
||||
|
||||
// start with standard engine, override specific methods afterwards
|
||||
this.superClass = w.List.prototype.templateEngines.standard;
|
||||
this.superClass(list, settings);
|
||||
|
||||
// todo refer to listjs code instead of copy-pasting
|
||||
var listSource = h.getByClass(settings.listClass, list.listContainer, true);
|
||||
var templater = this;
|
||||
var ensure = {
|
||||
created: function(item) {
|
||||
if(item.elm === undefined) {
|
||||
templater.create(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var init = {
|
||||
start: function(options) {
|
||||
this.defaults(options);
|
||||
this.callbacks(options);
|
||||
},
|
||||
defaults: function(options) {
|
||||
options.listHeadingsClass = options.listHeadingsClass || 'list-heading';
|
||||
},
|
||||
callbacks: function(options) {
|
||||
list.on('updated', templater.updateListHeadings);
|
||||
}
|
||||
};
|
||||
|
||||
this.show = function(item) {
|
||||
ensure.created(item);
|
||||
listSource.appendChild(item.elm); // append item (or move it to the end)
|
||||
$(item.elm).removeClass('unlisted');
|
||||
};
|
||||
this.hide = function(item) {
|
||||
ensure.created(item);
|
||||
$(item.elm).addClass('unlisted');
|
||||
listSource.appendChild(item.elm);
|
||||
};
|
||||
this.clear = function() {
|
||||
$(listSource.childNodes).addClass('unlisted');
|
||||
};
|
||||
|
||||
this.updateListHeadings = function() {
|
||||
var headSel = '.' + settings.listHeadingsClass;
|
||||
|
||||
$(headSel, listSource).each(function() {
|
||||
var listedCount = $(this).nextUntil(headSel, ':not(.unlisted)').length;
|
||||
$(this).toggleClass('unlisted', 0==listedCount);
|
||||
});
|
||||
};
|
||||
|
||||
init.start(settings);
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
End copy-pasted and modified code
|
||||
*******************************************************************************/
|
||||
})(window);
|
||||
|
|
@ -7,9 +7,6 @@
|
|||
|
||||
var modified = false // indicates if anything has been clicked on this page
|
||||
var groupBalance = 0; // available group money
|
||||
var currencySeparator = "."; // default decimal separator
|
||||
var currencyPrecision = 2; // default digits behind comma
|
||||
var currencyUnit = "€"; // default currency
|
||||
var minimumBalance = 0; // minimum group balance for the order to be succesful
|
||||
var toleranceIsCostly = true; // default tolerance behaviour
|
||||
var isStockit = false; // Wheter the order is from stock oder normal supplier
|
||||
|
|
@ -23,12 +20,6 @@ var toleranceOthers = new Array();
|
|||
var itemsAllocated = new Array(); // how many items the group has been allocated and should definitely get
|
||||
var quantityAvailable = new Array(); // stock_order. how many items are currently in stock
|
||||
|
||||
function setCurrencyFormat(separator, precision, unit) {
|
||||
currencySeparator = separator;
|
||||
currencyPrecision = precision;
|
||||
currencyUnit = unit;
|
||||
}
|
||||
|
||||
function setToleranceBehaviour(value) {
|
||||
toleranceIsCostly = value;
|
||||
}
|
||||
|
|
@ -124,7 +115,7 @@ function update(item, quantity, tolerance) {
|
|||
} else {
|
||||
itemTotal[item] = price[item] * (Number(quantity));
|
||||
}
|
||||
$('#price_' + item + '_display').html(asMoney(itemTotal[item]));
|
||||
$('#price_' + item + '_display').html(I18n.l("currency", itemTotal[item]));
|
||||
|
||||
// update missing units
|
||||
var missing_units = unit[item] - (((quantityOthers[item] + Number(quantity)) % unit[item]) + Number(tolerance) + toleranceOthers[item])
|
||||
|
|
@ -137,10 +128,6 @@ function update(item, quantity, tolerance) {
|
|||
updateBalance();
|
||||
}
|
||||
|
||||
function asMoney(amount) {
|
||||
return String(amount.toFixed(currencyPrecision)).replace(/\./, currencySeparator) + ' ' + currencyUnit;
|
||||
}
|
||||
|
||||
function calcUnits(unitSize, quantity, tolerance) {
|
||||
var units = Math.floor(quantity / unitSize)
|
||||
var remainder = quantity % unitSize
|
||||
|
|
@ -158,10 +145,10 @@ function updateBalance() {
|
|||
for (i in itemTotal) {
|
||||
total += itemTotal[i];
|
||||
}
|
||||
$('#total_price').html(asMoney(total));
|
||||
$('#total_price').html(I18n.l("currency", total));
|
||||
var balance = groupBalance - total;
|
||||
$('#new_balance').html(asMoney(balance));
|
||||
$('#total_balance').val(asMoney(balance));
|
||||
$('#new_balance').html(I18n.l("currency", balance));
|
||||
$('#total_balance').val(I18n.l("currency", balance));
|
||||
// determine bgcolor and submit button state according to balance
|
||||
var bgcolor = '';
|
||||
if (balance < minimumBalance) {
|
||||
|
|
@ -191,6 +178,6 @@ $(function() {
|
|||
});
|
||||
|
||||
$('a[data-confirm_switch_order]').click(function() {
|
||||
return (!modified || confirm('Änderungen an dieser Bestellung gehen verloren, wenn zu einer anderen Bestellung gewechselt wird. Möchtest Du trotzdem wechseln?'));
|
||||
return (!modified || confirm(I18n.t('js.ordering.confirm_change')));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
*= require select2
|
||||
*= require token-input-bootstrappy
|
||||
*= require bootstrap-datepicker
|
||||
*= require list.unlist
|
||||
*/
|
||||
|
|
@ -1,24 +1,23 @@
|
|||
@import "twitter/bootstrap/bootstrap";
|
||||
@import "twitter/bootstrap/responsive";
|
||||
body {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
@import "twitter/bootstrap/responsive";
|
||||
|
||||
// Set the correct sprite paths
|
||||
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png');
|
||||
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png');
|
||||
@iconSpritePath: image-url('twitter/bootstrap/glyphicons-halflings.png');
|
||||
@iconWhiteSpritePath: image-url('twitter/bootstrap/glyphicons-halflings-white.png');
|
||||
|
||||
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
||||
// Note: If you use asset_path() here, your compiled boostrap_and_overrides.css will not
|
||||
// have the proper paths. So for now we use the absolute path.
|
||||
@fontAwesomeEotPath: '/assets/fontawesome-webfont.eot';
|
||||
@fontAwesomeWoffPath: '/assets/fontawesome-webfont.woff';
|
||||
@fontAwesomeTtfPath: '/assets/fontawesome-webfont.ttf';
|
||||
@fontAwesomeSvgPath: '/assets/fontawesome-webfont.svg';
|
||||
@fontAwesomeEotPath: asset-url('fontawesome-webfont.eot');
|
||||
@fontAwesomeEotPath_iefix: asset-url('fontawesome-webfont.eot?#iefix');
|
||||
@fontAwesomeWoffPath: asset-url('fontawesome-webfont.woff');
|
||||
@fontAwesomeTtfPath: asset-url('fontawesome-webfont.ttf');
|
||||
@fontAwesomeSvgPath: asset-url('fontawesome-webfont.svg#fontawesomeregular');
|
||||
@import 'fontawesome/font-awesome';
|
||||
|
||||
// Font Awesome
|
||||
@import "fontawesome";
|
||||
// Glyphicons
|
||||
//@import "twitter/bootstrap/sprites.less";
|
||||
|
||||
// Your custom LESS stylesheets goes here
|
||||
//
|
||||
|
|
@ -26,7 +25,7 @@ body {
|
|||
// you may use and inherit here
|
||||
//
|
||||
// If you'd like to override bootstrap's own variables, you can do so here as well
|
||||
// See http://twitter.github.com/bootstrap/less.html for their names and documentation
|
||||
// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
|
||||
//
|
||||
// Example:
|
||||
// @linkColor: #ff0000;
|
||||
|
|
@ -238,3 +237,8 @@ tr.unavailable {
|
|||
margin-bottom: 15px
|
||||
}
|
||||
}
|
||||
|
||||
// allow buttons as input add-on (with proper height)
|
||||
.input-append button.add-on {
|
||||
height: inherit;
|
||||
}
|
||||
|
|
|
|||
3
app/assets/stylesheets/list.unlist.css
Normal file
3
app/assets/stylesheets/list.unlist.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.list .unlisted:not(.no-unlist) {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def deny_access
|
||||
session[:return_to] = request.original_url
|
||||
redirect_to login_url, :alert => 'Access denied!'
|
||||
redirect_to login_url, :alert => I18n.t('application.controller.error_denied')
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -37,7 +37,7 @@ class ApplicationController < ActionController::Base
|
|||
# No user at all: redirect to login page.
|
||||
session[:user_id] = nil
|
||||
session[:return_to] = request.original_url
|
||||
redirect_to login_url, :alert => 'Authentication required!'
|
||||
redirect_to login_url, :alert => I18n.t('application.controller.error_authn')
|
||||
else
|
||||
# We have an authenticated user, now check role...
|
||||
# Roles gets the user through his memberships.
|
||||
|
|
@ -83,7 +83,7 @@ class ApplicationController < ActionController::Base
|
|||
def authenticate_membership_or_admin
|
||||
@group = Group.find(params[:id])
|
||||
unless @group.member?(@current_user) or @current_user.role_admin?
|
||||
redirect_to root_path, alert: "Diese Aktion ist nur für Mitglieder der Gruppe erlaubt!"
|
||||
redirect_to root_path, alert: I18n.t('application.controller.error_members_only')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ class ArticlesController < ApplicationController
|
|||
sort = case params['sort']
|
||||
when "name" then "articles.name"
|
||||
when "unit" then "articles.unit"
|
||||
when "category" then "article_categories.name"
|
||||
when "article_category" then "article_categories.name"
|
||||
when "note" then "articles.note"
|
||||
when "availability" then "articles.availability"
|
||||
when "name_reverse" then "articles.name DESC"
|
||||
when "unit_reverse" then "articles.unit DESC"
|
||||
when "category_reverse" then "article_categories.name DESC"
|
||||
when "article_category_reverse" then "article_categories.name DESC"
|
||||
when "note_reverse" then "articles.note DESC"
|
||||
when "availability_reverse" then "articles.availability DESC"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Finance::BalancingController < Finance::BaseController
|
|||
flash.now.alert = t('finance.balancing.new.alert') if @order.closed?
|
||||
@comments = @order.comments
|
||||
|
||||
@articles = @order.order_articles.ordered.includes(:article, :article_price,
|
||||
@articles = @order.order_articles.ordered_or_member.includes(:article, :article_price,
|
||||
group_order_articles: {group_order: :ordergroup})
|
||||
|
||||
sort_param = params['sort'] || 'name'
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
@financial_transaction = FinancialTransaction.new(params[:financial_transaction])
|
||||
@financial_transaction.user = current_user
|
||||
@financial_transaction.add_transaction!
|
||||
redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: t('finance.financial_transactions.create.notice')
|
||||
redirect_to finance_ordergroup_transactions_url(@ordergroup), notice: I18n.t('finance.financial_transactions.controller.create.notice')
|
||||
rescue ActiveRecord::RecordInvalid => error
|
||||
flash.now[:alert] = error.message
|
||||
render :action => :new
|
||||
|
|
@ -44,16 +44,16 @@ class Finance::FinancialTransactionsController < ApplicationController
|
|||
end
|
||||
|
||||
def create_collection
|
||||
raise "Notiz wird benötigt!" if params[:note].blank?
|
||||
raise I18n.t('finance.financial_transactions.controller.create_collection.error_note_required') if params[:note].blank?
|
||||
params[:financial_transactions].each do |trans|
|
||||
# ignore empty amount fields ...
|
||||
unless trans[:amount].blank?
|
||||
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction!(trans[:amount], params[:note], @current_user)
|
||||
end
|
||||
end
|
||||
redirect_to finance_ordergroups_url, notice: t('finance.create_collection.create.notice')
|
||||
redirect_to finance_ordergroups_url, notice: I18n.t('finance.financial_transactions.controller.create_collection.notice')
|
||||
rescue => error
|
||||
redirect_to finance_new_transaction_collection_url, alert: t('finance.create_collection.create.alert', error: error.to_s)
|
||||
redirect_to finance_new_transaction_collection_url, alert: I18n.t('finance.financial_transactions.controller.create_collection.alert', error: error.to_s)
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class LoginController < ApplicationController
|
|||
# Sends an email to a user with the token that allows setting a new password through action "password".
|
||||
def reset_password
|
||||
if request.get? || params[:user].nil? # Catch for get request and give better error message.
|
||||
redirect_to forgot_password_url, alert: 'Ein Problem ist aufgetreten. Bitte erneut versuchen' and return
|
||||
redirect_to forgot_password_url, alert: I18n.t('errors.general_again') and return
|
||||
end
|
||||
|
||||
if (user = User.find_by_email(params[:user][:email]))
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ class OrdersController < ApplicationController
|
|||
order = Order.find(params[:id])
|
||||
order.finish!(@current_user)
|
||||
redirect_to order, notice: I18n.t('orders.finish.notice')
|
||||
rescue => error
|
||||
redirect_to orders_url, alert: I18n.t('errors.general_msg', :msg => error.message)
|
||||
end
|
||||
|
||||
# Renders the fax-text-file
|
||||
|
|
@ -107,9 +109,9 @@ class OrdersController < ApplicationController
|
|||
supplier = order.supplier
|
||||
contact = FoodsoftConfig[:contact].symbolize_keys
|
||||
text = I18n.t('orders.fax.heading', :name => FoodsoftConfig[:name])
|
||||
text += "\n" + I18n.t('orders.fax.customer_number') + ': #{supplier.customer_number}' unless supplier.customer_number.blank?
|
||||
text += "\n#{Supplier.human_attribute_name(:customer_number)}: #{supplier.customer_number}" unless supplier.customer_number.blank?
|
||||
text += "\n" + I18n.t('orders.fax.delivery_day')
|
||||
text += "\n\n#{supplier.name}\n#{supplier.address}\n" + I18n.t('simple_form.labels.supplier.fax') + ": #{supplier.fax}\n\n"
|
||||
text += "\n\n#{supplier.name}\n#{supplier.address}\n#{Supplier.human_attribute_name(:fax)}: #{supplier.fax}\n\n"
|
||||
text += "****** " + I18n.t('orders.fax.to_address') + "\n\n"
|
||||
text += "#{FoodsoftConfig[:name]}\n#{contact[:street]}\n#{contact[:zip_code]} #{contact[:city]}\n\n"
|
||||
text += "****** " + I18n.t('orders.fax.articles') + "\n\n"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ class StockitController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@stock_article = StockArticle.find(params[:id])
|
||||
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC')
|
||||
end
|
||||
|
||||
def destroy
|
||||
@article = StockArticle.find(params[:id])
|
||||
@article.mark_as_deleted
|
||||
|
|
@ -55,9 +60,4 @@ class StockitController < ApplicationController
|
|||
|
||||
render :partial => 'form', :locals => {:stock_article => stock_article}
|
||||
end
|
||||
|
||||
def history
|
||||
@stock_article = StockArticle.undeleted.find(params[:stock_article_id])
|
||||
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ class OrderFax < OrderPdf
|
|||
text "#{contact[:zip_code]} #{contact[:city]}", size: 9, align: :right
|
||||
move_down 5
|
||||
unless @order.supplier.try(:customer_number).blank?
|
||||
text "#{I18n.t('simple_form.labels.supplier.customer_number')}: #{@order.supplier[:customer_number]}", size: 9, align: :right
|
||||
text "#{Supplier.human_attribute_name :customer_number}: #{@order.supplier[:customer_number]}", size: 9, align: :right
|
||||
move_down 5
|
||||
end
|
||||
unless contact[:phone].blank?
|
||||
text "#{I18n.t('simple_form.labels.supplier.phone')}: #{contact[:phone]}", size: 9, align: :right
|
||||
text "#{Supplier.human_attribute_name :phone}: #{contact[:phone]}", size: 9, align: :right
|
||||
move_down 5
|
||||
end
|
||||
unless contact[:email].blank?
|
||||
text "#{I18n.t('simple_form.labels.supplier.email')}: #{contact[:email]}", size: 9, align: :right
|
||||
text "#{Supplier.human_attribute_name :email}: #{contact[:email]}", size: 9, align: :right
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class OrderFax < OrderPdf
|
|||
text @order.supplier.try(:address).to_s
|
||||
unless @order.supplier.try(:fax).blank?
|
||||
move_down 5
|
||||
text "#{I18n.t('simple_form.labels.supplier.fax')}: #{@order.supplier[:fax]}"
|
||||
text "#{Supplier.human_attribute_name :fax}: #{@order.supplier[:fax]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -48,10 +48,10 @@ class OrderFax < OrderPdf
|
|||
text Date.today.strftime(I18n.t('date.formats.default')), align: :right
|
||||
|
||||
move_down 10
|
||||
text "#{I18n.t('simple_form.labels.delivery.delivered_on')}:"
|
||||
text "#{Delivery.human_attribute_name :delivered_on}:"
|
||||
move_down 10
|
||||
unless @order.supplier.try(:contact_person).blank?
|
||||
text "#{I18n.t('simple_form.labels.supplier.contact_person')}: #{@order.supplier[:contact_person]}"
|
||||
text "#{Supplier.human_attribute_name :contact_person}: #{@order.supplier[:contact_person]}"
|
||||
move_down 10
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,22 @@ module ApplicationHelper
|
|||
|
||||
link_to(text, url_for(url_options), html_options)
|
||||
end
|
||||
|
||||
# Generates text for table heading for model attribute
|
||||
# When the 'short' option is true, abbreviations will be used:
|
||||
# When there is a non-empty model attribute 'foo', it looks for
|
||||
# the model attribute translation 'foo_short' and use that as
|
||||
# heading, with an acronym title of 'foo'.
|
||||
# Other options are passed through to I18n.
|
||||
def heading_helper(model, attribute, options = {})
|
||||
i18nopts = options.select {|a| !['short'].include?(a) }
|
||||
s = model.human_attribute_name(attribute, i18nopts)
|
||||
if options[:short]
|
||||
sshort = model.human_attribute_name("#{attribute}_short".to_sym, options.merge({defaults: ''}))
|
||||
s = raw "<acronym title='#{s}'>#{sshort}</acronym>" unless sshort.empty?
|
||||
end
|
||||
s
|
||||
end
|
||||
|
||||
# Generates a link to the top of the website
|
||||
def link_to_top
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class Order < ActiveRecord::Base
|
|||
unless finished?
|
||||
Order.transaction do
|
||||
# set new order state (needed by notify_order_finished)
|
||||
update_attributes(:state => 'finished', :ends => Time.now, :updated_by => user)
|
||||
update_attributes!(:state => 'finished', :ends => Time.now, :updated_by => user)
|
||||
|
||||
# Update order_articles. Save the current article_price to keep price consistency
|
||||
# Also save results for each group_order_result
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class OrderArticle < ActiveRecord::Base
|
|||
validate :article_and_price_exist
|
||||
validates_uniqueness_of :article_id, scope: :order_id
|
||||
|
||||
scope :ordered, :conditions => "units_to_order >= 1"
|
||||
scope :ordered, :conditions => "units_to_order > 0"
|
||||
scope :ordered_or_member, -> { includes(:group_order_articles).where("units_to_order > 0 OR group_order_articles.result > 0") }
|
||||
|
||||
before_create :init_from_balancing
|
||||
after_destroy :update_ordergroup_prices
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class Ordergroup < Group
|
|||
end
|
||||
|
||||
def avg_jobs_per_euro
|
||||
stats[:orders_sum] != 0 ? stats[:jobs_size].to_f / stats[:orders_sum].to_f : 0
|
||||
stats[:jobs_size].to_f / stats[:orders_sum].to_f rescue 0
|
||||
end
|
||||
|
||||
# This is the ordergroup job per euro performance
|
||||
|
|
@ -90,7 +90,7 @@ class Ordergroup < Group
|
|||
# Global average
|
||||
def self.avg_jobs_per_euro
|
||||
stats = Ordergroup.pluck(:stats)
|
||||
stats.sum {|s| s[:jobs_size].to_f } / stats.sum {|s| s[:orders_sum].to_f }
|
||||
stats.sum {|s| s[:jobs_size].to_f } / stats.sum {|s| s[:orders_sum].to_f } rescue 0
|
||||
end
|
||||
|
||||
def account_updated
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t('simple_form.labels.article_category.name')
|
||||
%th= t('simple_form.labels.article_category.description')
|
||||
%th= heading_helper ArticleCategory, :name
|
||||
%th= heading_helper ArticleCategory, :description
|
||||
%th
|
||||
%tbody
|
||||
- @article_categories.each do |article_category|
|
||||
|
|
|
|||
|
|
@ -6,16 +6,15 @@
|
|||
%thead
|
||||
%tr
|
||||
%th
|
||||
%th= sort_link_helper t('simple_form.labels.article.name'), "name"
|
||||
%th= sort_link_helper heading_helper(Article, :name), "name"
|
||||
%th
|
||||
%th= sort_link_helper t('simple_form.labels.article.article_category'), "category"
|
||||
%th= sort_link_helper t('simple_form.labels.article.unit'), "unit"
|
||||
%th= sort_link_helper t('simple_form.labels.article.note'), "note"
|
||||
%th{:style => "width: 4em;"}
|
||||
%acronym{:title => t('.unit_quantity_desc')}= t '.unit_quantity_short'
|
||||
%th{:style => "width: 5em;"}= t '.price_netto'
|
||||
%th{:style => "width: 3.5em;"}= t 'simple_form.labels.defaults.tax'
|
||||
%th{:style => "width: 4em;"}= t 'simple_form.labels.defaults.deposit'
|
||||
%th= sort_link_helper heading_helper(Article, :article_category), "article_category"
|
||||
%th= sort_link_helper heading_helper(Article, :unit), "unit"
|
||||
%th= sort_link_helper heading_helper(Article, :note), "note"
|
||||
%th{:style => "width: 4em;"}= heading_helper Article, :unit_quantity, short: true
|
||||
%th{:style => "width: 5em;"}= heading_helper Article, :price
|
||||
%th{:style => "width: 3.5em;"}= heading_helper Article, :tax
|
||||
%th{:style => "width: 4em;"}= heading_helper Article, :deposit
|
||||
%th{:style => "width: 3em;"}
|
||||
|
||||
%tbody#listbody
|
||||
|
|
|
|||
|
|
@ -1,20 +1,16 @@
|
|||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th
|
||||
%acronym{:title => t('.available_desc')}= t '.available_short'
|
||||
%th= t 'simple_form.labels.article.name'
|
||||
%th= t 'simple_form.labels.article.unit'
|
||||
%th
|
||||
%acronym{:title => t('.price_desc')}= t '.price_short'
|
||||
%th
|
||||
%acronym{:title => t('.unit_quantity_desc')}= t '.unit_quantity_short'
|
||||
%th
|
||||
%acronym{:title => t('.order_number_desc')}= t '.order_number_short'
|
||||
%th= t 'simple_form.labels.article.note'
|
||||
%th= t 'simple_form.labels.article.article_category'
|
||||
%th= t 'simple_form.labels.defaults.tax'
|
||||
%th= t 'simple_form.labels.defaults.deposit'
|
||||
%th= heading_helper Article, :availability, short: true
|
||||
%th= heading_helper Article, :name
|
||||
%th= heading_helper Article, :unit
|
||||
%th= heading_helper Article, :price, short: true
|
||||
%th= heading_helper Article, :unit_quantity, short: true
|
||||
%th= heading_helper Article, :order_number, short: true
|
||||
%th= heading_helper Article, :note
|
||||
%th= heading_helper Article, :article_category
|
||||
%th= heading_helper Article, :tax
|
||||
%th= heading_helper Article, :deposit
|
||||
%tbody
|
||||
- @articles.each_with_index do |article, index|
|
||||
= fields_for "articles[#{article.id || index}]", article do |form|
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.article.name'
|
||||
%th= t 'simple_form.labels.article.origin'
|
||||
%th= t 'simple_form.labels.article.manufacturer'
|
||||
%th= t 'simple_form.labels.article.note'
|
||||
%th{:style => "width:4em"}= t 'simple_form.labels.defaults.price'
|
||||
%th= t 'simple_form.labels.article.unit'
|
||||
%th= t 'simple_form.labels.defaults.unit_quantity'
|
||||
%th= heading_helper Article, :name
|
||||
%th= heading_helper Article, :origin
|
||||
%th= heading_helper Article, :manufacturer
|
||||
%th= heading_helper Article, :note
|
||||
%th{:style => "width:4em"}= heading_helper Article, :price
|
||||
%th= heading_helper Article, :unit
|
||||
%th= heading_helper Article, :unit_quantity, short: true
|
||||
%th
|
||||
%tbody
|
||||
- for article in @articles
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
- title 'Artikel mit externer Datenbank synchronisieren'
|
||||
- title t('.title')
|
||||
|
||||
= form_tag update_synchronized_supplier_articles_path(@supplier) do
|
||||
%h2= t '.outlist.title'
|
||||
|
|
@ -11,30 +11,28 @@
|
|||
= hidden_field_tag "outlisted_articles[#{article.id}]", '1'
|
||||
= article.name
|
||||
- if article.in_open_order
|
||||
.alert
|
||||
Achtung, #{article.name} wird gerade in einer laufenden Bestellung verwendet. Bitte erst Bestellung anpassen.
|
||||
.alert= t '.alert_used', article: article.name
|
||||
- else
|
||||
%i= t '.outlist.body_skip'
|
||||
%hr/
|
||||
%h2= t '.update.title'
|
||||
%p
|
||||
%i
|
||||
%b= @updated_articles.size
|
||||
= t '.update.update_msg'
|
||||
= t('.update.body').html_safe
|
||||
= t '.update.update_msg', count: @updated_articles.size
|
||||
= t '.update.body'
|
||||
%table.table
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.article.name'
|
||||
%th= t 'simple_form.labels.article.note'
|
||||
%th= t 'simple_form.labels.article.manufacturer'
|
||||
%th= t 'simple_form.labels.article.origin'
|
||||
%th= t 'simple_form.labels.article.unit'
|
||||
%th= t '.unit_quantity_short'
|
||||
%th= t '.price_short'
|
||||
%th= t 'simple_form.labels.defaults.tax'
|
||||
%th= t 'simple_form.labels.defaults.deposit'
|
||||
%th= t 'simple_form.labels.article.article_category'
|
||||
%th= heading_helper Article, :name
|
||||
%th= heading_helper Article, :note
|
||||
%th= heading_helper Article, :manufacturer
|
||||
%th= heading_helper Article, :origin
|
||||
%th= heading_helper Article, :unit
|
||||
%th= heading_helper Article, :unit_quantity, short: true
|
||||
%th= heading_helper Article, :price
|
||||
%th= heading_helper Article, :tax
|
||||
%th= heading_helper Article, :deposit
|
||||
%th= heading_helper Article, :article_category
|
||||
%tbody
|
||||
- @updated_articles.each do |updated_article, attrs|
|
||||
- article = Article.find(updated_article.id)
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
= t('.body').html_safe
|
||||
%pre
|
||||
= [t('.fields.status'),
|
||||
t('simple_form.labels.defaults.order_number'),
|
||||
t('simple_form.labels.article.name'),
|
||||
t('simple_form.labels.article.note'),
|
||||
t('simple_form.labels.article.manufacturer'),
|
||||
t('simple_form.labels.article.origin'),
|
||||
t('simple_form.labels.article.unit'),
|
||||
t('simple_form.labels.defaults.price'),
|
||||
t('simple_form.labels.defaults.tax'),
|
||||
t('simple_form.labels.defaults.deposit'),
|
||||
t('simple_form.labels.defaults.unit_quantity'),
|
||||
Article.human_attribute_name(:order_number),
|
||||
Article.human_attribute_name(:name),
|
||||
Article.human_attribute_name(:note),
|
||||
Article.human_attribute_name(:manufacturer),
|
||||
Article.human_attribute_name(:origin),
|
||||
Article.human_attribute_name(:unit),
|
||||
Article.human_attribute_name(:price),
|
||||
Article.human_attribute_name(:tax),
|
||||
Article.human_attribute_name(:deposit),
|
||||
Article.human_attribute_name(:unit_quantity),
|
||||
t('.fields.season_amount'),
|
||||
t('.fields.season_price'),
|
||||
t('simple_form.labels.article.article_category')].join(" | ")
|
||||
Article.human_attribute_name(:article_category)].join(" | ")
|
||||
|
||||
= form_for :articles, :url => parse_upload_supplier_articles_path(@supplier),
|
||||
:html => { :multipart => true } do |f|
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@
|
|||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
enablePriceTooltips();
|
||||
});
|
||||
|
||||
function mark_article_for_delivery(stock_article_id) {
|
||||
|
|
@ -80,14 +78,6 @@
|
|||
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|
|
||||
= f.error_notification
|
||||
= base_errors f.object
|
||||
|
|
|
|||
|
|
@ -5,21 +5,18 @@
|
|||
|
||||
$('#stock_changes tr').removeClass('success');
|
||||
|
||||
var quantity = w.prompt('<%= j(t('.how_many_units', :unit => @stock_change.stock_article.unit, :name => @stock_change.stock_article.name)) %>');
|
||||
if(null === quantity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var stock_change = $(
|
||||
'<%= j(render(:partial => 'stock_change', :locals => {:stock_change => @stock_change})) %>'
|
||||
).addClass('success');
|
||||
enablePriceTooltips(stock_change);
|
||||
$('input.stock-change-quantity', stock_change).val(quantity);
|
||||
|
||||
$('#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);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ $('div.container-fluid').prepend(
|
|||
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');
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.delivery.delivered_on'
|
||||
%th= heading_helper Delivery, :delivered_on
|
||||
%th.numeric= t 'deliveries.invoice_amount'
|
||||
%th= t 'simple_form.labels.defaults.note'
|
||||
%th= heading_helper Delivery, :note
|
||||
%tbody
|
||||
- for delivery in @deliveries
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
- title t('.title')
|
||||
|
||||
%dl
|
||||
%dt= t 'simple_form.labels.delivery.supplier'
|
||||
%dt= heading_helper Delivery, :supplier
|
||||
%dd= @delivery.supplier.name
|
||||
%dt= t 'simple_form.labels.delivery.delivered_on'
|
||||
%dt= heading_helper Delivery, :delivered_on
|
||||
%dd= @delivery.delivered_on
|
||||
%dt= t 'deliveries.invoice_amount'
|
||||
%dd= link_to_invoice(@delivery)
|
||||
- if @delivery.invoice
|
||||
%dt= t 'deliveries.invoice_net_amount'
|
||||
%dd= number_to_currency @delivery.invoice.net_amount
|
||||
%dt= t 'simple_form.labels.defaults.note'
|
||||
%dt= heading_helper Delivery, :note
|
||||
%dd= simple_format @delivery.note
|
||||
|
||||
%h2= t '.title_articles'
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ $('div.container-fluid').prepend(
|
|||
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');
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
var ordergroup = "#{escape_javascript(render('ordergroup'))}"
|
||||
|
||||
$(function() {
|
||||
$('a[data-remove-transaction]').live('click', function() {
|
||||
$(document).on('click', 'a[data-remove-transaction]', function() {
|
||||
$(this).parents('tr').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a[data-add-transaction]').click(function() {
|
||||
$(document).on('click', 'a[data-add-transaction]', function() {
|
||||
$('#ordergroups').append(ordergroup);
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
%h3= t('.amount_change_for', article: @order_article.article.name)
|
||||
.modal-body
|
||||
= form.input :ordergroup_id, as: :select, collection: Ordergroup.all.map { |g| [g.name, g.id] }
|
||||
= form.input :result, hint: "Einheit: #{@order_article.article.unit}"
|
||||
= form.input :result, hint: I18n.t('.result_hint', unit: @order_article.article.unit)
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
= form.submit t('ui.save'), class: 'btn btn-primary'
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.invoice.number'
|
||||
%th= t 'simple_form.labels.invoice.supplier'
|
||||
%th= t 'simple_form.labels.invoice.date'
|
||||
%th= t 'simple_form.labels.invoice.paid_on'
|
||||
%th= t 'simple_form.labels.invoice.amount'
|
||||
%th= t 'simple_form.labels.invoice.delivery'
|
||||
%th= t 'simple_form.labels.invoice.order'
|
||||
%th= t 'simple_form.labels.invoice.note'
|
||||
%th= heading_helper Invoice, :number
|
||||
%th= heading_helper Invoice, :supplier
|
||||
%th= heading_helper Invoice, :date
|
||||
%th= heading_helper Invoice, :paid_on
|
||||
%th= heading_helper Invoice, :amount
|
||||
%th= heading_helper Invoice, :delivery
|
||||
%th= heading_helper Invoice, :order
|
||||
%th= heading_helper Invoice, :note
|
||||
%th
|
||||
%th
|
||||
%tbody
|
||||
|
|
|
|||
|
|
@ -1,38 +1,38 @@
|
|||
- title t('.title', number: @invoice.number)
|
||||
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.supplier') + ':'
|
||||
%b= heading_helper(Invoice, :supplier) + ':'
|
||||
= @invoice.supplier.name
|
||||
|
||||
- if @invoice.delivery
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.delivery') + ':'
|
||||
%b= heading_helper(Invoice, :delivery) + ':'
|
||||
= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_delivery'), [@invoice.supplier,@invoice.delivery])).html_safe
|
||||
- if @invoice.order
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.order') + ':'
|
||||
%b= heading_helper(Invoice, :order) + ':'
|
||||
= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_order'), @invoice.order)).html_safe
|
||||
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.number') + ':'
|
||||
%b= heading_helper(Invoice, :number) + ':'
|
||||
= @invoice.number
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.date') + ':'
|
||||
%b= heading_helper(Invoice, :date) + ':'
|
||||
= @invoice.date
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.paid_on') + ':'
|
||||
%b= heading_helper(Invoice, :paid_on) + ':'
|
||||
= @invoice.paid_on
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.amount') + ':'
|
||||
%b= heading_helper(Invoice, :amount) + ':'
|
||||
= number_to_currency @invoice.amount
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.deposit') + ':'
|
||||
%b= heading_helper(Invoice, :deposit) + ':'
|
||||
= number_to_currency @invoice.deposit
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.deposit_credit') + ':'
|
||||
%b= heading_helper(Invoice, :deposit_credit) + ':'
|
||||
= number_to_currency @invoice.deposit_credit
|
||||
%p
|
||||
%b= t('simple_form.labels.invoice.note') + ':'
|
||||
%b= heading_helper(Invoice, :note) + ':'
|
||||
=h @invoice.note
|
||||
|
||||
= link_to t('ui.edit'), edit_finance_invoice_path(@invoice)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
= f.input :unit
|
||||
|
||||
- if @order_article.article.is_a?(StockArticle)
|
||||
%div.alert Preise von Lagerartikeln können nicht geändert werden!
|
||||
%div.alert= t '.stock_alert'
|
||||
- else
|
||||
= simple_fields_for :article_price, @order_article.article_price do |f|
|
||||
= f.input :unit_quantity
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
%thead
|
||||
%tr
|
||||
- if FoodsoftConfig[:use_nick]
|
||||
%th= t 'simple_form.labels.user.nick'
|
||||
%th= t 'simple_form.labels.user.name'
|
||||
%th= t 'simple_form.labels.user.email'
|
||||
%th= t 'simple_form.labels.user.phone'
|
||||
%th= t 'simple_form.labels.user.ordergroup'
|
||||
%th= t 'simple_form.labels.user.workgroup', count: 3
|
||||
%th= heading_helper User, :nick
|
||||
%th= heading_helper User, :name
|
||||
%th= heading_helper User, :email
|
||||
%th= heading_helper User, :phone
|
||||
%th= heading_helper User, :ordergroup
|
||||
%th= heading_helper User, :workgroup, count: 3
|
||||
%tbody
|
||||
- for user in @users
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -3,16 +3,20 @@
|
|||
$(function() {
|
||||
#{data_to_js(@ordering_data)}
|
||||
setGroupBalance(#{@ordering_data[:available_funds]});
|
||||
setCurrencyFormat("#{t('number.currency.format.separator')}", #{t('number.currency.format.precision')}, "#{t('number.currency.format.unit')}");
|
||||
setMinimumBalance(#{FoodsoftConfig[:minimum_balance] or 0});
|
||||
setToleranceBehaviour(#{FoodsoftConfig[:tolerance_is_costly]});
|
||||
setStockit(#{@order.stockit?});
|
||||
// create List for search-feature (using list.js, http://listjs.com)
|
||||
var listjsResetPlugin = ['reset', {highlightClass: 'btn-primary'}];
|
||||
var listjsDelayPlugin = ['delay', {delayedSearchTime: 500}];
|
||||
new List(document.body, { valueNames: ['name'], engine: 'unlist', plugins: [listjsResetPlugin, listjsDelayPlugin] });
|
||||
});
|
||||
|
||||
- title t('.title'), false
|
||||
|
||||
.row-fluid
|
||||
.well.pull-left
|
||||
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= '×'.html_safe
|
||||
%h2= @order.name
|
||||
%dl.dl-horizontal
|
||||
- unless @order.note.blank?
|
||||
|
|
@ -35,8 +39,17 @@
|
|||
%dd= number_to_currency(@ordering_data[:available_funds])
|
||||
|
||||
.well.pull-right
|
||||
%button{type: "button", class: "close", data: {dismiss: 'alert'}}= '×'.html_safe
|
||||
= render 'switch_order', current_order: @order
|
||||
|
||||
.row-fluid
|
||||
.well.clear
|
||||
.form-search
|
||||
.input-append
|
||||
= text_field_tag :article, params[:article], placeholder: t('.search_article'), class: 'search-query delayed-search resettable'
|
||||
%button.add-on.btn.reset-search{:type => :button, :title => t('.reset_article_search')}
|
||||
%i.icon.icon-remove
|
||||
|
||||
= form_for @group_order do |f|
|
||||
= f.hidden_field :lock_version
|
||||
= f.hidden_field :order_id
|
||||
|
|
@ -59,9 +72,9 @@
|
|||
%th(style="width:20px")= t '.available'
|
||||
%th#col_required= t '.amount'
|
||||
%th{style: "width:15px;"}= t '.sum'
|
||||
%tbody
|
||||
%tbody.list
|
||||
- @order.articles_grouped_by_category.each do |category, order_articles|
|
||||
%tr.article-category
|
||||
%tr.list-heading.article-category
|
||||
%td
|
||||
= category
|
||||
%i.icon-tag
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@
|
|||
= form.hidden_field :group_id
|
||||
= form.input :email
|
||||
= form.submit t('.action')
|
||||
= link_to t('.back'), :back
|
||||
= link_to t('ui.or_cancel'), :back
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@
|
|||
Javascripts
|
||||
\==================================================
|
||||
/ Placed at the end of the document so the pages load faster
|
||||
:javascript
|
||||
I18n = {locale: '#{j(I18n.locale.to_s)}'}
|
||||
= javascript_include_tag "application"
|
||||
:javascript
|
||||
I18n.defaultLocale = "#{I18n.default_locale}";
|
||||
I18n.locale = "#{I18n.locale}";
|
||||
I18n.fallbacks = true;
|
||||
= yield(:javascript)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
%h2= t '.title'
|
||||
- if ordergroup.not_enough_apples?
|
||||
.alert
|
||||
= t '.not_enough_apples'
|
||||
= t '.not_enough_apples'
|
||||
- unless Order.open.empty?
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@
|
|||
= form.hidden_field :stock_article_id
|
||||
= "Menge (#{stock_change.stock_article.quantity_available})"
|
||||
= form.text_field :quantity, :size => 5, :autocomplete => 'off'
|
||||
%b= stock_change.stock_article.name
|
||||
= "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})"
|
||||
%span{:data => {:toggle => :tooltip, :title => render(:partial => 'shared/article_price_info', :locals => {:article => stock_change.stock_article})}}
|
||||
%b= stock_change.stock_article.name
|
||||
= "(#{number_to_currency(stock_change.stock_article.price)} / #{stock_change.stock_article.unit})"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
%span.add-on %
|
||||
= f.input :deposit
|
||||
- else
|
||||
= f.input :price, :input_html => {:disabled => 'disabled'}, :hint => t('.form.price_hint')
|
||||
= f.input :price, :input_html => {:disabled => 'disabled'}, :hint => t('.price_hint')
|
||||
= f.association :article_category
|
||||
.form-actions
|
||||
= f.submit class: 'btn'
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
- title t('.stock_changes', :article_name => @stock_article.name)
|
||||
|
||||
%table.table.table-hover#stock_changes
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.datetime'
|
||||
%th= t '.reason'
|
||||
%th= t '.change_quantity'
|
||||
%th= t '.new_quantity'
|
||||
%tbody
|
||||
- reversed_history = @stock_article.quantity_history.reverse
|
||||
- @stock_changes.each_with_index do |stock_change, index|
|
||||
%tr
|
||||
%td= l stock_change.created_at
|
||||
%td= link_to_stock_change_reason(stock_change)
|
||||
%td= stock_change.quantity
|
||||
%td= reversed_history[index]
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
%tbody
|
||||
- for article in @stock_articles
|
||||
%tr{:class => stock_article_classes(article), :id => "stockArticle-#{article.id}"}
|
||||
%td=h article.name
|
||||
%td= link_to article.name, article
|
||||
%td= article.quantity
|
||||
%td= article.quantity - article.quantity_available
|
||||
%th= article.quantity_available
|
||||
|
|
@ -56,7 +56,6 @@
|
|||
%td= article.article_category.name
|
||||
%td
|
||||
= link_to t('ui.edit'), edit_stock_article_path(article), class: 'btn btn-mini'
|
||||
= link_to t('ui.history'), stock_article_history_path(article), class: 'btn btn-mini'
|
||||
= link_to t('ui.delete'), article, :method => :delete, :confirm => t('.confirm_delete'),
|
||||
class: 'btn btn-mini btn-danger', :remote => true
|
||||
%p
|
||||
|
|
|
|||
47
app/views/stockit/show.html.haml
Normal file
47
app/views/stockit/show.html.haml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
- title @stock_article.name
|
||||
|
||||
.row-fluid
|
||||
.span6
|
||||
%dl.dl-horizontal
|
||||
%dt= StockArticle.human_attribute_name 'supplier'
|
||||
%dd= link_to @stock_article.supplier.name, @stock_article.supplier
|
||||
%dt= StockArticle.human_attribute_name 'name'
|
||||
%dd= @stock_article.name
|
||||
%dt= StockArticle.human_attribute_name 'unit'
|
||||
%dd= @stock_article.unit
|
||||
%dt= StockArticle.human_attribute_name 'price'
|
||||
%dd= number_to_currency @stock_article.price
|
||||
%dt= StockArticle.human_attribute_name 'tax'
|
||||
%dd= number_to_percentage @stock_article.tax
|
||||
%dt= StockArticle.human_attribute_name 'deposit'
|
||||
%dd= number_to_currency @stock_article.deposit
|
||||
%dt= StockArticle.human_attribute_name 'fc_price'
|
||||
%dd= number_to_currency @stock_article.fc_price
|
||||
%dt= StockArticle.human_attribute_name 'article_category'
|
||||
%dd= @stock_article.article_category.name
|
||||
%dt= StockArticle.human_attribute_name 'note'
|
||||
%dd= @stock_article.note
|
||||
%dt= StockArticle.human_attribute_name 'quantity'
|
||||
%dd= @stock_article.quantity
|
||||
%dt= StockArticle.human_attribute_name 'quantity_available'
|
||||
%dd= @stock_article.quantity_available
|
||||
.form-actions
|
||||
= link_to t('ui.edit'), edit_stock_article_path(@stock_article), class: 'btn'
|
||||
|
||||
.span6
|
||||
%h2= t('.stock_changes')
|
||||
%table.table.table-hover#stock_changes
|
||||
%thead
|
||||
%tr
|
||||
%th= t '.datetime'
|
||||
%th= t '.reason'
|
||||
%th= t '.change_quantity'
|
||||
%th= t '.new_quantity'
|
||||
%tbody
|
||||
- reversed_history = @stock_article.quantity_history.reverse
|
||||
- @stock_changes.each_with_index do |stock_change, index|
|
||||
%tr
|
||||
%td= l stock_change.created_at
|
||||
%td= link_to_stock_change_reason(stock_change)
|
||||
%td= stock_change.quantity
|
||||
%td= reversed_history[index]
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
= simple_form_for @supplier do |f|
|
||||
- if @supplier.shared_supplier
|
||||
.alert.alert-success
|
||||
= t 'suppliers.shared_supplier_note'
|
||||
.alert.alert-info
|
||||
= t 'suppliers.shared_supplier_note'
|
||||
= f.hidden_field :shared_supplier_id
|
||||
= f.input :name
|
||||
= f.input :address
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.supplier.name'
|
||||
%th= t 'simple_form.labels.supplier.phone'
|
||||
%th= t 'simple_form.labels.supplier.customer_number'
|
||||
%th= heading_helper Supplier, :name
|
||||
%th= heading_helper Supplier, :phone
|
||||
%th= heading_helper Supplier, :customer_number, short: true
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.supplier.name'
|
||||
%th= t 'simple_form.labels.supplier.address'
|
||||
%th= t 'simple_form.labels.supplier.note'
|
||||
%th= t 'simple_form.labels.supplier.delivery_days'
|
||||
%th= t 'simple_form.labels.supplier.is_subscribed'
|
||||
%th= heading_helper Supplier, :name
|
||||
%th= heading_helper Supplier, :address
|
||||
%th= heading_helper Supplier, :note
|
||||
%th= heading_helper Supplier, :delivery_days
|
||||
%th= heading_helper Supplier, :is_subscribed
|
||||
%tbody
|
||||
- for shared_supplier in @shared_suppliers
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -4,32 +4,32 @@
|
|||
.span6
|
||||
- if shared_supplier = @supplier.shared_supplier
|
||||
.alert.alert-info
|
||||
= t 'suppliers.shared_supplier_note'
|
||||
= t 'suppliers.shared_supplier_note'
|
||||
|
||||
%dl.dl-horizontal
|
||||
%dt= t('simple_form.labels.supplier.address') + ':'
|
||||
%dt= heading_helper(Supplier, :address) + ':'
|
||||
%dd= @supplier.address
|
||||
%dt= t('simple_form.labels.supplier.phone') + ':'
|
||||
%dt= heading_helper(Supplier, :phone) + ':'
|
||||
%dd= @supplier.phone
|
||||
%dt= t('simple_form.labels.supplier.phone2') + ':'
|
||||
%dt= heading_helper(Supplier, :phone2) + ':'
|
||||
%dd= @supplier.phone2
|
||||
%dt= t('simple_form.labels.supplier.fax') + ':'
|
||||
%dt= heading_helper(Supplier, :fax) + ':'
|
||||
%dd= @supplier.fax
|
||||
%dt= t('simple_form.labels.supplier.email') + ':'
|
||||
%dt= heading_helper(Supplier, :email) + ':'
|
||||
%dd= @supplier.email
|
||||
%dt= t('simple_form.labels.supplier.url') + ':'
|
||||
%dt= heading_helper(Supplier, :url) + ':'
|
||||
%dd= link_to @supplier.url, @supplier.url
|
||||
%dt= t('simple_form.labels.supplier.contact_person') + ':'
|
||||
%dt= heading_helper(Supplier, :contact_person) + ':'
|
||||
%dd= @supplier.contact_person
|
||||
%dt= t('simple_form.labels.supplier.customer_number') + ':'
|
||||
%dt= heading_helper(Supplier, :customer_number) + ':'
|
||||
%dd= @supplier.customer_number
|
||||
%dt= t('simple_form.labels.supplier.delivery_days') + ':'
|
||||
%dt= heading_helper(Supplier, :delivery_days) + ':'
|
||||
%dd= @supplier.delivery_days
|
||||
%dt= t('simple_form.labels.supplier.order_howto') + ':'
|
||||
%dt= heading_helper(Supplier, :order_howto) + ':'
|
||||
%dd= @supplier.order_howto
|
||||
%dt= t('simple_form.labels.supplier.note') + ':'
|
||||
%dt= heading_helper(Supplier, :note) + ':'
|
||||
%dd= @supplier.note
|
||||
%dt= t('simple_form.labels.supplier.min_order_quantity') + ':'
|
||||
%dt= heading_helper(Supplier, :min_order_quantity) + ':'
|
||||
%dd= @supplier.min_order_quantity
|
||||
|
||||
.clearfix
|
||||
|
|
@ -43,8 +43,8 @@
|
|||
%table.table.table-horizontal
|
||||
%thead
|
||||
%tr
|
||||
%th= t 'simple_form.labels.defaults.date'
|
||||
%th= t 'simple_form.labels.defaults.amount'
|
||||
%th= heading_helper Delivery, :date
|
||||
%th= heading_helper Delivery, :amount
|
||||
%tbody
|
||||
- for delivery in @deliveries
|
||||
%tr
|
||||
|
|
|
|||
|
|
@ -3,22 +3,22 @@
|
|||
|
||||
%section
|
||||
%dl.dl-horizontal
|
||||
%dt= t 'simple_form.labels.task.name'
|
||||
%dt= Task.human_attribute_name(:name)
|
||||
%dd= @task.name
|
||||
- if @task.description.present?
|
||||
%dt= t 'simple_form.labels.defaults.description'
|
||||
%dt= Task.human_attribute_name(:description)
|
||||
%dd= simple_format(@task.description)
|
||||
- if @task.due_date.present?
|
||||
%dt= t '.due_date'
|
||||
%dt= Task.human_attribute_name(:due_date)
|
||||
%dd
|
||||
= format_date(@task.due_date)
|
||||
- if @task.periodic?
|
||||
%i.icon-repeat{title: t('tasks.repeated')}
|
||||
%dt= t 'simple_form.labels.task.duration'
|
||||
%dt= Task.human_attribute_name(:duration)
|
||||
%dd= t('.hours', count: @task.duration)
|
||||
%dt= t 'simple_form.labels.task.user_list'
|
||||
%dt= Task.human_attribute_name(:user_list)
|
||||
%dd= task_assignments(@task)
|
||||
%dt= t 'simple_form.labels.task.workgroup'
|
||||
%dt= Task.human_attribute_name(:workgroup)
|
||||
%dd
|
||||
- if @task.workgroup
|
||||
= link_to @task.workgroup.name, workgroup_tasks_path(workgroup_id: @task.workgroup_id)
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
- unless @task.done?
|
||||
= link_to t('.mark_done'), set_done_task_path(@task), method: :post, class: 'btn'
|
||||
= link_to t('ui.edit'), edit_task_path(@task), class: 'btn'
|
||||
= link_to t('ui.delete'), task_path(@task), :method => :delete, :confirm => "Die Aufgabe wirklich löschen?",
|
||||
= link_to t('ui.delete'), task_path(@task), :method => :delete, :confirm => t('.confirm_delete_single'),
|
||||
class: 'btn btn-danger'
|
||||
- if @task.periodic?
|
||||
= link_to t('.delete_group'), task_path(@task, periodic: true), method: :delete,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue