| Line 588... |
Line 588... |
| 588 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
588 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
| 589 |
if(!voucherExists(voucherType)) {
|
589 |
if(!voucherExists(voucherType)) {
|
| 590 |
Window.alert("Voucher already exists");
|
590 |
Window.alert("Voucher already exists");
|
| 591 |
return false;
|
591 |
return false;
|
| 592 |
}
|
592 |
}
|
| 593 |
|
593 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);;
|
| 594 |
catalogService.addVoucher(item.getCatalogItemId(), voucherType, voucherAmount, new AsyncCallback<Boolean>() {
|
594 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
| 595 |
@Override
|
595 |
@Override
|
| 596 |
public void onSuccess(Boolean result) {
|
596 |
public void onSuccess(Boolean result) {
|
| 597 |
if(result) {
|
597 |
if(result) {
|
| 598 |
GWT.log("Voucher Added");
|
598 |
GWT.log("Voucher Added");
|
| 599 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
599 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
| Line 868... |
Line 868... |
| 868 |
VoucherItemDialog voucherDialog = new VoucherItemDialog(voucherAmount);
|
868 |
VoucherItemDialog voucherDialog = new VoucherItemDialog(voucherAmount);
|
| 869 |
voucherDialog.updateButton.setText("Update");
|
869 |
voucherDialog.updateButton.setText("Update");
|
| 870 |
voucherDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
870 |
voucherDialog.setVoucherUpdateListener(new VoucherItemDialog.VoucherUpdateListener() {
|
| 871 |
@Override
|
871 |
@Override
|
| 872 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
872 |
public boolean onUpdate(final String voucherType, final long voucherAmount) {
|
| - |
|
873 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
| 873 |
catalogService.addVoucher(item.getCatalogItemId(), voucherType, voucherAmount, new AsyncCallback<Boolean>() {
|
874 |
catalogService.addVoucher(item.getCatalogItemId(), voucherTypeValue, voucherAmount, new AsyncCallback<Boolean>() {
|
| 874 |
@Override
|
875 |
@Override
|
| 875 |
public void onSuccess(Boolean result) {
|
876 |
public void onSuccess(Boolean result) {
|
| 876 |
if(result) {
|
877 |
if(result) {
|
| 877 |
GWT.log("Voucher Updated");
|
878 |
GWT.log("Voucher Updated");
|
| 878 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
879 |
VoucherItemMapping newvoucher = new VoucherItemMapping(voucherAmount, voucherType);
|
| Line 907... |
Line 908... |
| 907 |
@Override
|
908 |
@Override
|
| 908 |
public void onClick(ClickEvent event) {
|
909 |
public void onClick(ClickEvent event) {
|
| 909 |
Cell cell = tableVouchers.getCellForEvent(event);
|
910 |
Cell cell = tableVouchers.getCellForEvent(event);
|
| 910 |
final int row = cell.getRowIndex();
|
911 |
final int row = cell.getRowIndex();
|
| 911 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
912 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
| 912 |
|
913 |
Long voucherTypeValue = Utils.getVoucherTypeId(voucherType);
|
| 913 |
catalogService.deleteVoucher(item.getCatalogItemId(), voucherType, new AsyncCallback<Boolean>() {
|
914 |
catalogService.deleteVoucher(item.getCatalogItemId(), voucherTypeValue, new AsyncCallback<Boolean>() {
|
| 914 |
@Override
|
915 |
@Override
|
| 915 |
public void onSuccess(Boolean result) {
|
916 |
public void onSuccess(Boolean result) {
|
| 916 |
if(result) {
|
917 |
if(result) {
|
| 917 |
GWT.log("Voucher deleted");
|
918 |
GWT.log("Voucher deleted");
|
| 918 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|
919 |
String voucherType = tableVouchers.getText(row, TABLE_INDEX_VOUCHERS_TYPE);
|