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,
|
"decimal": true,
|
||||||
"isCustom": true,
|
"isCustom": true,
|
||||||
"readOnly": true,
|
"readOnly": true,
|
||||||
"required": true
|
"required": true,
|
||||||
|
"view": "custom:views/c-vmh-erstgespraech/fields/warmmiete"
|
||||||
},
|
},
|
||||||
"erfolgsaussichten": {
|
"erfolgsaussichten": {
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
@@ -161,7 +162,8 @@
|
|||||||
"tooltip": true,
|
"tooltip": true,
|
||||||
"isCustom": true,
|
"isCustom": true,
|
||||||
"onlyDefaultCurrency": true,
|
"onlyDefaultCurrency": true,
|
||||||
"readOnly": true
|
"readOnly": true,
|
||||||
|
"view": "custom:views/c-vmh-erstgespraech/fields/streitwert"
|
||||||
},
|
},
|
||||||
"anruferIst": {
|
"anruferIst": {
|
||||||
"type": "enum",
|
"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."
|
echo "Bitte behebe die oben genannten Fehler und führe das Script erneut aus."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}Starte Rebuild...${NC}"
|
echo -e "${GREEN}Starte Rebuild und Cache-Bereinigung...${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Rebuild durchführen
|
# Rebuild und Cache-Bereinigung durchführen
|
||||||
if command -v docker &> /dev/null; then
|
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 ""
|
||||||
echo -e "${GREEN}=========================================="
|
|
||||||
echo "✓ REBUILD ERFOLGREICH ABGESCHLOSSEN"
|
echo -e "${BLUE}[2/2] Führe Rebuild aus...${NC}"
|
||||||
echo "==========================================${NC}"
|
if docker exec espocrm php /var/www/html/command.php rebuild 2>&1; then
|
||||||
exit 0
|
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
|
else
|
||||||
|
echo -e "${RED}✗ Clear Cache fehlgeschlagen${NC}"
|
||||||
|
echo "Fahre mit Rebuild fort..."
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${RED}=========================================="
|
|
||||||
echo "✗ REBUILD FEHLGESCHLAGEN"
|
if docker exec espocrm php /var/www/html/command.php rebuild 2>&1; then
|
||||||
echo "==========================================${NC}"
|
echo ""
|
||||||
echo "Prüfe die Logs unter data/logs/ für weitere Details."
|
echo -e "${GREEN}=========================================="
|
||||||
exit 1
|
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
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${RED}✗ Docker nicht gefunden. Rebuild kann nicht durchgeführt werden.${NC}"
|
echo -e "${RED}✗ Docker nicht gefunden. Rebuild kann nicht durchgeführt werden.${NC}"
|
||||||
|
|||||||
@@ -349,8 +349,8 @@ return [
|
|||||||
0 => 'youtube.com',
|
0 => 'youtube.com',
|
||||||
1 => 'google.com'
|
1 => 'google.com'
|
||||||
],
|
],
|
||||||
'cacheTimestamp' => 1769181610,
|
'cacheTimestamp' => 1769183183,
|
||||||
'microtime' => 1769181610.43814,
|
'microtime' => 1769183183.901404,
|
||||||
'siteUrl' => 'https://crm.bitbylaw.com',
|
'siteUrl' => 'https://crm.bitbylaw.com',
|
||||||
'fullTextSearchMinLength' => 4,
|
'fullTextSearchMinLength' => 4,
|
||||||
'appTimestamp' => 1768843902,
|
'appTimestamp' => 1768843902,
|
||||||
|
|||||||
Reference in New Issue
Block a user