Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2e8dd1d8

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 2e8dd1d85541033e1b4f5fe2f41da528e860c6e5
  • Vorgänger bdf33d88
  • Nachfolger 7502b084

Pflichtenheft Angebote/Aufträge: "Abbrechen" ohne AJAX-Call nur in JS

Unterschiede anzeigen:

SL/Controller/RequirementSpecOrder.pm
17 17
use SL::Helper::Flash;
18 18
use SL::Locale::String;
19 19

  
20
use constant TAB_ID => 'ui-tabs-4';
20
use constant LIST_SELECTOR  => '#quotations_and_orders';
21
use constant FORMS_SELECTOR => '#quotations_and_orders_article_assignment,#quotations_and_orders_new,#quotations_and_orders_update';
21 22

  
22 23
use Rose::Object::MakeMethods::Generic
23 24
(
......
44 45
    return $self->js->flash('error', t8('This function requires the presence of articles with a time-based unit such as "h" or "min".'))->render($self);
45 46
  }
46 47

  
47
  my $html   = $self->render('requirement_spec_order/new', { output => 0 }, make_part_title => sub { $_[0]->partnumber . ' ' . $_[0]->description });
48
  $self->js->html('#' . TAB_ID(), $html)
48
  my $html = $self->render('requirement_spec_order/new', { output => 0 }, make_part_title => sub { $_[0]->partnumber . ' ' . $_[0]->description });
49
  $self->js->hide(LIST_SELECTOR())
50
           ->after(LIST_SELECTOR(), $html)
49 51
           ->render($self);
50 52
}
51 53

  
......
72 74

  
73 75
  # 3. Notify the user and return to list.
74 76
  my $html = $self->render('requirement_spec_order/list', { output => 0 });
75
  $self->js->html('#' . TAB_ID(), $html)
77
  $self->js->replaceWith(LIST_SELECTOR(), $html)
78
           ->remove(FORMS_SELECTOR())
76 79
           ->flash('info', $::form->{quotation} ? t8('Sales quotation #1 has been created.', $order->quonumber) : t8('Sales order #1 has been created.', $order->ordnumber))
77 80
           ->render($self);
78 81
}
......
99 102
    make_section_title => sub { $_[0]->fb_number . ' ' . $_[0]->title },
100 103
  );
101 104

  
102
  $self->js->html('#' . TAB_ID(), $html)
105
  $self->js->hide(LIST_SELECTOR())
106
           ->after(LIST_SELECTOR(), $html)
103 107
           ->render($self);
104 108
}
105 109

  
......
136 140
  $self->init_requirement_spec;
137 141

  
138 142
  my $html = $self->render('requirement_spec_order/list', { output => 0 });
139
  $self->js->html('#' . TAB_ID(), $html)
143
  $self->js->replaceWith(LIST_SELECTOR(), $html)
144
           ->remove(FORMS_SELECTOR())
140 145
           ->flash('info', $::form->{quotation} ? t8('Sales quotation #1 has been updated.', $order->quonumber) : t8('Sales order #1 has been updated.', $order->ordnumber))
141 146
           ->render($self);
142 147
}
......
149 154
  }
150 155

  
151 156
  my $html   = $self->render('requirement_spec_order/edit_assignment', { output => 0 }, make_part_title => sub { $_[0]->partnumber . ' ' . $_[0]->description });
152
  $self->js->html('#' . TAB_ID(), $html)
157
  $self->js->hide(LIST_SELECTOR())
158
           ->after(LIST_SELECTOR(), $html)
153 159
           ->render($self);
154 160
}
155 161

  
......
159 165
  SL::DB::RequirementSpecItem->new(id => $_->{id})->load->update_attributes(order_part_id => ($_->{order_part_id} || undef)) for @{ $sections };
160 166

  
161 167
  my $html = $self->render('requirement_spec_order/list', { output => 0 });
162
  $self->js->html('#' . TAB_ID(), $html)
168
  $self->js->replaceWith(LIST_SELECTOR(), $html)
169
           ->remove(FORMS_SELECTOR())
163 170
           ->render($self);
164 171
}
165 172

  
......
172 179
  $self->init_requirement_spec;
173 180

  
174 181
  my $html = $self->render('requirement_spec_order/list', { output => 0 });
175
  $self->js->html('#' . TAB_ID(), $html)
182
  $self->js->replaceWith(LIST_SELECTOR(), $html)
176 183
           ->flash('info', $order->quotation ? t8('Sales quotation #1 has been deleted.', $order->quonumber) : t8('Sales order #1 has been deleted.', $order->ordnumber))
177 184
           ->render($self);
178 185
}
179 186

  
180
sub action_cancel {
181
  my ($self) = @_;
182

  
183
  my $html = $self->render('requirement_spec_order/list', { output => 0 });
184
  $self->js->html('#' . TAB_ID(), $html)
185
           ->render($self);
186
}
187

  
188 187
#
189 188
# filters
190 189
#
js/requirement_spec.js
365 365
};
366 366

  
367 367
ns.standard_quotation_order_ajax_call = function(key, opt) {
368
  if ((key == 'cancel') && !confirm(kivi.t8('Do you really want to cancel?')))
368
  if (key == 'cancel') {
369
    if (confirm(kivi.t8('Do you really want to cancel?'))) {
370
      $('#quotations_and_orders').show();
371
      $('#quotations_and_orders_article_assignment,#quotations_and_orders_new,#quotations_and_orders_update').remove();
372
    }
369 373
    return true;
374
  }
370 375

  
371 376
  else if ((key == 'create') && $('#quotations_and_orders_form INPUT[name="sections[].order_part_id"]').filter(function(idx, elt) { return ($(elt).val() || '') == '' }).size()) {
372 377
    alert(kivi.t8('There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.'));
templates/webpages/requirement_spec_order/update.html
2 2
[% SET style = "width: 400px" %]
3 3
[% SET order = SELF.rs_order.order %]
4 4

  
5
<div class="quotations-and-orders-update-context-menu">
5
<div id="quotations_and_orders_update" class="quotations-and-orders-update-context-menu">
6 6

  
7 7
 <h2>
8 8
  [% IF order.quotation %]

Auch abrufbar als: Unified diff