glanzlicht / MACHWEIS

Mach’s. Beleg’s. Rechne es ab. MACHWEIS ist eine Local-First-Flutter-App für schnelle, kontrollierbare Leistungsnachweise im Handwerk. Die Oberfläche läuft auf iOS, Android und im Web und ist vollständig deutschsprachig.

Verified secure showcase
180 Files 605 KB Public size 26 Redacted Dart · PHP · SQL · Markdown · XML · PLIST

Project overview

MACHWEIS is a verified code showcase with 180 visible project entries across 8 top-level modules. The primary detected language is Dart; protected files remain visible in the structure while their contents stay private.

README

MACHWEIS

Mach’s. Beleg’s. Rechne es ab.

Produktansicht

MACHWEIS Dashboard auf Laptop und Smartphone

MACHWEIS ist eine Local-First-Flutter-App für schnelle, kontrollierbare Leistungsnachweise im Handwerk. Die Oberfläche läuft auf iOS, Android und im Web und ist vollständig deutschsprachig.

Aktueller Funktionsumfang

  • lokale Firmen-, Kunden-, Auftrags- und Mitarbeiterdaten (SQLite auf Android/iOS, Browser-Speicher im Web)
  • mobile Stammdaten-Synchronisation für Kunden, Baustellen, Aufträge, Mitarbeiterprofile und Auftragszuweisungen über die serverseitigen Push-/Pull-Endpunkte
  • atomare lokale Änderungen mit Outbox, Cursor, Retry, sichtbaren Konflikten und einer ausdrücklichen Importentscheidung bei der ersten Verbindung
  • unveränderliche Berichtsversionen mit sichtbarem Prüfverlauf
  • persistente Offline-Synchronisationswarteschlange mit Retry-Strategie
  • lokale Fotodokumentation per Kamera, Galerie oder Web-Dateiauswahl
  • gebrandete PDF-Leistungsnachweise mit Unterschrift, Fotodokumentation und vorbereitetem Teilen per E-Mail
  • prüfpflichtiger KI-Assistent für Baustellennotizen mit OpenAI, Google Gemini oder eigenem Proxy
  • Rollen: Inhaber, Büro, Bauleiter und Monteur
  • strukturierte Arbeitszeit mit Leistungsdatum, Pause und Nettozeit
  • mehrere Leistungs- und Materialpositionen
  • Zusatzaufträge mit Kundenbestätigung
  • Vollständigkeitsprüfung vor Unterschrift
  • digitale Kundenunterschrift und unveränderlicher Abschluss
  • CSV-Export und vorbereitete PDF-Renderer-Schnittstelle
  • responsive Smartphone- und Webnavigation
  • aktuelle App-Version und Build-Nummer dauerhaft am unteren Rand der Navigation

Lokale Entwicklung

flutter pub get
flutter analyze
flutter test
flutter run -d chrome

Produktkontext und technische Leitplanken stehen in [docs/PRODUCT_BRIEF.md](docs/PRODUCT_BRIEF.md). Architektur und Serververtrag der KI-Unterstützung beschreibt [docs/AI_INTEGRATION.md](docs/AI_INTEGRATION.md).

Die Stammdaten-Synchronisation ist ausschließlich für iOS und Android aktiviert. Sie verwendet das Access-Token der mobilen Anmeldung und erneuert es bei Bedarf über die bestehende Authentifizierung. Im Web bleibt die Synchronisation bewusst deaktiviert.

Backend-Grundgerüst

Das separate PHP-8.4-REST-Grundgerüst liegt in [backend/](backend/README.md). Es enthält in diesem Stand ausschließlich Infrastruktur und den Health-Endpunkt; Login, Fachlogik und KI sind noch nicht enthalten.

lib/core/ai/ai_report_assistant.dartDart
Protected before publication 1 protected passages across 1 lines are visibly marked below.
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'ai_settings_store.dart';
class AiMaterialSuggestion {
const AiMaterialSuggestion({
required this.name,
required this.quantity,
required this.unit,
});
final String name;
final String quantity;
final String unit;
factory AiMaterialSuggestion.fromJson(Map<String, dynamic> json) =>
AiMaterialSuggestion(
name: json['name'] as String? ?? '',
quantity: json['quantity']?.toString() ?? '',
unit: json['unit'] as String? ?? 'Stk.',
);
}
class AiReportSuggestion {
const AiReportSuggestion({
required this.activities,
required this.materials,
required this.additionalOrder,
required this.openQuestions,
required this.confidence,
this.startTime,
this.endTime,
this.breakMinutes,
});
final List<String> activities;
final List<AiMaterialSuggestion> materials;
final String additionalOrder;
final List<String> openQuestions;
final double confidence;
final String? startTime;
final String? endTime;
final int? breakMinutes;
factory AiReportSuggestion.fromJson(Map<String, dynamic> json) =>
AiReportSuggestion(
activities: (json['activities'] as List<dynamic>? ?? const [])
.whereType<String>()
.where((value) => value.trim().isNotEmpty)
.toList(),
materials: (json['materials'] as List<dynamic>? ?? const [])
.whereType<Map<String, dynamic>>()
.map(AiMaterialSuggestion.fromJson)
.where((value) => value.name.trim().isNotEmpty)
.toList(),
additionalOrder: json['additionalOrder'] as String? ?? '',
openQuestions: (json['openQuestions'] as List<dynamic>? ?? const [])
.whereType<String>()
.toList(),
confidence: (json['confidence'] as num?)?.toDouble() ?? 0,
startTime: json['startTime'] as String?,
endTime: json['endTime'] as String?,
breakMinutes: json['breakMinutes'] as int?,
);
}
class AiReportRequest {
const AiReportRequest({
required this.notes,
required this.customer,
required this.site,
});
final String notes;
final String customer;
final String site;
}
class AiAssistantException implements Exception {
const AiAssistantException(this.message);
final String message;
@override
String toString() => message;
}
abstract interface class AiReportAssistant {
Future<AiReportSuggestion> suggest(AiReportRequest request);
}
class RemoteAiReportAssistant implements AiReportAssistant {
RemoteAiReportAssistant({http.Client? client})
: _client = client ?? http.Client();
final http.Client _client;
static const outputSchema = <String, Object?>{
'type': 'object',
'additionalProperties': false,
'properties': {
'activities': {
'type': 'array',
'items': {'type': 'string'},
},
'materials': {
'type': 'array',
'items': {
'type': 'object',
'additionalProperties': false,
'properties': {
'name': {'type': 'string'},
'quantity': {'type': 'string'},
'unit': {'type': 'string'},
},
'required': ['name', 'quantity', 'unit'],
},
},
'additionalOrder': {'type': 'string'},
'openQuestions': {
'type': 'array',
'items': {'type': 'string'},
},
'confidence': {'type': 'number', 'minimum': 0, 'maximum': 1},
'startTime': {
'type': ['string', 'null'],
},
'endTime': {
'type': ['string', 'null'],
},
'breakMinutes': {
'type': ['integer', 'null'],
},
},
'required': [
'activities',
'materials',
'additionalOrder',
'openQuestions',
'confidence',
'startTime',
'endTime',
'breakMinutes',
],
};
@override
Future<AiReportSuggestion> suggest(AiReportRequest request) async {
final settings = AiSettingsStore.instance.settings;
if (!settings.enabled) {
throw const AiAssistantException('KI-Unterstützung ist deaktiviert.');
}
if (!settings.usesProxy) {
throw const AiAssistantException(
'Für KI-Anfragen ist eine sichere Server-/Proxy-URL erforderlich.',
);
}
final response = await _proxyRequest(settings, request);
try {
return AiReportSuggestion.fromJson(
jsonDecode(response) as Map<String, dynamic>,
);
} on Object {
throw const AiAssistantException(
'Die KI-Antwort hatte ein unerwartetes Format.',
);
}
}
Future<String> _proxyRequest(
AiSettings settings,
AiReportRequest request,
) async {
final base = settings.proxyUrl.trim().replaceFirst(RegExp(r'/+$'), '');
final response = await _client
.post(
Uri.parse('$base/[INTERNAL_AI_ENDPOINT]'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode({
'provider': settings.provider.name,
'model': settings.activeModel,
'input': _input(request),
'schema': outputSchema,
}),
)
.timeout(const Duration(seconds: 35));
final json = _checkedJson(response);
final suggestion = json['suggestion'];
return suggestion is String ? suggestion : jsonEncode(suggestion ?? json);
}
Map<String, dynamic> _checkedJson(http.Response response) {
Map<String, dynamic> json;
try {
json =
jsonDecode(utf8.decode(response.bodyBytes)) as Map<String, dynamic>;
} on Object {
throw AiAssistantException(
'Der KI-Dienst antwortete ungültig (${response.statusCode}).',
);
}
if (response.statusCode < 200 || response.statusCode >= 300) {
final error = json['error'];
final message = error is Map<String, dynamic>
? error['message']?.toString()
: null;
throw AiAssistantException(
message ?? 'KI-Anfrage fehlgeschlagen (${response.statusCode}).',
);
}
return json;
}
String _input(AiReportRequest request) =>
'Kunde: ${request.customer}\nBaustelle: ${request.site}\nRohe Notizen des Monteurs:\n${request.notes}';
}

Architecture

High-level modules detected from the verified public snapshot. Protected implementation details are intentionally omitted.

backendmodule
libmodule
iosmodule
testmodule
androidmodule
docsmodule
webmodule
assetsmodule

Technology stack

DartPHPLOCKPBXPROJSQLMarkdownFlutter / Dart
Dart66.7%
PHP14.5%
LOCK4.0%
PBXPROJ3.8%
SQL3.1%
Markdown1.3%
XML0.9%
YAML0.9%