implemented proper messages for accounting events
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -9,6 +9,8 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface AccountDb {
|
public interface AccountDb {
|
||||||
|
Transaction dropTransaction(Transaction transaction);
|
||||||
|
|
||||||
void dropTransactionTag(long transactionId, String tag);
|
void dropTransactionTag(long transactionId, String tag);
|
||||||
|
|
||||||
Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount);
|
Optional<Transaction> lastTransaction(long accountId, String source, String dest, double amount);
|
||||||
|
|||||||
@@ -6,13 +6,11 @@ import static de.srsoftware.umbrella.accounting.Constants.CONFIG_DATABASE;
|
|||||||
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
|
import static de.srsoftware.umbrella.core.ConnectionProvider.connect;
|
||||||
import static de.srsoftware.umbrella.core.ModuleRegistry.tagService;
|
import static de.srsoftware.umbrella.core.ModuleRegistry.tagService;
|
||||||
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
import static de.srsoftware.umbrella.core.ModuleRegistry.userService;
|
||||||
import static de.srsoftware.umbrella.core.Util.mapValues;
|
|
||||||
import static de.srsoftware.umbrella.core.constants.Path.*;
|
import static de.srsoftware.umbrella.core.constants.Path.*;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.invalidField;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.invalidField;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.missingField;
|
||||||
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
||||||
import static de.srsoftware.umbrella.messagebus.events.Event.EventType.CREATE;
|
import static de.srsoftware.umbrella.messagebus.events.Event.EventType.CREATE;
|
||||||
import static de.srsoftware.umbrella.messagebus.events.Event.EventType.UPDATE;
|
|
||||||
import static java.lang.System.Logger.Level.WARNING;
|
import static java.lang.System.Logger.Level.WARNING;
|
||||||
|
|
||||||
import com.sun.net.httpserver.HttpExchange;
|
import com.sun.net.httpserver.HttpExchange;
|
||||||
@@ -26,13 +24,12 @@ import de.srsoftware.umbrella.core.constants.Field;
|
|||||||
import de.srsoftware.umbrella.core.constants.Text;
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||||
import de.srsoftware.umbrella.core.model.*;
|
import de.srsoftware.umbrella.core.model.*;
|
||||||
|
import de.srsoftware.umbrella.messagebus.events.Event;
|
||||||
|
import de.srsoftware.umbrella.messagebus.events.TransactionEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.messagebus.events.Event;
|
|
||||||
import de.srsoftware.umbrella.messagebus.events.TransactionEvent;
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@@ -143,11 +140,18 @@ public class AccountingModule extends BaseHandler implements AccountingService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean dropTransaction(Transaction transaction, UmbrellaUser user, HttpExchange ex) throws IOException {
|
||||||
|
var dropped = accountDb.dropTransaction(transaction);
|
||||||
|
messageBus().dispatch(new TransactionEvent(user,dropped,Event.EventType.DELETE));
|
||||||
|
return sendContent(ex,dropped);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean dropTransaction(Transaction transaction, UmbrellaUser user, Path path, HttpExchange ex) throws IOException {
|
public boolean dropTransaction(Transaction transaction, UmbrellaUser user, Path path, HttpExchange ex) throws IOException {
|
||||||
var head = path.pop();
|
var head = path.pop();
|
||||||
return switch (head){
|
return switch (head){
|
||||||
case TAG -> dropTransactionTag(user,transaction,ex);
|
case TAG -> dropTransactionTag(user,transaction,ex);
|
||||||
case null, default -> super.doDelete(path,ex);
|
case null -> dropTransaction(transaction,user,ex);
|
||||||
|
default -> super.doDelete(path,ex);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import static de.srsoftware.umbrella.accounting.Constants.*;
|
|||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.*;
|
||||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||||
import static de.srsoftware.umbrella.messagebus.MessageBus.messageBus;
|
|
||||||
import static de.srsoftware.umbrella.messagebus.events.Event.EventType.UPDATE;
|
|
||||||
import static java.text.MessageFormat.format;
|
import static java.text.MessageFormat.format;
|
||||||
|
|
||||||
import de.srsoftware.tools.jdbc.Condition;
|
import de.srsoftware.tools.jdbc.Condition;
|
||||||
@@ -21,8 +19,6 @@ import de.srsoftware.umbrella.core.constants.Field;
|
|||||||
import de.srsoftware.umbrella.core.constants.Text;
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.core.model.Account;
|
import de.srsoftware.umbrella.core.model.Account;
|
||||||
import de.srsoftware.umbrella.core.model.Transaction;
|
import de.srsoftware.umbrella.core.model.Transaction;
|
||||||
import de.srsoftware.umbrella.messagebus.events.TransactionEvent;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
@@ -121,6 +117,21 @@ public class SqliteDb extends BaseDb implements AccountDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Transaction dropTransaction(Transaction transaction){
|
||||||
|
try {
|
||||||
|
db.setAutoCommit(false);
|
||||||
|
Query.delete().from(TABLE_TAGS_TRANSACTIONS).where(TRANSACTION_ID,equal(transaction.id())).execute(db);
|
||||||
|
Query.delete().from(TABLE_TRANSACTIONS).where(ID,equal(transaction.id())).execute(db);
|
||||||
|
db.setAutoCommit(true);
|
||||||
|
return transaction;
|
||||||
|
} catch (SQLException e){
|
||||||
|
try {
|
||||||
|
db.rollback();
|
||||||
|
} catch (SQLException ignored){};
|
||||||
|
throw failedToDropObject(transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropTransactionTag(long transactionId, String tag) {
|
public void dropTransactionTag(long transactionId, String tag) {
|
||||||
try {
|
try {
|
||||||
@@ -299,13 +310,9 @@ public class SqliteDb extends BaseDb implements AccountDb {
|
|||||||
}
|
}
|
||||||
} else if (transaction.isDirty()) {
|
} else if (transaction.isDirty()) {
|
||||||
try {
|
try {
|
||||||
if (transaction.amount() == 0 || transaction.source().isEmpty() || transaction.destination().isEmpty()) {
|
|
||||||
delete().from(TABLE_TRANSACTIONS).where(Field.ID, equal(transaction.id())).where(ACCOUNT, equal(transaction.accountId())).execute(db);
|
|
||||||
} else {
|
|
||||||
replaceInto(TABLE_TRANSACTIONS, Field.ID, Field.ACCOUNT, Field.TIMESTAMP, Field.SOURCE, Field.DESTINATION, Field.AMOUNT, Field.DESCRIPTION)
|
replaceInto(TABLE_TRANSACTIONS, Field.ID, Field.ACCOUNT, Field.TIMESTAMP, Field.SOURCE, Field.DESTINATION, Field.AMOUNT, Field.DESCRIPTION)
|
||||||
.values(transaction.id(), transaction.accountId(), timestamp, transaction.source().value(), transaction.destination().value(), transaction.amount(), transaction.purpose())
|
.values(transaction.id(), transaction.accountId(), timestamp, transaction.source().value(), transaction.destination().value(), transaction.amount(), transaction.purpose())
|
||||||
.execute(db).close();
|
.execute(db).close();
|
||||||
}
|
|
||||||
return transaction.clearDirtyState();
|
return transaction.clearDirtyState();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw failedToStoreObject(transaction);
|
throw failedToStoreObject(transaction);
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
|
/* © SRSoftware 2025 */
|
||||||
package de.srsoftware.umbrella.messagebus.events;
|
package de.srsoftware.umbrella.messagebus.events;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.core.ModuleRegistry;
|
import static de.srsoftware.umbrella.core.ModuleRegistry.accountingService;
|
||||||
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
||||||
|
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import de.srsoftware.umbrella.core.constants.Module;
|
import de.srsoftware.umbrella.core.constants.Module;
|
||||||
import de.srsoftware.umbrella.core.constants.Text;
|
import de.srsoftware.umbrella.core.constants.Text;
|
||||||
import de.srsoftware.umbrella.core.model.Transaction;
|
import de.srsoftware.umbrella.core.model.Transaction;
|
||||||
import de.srsoftware.umbrella.core.model.Translatable;
|
import de.srsoftware.umbrella.core.model.Translatable;
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||||
import de.srsoftware.umbrella.core.model.UnTranslatable;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.ModuleRegistry.accountingService;
|
|
||||||
import static de.srsoftware.umbrella.core.model.Translatable.t;
|
|
||||||
import static java.text.MessageFormat.format;
|
|
||||||
|
|
||||||
public class TransactionEvent extends Event<Transaction> {
|
public class TransactionEvent extends Event<Transaction> {
|
||||||
private Collection<UmbrellaUser> audience;
|
private Collection<UmbrellaUser> audience;
|
||||||
|
|
||||||
@@ -38,17 +35,42 @@ public class TransactionEvent extends Event<Transaction> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable describe() {
|
public Translatable describe() {
|
||||||
|
var user = initiator().name();
|
||||||
|
var type = t(Text.TRANSACTION);
|
||||||
|
var entity = payload().purpose();
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case UPDATE -> new UnTranslatable(diff().orElse(""));
|
case CREATE -> describeDetail();
|
||||||
case null, default -> new UnTranslatable(payload().toString());
|
case DELETE -> describeDetail();
|
||||||
|
case UPDATE -> describeUpdate();
|
||||||
|
case null, default -> t("TODO"); // TODO
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Translatable describeUpdate() {
|
||||||
|
var head = t("Changes in {type} '{entity}':\n\n{body}",Field.TYPE,t(Text.TRANSACTION),Field.ENTITY,oldData().get(PURPOSE),BODY,diff().orElse(""));
|
||||||
|
return t("{head}\n\n{link}","head",head,"link",link());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Translatable describeDetail(){
|
||||||
|
var tr = payload();
|
||||||
|
var head = subject();
|
||||||
|
|
||||||
|
var message = "{head}:\n\n{source}: {source_name}\n{destination}: {dest_name}\n{amount}: {value}\n{purpose}: {purpose_val}\n\n{link}";
|
||||||
|
return t(message,Field.HEAD, head, SOURCE,t(Text.SOURCE), "source_name",tr.source(), DESTINATION,t(Text.DESTINATION),"dest_name",tr.destination(), AMOUNT,t(Text.AMOUNT), VALUE,tr.amount(), PURPOSE,t(Text.PURPOSE),"purpose_val",tr.purpose(),"link",link());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Translatable link() {
|
||||||
|
return t("You can view/edit this transaction at {base_url}/account/{id}", ID, payload().accountId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Translatable subject() {
|
public Translatable subject() {
|
||||||
|
var user = initiator().name();
|
||||||
|
var entity = payload().purpose();
|
||||||
return switch (eventType()){
|
return switch (eventType()){
|
||||||
case CREATE -> t("user_created_entity", Field.USER,initiator().name(), Field.ENTITY, t(Text.TRANSACTION));
|
case CREATE -> t("{user} added a new transaction: {entity}", USER,user, ENTITY, entity);
|
||||||
case UPDATE -> t("user_updated_entity", Field.USER,initiator().name(), Field.ENTITY, t(Text.TRANSACTION));
|
case DELETE -> t("The transaction '{entity}' has been deleted by {user}",Field.ENTITY, entity, USER, user);
|
||||||
|
case UPDATE -> t("{user} updated the transaction '{entity}'", USER,user, ENTITY, oldData().get(PURPOSE));
|
||||||
case null, default -> t("TODO"); // TODO
|
case null, default -> t("TODO"); // TODO
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
/* © SRSoftware 2025 */
|
/* © SRSoftware 2025 */
|
||||||
package de.srsoftware.umbrella.core.api;
|
package de.srsoftware.umbrella.core.api;
|
||||||
|
|
||||||
|
import static de.srsoftware.umbrella.core.Util.mapValues;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
import de.srsoftware.tools.Mappable;
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import de.srsoftware.umbrella.core.model.Account;
|
import de.srsoftware.umbrella.core.model.Account;
|
||||||
import de.srsoftware.umbrella.core.model.Transaction;
|
import de.srsoftware.umbrella.core.model.Transaction;
|
||||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static de.srsoftware.umbrella.core.Util.mapValues;
|
|
||||||
|
|
||||||
public interface AccountingService {
|
public interface AccountingService {
|
||||||
public record AccountData(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) implements Mappable {
|
public record AccountData(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) implements Mappable {
|
||||||
public static AccountData of(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) {
|
public static AccountData of(Account account, List<Transaction> transactions, HashMap<Long, UmbrellaUser> userMap) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ package de.srsoftware.umbrella.core.constants;
|
|||||||
public class Text {
|
public class Text {
|
||||||
public static final String ACCOUNT = "account";
|
public static final String ACCOUNT = "account";
|
||||||
public static final String ACCOUNTING = "accounting";
|
public static final String ACCOUNTING = "accounting";
|
||||||
|
public static final String AMOUNT = "amount";
|
||||||
|
|
||||||
public static final String BOOKMARK = "bookmark";
|
public static final String BOOKMARK = "bookmark";
|
||||||
public static final String BOOKMARKS = "bookmarks";
|
public static final String BOOKMARKS = "bookmarks";
|
||||||
@@ -21,6 +22,7 @@ public class Text {
|
|||||||
public static final String CUSTOMER = "customer";
|
public static final String CUSTOMER = "customer";
|
||||||
public static final String CUSTOMER_SETTINGS = "customer settings";
|
public static final String CUSTOMER_SETTINGS = "customer settings";
|
||||||
|
|
||||||
|
public static final String DESTINATION = "destination";
|
||||||
public static final String DOCUMENT = "document";
|
public static final String DOCUMENT = "document";
|
||||||
public static final String DOCUMENTS = "documents";
|
public static final String DOCUMENTS = "documents";
|
||||||
public static final String DOCUMENT_TYPE_ID = "document type id";
|
public static final String DOCUMENT_TYPE_ID = "document type id";
|
||||||
@@ -60,6 +62,7 @@ public class Text {
|
|||||||
public static final String PROJECT_WITH_ID = "project ({id})";
|
public static final String PROJECT_WITH_ID = "project ({id})";
|
||||||
public static final String PROPERTIES = "properties";
|
public static final String PROPERTIES = "properties";
|
||||||
public static final String PROPERTY = "property";
|
public static final String PROPERTY = "property";
|
||||||
|
public static final String PURPOSE = "purpose";
|
||||||
|
|
||||||
public static final String RECEIVER = "receiver";
|
public static final String RECEIVER = "receiver";
|
||||||
public static final String RECEIVERS = "receivers";
|
public static final String RECEIVERS = "receivers";
|
||||||
@@ -69,6 +72,7 @@ public class Text {
|
|||||||
public static final String SERVICE_WITH_ID = "service ({id})";
|
public static final String SERVICE_WITH_ID = "service ({id})";
|
||||||
public static final String SESSION = "session";
|
public static final String SESSION = "session";
|
||||||
public static final String SETTINGS = "settings";
|
public static final String SETTINGS = "settings";
|
||||||
|
public static final String SOURCE = "source";
|
||||||
public static final String STOCK = "stock";
|
public static final String STOCK = "stock";
|
||||||
public static final String STRING = "string";
|
public static final String STRING = "string";
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
/* © SRSoftware 2025 */
|
/* © SRSoftware 2025 */
|
||||||
package de.srsoftware.umbrella.core.model;
|
package de.srsoftware.umbrella.core.model;
|
||||||
|
|
||||||
|
import static de.srsoftware.tools.Optionals.isSet;
|
||||||
|
|
||||||
import de.srsoftware.tools.Mappable;
|
import de.srsoftware.tools.Mappable;
|
||||||
import de.srsoftware.umbrella.core.constants.Field;
|
import de.srsoftware.umbrella.core.constants.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static de.srsoftware.tools.Optionals.isSet;
|
|
||||||
import static de.srsoftware.tools.Optionals.nullIfEmpty;
|
|
||||||
|
|
||||||
public class IdOrString implements Mappable {
|
public class IdOrString implements Mappable {
|
||||||
private final Long id;
|
private final Long id;
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import static de.srsoftware.umbrella.core.ModuleRegistry.*;
|
|||||||
import static de.srsoftware.umbrella.core.ResponseCode.HTTP_UNPROCESSABLE;
|
import static de.srsoftware.umbrella.core.ResponseCode.HTTP_UNPROCESSABLE;
|
||||||
import static de.srsoftware.umbrella.core.Util.mapValues;
|
import static de.srsoftware.umbrella.core.Util.mapValues;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
import static de.srsoftware.umbrella.core.constants.Field.AMOUNT;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.COMPANY;
|
import static de.srsoftware.umbrella.core.constants.Field.COMPANY;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.CUSTOMER;
|
import static de.srsoftware.umbrella.core.constants.Field.CUSTOMER;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.DOCUMENT;
|
import static de.srsoftware.umbrella.core.constants.Field.DOCUMENT;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import static de.srsoftware.umbrella.core.Errors.*;
|
|||||||
import static de.srsoftware.umbrella.core.ModuleRegistry.translator;
|
import static de.srsoftware.umbrella.core.ModuleRegistry.translator;
|
||||||
import static de.srsoftware.umbrella.core.constants.Constants.FALLBACK_LANG;
|
import static de.srsoftware.umbrella.core.constants.Constants.FALLBACK_LANG;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
|
import static de.srsoftware.umbrella.core.constants.Field.AMOUNT;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.COMPANY;
|
import static de.srsoftware.umbrella.core.constants.Field.COMPANY;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.CUSTOMER;
|
import static de.srsoftware.umbrella.core.constants.Field.CUSTOMER;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.NUMBER;
|
import static de.srsoftware.umbrella.core.constants.Field.NUMBER;
|
||||||
|
|||||||
@@ -57,13 +57,9 @@
|
|||||||
window.setTimeout(scrollToBottom,100);
|
window.setTimeout(scrollToBottom,100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEvent(evt,method){
|
|
||||||
let event_data = JSON.parse(evt.data);
|
|
||||||
console.log({method, event_data});
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDeleteEvent(evt){
|
function handleDeleteEvent(evt){
|
||||||
handleEvent(evt,'delete');
|
const event_data = JSON.parse(evt.data);
|
||||||
|
transactions = transactions.filter(t => t.id != event_data.transaction.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateEvent(evt){
|
function handleUpdateEvent(evt){
|
||||||
@@ -139,6 +135,7 @@
|
|||||||
<th>{t('other party')}</th>
|
<th>{t('other party')}</th>
|
||||||
<th>{t('purpose')}</th>
|
<th>{t('purpose')}</th>
|
||||||
<th>{t('tags')}</th>
|
<th>{t('tags')}</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -160,7 +157,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
{sums[0].toFixed(2)} {account.currency}
|
{sums[0].toFixed(2)} {account.currency}
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2"></td>
|
<td colspan="3"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -8,6 +8,16 @@
|
|||||||
let { account, addToFilter = tag => {}, transaction, users } = $props();
|
let { account, addToFilter = tag => {}, transaction, users } = $props();
|
||||||
let hidden = $state(false);
|
let hidden = $state(false);
|
||||||
|
|
||||||
|
function deleteTransaction(ev){
|
||||||
|
if (confirm(t('confirm_delete',{element:transaction.purpose}))){
|
||||||
|
const url = api(`accounting/transaction/${transaction.id}`);
|
||||||
|
const res = drop(url);
|
||||||
|
if (res.ok){
|
||||||
|
yikes();
|
||||||
|
} else error(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function dropTag(tag){
|
async function dropTag(tag){
|
||||||
var url = api(`accounting/transaction/${transaction.id}/tag`)
|
var url = api(`accounting/transaction/${transaction.id}/tag`)
|
||||||
var res = await drop(url,{tag});
|
var res = await drop(url,{tag});
|
||||||
@@ -127,5 +137,8 @@
|
|||||||
<Autocomplete {getCandidates} {onCommit} />
|
<Autocomplete {getCandidates} {onCommit} />
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="actions">
|
||||||
|
<button class="symbol" onclick={deleteTransaction}></button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import static de.srsoftware.umbrella.core.Util.mapValues;
|
|||||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.PERMISSION;
|
import static de.srsoftware.umbrella.core.constants.Field.PERMISSION;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.SETTINGS;
|
import static de.srsoftware.umbrella.core.constants.Field.SETTINGS;
|
||||||
|
import static de.srsoftware.umbrella.core.constants.Field.SOURCE;
|
||||||
import static de.srsoftware.umbrella.core.constants.Field.TAGS;
|
import static de.srsoftware.umbrella.core.constants.Field.TAGS;
|
||||||
import static de.srsoftware.umbrella.core.constants.Module.PROJECT;
|
import static de.srsoftware.umbrella.core.constants.Module.PROJECT;
|
||||||
import static de.srsoftware.umbrella.core.constants.Path.*;
|
import static de.srsoftware.umbrella.core.constants.Path.*;
|
||||||
|
|||||||
@@ -397,6 +397,7 @@
|
|||||||
"The task '{task}' has been created": "Die Aufgabe '{task}' wurde angelegt",
|
"The task '{task}' has been created": "Die Aufgabe '{task}' wurde angelegt",
|
||||||
"The task '{task}' has been deleted": "Die Aufgabe '{task}' wurde gelöscht",
|
"The task '{task}' has been deleted": "Die Aufgabe '{task}' wurde gelöscht",
|
||||||
"The task '{task}' has been deleted by {user}": "Die Aufgabe '{task}' wurde von {user} gelöscht",
|
"The task '{task}' has been deleted by {user}": "Die Aufgabe '{task}' wurde von {user} gelöscht",
|
||||||
|
"The transaction '{entity}' has been deleted by {user}": "Der Umsatz „{entity}“ wurde von {user} gelöscht",
|
||||||
"The wiki page '{name}' has been created": "Die Wiki-Seite „{name}“ wurde angelegt",
|
"The wiki page '{name}' has been created": "Die Wiki-Seite „{name}“ wurde angelegt",
|
||||||
"The wiki page '{name}' has been deleted": "Die Wiki-Seite „{name}“ wurde gelöscht.",
|
"The wiki page '{name}' has been deleted": "Die Wiki-Seite „{name}“ wurde gelöscht.",
|
||||||
"The wiki page '{page}' has been deleted by {user}": "Die Wiki-Seite „{page}“ wurde durch {user} gelöscht.",
|
"The wiki page '{page}' has been deleted by {user}": "Die Wiki-Seite „{page}“ wurde durch {user} gelöscht.",
|
||||||
@@ -428,6 +429,8 @@
|
|||||||
"upload_file": "Datei hochladen",
|
"upload_file": "Datei hochladen",
|
||||||
"user": "Benutzer",
|
"user": "Benutzer",
|
||||||
"user ({id})": "Benutzer ({id})",
|
"user ({id})": "Benutzer ({id})",
|
||||||
|
"{user} added a new transaction: {entity}": "{user} hat einen neuen Umsatz hinzugefügt: {entity}",
|
||||||
|
"{user} updated the transaction '{entity}'": "{user} hat den Umsatz „{entity}“ aktualisiert",
|
||||||
"user_list": "Benutzer-Liste",
|
"user_list": "Benutzer-Liste",
|
||||||
"user_module" : "Umbrella User-Verwaltung",
|
"user_module" : "Umbrella User-Verwaltung",
|
||||||
"user profile": "Benutzer-Profil",
|
"user profile": "Benutzer-Profil",
|
||||||
@@ -455,6 +458,7 @@
|
|||||||
"wiki_pages": "Wiki-Seiten",
|
"wiki_pages": "Wiki-Seiten",
|
||||||
|
|
||||||
"year": "Jahr",
|
"year": "Jahr",
|
||||||
|
"You can view/edit this transaction at {base_url}/account/{id}": "Du kannst diese transaktion unter {base_url}/account/{id} ansehen",
|
||||||
"You can view/edit this project at {base_url}/project/{id}/view": "Du kannst dieses Projekt unter {base_url}/project/{id}/view ansehen/bearbeiten.",
|
"You can view/edit this project at {base_url}/project/{id}/view": "Du kannst dieses Projekt unter {base_url}/project/{id}/view ansehen/bearbeiten.",
|
||||||
"You can view/edit this task at {base_url}/task/{id}/view": "Du kannst diese Aufgabe unter {base_url}/task/{id}/view ansehen/bearbeiten.",
|
"You can view/edit this task at {base_url}/task/{id}/view": "Du kannst diese Aufgabe unter {base_url}/task/{id}/view ansehen/bearbeiten.",
|
||||||
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "Du kannst diese Wiki-Seite unter {base_url}/wiki/{id}/view ansehen/bearbeiten.",
|
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "Du kannst diese Wiki-Seite unter {base_url}/wiki/{id}/view ansehen/bearbeiten.",
|
||||||
|
|||||||
@@ -397,6 +397,7 @@
|
|||||||
"The task '{task}' has been created": "The task '{task}' has been created",
|
"The task '{task}' has been created": "The task '{task}' has been created",
|
||||||
"The task '{task}' has been deleted": "The task '{task}' has been deleted",
|
"The task '{task}' has been deleted": "The task '{task}' has been deleted",
|
||||||
"The task '{task}' has been deleted by {user}": "The task '{task}' has been deleted by {user}",
|
"The task '{task}' has been deleted by {user}": "The task '{task}' has been deleted by {user}",
|
||||||
|
"The transaction '{entity}' has been deleted by {user}": "The transaction '{entity}' has been deleted by {user}",
|
||||||
"The wiki page '{name}' has been created": "The wiki page '{name}' has been created",
|
"The wiki page '{name}' has been created": "The wiki page '{name}' has been created",
|
||||||
"The wiki page '{name}' has been deleted": "The wiki page '{name}' has been deleted",
|
"The wiki page '{name}' has been deleted": "The wiki page '{name}' has been deleted",
|
||||||
"The wiki page '{page}' has been deleted by {user}": "The wiki page '{page}' has been deleted by {user}",
|
"The wiki page '{page}' has been deleted by {user}": "The wiki page '{page}' has been deleted by {user}",
|
||||||
@@ -428,6 +429,8 @@
|
|||||||
"upload_file": "upload file",
|
"upload_file": "upload file",
|
||||||
"user": "user",
|
"user": "user",
|
||||||
"user ({id})": "user ({id})",
|
"user ({id})": "user ({id})",
|
||||||
|
"{user} added a new transaction: {entity}": "{user} added a new transaction: {entity}",
|
||||||
|
"{user} updated the transaction '{entity}'": "{user} updated the transaction '{entity}'",
|
||||||
"user_list": "user list",
|
"user_list": "user list",
|
||||||
"user_module" : "Umbrella user management",
|
"user_module" : "Umbrella user management",
|
||||||
"user profile": "User profile",
|
"user profile": "User profile",
|
||||||
@@ -455,10 +458,11 @@
|
|||||||
"wiki_pages": "wiki pages",
|
"wiki_pages": "wiki pages",
|
||||||
|
|
||||||
"year": "year",
|
"year": "year",
|
||||||
|
"You have been added to the new project '{project}', created by {user}:\n\n{body}": "You have been added to the new project '{project}', created by {user}:\n\n{body}",
|
||||||
|
"You can view/edit this transaction at {base_url}/account/{id}": "Du kannst diese transaktion unter {base_url}/account/{id} ansehen",
|
||||||
"You can view/edit this project at {base_url}/project/{id}/view": "You can view/edit this project at {base_url}/project/{id}/view",
|
"You can view/edit this project at {base_url}/project/{id}/view": "You can view/edit this project at {base_url}/project/{id}/view",
|
||||||
"You can view/edit this task at {base_url}/task/{id}/view": "You can view/edit this task at {base_url}/task/{id}/view",
|
"You can view/edit this task at {base_url}/task/{id}/view": "You can view/edit this task at {base_url}/task/{id}/view",
|
||||||
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "You can view/edit this wiki page at {base_url}/wiki/{id}/view",
|
"You can view/edit this wiki page at {base_url}/wiki/{id}/view": "You can view/edit this wiki page at {base_url}/wiki/{id}/view",
|
||||||
"You have been added to the new project '{project}', created by {user}:\n\n{body}": "You have been added to the new project '{project}', created by {user}:\n\n{body}",
|
|
||||||
"You may change your notification settings at {base_url}/message/settings": "You may change your notification settings at {base_url}/message/settings .",
|
"You may change your notification settings at {base_url}/message/settings": "You may change your notification settings at {base_url}/message/settings .",
|
||||||
"Your token to create a new password" : "Your token to create a new password",
|
"Your token to create a new password" : "Your token to create a new password",
|
||||||
"your_profile": "your profile"
|
"your_profile": "your profile"
|
||||||
|
|||||||
Reference in New Issue
Block a user