Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1758316c

Von Bernd Bleßmann vor 8 Monaten hinzugefügt

  • ID 1758316cbea2d674b3fcfce86dc82a224e6d3bcd
  • Vorgänger c5d1e2ed
  • Nachfolger a00ec2d1

Zwischeninventur: Mobil-Menüeintrag und -Controller

Unterschiede anzeigen:

SL/Controller/StockCounting.pm
package SL::Controller::StockCounting;
use strict;
use parent qw(SL::Controller::Base);
use SL::DB::Employee;
use SL::DB::StockCounting;
use SL::DB::StockCountingItem;
use SL::Locale::String qw(t8);
use Rose::Object::MakeMethods::Generic(
#scalar => [ qw() ],
'scalar --get_set_init' => [ qw(is_developer countings stock_counting_item) ],
);
# check permissions
__PACKAGE__->run_before(sub { $::auth->assert('warehouse_management'); });
# load js
__PACKAGE__->run_before(sub { $::request->layout->add_javascripts('kivi.Validator.js', 'kivi.StockCounting.js'); });
################ actions #################
sub action_select_counting {
my ($self) = @_;
$self->render('stock_counting/select_counting');
}
sub action_start_counting {
my ($self) = @_;
$self->render('stock_counting/count');
}
sub action_count {
my ($self) = @_;
my @errors;
push @errors, t8('EAN is missing') if !$::form->{ean};
return $self->render('stock_counting/count', errors => \@errors) if @errors;
my $parts = SL::DB::Manager::Part->get_all(where => [ean => $::form->{ean},
or => [obsolete => 0, obsolete => undef]]);
push @errors, t8 ('Part not found') if scalar(@$parts) == 0;
push @errors, t8 ('Part is ambiguous') if scalar(@$parts) > 1;
$self->stock_counting_item->part($parts->[0]) if !@errors;
my @validation_errors = $self->stock_counting_item->validate;
push @errors, @validation_errors if @validation_errors;
$::form->error(join "\n", @errors) if @errors;
$self->stock_counting_item->qty(1);
$self->stock_counting_item->save;
$self->render('stock_counting/count',);
}
sub init_is_developer {
!!$::auth->assert('developer', 'may_fail')
}
sub init_countings {
SL::DB::Manager::StockCounting->get_all_sorted;
}
sub init_stock_counting_item {
SL::DB::StockCountingItem->new(%{$::form->{stock_counting_item}},
employee => SL::DB::Manager::Employee->current);
}
1;
js/kivi.StockCounting.js
namespace('kivi.StockCounting', function(ns) {
});
menus/mobile/00-erp.yaml
access: ap_transactions
params:
action: ScanQRBill/scan_view
- id: stock_counting
name: Stock Counting
order: 250
access: warehouse_management
params:
action: StockCounting/select_counting
- id: component_test
name: Component Test
order: 300
templates/mobile_webpages/stock_counting/count.html
[%- USE T8 %]
[%- USE LxERP %]
[%- USE P %]
<div class="section">
<div class="container">
<div class="z-depth-1 grey lighten-4 row" style="padding: 32px 48px 0px 48px; border: 1px solid #EEE;">
<div class="row">[% SELF.stock_counting_item.counting.name %]</div>
<div class="row">[% SELF.stock_counting_item.counting.description %]</div>
<div class="row">[% SELF.stock_counting_item.counting.part.displayable_name %]</div>
<div class="row">[% SELF.stock_counting_item.counting.partsgroup.displayable_name %]</div>
<div class="row">[% SELF.stock_counting_item.counting.vendor.displayable_name %]</div>
<form method="post" name="count_form" id="count_form" action="controller.pl" target="_top" class="col s12">
[% P.hidden_tag('stock_counting_item.counting_id', SELF.stock_counting_item.counting_id) %]
[% IF SELF.stock_counting_item.counting.bin_id %]
<div class="row">[% SELF.stock_counting_item.counting.bin.full_description %]</div>
[% P.hidden_tag('stock_counting_item.bin_id', SELF.stock_counting_item.counting.bin_id) %]
[% ELSE %]
<div class="row">
[% P.M.wh_bin_select('dummy_wh', bin_name='stock_counting_item.bin_id', with_empty=1, 'data-validate'='required', label=LxERP.t8('Bin'), class='col s12') %]
</div>
[% END %]
<div class="row">
[% P.M.input_tag('ean', '', placeholder=last_ean || LxERP.t8('EAN'), 'data-validate'='required', label=LxERP.t8('Part to count'), class='col s12') %]
</div>
<div class="row">
[% P.hidden_tag("action", "StockCounting/count") %]
[% P.M.submit_tag("btn_count", LxERP.t8("Do count"), class="col s12", large=1) %]
</div>
</form>
</div>
</div>
</div>
templates/mobile_webpages/stock_counting/select_counting.html
[%- USE T8 %]
[%- USE LxERP %]
[%- USE P %]
<div class="section">
<div class="container">
<div class="z-depth-1 grey lighten-4 row" style="padding: 32px 48px 0px 48px; border: 1px solid #EEE;">
<form method="post" name="count_form" action="controller.pl" target="_top" class="col s12">
<div class="row">
[% P.M.select_tag('stock_counting_item.counting_id', SELF.countings,
class='col s12',
title_key='name',
label=LxERP.t8('Select a Stock Counting'))
%]
</div>
<div class="row">
[% P.hidden_tag("action", "StockCounting/start_counting") %]
[% P.M.submit_tag("btn_start", LxERP.t8("Start"), class="col s12", large=1) %]
</div>
</form>
</div>
</div>
</div>

Auch abrufbar als: Unified diff