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.

backend/migrations/005_master_data_sync.sqlSQL
CREATE TABLE IF NOT EXISTS sync_changes (
change_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
tenant_id CHAR(36) NOT NULL,
entity_type VARCHAR(40) NOT NULL,
entity_id CHAR(36) NOT NULL,
operation VARCHAR(20) NOT NULL,
row_version INT NOT NULL,
data_json LONGTEXT NOT NULL,
changed_at DATETIME NOT NULL,
INDEX sync_changes_tenant_cursor (tenant_id, change_id),
CONSTRAINT sync_changes_tenant_fk FOREIGN KEY (tenant_id) REFERENCES tenants(id)
);
CREATE TABLE IF NOT EXISTS sync_operations (
id CHAR(36) PRIMARY KEY,
tenant_id CHAR(36) NOT NULL,
operation_id VARCHAR(100) NOT NULL,
idempotency_key VARCHAR(200) NOT NULL,
request_hash CHAR(64) NOT NULL,
result_json LONGTEXT NULL,
http_status SMALLINT NULL,
created_at DATETIME NOT NULL,
completed_at DATETIME NULL,
UNIQUE KEY sync_operations_tenant_operation (tenant_id, operation_id),
UNIQUE KEY sync_operations_tenant_idempotency (tenant_id, idempotency_key),
CONSTRAINT sync_operations_tenant_fk FOREIGN KEY (tenant_id) REFERENCES tenants(id)
);
-- Seed the cursor with the current server state. NOT EXISTS keeps a partially
-- applied migration safely repeatable without duplicating the baseline.
INSERT INTO sync_changes (tenant_id, entity_type, entity_id, operation, row_version, data_json, changed_at)
SELECT c.tenant_id, 'customers', c.id, IF(c.deleted_at IS NULL, 'upsert', 'delete'), c.row_version,
JSON_OBJECT('id', c.id, 'tenant_id', c.tenant_id, 'name', c.name, 'contact', c.contact, 'email', c.email, 'phone', c.phone, 'address', c.address, 'row_version', c.row_version, 'created_at', c.created_at, 'updated_at', c.updated_at, 'deleted_at', c.deleted_at),
UTC_TIMESTAMP()
FROM customers c
WHERE NOT EXISTS (SELECT 1 FROM sync_changes sc WHERE sc.tenant_id = c.tenant_id AND sc.entity_type = 'customers' AND sc.entity_id = c.id);
INSERT INTO sync_changes (tenant_id, entity_type, entity_id, operation, row_version, data_json, changed_at)
SELECT s.tenant_id, 'sites', s.id, IF(s.deleted_at IS NULL, 'upsert', 'delete'), s.row_version,
JSON_OBJECT('id', s.id, 'tenant_id', s.tenant_id, 'customer_id', s.customer_id, 'name', s.name, 'address', s.address, 'row_version', s.row_version, 'created_at', s.created_at, 'updated_at', s.updated_at, 'deleted_at', s.deleted_at),
UTC_TIMESTAMP()
FROM sites s
WHERE NOT EXISTS (SELECT 1 FROM sync_changes sc WHERE sc.tenant_id = s.tenant_id AND sc.entity_type = 'sites' AND sc.entity_id = s.id);
INSERT INTO sync_changes (tenant_id, entity_type, entity_id, operation, row_version, data_json, changed_at)
SELECT j.tenant_id, 'jobs', j.id, IF(j.deleted_at IS NULL, 'upsert', 'delete'), j.row_version,
JSON_OBJECT('id', j.id, 'tenant_id', j.tenant_id, 'customer_id', j.customer_id, 'site_id', j.site_id, 'number', j.number, 'title', j.title, 'description', j.description, 'status', j.status, 'row_version', j.row_version, 'created_at', j.created_at, 'updated_at', j.updated_at, 'deleted_at', j.deleted_at),
UTC_TIMESTAMP()
FROM jobs j
WHERE NOT EXISTS (SELECT 1 FROM sync_changes sc WHERE sc.tenant_id = j.tenant_id AND sc.entity_type = 'jobs' AND sc.entity_id = j.id);
INSERT INTO sync_changes (tenant_id, entity_type, entity_id, operation, row_version, data_json, changed_at)
SELECT e.tenant_id, 'employee_profiles', e.id, IF(e.deleted_at IS NULL, 'upsert', 'delete'), e.row_version,
JSON_OBJECT('id', e.id, 'tenant_id', e.tenant_id, 'user_id', e.user_id, 'employee_number', e.employee_number, 'first_name', e.first_name, 'last_name', e.last_name, 'email', e.email, 'phone', e.phone, 'is_active', e.is_active, 'row_version', e.row_version, 'created_at', e.created_at, 'updated_at', e.updated_at, 'deleted_at', e.deleted_at),
UTC_TIMESTAMP()
FROM employee_profiles e
WHERE NOT EXISTS (SELECT 1 FROM sync_changes sc WHERE sc.tenant_id = e.tenant_id AND sc.entity_type = 'employee_profiles' AND sc.entity_id = e.id);
INSERT INTO sync_changes (tenant_id, entity_type, entity_id, operation, row_version, data_json, changed_at)
SELECT a.tenant_id, 'job_assignments', a.id, IF(a.deleted_at IS NULL, 'upsert', 'delete'), a.row_version,
JSON_OBJECT('id', a.id, 'tenant_id', a.tenant_id, 'job_id', a.job_id, 'employee_id', a.employee_id, 'assigned_from', a.assigned_from, 'assigned_until', a.assigned_until, 'row_version', a.row_version, 'created_at', a.created_at, 'updated_at', a.updated_at, 'deleted_at', a.deleted_at),
UTC_TIMESTAMP()
FROM job_assignments a
WHERE NOT EXISTS (SELECT 1 FROM sync_changes sc WHERE sc.tenant_id = a.tenant_id AND sc.entity_type = 'job_assignments' AND sc.entity_id = a.id);

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%