Project

General

Profile

« Previous | Next » 

Revision 39787

Added a new accounting action (processing payment)

View differences:

AccountingRequestInfoElement.java
36 36
    private FlowPanel firstDivider = new FlowPanel();
37 37

  
38 38
    private FlowPanel actionButtons = new FlowPanel();
39
    private Button processing = new Button("Processing");
39 40
    private Button paid = new Button("Paid");
40 41
    private Button putOnHold = new Button("Hold");
41 42
    private Button denied = new Button("Deny");
......
160 161

  
161 162
        editInfoButtons.addStyleName("requestInfoActionButtons");
162 163

  
164
        processing.addStyleName("requestInfoActionButton");
165
        processing.setType(ButtonType.DEFAULT);
166
        processing.addClickHandler(new ClickHandler() {
167
            @Override
168
            public void onClick(ClickEvent clickEvent) {
169

  
170
                errorLabel.setVisible(false);
171
                successLabel.setVisible(false);
172

  
173
                final HTML loadingWheel = new HTML("<div class=\"loader-big\"></div><div class=\"whiteFilm\"></div>");
174
                requestInfoPanel.addStyleName("loading");
175
                requestInfoPanel.add(loadingWheel);
176

  
177
                String comment = comments.getValue().trim();
178
                if(comment.equals(""))
179
                    comment = null;
180

  
181
                final String commentText = comment;
182
                dataService.processingRequest(requestInfo.getId(), GoldOAPortal.currentUser.getId(), comment, new AsyncCallback<Void>() {
183

  
184
                    @Override
185
                    public void onFailure(Throwable throwable) {
186

  
187
                        requestInfoPanel.removeStyleName("loading");
188
                        requestInfoPanel.remove(loadingWheel);
189

  
190
                        errorLabel.setText("Error while processing request's payment.");
191
                        errorLabel.setVisible(true);
192
                        if (actionListener != null)
193
                            actionListener.actionHappened(false, Request.RequestStatus.ACCOUNTING_PROCESSING, commentText);
194
                    }
195

  
196
                    @Override
197
                    public void onSuccess(Void aVoid) {
198

  
199
                        requestInfoPanel.removeStyleName("loading");
200
                        requestInfoPanel.remove(loadingWheel);
201

  
202
                        successLabel.setText("Request's payment processing");
203
                        successLabel.setVisible(true);
204
                        requestInfoPanel.remove(commentsForm);
205
                        requestInfoPanel.remove(actionButtons);
206
                        if (actionListener != null)
207
                            actionListener.actionHappened(true, Request.RequestStatus.ACCOUNTING_PROCESSING, commentText);
208
                    }
209
                });
210
            }
211
        });
212
        actionButtons.add(processing);
213

  
163 214
        paid.addStyleName("requestInfoActionButton");
164 215
        paid.setType(ButtonType.DEFAULT);
165 216
        paid.addClickHandler(new ClickHandler() {

Also available in: Unified diff