feat: tax page
This commit is contained in:
@@ -31,11 +31,11 @@ class _TaxPageState extends State<TaxPage> {
|
||||
serviceChargeValue: serviceChargeValue,
|
||||
onSave: (newTaxValue, newServiceChargeValue) {
|
||||
context.read<TaxSettingsBloc>().add(
|
||||
TaxSettingsEvent.updateSettings(
|
||||
taxValue: newTaxValue,
|
||||
serviceChargeValue: newServiceChargeValue,
|
||||
),
|
||||
);
|
||||
TaxSettingsEvent.updateSettings(
|
||||
taxValue: newTaxValue,
|
||||
serviceChargeValue: newServiceChargeValue,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -49,11 +49,11 @@ class _TaxPageState extends State<TaxPage> {
|
||||
serviceChargeValue: serviceChargeValue,
|
||||
onSave: (newTaxValue, newServiceChargeValue) {
|
||||
context.read<TaxSettingsBloc>().add(
|
||||
TaxSettingsEvent.updateSettings(
|
||||
taxValue: newTaxValue,
|
||||
serviceChargeValue: newServiceChargeValue,
|
||||
),
|
||||
);
|
||||
TaxSettingsEvent.updateSettings(
|
||||
taxValue: newTaxValue,
|
||||
serviceChargeValue: newServiceChargeValue,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -61,91 +61,110 @@ class _TaxPageState extends State<TaxPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SettingsTitle('Perhitungan Biaya'),
|
||||
const SizedBox(height: 24),
|
||||
BlocBuilder<TaxSettingsBloc, TaxSettingsState>(
|
||||
builder: (context, state) {
|
||||
return state.when(
|
||||
initial: () => const Center(child: CircularProgressIndicator()),
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (message) => Center(child: Text('Error: $message')),
|
||||
loaded: (taxModel, serviceChargeValue) {
|
||||
final items = [
|
||||
TaxModel(name: 'Biaya Layanan', type: TaxType.layanan, value: serviceChargeValue),
|
||||
taxModel,
|
||||
];
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SettingsTitle(
|
||||
'Perhitungan Biaya',
|
||||
subtitle: 'Biaya Layanan dan Pajak',
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: BlocBuilder<TaxSettingsBloc, TaxSettingsState>(
|
||||
builder: (context, state) {
|
||||
return state.when(
|
||||
initial: () =>
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
loading: () =>
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
error: (message) => Center(child: Text('Error: $message')),
|
||||
loaded: (taxModel, serviceChargeValue) {
|
||||
final items = [
|
||||
TaxModel(
|
||||
name: 'Biaya Layanan',
|
||||
type: TaxType.layanan,
|
||||
value: serviceChargeValue),
|
||||
taxModel,
|
||||
];
|
||||
|
||||
return CustomTabBar(
|
||||
tabTitles: const ['Layanan', 'Pajak'],
|
||||
initialTabIndex: 0,
|
||||
tabViews: [
|
||||
// LAYANAN TAB
|
||||
SizedBox(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 2, // Add button + 1 service charge item
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
childAspectRatio: 0.85,
|
||||
crossAxisCount: 3,
|
||||
crossAxisSpacing: 30.0,
|
||||
mainAxisSpacing: 30.0,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return AddData(
|
||||
title: 'Edit Perhitungan',
|
||||
onPressed: () => onAddDataTap(serviceChargeValue, taxModel.value),
|
||||
return CustomTabBar(
|
||||
tabTitles: const ['Layanan', 'Pajak'],
|
||||
initialTabIndex: 0,
|
||||
tabViews: [
|
||||
// LAYANAN TAB
|
||||
SizedBox(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 2, // Add button + 1 service charge item
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
childAspectRatio: 0.85,
|
||||
crossAxisCount: 3,
|
||||
crossAxisSpacing: 30.0,
|
||||
mainAxisSpacing: 30.0,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return AddData(
|
||||
title: 'Edit Perhitungan',
|
||||
onPressed: () => onAddDataTap(
|
||||
serviceChargeValue, taxModel.value),
|
||||
);
|
||||
}
|
||||
final item = items.firstWhere(
|
||||
(element) => element.type.isLayanan);
|
||||
return ManageTaxCard(
|
||||
data: item,
|
||||
onEditTap: () => onEditTap(
|
||||
item, serviceChargeValue, taxModel.value),
|
||||
);
|
||||
}
|
||||
final item = items.firstWhere((element) => element.type.isLayanan);
|
||||
return ManageTaxCard(
|
||||
data: item,
|
||||
onEditTap: () => onEditTap(item, serviceChargeValue, taxModel.value),
|
||||
);
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// PAJAK TAB
|
||||
SizedBox(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 2, // Add button + 1 tax item
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
childAspectRatio: 0.85,
|
||||
crossAxisCount: 3,
|
||||
crossAxisSpacing: 30.0,
|
||||
mainAxisSpacing: 30.0,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return AddData(
|
||||
title: 'Edit Perhitungan',
|
||||
onPressed: () => onAddDataTap(serviceChargeValue, taxModel.value),
|
||||
// PAJAK TAB
|
||||
SizedBox(
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: 2, // Add button + 1 tax item
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
childAspectRatio: 0.85,
|
||||
crossAxisCount: 3,
|
||||
crossAxisSpacing: 30.0,
|
||||
mainAxisSpacing: 30.0,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return AddData(
|
||||
title: 'Edit Perhitungan',
|
||||
onPressed: () => onAddDataTap(
|
||||
serviceChargeValue, taxModel.value),
|
||||
);
|
||||
}
|
||||
final item = items.firstWhere(
|
||||
(element) => element.type.isPajak);
|
||||
return ManageTaxCard(
|
||||
data: item,
|
||||
onEditTap: () => onEditTap(
|
||||
item, serviceChargeValue, taxModel.value),
|
||||
);
|
||||
}
|
||||
final item = items.firstWhere((element) => element.type.isPajak);
|
||||
return ManageTaxCard(
|
||||
data: item,
|
||||
onEditTap: () => onEditTap(item, serviceChargeValue, taxModel.value),
|
||||
);
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user