import 'dart:async'; import 'package:fikoyt_merkez/apps/mesaici/widgets/aktif_kart/cikis_secici.dart'; import 'package:fikoyt_merkez/apps/mesaici/widgets/aktif_kart/giris_secici.dart'; import 'package:fikoyt_merkez/core/Extensions/fiko_duration_ext.dart'; import 'package:fikoyt_merkez/core/Extensions/fiko_tarih.dart'; import 'package:fikoyt_merkez/core/fikoyt.service.dart'; import 'package:fikoyt_merkez/core/interface/fiko_dialog_ayarlari.dart'; import 'package:fikoyt_merkez/core/widgets/dakika_secici/duration_picker.dart'; import 'package:fikoyt_merkez/core/widgets/fiko_ui/fiko_button/fiko_button.dart'; import 'package:fikoyt_merkez/core/widgets/yazi_kutulari/yazi_kutulari.dart'; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_multi_formatter/flutter_multi_formatter.dart'; import 'package:get/get.dart'; import '../../model/calisma_kayit.dart'; class SaatTablosuMesaiCarpani extends StatelessWidget { SaatTablosuMesaiCarpani({super.key, required this.kayit}); final Rx? kayit; @override Widget build(BuildContext context) { RxBool mesaiCarpaniEditGoster = false.obs; 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", 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( () => FikoButton1( text: kayit?.value.giris != null ? "${kayit?.value.giris?.formatla('HH:mm:ss')}" : "Seçiniz", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: kayit?.value.giris == null ? Colors.red : Colors.green, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () { FikoYTService.dialogGoster( context, GirisSecici( kayit: kayit, ), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { kayit?.value.giris = null; kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Girişi Sil", style: TextStyle( color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle( color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Giriş Saatiniz", baslikSimge: "🕙", ), ); }, ), ), ), Expanded( child: FikoButton1( text: "Seçiniz", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () async { print(await FikoYTService.saatSec(context)); }, ), ), Expanded( child: Obx( () => FikoButton1( text: kayit?.value.cikis != null ? "${kayit?.value.cikis?.formatla('HH:mm:ss')}" : "Seçiniz", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: kayit?.value.cikis == null ? Colors.red : Colors.green, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () async { FikoYTService.dialogGoster( context, CikisSecici( kayit: kayit, ), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { kayit?.value.cikis = null; kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Çıkışı Sil", style: TextStyle( color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle( color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Çıkış Saatiniz", baslikSimge: "🕙", ), ); }, ), ), ), ], ), 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( () => FikoButton1( text: "x${kayit?.value.mesaiCarpani?.toStringAsFixed(3) ?? 1.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: () { FikoYTService.dialogGoster( context, Column( children: [ const Text( " Fazla Çalışılan Süre İçin Maaş Katsayısını Aşağıdaki Çubuğu Kaydırarak Ayarlayınız. "), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ FikoButton1( text: "⏳ Geçerli Mesai Oranı", textSize: 10, edgePadding: const EdgeInsets.symmetric( horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { mesaiCarpaniEditGoster.value = false; }, ), ], ), Obx( () => Slider( value: kayit?.value.mesaiCarpani ?? 1.0, // label: "", min: 1, max: 5, onChanged: (double value) { kayit?.value.mesaiCarpani = value; mesaiCarpaniEditGoster.value = false; kayit?.refresh(); }, ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Obx( () => FikoButton1( text: "x${kayit?.value.mesaiCarpani?.toStringAsFixed(3) ?? 1.000.toStringAsFixed(3)}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.green, textStrokeColor: Colors.transparent, onPressed: () { mesaiCarpaniEditGoster.value = !mesaiCarpaniEditGoster.value; }, ), ), ], ), Obx( () => Visibility( visible: mesaiCarpaniEditGoster.value, child: FikoYaziKutusu( baslik: "Mesai Çarpanı", simgeSol: const Text( "➗", style: TextStyle(fontSize: 22), ), klavyeTipi: TextInputType.number, formatlayicilar: [ CurrencyInputFormatter( trailingSymbol: "x", mantissaLength: 3, ) // MaskedInputFormatter( // '00000-0000-M00-B00-N# ', // allowedCharMatcher: RegExp("^[0-9]*\$"), // ), ], degeri: (kayit?.value.mesaiCarpani ?? 1.0) .toCurrencyString( trailingSymbol: 'x', mantissaLength: 3), degisti: (value) { double deger = double.parse(value .replaceAll("x", "") .replaceAll(",", "")); if (deger < 1.0) deger = 1.0; if (deger > 5.0) deger = 5.0; kayit?.value.mesaiCarpani = deger; kayit?.refresh(); }, // degeri: "0.00₺", ), ), ), ], ), FikoDialogAyarlari( altButonlar: [ TextButton( onPressed: () { kayit?.value.mesaiCarpani = 1.0; kayit?.refresh(); Navigator.pop(context); }, child: const Text( "Çarpanı Sıfırla", style: TextStyle( color: Colors.redAccent, fontWeight: FontWeight.bold), ), ), TextButton( onPressed: () { Navigator.pop(context); }, child: const Text( "Kapat", style: TextStyle( color: Colors.green, fontWeight: FontWeight.bold), ), ), ], baslik: "Mesai Çarpanı", baslikSimge: "➗", ), ); }, ), ), ), Expanded( child: Obx( () => FikoButton1( text: "${kayit?.value.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, Column( children: [ Obx( () => DurationPicker( duration: Duration( minutes: kayit?.value.calismaSuresi?.inMinutes ?? 0, ), baseUnit: BaseUnit.minute, snapToMins: 0.1, onChange: (value) { kayit?.value.calismaSuresi = value; kayit?.refresh(); }, ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ FikoButton1( text: "⏳ 11 Saat", textSize: 10, edgePadding: const EdgeInsets.symmetric( horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { kayit?.value.calismaSuresi = const Duration(hours: 11); kayit?.refresh(); Navigator.pop(context); }, ), const SizedBox( width: 5, ), FikoButton1( text: "⏳ 9 Saat", textSize: 10, edgePadding: const EdgeInsets.symmetric( horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { kayit?.value.calismaSuresi = const Duration(hours: 9); kayit?.refresh(); Navigator.pop(context); }, ), const SizedBox( width: 5, ), FikoButton1( text: "⏳ 7,5 Saat", textSize: 10, edgePadding: const EdgeInsets.symmetric( horizontal: 10, vertical: 1), textColor: Colors.black, textStrokeColor: Colors.transparent, borderColor: Colors.blue, onPressed: () { kayit?.value.calismaSuresi = const Duration(hours: 7, minutes: 30); kayit?.refresh(); Navigator.pop(context); }, ), ], ), ], ), FikoDialogAyarlari( baslik: "Çalışma Süresi", baslikSimge: "🛠️"), ); }, ), ), ), ], ), 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: Obx( () => FikoButton1( text: "${zamanFarki?.value?.insanize ?? '❌ Yok'}", textSize: 12, edgePadding: const EdgeInsets.symmetric(vertical: 2.0), textColor: Colors.red, textStrokeColor: Colors.transparent, radius: 0, backColor: Colors.grey.shade200, onPressed: () {}, ), ), ), Expanded( child: FikoButton1( text: "❌ 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, curve: Curves.easeIn), // ScaleEffect(begin: const Offset(0.2, 0.2),duration: 500.ms, curve: Curves.easeIn), 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, ), ]); } }