Add warmmiete and streitwert calculations; enhance check_and_rebuild script for cache clearing
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
define('custom:views/c-vmh-erstgespraech/fields/streitwert', ['views/fields/currency'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.calculating = false;
|
||||
|
||||
// Listen to changes on dependent fields
|
||||
this.listenTo(this.model, 'change:kaltmiete', this.calculate.bind(this));
|
||||
this.listenTo(this.model, 'change:bKPauschale', this.calculate.bind(this));
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
Dep.prototype.afterRender.call(this);
|
||||
// Don't calculate on initial render - only on changes
|
||||
},
|
||||
|
||||
calculate: function () {
|
||||
if (this.calculating) return;
|
||||
this.calculating = true;
|
||||
|
||||
var kaltmiete = parseFloat(this.model.get('kaltmiete')) || 0;
|
||||
var bKPauschale = parseFloat(this.model.get('bKPauschale')) || 0;
|
||||
|
||||
var streitwert = (kaltmiete + bKPauschale) * 12;
|
||||
|
||||
// Set value - this will trigger the parent view to update
|
||||
this.model.set('streitwert', streitwert);
|
||||
|
||||
this.calculating = false;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
define('custom:views/c-vmh-erstgespraech/fields/warmmiete', ['views/fields/currency'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
this.calculating = false;
|
||||
|
||||
// Listen to changes on dependent fields
|
||||
this.listenTo(this.model, 'change:kaltmiete', this.calculate.bind(this));
|
||||
this.listenTo(this.model, 'change:bKVorauszahlung', this.calculate.bind(this));
|
||||
this.listenTo(this.model, 'change:bKPauschale', this.calculate.bind(this));
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
Dep.prototype.afterRender.call(this);
|
||||
// Don't calculate on initial render - only on changes
|
||||
},
|
||||
|
||||
calculate: function () {
|
||||
if (this.calculating) return;
|
||||
this.calculating = true;
|
||||
|
||||
var kaltmiete = parseFloat(this.model.get('kaltmiete')) || 0;
|
||||
var bKVorauszahlung = parseFloat(this.model.get('bKVorauszahlung')) || 0;
|
||||
var bKPauschale = parseFloat(this.model.get('bKPauschale')) || 0;
|
||||
|
||||
var warmmiete = kaltmiete + bKVorauszahlung + bKPauschale;
|
||||
|
||||
// Set value - this will trigger the parent view to update
|
||||
this.model.set('warmmiete', warmmiete);
|
||||
|
||||
this.calculating = false;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
49
client/custom/src/views/c-vmh-erstgespraech/record/edit.js
Normal file
49
client/custom/src/views/c-vmh-erstgespraech/record/edit.js
Normal file
@@ -0,0 +1,49 @@
|
||||
define('custom:views/c-vmh-erstgespraech/record/edit', ['views/record/edit'], function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
|
||||
// Listen for changes on Kaltmiete, BK-Vorauszahlung, and BK-Pauschale
|
||||
this.listenTo(this.model, 'change:kaltmiete change:bKVorauszahlung change:bKPauschale', function () {
|
||||
this.calculateFields();
|
||||
}, this);
|
||||
|
||||
// Initial calculation after fields are ready
|
||||
this.once('after:render', function () {
|
||||
this.calculateFields();
|
||||
}, this);
|
||||
},
|
||||
|
||||
calculateFields: function () {
|
||||
var kaltmiete = parseFloat(this.model.get('kaltmiete')) || 0;
|
||||
var bKVorauszahlung = parseFloat(this.model.get('bKVorauszahlung')) || 0;
|
||||
var bKPauschale = parseFloat(this.model.get('bKPauschale')) || 0;
|
||||
|
||||
// Berechne Warmmiete
|
||||
var warmmiete = kaltmiete + bKVorauszahlung + bKPauschale;
|
||||
this.model.set('warmmiete', warmmiete, {silent: false});
|
||||
|
||||
// Berechne Streitwert
|
||||
var streitwert = (kaltmiete + bKPauschale) * 12;
|
||||
this.model.set('streitwert', streitwert, {silent: false});
|
||||
|
||||
// Force update der View
|
||||
if (this.hasView('warmmiete')) {
|
||||
var warmmieteView = this.getView('warmmiete');
|
||||
if (warmmieteView && warmmieteView.reRender) {
|
||||
warmmieteView.reRender();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasView('streitwert')) {
|
||||
var streitwertView = this.getView('streitwert');
|
||||
if (streitwertView && streitwertView.reRender) {
|
||||
streitwertView.reRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
@@ -123,7 +123,8 @@
|
||||
"decimal": true,
|
||||
"isCustom": true,
|
||||
"readOnly": true,
|
||||
"required": true
|
||||
"required": true,
|
||||
"view": "custom:views/c-vmh-erstgespraech/fields/warmmiete"
|
||||
},
|
||||
"erfolgsaussichten": {
|
||||
"type": "enum",
|
||||
@@ -161,7 +162,8 @@
|
||||
"tooltip": true,
|
||||
"isCustom": true,
|
||||
"onlyDefaultCurrency": true,
|
||||
"readOnly": true
|
||||
"readOnly": true,
|
||||
"view": "custom:views/c-vmh-erstgespraech/fields/streitwert"
|
||||
},
|
||||
"anruferIst": {
|
||||
"type": "enum",
|
||||
|
||||
@@ -146,24 +146,50 @@ if [ "$ERRORS" -gt 0 ]; then
|
||||
echo "Bitte behebe die oben genannten Fehler und führe das Script erneut aus."
|
||||
exit 1
|
||||
else
|
||||
echo -e "${GREEN}Starte Rebuild...${NC}"
|
||||
echo -e "${GREEN}Starte Rebuild und Cache-Bereinigung...${NC}"
|
||||
echo ""
|
||||
|
||||
# Rebuild durchführen
|
||||
# Rebuild und Cache-Bereinigung durchführen
|
||||
if command -v docker &> /dev/null; then
|
||||
if docker exec espocrm php /var/www/html/command.php rebuild 2>&1; then
|
||||
echo -e "${BLUE}[1/2] Führe Clear Cache aus...${NC}"
|
||||
if docker exec espocrm php /var/www/html/command.php ClearCache 2>&1; then
|
||||
echo -e "${GREEN}✓ Cache erfolgreich gelöscht${NC}"
|
||||
echo ""
|
||||
echo -e "${GREEN}=========================================="
|
||||
echo "✓ REBUILD ERFOLGREICH ABGESCHLOSSEN"
|
||||
echo "==========================================${NC}"
|
||||
exit 0
|
||||
|
||||
echo -e "${BLUE}[2/2] Führe Rebuild aus...${NC}"
|
||||
if docker exec espocrm php /var/www/html/command.php rebuild 2>&1; then
|
||||
echo ""
|
||||
echo -e "${GREEN}=========================================="
|
||||
echo "✓ REBUILD ERFOLGREICH ABGESCHLOSSEN"
|
||||
echo "==========================================${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
echo -e "${RED}=========================================="
|
||||
echo "✗ REBUILD FEHLGESCHLAGEN"
|
||||
echo "==========================================${NC}"
|
||||
echo "Prüfe die Logs unter data/logs/ für weitere Details."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}✗ Clear Cache fehlgeschlagen${NC}"
|
||||
echo "Fahre mit Rebuild fort..."
|
||||
echo ""
|
||||
echo -e "${RED}=========================================="
|
||||
echo "✗ REBUILD FEHLGESCHLAGEN"
|
||||
echo "==========================================${NC}"
|
||||
echo "Prüfe die Logs unter data/logs/ für weitere Details."
|
||||
exit 1
|
||||
|
||||
if docker exec espocrm php /var/www/html/command.php rebuild 2>&1; then
|
||||
echo ""
|
||||
echo -e "${GREEN}=========================================="
|
||||
echo "✓ REBUILD ERFOLGREICH ABGESCHLOSSEN"
|
||||
echo "==========================================${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
echo -e "${RED}=========================================="
|
||||
echo "✗ REBUILD FEHLGESCHLAGEN"
|
||||
echo "==========================================${NC}"
|
||||
echo "Prüfe die Logs unter data/logs/ für weitere Details."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}✗ Docker nicht gefunden. Rebuild kann nicht durchgeführt werden.${NC}"
|
||||
|
||||
@@ -349,8 +349,8 @@ return [
|
||||
0 => 'youtube.com',
|
||||
1 => 'google.com'
|
||||
],
|
||||
'cacheTimestamp' => 1769181610,
|
||||
'microtime' => 1769181610.43814,
|
||||
'cacheTimestamp' => 1769183183,
|
||||
'microtime' => 1769183183.901404,
|
||||
'siteUrl' => 'https://crm.bitbylaw.com',
|
||||
'fullTextSearchMinLength' => 4,
|
||||
'appTimestamp' => 1768843902,
|
||||
|
||||
Reference in New Issue
Block a user