Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 46e1177c

Von Sven Schöling vor mehr als 10 Jahren hinzugefügt

  • ID 46e1177c8b8a14cfef2765e1f7b784116bddfc17
  • Vorgänger 4d0bc1f1
  • Nachfolger 303a4d5d

PartPicker: Diverse Verbesserungen

- Dialog vergrössert
- Unterstützung für Listenansicht
- Bild hoch Bild runter im paginaten gemappt
- Focus nach Klickauswahl wieder auf das ursprüngliche Feld gesetzt
- Unterscheidung zwischen minimaler Rückmeldung (nur id und name) und fettem
json Objekt verbessert. Im letzten Fall wird immer garantiert das komplette
Objekt ausgeliefert.

Unterschiede anzeigen:

css/kivitendo/main.css
384 384
.float-left {
385 385
  float: left;
386 386
}
387
.float-right {
388
  float: right;
389
}
387 390

  
388 391
.block-context {
389 392
  overflow: hidden;
......
402 405
}
403 406

  
404 407
div.part_picker_part {
405
  float:left; width: 350px;
406 408
  padding: 5px;
407 409
  margin: 5px;
408
  overflow:hidden;
409 410
  border: 1px;
410 411
  border-color: darkgray;
411 412
  border-style: solid;
412 413
  -webkit-border-radius: 4px;
413 414
  -moz-border-radius: 4px;
414 415
  border-radius: 4px;
415
  background-color: whitesmoke;
416
  background-color: white;
416 417
  cursor: pointer;
417 418
}
418

  
419 419
div.part_picker_part:hover {
420 420
  background-color: #CCCCCC;
421 421
  color: #FE5F14;
422 422
  border-color: gray;
423 423
}
424
div.ppp_block {
425
  overflow:hidden;
426
  float:left;
427
  width: 350px;
428
}
429
div.ppp_block span.ppp_block_number {
430
  float:left;
431
}
432
div.ppp_block span.ppp_block_description {
433
  float:right;
434
  font-weight:bold;
435
}
436
div.ppp_line span.ppp_block_description {
437
  margin-left:1em;
438
  font-weight:bold;
439
}
440
div.ppp_line span.ppp_block_sellprice {
441
  display:none;
442
}
443
span.toggle_selected {
444
  font-weight: bold;
445
}
css/lx-office-erp/main.css
436 436
.float-left {
437 437
  float: left;
438 438
}
439
.float-right {
440
  float: right;
441
}
439 442

  
440 443
.block-context {
441 444
  overflow: hidden;
......
454 457
}
455 458

  
456 459
div.part_picker_part {
457
  float:left; width: 350px;
458 460
  padding: 5px;
459 461
  margin: 5px;
460
  overflow:hidden;
461 462
  border: 1px;
462 463
  border-color: darkgray;
463 464
  border-style: solid;
......
467 468
  background-color: whitesmoke;
468 469
  cursor: pointer;
469 470
}
470

  
471 471
div.part_picker_part:hover {
472 472
  background-color: lightgray;
473 473
  border-color: gray;
474 474
}
475
div.ppp_block {
476
  overflow:hidden;
477
  float:left;
478
  width: 350px;
479
}
480
div.ppp_block span.ppp_block_number {
481
  float:left;
482
}
483
div.ppp_block span.ppp_block_description {
484
  float:right;
485
  font-weight:bold;
486
}
487
div.ppp_line span.ppp_block_description {
488
  margin-left:1em;
489
  font-weight:bold;
490
}
491
div.ppp_line span.ppp_block_sellprice {
492
  display:none;
493
}
494
span.toggle_selected {
495
  font-weight: bold;
496
}
js/autocomplete_part.js
8 8
      ESCAPE: 27,
9 9
      ENTER:  13,
10 10
      TAB:    9,
11
      LEFT:   37,
12
      RIGHT:  39,
13
      PAGE_UP: 33,
14
      PAGE_DOWN: 34,
11 15
    };
12 16
    var o = $.extend({
13 17
      limit: 20,
14 18
      delay: 50,
19
      fat_set_item: 0, // use this option to get a fat item json with all
20
                       // relevant data instead of the guaranteed id + name
15 21
    }, options);
16 22
    var STATES = {
17 23
      UNIQUE: 1,
......
35 41
          real_id: real_id,
36 42
        }, ajax_data($dummy.val())),
37 43
        id: 'part_selection',
38
        dialog: { title: k.t8('Part picker') }
44
        dialog: {
45
          title: k.t8('Part picker'),
46
          width: 800,
47
          height: 800,
48
        }
39 49
      });
40 50
      window.clearTimeout(timer);
41 51
      return true;
......
46 56
        'filter.all:substr::ilike': term,
47 57
        'filter.obsolete': 0,
48 58
        'filter.unit_obj.convertible_to': $convertible_unit && $convertible_unit.val() ? $convertible_unit.val() : '',
59
        no_paginate:  $('#no_paginate').prop('checked') ? 1 : 0,
49 60
        column:   $column && $column.val() ? $column.val() : '',
50 61
        current:  $real.val(),
51 62
      };
......
71 82
      state = STATES.PICKED;
72 83
      last_real = $real.val();
73 84
      last_dummy = $dummy.val();
74
      $real.trigger('change').trigger('set_item:PartPicker', item);
85
      $real.trigger('change');
86

  
87
      if (o.fat_set_item) {
88
        $.ajax({
89
          url: 'controller.pl?action=Part/show.json',
90
          data: { id: item.id },
91
          success: function(rsp) {
92
            $real.trigger('set_item:PartPicker', rsp);
93
          },
94
        });
95
      } else {
96
        $real.trigger('set_item:PartPicker', item);
97
      }
75 98
    }
76 99

  
77 100
    function make_defined_state () {
......
94 117
    };
95 118

  
96 119
    function result_timer (event) {
120
      if (!$('no_paginate').prop('checked')) {
121
        if (event.keyCode == KEY.PAGE_UP) {
122
          $('#part_picker_result a.paginate-prev').click();
123
          return;
124
        }
125
        if (event.keyCode == KEY.PAGE_DOWN) {
126
          $('#part_picker_result a.paginate-next').click();
127
          return;
128
        }
129
      }
97 130
      window.clearTimeout(timer);
98 131
      timer = window.setTimeout(update_results, 100);
99 132
    }
......
175 208
    var picker = $('<div>');
176 209
    $dummy.after(pcont);
177 210
    pcont.append(picker);
178
    picker.addClass('icon16 CRM--Schnellsuche').click(open_dialog);
211
    picker.addClass('icon16 crm--search').click(open_dialog);
179 212

  
180 213
    var pp = {
181 214
      real:           function() { return $real },
......
192 225
        $('div.part_picker_part').each(function(){
193 226
          $(this).click(function(){
194 227
            set_item({
195
              name: $(this).children('input.part_picker_description').val(),
196 228
              id:   $(this).children('input.part_picker_id').val(),
229
              name: $(this).children('input.part_picker_description').val(),
230
              unit: $(this).children('input.part_picker_unit').val(),
197 231
            });
198 232
            close_popup();
233
            $dummy.focus();
199 234
            return true;
200 235
          });
201 236
        });
locale/de/all
180 180
  'Aktion'                      => 'Aktion',
181 181
  'All'                         => 'Alle',
182 182
  'All Accounts'                => 'Alle Konten',
183
  'All as list'                 => 'Alle als Liste',
183 184
  'All changes in that file have been reverted.' => 'Alle &Auml;nderungen in dieser Datei wurden r&uuml;ckg&auml;ngig gemacht.',
184 185
  'All clients'                 => 'Alle Mandanten',
185 186
  'All general ledger entries'  => 'Alle Hauptbucheinträge',
templates/webpages/part/_part_picker_result.html
5 5

  
6 6
[%# L.dump(SELF.parts) %]
7 7

  
8
[% FOREACH part = SELF.parts %]
9
  [% PROCESS part_block %]
10
[% END %]
11

  
12
[%- BLOCK part_block %]
13
<div class='part_picker_part'>
8
[% BLOCK part_block %]
9
<div class='part_picker_part [% FORM.no_paginate ? 'ppp_line' : 'ppp_block' %]'>
14 10
  <input type='hidden' class='part_picker_id' value='[% part.id %]'>
15 11
  <input type='hidden' class='part_picker_partnumber' value='[% part.partnumber %]'>
16 12
  <input type='hidden' class='part_picker_description' value='[% part.description %]'>
17
  <span style='float:left'>[% part.partnumber | html %]</span>
18
  <span style='float:right; font-weight:bold'>[% part.description | html %]</span>
13
  <input type='hidden' class='part_picker_unit' value='[% part.unit %]'>
14
  <span class='ppp_block_number'>[% part.partnumber | html %]</span>
15
  <span class='ppp_block_description'>[% part.description | html %]</span>
19 16
  <div style='clear:both;'></div>
20
  [% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]
17
  <span class='ppp_block_sellprice'>[% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %]</span>
21 18
</div>
22 19
[%- END %]
23 20

  
21

  
22
[% FOREACH part = SELF.parts %]
23
  [% PROCESS part_block %]
24
[% END %]
25

  
24 26
<div style='clear:both'></div>
25 27

  
26 28
[% L.paginate_controls(target='#part_picker_result', selector='#part_picker_result', models=SELF.models) %]
templates/webpages/part/part_picker_search.html
8 8
[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', SELF.filter.all_substr__ilike, class='part_picker_filter') %]
9 9
[% L.hidden_tag('part_picker_real_id', FORM.real_id) %]
10 10

  
11
<div class='float-right'>
12
  [% L.checkbox_tag('no_paginate', checked=FORM.no_paginate, id='no_paginate', for_submit=1, label=LxERP.t8('All as list')) %]
13
</div>
14

  
11 15
<div style='clear:both'></div>
12 16
<div id='part_picker_result'></div>
13 17
</div>
......
19 23
    pp.update_results();
20 24
  });
21 25
  $('#part_picker_filter').keypress(pp.result_timer);
26
  $('#no_paginate').change(pp.update_results);
27

  
22 28
</script>

Auch abrufbar als: Unified diff