import 'package:fikoyt_finans/apps/mesaici/model/model_hareketler.dart'; import 'package:fikoyt_finans/apps/mesaici/model/ayarlar/model_ayarlar.dart'; import 'package:fikoyt_finans/core/Extensions/fiko_duration_ext.dart'; import 'package:fikoyt_finans/core/Extensions/fiko_tarih.dart'; import 'package:fikoyt_finans/core/fikoyt.service.dart'; import 'package:fikoyt_finans/core/interface/fiko_dialog_ayarlari.dart'; import 'package:fikoyt_finans/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:get/get.dart'; import 'package:vrouter/vrouter.dart'; import 'calisma_suresi_sec.dart'; import 'cikis_secici.dart'; import 'giris_secici.dart'; import 'molalar.dart'; import 'saat_tablosu_dialog_mesai_carpani.dart'; class SaatTablosu extends StatefulWidget { SaatTablosu({super.key, required this.kayit}); final Rx? kayit; @override State createState() => _SaatTablosuState(); } class _SaatTablosuState extends State { // FikoYTMesaiciService servisMesaici = Get.put(FikoYTMesaiciService()); FikoYTService servisFikoYT = FikoYTService(); @override void initState() { super.initState(); } @override void dispose() { super.dispose(); } @override Widget build(BuildContext context) { return Column( children: [ Row( children: [ Expanded( child: Column( children: [ Text( "Giriş", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), Expanded( child: Column( children: [ Text( "Mola(${widget.kayit?.value?.calismaKarti?.molalar?.toplamMola.insanize ?? 'Yok'})", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), Expanded( child: Column( children: [ Text( "Çıkış", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Obx( () => AnimatedFikoButton1( text: widget.kayit?.value?.calismaKarti?.giris?.formatla('HH:mm:ss') ?? 'Seçiniz', textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: widget.kayit?.value?.calismaKarti?.giris == null ? Colors.red : Colors.green, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () { FikoYTService.dialogGoster( context, GirisSecici( kayit: widget.kayit, ), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { widget.kayit?.value?.calismaKarti?.giris = null; widget.kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Girişi Sil", style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), const Spacer(), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Giriş Saatiniz", baslikSimge: "🕙", ), ).then( (value) { widget.kayit?.refresh(); }, ); }, ), ), ), Expanded( child: Obx( () => AnimatedFikoButton1( text: "${widget.kayit?.value?.calismaKarti?.yasananMolaSuresi.insanize ?? '❌ Yok'}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () async { FikoYTService.dialogGoster( context, MolalarWidget( kayit: widget.kayit, ), FikoDialogAyarlari( baslik: "Mola Ekle", baslikSimge: "🕙", arkaPlanaTiklanincaKapansin: false, altButonlar: [ TextButton( onPressed: () { widget.kayit?.value?.calismaKarti?.molalar = []; widget.kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Temizle", style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), const Spacer(), TextButton( onPressed: () { widget.kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold), ), ), ], ), ); }, ), ), ), Expanded( child: Obx( () => AnimatedFikoButton1( text: widget.kayit?.value?.calismaKarti?.cikis != null ? "${widget.kayit?.value?.calismaKarti?.cikis?.formatla('HH:mm:ss')}" : "Seçiniz", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: widget.kayit?.value?.calismaKarti?.cikis == null ? Colors.red : Colors.green, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () async { FikoYTService.dialogGoster( context, CikisSecici( kayit: widget.kayit, ), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { widget.kayit?.value?.calismaKarti?.cikis = null; widget.kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Çıkışı Sil", style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), const Spacer(), TextButton( onPressed: () { widget.kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Çıkış Saatiniz", baslikSimge: "🕙", ), ).then( (value) { widget.kayit?.refresh(); }, ); }, ), ), ), ], ), Row( children: [ Expanded( child: Column( children: [ Text( "F.Mesai Oranı", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), Expanded( child: Column( children: [ Text( "Çalışma Süresi", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Obx( () => AnimatedFikoButton1( text: "%${widget.kayit?.value?.calismaKarti?.mesaiOrani?.toStringAsFixed(3) ?? 0.000.toStringAsFixed(3)}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.green, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () async { FikoYTService.dialogGoster( context, SaatTablosuMesaiCarpani(kayit: widget.kayit), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { widget.kayit?.value?.calismaKarti?.mesaiOrani = 0.00; widget.kayit?.refresh(); context.vRouter.pop(); }, child: const Text( "Çarpanı Sıfırla", style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), const Spacer(), TextButton( onPressed: () { widget.kayit?.refresh(); context.vRouter.pop(); // Navigator.of(context, rootNavigator: true).pop(); }, child: const Text( "Kapat", style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Mesai Çarpanı", baslikSimge: "✨", ), ).then( (value) { widget.kayit?.refresh(); }, ); }, ), ), ), Expanded( child: Obx( () => AnimatedFikoButton1( text: "${widget.kayit?.value?.calismaKarti?.calismaSuresi?.insanize ?? 'Yok'}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.yellow, textStrokeWidth: 2, radius: 0, backColor: Colors.grey.shade200, onPressed: () { FikoYTService.dialogGoster( context, CalismaSuresiSecWidget(kayit: widget.kayit), FikoDialogAyarlari( baslik: "Çalışma Süresi", baslikSimge: "🛠️", altButonlar: [ TextButton( onPressed: () { widget.kayit?.value?.calismaKarti?.calismaSuresi = null; widget.kayit?.refresh(); context.vRouter.pop(); }, child: const Text( "Sıfırla", style: TextStyle(color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), const Spacer(), TextButton( onPressed: () { widget.kayit?.refresh(); context.vRouter.pop(); // Navigator.of(context, rootNavigator: true).pop(); }, child: const Text( "Kapat", style: TextStyle(color: Colors.green, fontWeight: FontWeight.bold), ), ), ], ), ).then( (value) { widget.kayit?.refresh(); }, ); }, ), ), ), ], ), Row( children: [ Expanded( child: Column( children: [ Text( "Normal Mesai", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), Expanded( child: Column( children: [ Text( "Fazla Mesai", style: TextStyle(color: Colors.blue.shade500, fontWeight: FontWeight.bold), ), ], ), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Row( children: [ Obx( () => Visibility( visible: ((widget.kayit?.value?.calismaKarti?.normalMesai ?? Duration.zero) == (widget.kayit?.value?.calismaKarti?.calismaSuresi ?? Duration.zero)) && (widget.kayit?.value?.calismaKarti?.normalMesai != Duration.zero), child: FikoButton1( text: '✔️', textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, ), ), ), Obx( () => Visibility( visible: ((widget.kayit?.value?.calismaKarti?.normalMesai ?? Duration.zero) < (widget.kayit?.value?.calismaKarti?.calismaSuresi ?? Duration.zero)) && (widget.kayit?.value?.calismaKarti?.normalMesai != Duration.zero), child: FikoButton1( text: '⛔', textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, ), ), ), Expanded( child: Obx( () => FikoButton1( text: "${widget.kayit?.value?.calismaKarti?.normalMesai?.insanize ?? '❌ Yok'}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: ((widget.kayit?.value?.calismaKarti?.normalMesai ?? Duration.zero) == (widget.kayit?.value?.calismaKarti?.calismaSuresi ?? Duration.zero)) && (widget.kayit?.value?.calismaKarti?.normalMesai != Duration.zero) ? Colors.green : Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), Obx( () => Visibility( visible: (widget.kayit?.value?.calismaKarti?.fazlaMesai ?? Duration.zero) > Duration.zero && (widget.kayit?.value?.calismaKarti?.normalMesai != Duration.zero), child: FikoButton1( text: '➕', textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, ), ), ), ], ), ), Expanded( child: Obx( () => FikoButton1( text: "${widget.kayit?.value?.calismaKarti?.fazlaMesai?.insanize ?? '❌ Yok'}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), ], ), ], ).animate(effects: [ FadeEffect( duration: 1000.ms, ), SaturateEffect(delay: 1000.ms, duration: 500.ms, curve: Curves.easeIn), BlurEffect( duration: 600.ms, begin: const Offset(3, 3), end: const Offset(0, 0), ), ShimmerEffect( delay: 1000.ms, duration: 1000.ms, curve: Curves.easeIn, ), ]); } }