Revision cc1f1d85
Von Bernd Bleßmann vor fast 4 Jahren hinzugefügt
SL/Controller/TimeRecording.pm | ||
---|---|---|
$self->{end_time} = $self->time_recording->end_time->to_kivitendo_time;
|
||
}
|
||
|
||
my $inputs_to_disable = $self->get_inputs_to_disable;
|
||
|
||
$self->setup_edit_action_bar;
|
||
|
||
$self->render('time_recording/form',
|
||
title => t8('Time Recording'),
|
||
title => t8('Time Recording'),
|
||
inputs_to_disable => $inputs_to_disable,
|
||
);
|
||
}
|
||
|
||
... | ... | |
$::form->{callback} || (action => 'list')
|
||
}
|
||
|
||
sub get_inputs_to_disable {
|
||
my ($self) = @_;
|
||
|
||
return [qw(customer project)] if $self->time_recording->order_id;
|
||
return [qw(customer)] if $self->time_recording->project_id && $self->time_recording->project->customer_id;
|
||
}
|
||
|
||
|
||
1;
|
js/kivi.TimeRecording.js | ||
---|---|---|
namespace('kivi.TimeRecording', function(ns) {
|
||
'use strict';
|
||
|
||
ns.inputs_to_disable = [];
|
||
|
||
ns.set_end_date = function() {
|
||
if ($('#start_date').val() !== '' && $('#end_date').val() === '') {
|
||
var kivi_start_date = kivi.format_date(kivi.parse_date($('#start_date').val()));
|
||
... | ... | |
});
|
||
};
|
||
|
||
ns.set_input_constraints = function() {
|
||
$(ns.inputs_to_disable).each(function(idx, elt) {
|
||
if ("customer" === elt) {
|
||
$('#time_recording_customer_id_name').prop('disabled', true);
|
||
}
|
||
if ("project" === elt) {
|
||
$('#time_recording_project_id_name').prop('disabled', true);
|
||
}
|
||
});
|
||
};
|
||
|
||
});
|
||
|
||
$(function() {
|
||
kivi.TimeRecording.set_input_constraints();
|
||
$('#time_recording_project_id').on('set_item:ProjectPicker', function(){ kivi.TimeRecording.project_changed() });
|
||
});
|
templates/webpages/time_recording/form.html | ||
---|---|---|
[%- END %]
|
||
|
||
</form>
|
||
|
||
<script type="text/javascript">
|
||
<!--
|
||
[% FOREACH i = inputs_to_disable %]
|
||
kivi.TimeRecording.inputs_to_disable.push("[% i %]");
|
||
[% END %]
|
||
-->
|
||
</script>
|
Auch abrufbar als: Unified diff
Zeiterfassung: Auch beim Laden entsprechende Eingabe-Felder sperren:
- wenn Auftrag ausgewählt. so ist Kunde und Projekt gesperrt
- wenn Projekt ausgewählt, und Projekt einen Kunden hat, so ist
Kunde gesperrt