feat: enhance SDUI widget model with dynamic visibility conditions, refactor NewPageLogic for improved form handling, and update UI components to support new visibility features

This commit is contained in:
2025-12-31 15:28:17 +03:30
parent fb0b817cf9
commit 26f94345f6
8 changed files with 711 additions and 594 deletions

View File

@@ -67,14 +67,16 @@ class SDUIFormWidget extends StatelessWidget {
paddingHorizontal,
paddingVertical,
visible,
visibleCondition,
) => children.isNotEmpty,
row: (children, spacing, mainAxisAlignment, visible) =>
row: (children, spacing, mainAxisAlignment, visible, visibleCondition) =>
children.isNotEmpty,
cardLabelItem: (data, child, children, visible, visibleCondition) =>
child != null || (children != null && children.isNotEmpty),
stepper: (data, children, visible, index) =>
stepper: (data, children, visible, visibleCondition) =>
children != null && children.isNotEmpty,
pageView: (data, children, visible) => children.isNotEmpty,
pageView: (data, children, visible, visibleCondition) =>
children.isNotEmpty,
orElse: () => false,
);
@@ -114,36 +116,89 @@ class SDUIFormWidget extends StatelessWidget {
return widget.map(
// ویجت‌های فرم
textFormField: (value) => _buildTextFormField(value.data),
textFormField: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildTextFormField(value.data),
),
cardLabelItem: (value) => _buildCardLabelItem(
value.data,
value.child,
value.children,
value.visibleCondition,
),
chipSelection: (value) => _buildChipSelection(value.data),
dropdown: (value) => _buildDropdown(value.data),
imagePicker: (value) => _buildImagePicker(value.data),
chipSelection: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildChipSelection(value.data),
),
dropdown: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildDropdown(value.data),
),
imagePicker: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildImagePicker(value.data),
),
// ویجت‌های layout
column: (value) => _buildColumn(
value.children,
value.spacing,
value.mainAxisSize,
value.crossAxisAlignment,
value.paddingHorizontal,
value.paddingVertical,
column: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildColumn(
value.children,
value.spacing,
value.mainAxisSize,
value.crossAxisAlignment,
value.paddingHorizontal,
value.paddingVertical,
),
),
row: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildRow(value.children, value.spacing, value.mainAxisAlignment),
),
sizedBox: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildSizedBox(value.width, value.height),
),
row: (value) =>
_buildRow(value.children, value.spacing, value.mainAxisAlignment),
sizedBox: (value) => _buildSizedBox(value.width, value.height),
// ویجت‌های پیچیده
stepper: (value) => _buildStepper(value.data, value.children),
pageView: (value) => _buildPageView(value.data, value.children),
stepper: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildStepper(value.data, value.children),
),
pageView: (value) => _buildWithVisibleCondition(
value.visibleCondition,
() => _buildPageView(value.data, value.children),
),
);
}
/// Helper method to handle visible_condition for widgets
Widget _buildWithVisibleCondition(
String? visibleCondition,
Widget Function() builder,
) {
// If no condition or condition is null/empty, always show
if (visibleCondition == null || visibleCondition.isEmpty) {
return builder();
}
// If state is null, only show first step (0) by default
if (state == null) {
if (visibleCondition.contains('activeStepperIndex == 0')) {
return builder();
}
return const SizedBox.shrink();
}
// Use Obx for reactive updates
return Obx(() {
if (!_evaluateVisibleCondition(visibleCondition)) {
return const SizedBox.shrink();
}
return builder();
});
}
Widget _buildTextFormField(TextFormFieldSDUIModel data) {
try {
// Use provided controller or create a new one
@@ -591,7 +646,7 @@ class SDUIFormWidget extends StatelessWidget {
_StepperInfo? _findStepperInTree(SDUIWidgetModel widgetModel) {
// Check if current widget is a stepper
return widgetModel.maybeWhen(
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
try {
return _StepperInfo(
stepperModel: widgetModel,
@@ -616,6 +671,27 @@ class SDUIFormWidget extends StatelessWidget {
visible,
paddingHorizontal,
paddingVertical,
visibleCondition,
) {
for (var child in children) {
final stepperInfo = _findStepperInTree(child);
if (stepperInfo != null) {
return _StepperInfo(
stepperModel: stepperInfo.stepperModel,
stepperData: stepperInfo.stepperData,
parentModel: widgetModel,
);
}
}
return null;
},
row:
(
children,
spacing,
mainAxisAlignment,
visible,
visibleCondition,
) {
for (var child in children) {
final stepperInfo = _findStepperInTree(child);
@@ -629,19 +705,6 @@ class SDUIFormWidget extends StatelessWidget {
}
return null;
},
row: (children, spacing, mainAxisAlignment, visible) {
for (var child in children) {
final stepperInfo = _findStepperInTree(child);
if (stepperInfo != null) {
return _StepperInfo(
stepperModel: stepperInfo.stepperModel,
stepperData: stepperInfo.stepperData,
parentModel: widgetModel,
);
}
}
return null;
},
cardLabelItem: (data, child, children, visible, visibleCondition) {
if (child != null) {
final stepperInfo = _findStepperInTree(child);
@@ -667,7 +730,7 @@ class SDUIFormWidget extends StatelessWidget {
}
return null;
},
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
if (children != null) {
for (var child in children) {
final stepperInfo = _findStepperInTree(child);
@@ -682,7 +745,7 @@ class SDUIFormWidget extends StatelessWidget {
}
return null;
},
pageView: (data, children, visible) {
pageView: (data, children, visible, visibleCondition) {
for (var child in children) {
final stepperInfo = _findStepperInTree(child);
if (stepperInfo != null) {
@@ -706,7 +769,7 @@ class SDUIFormWidget extends StatelessWidget {
// Check if current widget is a stepper
count +=
widgetModel.maybeWhen(
stepper: (data, children, visible, index) => 1,
stepper: (data, children, visible, visibleCondition) => 1,
orElse: () => 0,
) ??
0;
@@ -723,6 +786,21 @@ class SDUIFormWidget extends StatelessWidget {
visible,
paddingHorizontal,
paddingVertical,
visibleCondition,
) {
int childCount = 0;
for (var child in children) {
childCount += _countSteppersInTree(child);
}
return childCount;
},
row:
(
children,
spacing,
mainAxisAlignment,
visible,
visibleCondition,
) {
int childCount = 0;
for (var child in children) {
@@ -730,13 +808,6 @@ class SDUIFormWidget extends StatelessWidget {
}
return childCount;
},
row: (children, spacing, mainAxisAlignment, visible) {
int childCount = 0;
for (var child in children) {
childCount += _countSteppersInTree(child);
}
return childCount;
},
cardLabelItem: (data, child, children, visible, visibleCondition) {
int childCount = 0;
if (child != null) {
@@ -749,7 +820,7 @@ class SDUIFormWidget extends StatelessWidget {
}
return childCount;
},
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
int childCount = 0;
if (children != null) {
for (var child in children) {
@@ -758,7 +829,7 @@ class SDUIFormWidget extends StatelessWidget {
}
return childCount;
},
pageView: (data, children, visible) {
pageView: (data, children, visible, visibleCondition) {
int childCount = 0;
for (var child in children) {
childCount += _countSteppersInTree(child);
@@ -906,6 +977,7 @@ class SDUIFormWidget extends StatelessWidget {
visible,
paddingHorizontal,
paddingVertical,
visibleCondition,
) {
for (var child in children) {
stepIndices.addAll(
@@ -913,7 +985,7 @@ class SDUIFormWidget extends StatelessWidget {
);
}
},
row: (children, spacing, mainAxisAlignment, visible) {
row: (children, spacing, mainAxisAlignment, visible, visibleCondition) {
for (var child in children) {
stepIndices.addAll(_collectStepIndicesFromVisibleConditions(child));
}
@@ -928,14 +1000,14 @@ class SDUIFormWidget extends StatelessWidget {
}
}
},
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
if (children != null) {
for (var child in children) {
stepIndices.addAll(_collectStepIndicesFromVisibleConditions(child));
}
}
},
pageView: (data, children, visible) {
pageView: (data, children, visible, visibleCondition) {
for (var child in children) {
stepIndices.addAll(_collectStepIndicesFromVisibleConditions(child));
}
@@ -968,7 +1040,7 @@ class SDUIFormWidget extends StatelessWidget {
// Helper to check if a model is the stepper we want to exclude
bool isStepperToExclude(SDUIWidgetModel model) {
return model.maybeWhen(
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
return data.key == stepperKey;
},
orElse: () => false,
@@ -1007,12 +1079,13 @@ class SDUIFormWidget extends StatelessWidget {
visible,
paddingHorizontal,
paddingVertical,
visibleCondition,
) {
for (var child in children) {
if (isStepperToExclude(child)) {
// If stepper has children, build those children
child.maybeWhen(
stepper: (data, stepperChildren, visible, index) {
stepper: (data, stepperChildren, visible, visibleCondition) {
if (stepperChildren != null) {
int childIndex = 0;
for (var stepperChild in stepperChildren) {
@@ -1028,7 +1101,7 @@ class SDUIFormWidget extends StatelessWidget {
) {
return extractStepIndex(visibleCondition);
},
orElse: () => index != null ? index : childIndex,
orElse: () => childIndex,
);
widgets.add(
@@ -1067,71 +1140,85 @@ class SDUIFormWidget extends StatelessWidget {
}
return widgets;
},
row: (children, spacing, mainAxisAlignment, visible) {
for (var child in children) {
if (isStepperToExclude(child)) {
child.maybeWhen(
stepper: (data, stepperChildren, visible, index) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
}
},
orElse: () {},
);
continue;
}
widgets.add(
SDUIFormWidget(
model: child,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
return widgets;
},
row:
(
children,
spacing,
mainAxisAlignment,
visible,
visibleCondition,
) {
for (var child in children) {
if (isStepperToExclude(child)) {
child.maybeWhen(
stepper:
(data, stepperChildren, visible, visibleCondition) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
}
},
orElse: () {},
);
continue;
}
widgets.add(
SDUIFormWidget(
model: child,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
return widgets;
},
cardLabelItem: (data, child, children, visible, visibleCondition) {
final stepIndex = extractStepIndex(visibleCondition);
if (child != null) {
if (isStepperToExclude(child)) {
child.maybeWhen(
stepper: (stepperData, stepperChildren, visible, index) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
wrapWithKeyIfNeeded(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
stepIndex,
),
);
}
}
},
stepper:
(
stepperData,
stepperChildren,
visible,
visibleCondition,
) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
wrapWithKeyIfNeeded(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
stepIndex,
),
);
}
}
},
orElse: () {},
);
} else {
@@ -1155,26 +1242,32 @@ class SDUIFormWidget extends StatelessWidget {
for (var child in children) {
if (isStepperToExclude(child)) {
child.maybeWhen(
stepper: (stepperData, stepperChildren, visible, index) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
wrapWithKeyIfNeeded(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
stepIndex,
),
);
}
}
},
stepper:
(
stepperData,
stepperChildren,
visible,
visibleCondition,
) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
wrapWithKeyIfNeeded(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
stepIndex,
),
);
}
}
},
orElse: () {},
);
continue;
@@ -1197,7 +1290,7 @@ class SDUIFormWidget extends StatelessWidget {
}
return widgets;
},
stepper: (data, children, visible, index) {
stepper: (data, children, visible, visibleCondition) {
if (children != null) {
for (var child in children) {
widgets.add(
@@ -1215,27 +1308,33 @@ class SDUIFormWidget extends StatelessWidget {
}
return widgets;
},
pageView: (data, children, visible) {
pageView: (data, children, visible, visibleCondition) {
for (var child in children) {
if (isStepperToExclude(child)) {
child.maybeWhen(
stepper: (stepperData, stepperChildren, visible, index) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
}
},
stepper:
(
stepperData,
stepperChildren,
visible,
visibleCondition,
) {
if (stepperChildren != null) {
for (var stepperChild in stepperChildren) {
widgets.add(
SDUIFormWidget(
model: stepperChild,
controllers: controllers,
state: state,
onStateChanged: onStateChanged,
images: images,
onImagesChanged: onImagesChanged,
pageControllers: pageControllers,
),
);
}
}
},
orElse: () {},
);
continue;
@@ -1280,7 +1379,7 @@ class SDUIFormWidget extends StatelessWidget {
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
color: Colors.black.withAlpha(5),
blurRadius: 10,
offset: Offset(0, -2),
),

View File

@@ -2,9 +2,7 @@
"info": {
"type": "column",
"visible": true,
"data": {
"spacing": 30.0
},
"spacing": 30.0,
"children": [
{
"type": "card_label_item",
@@ -12,15 +10,12 @@
"data": {
"title": "اطلاعات پایه واحد",
"padding_horizontal": 12.0,
"padding_vertical": 11.0,
"visible_condition": "activeStepperIndex == 0"
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -66,8 +61,7 @@
"data": {
"key": "tenant_name",
"label": "نام مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
@@ -76,8 +70,7 @@
"data": {
"key": "tenant_national_id",
"label": "کد ملی مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
@@ -86,8 +79,7 @@
"data": {
"key": "tenant_phone_number",
"label": "شماره تماس مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
@@ -128,16 +120,13 @@
"visible": true,
"data": {
"title": "اطلاعات جوجه ریزی",
"visible_condition": "activeStepperIndex == 1",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -146,8 +135,7 @@
"key": "hatching_date",
"label": "تاریخ جوجه ریزی",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
@@ -157,8 +145,7 @@
"key": "visit_date",
"label": "تاریخ بازدید",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
@@ -199,16 +186,13 @@
"visible": true,
"data": {
"title": "وضعیت عمومی سالن",
"visible_condition": "activeStepperIndex == 2",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "image_picker",
@@ -364,16 +348,13 @@
"visible": true,
"data": {
"title": "تلفات",
"visible_condition": "activeStepperIndex == 3",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -420,8 +401,7 @@
"data": {
"key": "other_cause_of_unusual_casualties",
"label": "علت تلفات غیرعادی",
"keyboard_type": "text",
"visible_condition": "cause_of_unusual_casualties == 'سایر (شرح…)'"
"keyboard_type": "text"
}
},
{
@@ -449,8 +429,7 @@
"data": {
"key": "other_type_of_disease",
"label": "نوع بیماری",
"keyboard_type": "text",
"visible_condition": "type_of_disease == 'سایر (شرح)'"
"keyboard_type": "text"
}
},
{
@@ -475,7 +454,6 @@
"key": "sample_type",
"label": "نوع نمونه",
"selectedIndex": -1,
"visible_condition": "sampling_done == 'انجام شد'",
"options": [
{
"index": 0,
@@ -503,16 +481,13 @@
"visible": true,
"data": {
"title": "مسئول فنی",
"visible_condition": "activeStepperIndex == 4",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -540,16 +515,13 @@
"visible": true,
"data": {
"title": "نهاده و خوراک",
"visible_condition": "activeStepperIndex == 5",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "dropdown",
@@ -569,11 +541,11 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": "input_status == 'وابسته'",
"data": {
"key": "company_name",
"label": "نام کارخانه",
"keyboard_type": "text",
"visible_condition": "input_status == 'وابسته'"
"keyboard_type": "text"
}
},
{
@@ -582,13 +554,13 @@
"data": {
"key": "tracking_code",
"label": "شناسه خرید یا کد پیگیری",
"keyboard_type": "text",
"visible_condition": "input_status == 'مستقل'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": "input_status == 'مستقل'",
"data": {
"key": "input_inventory_until_visit",
"label": "موجودی نهاده مصرفی تا روز بازدید (کیلوگرم)",
@@ -658,16 +630,13 @@
"visible": true,
"data": {
"title": "زیرساخت و انرژی",
"visible_condition": "activeStepperIndex == 6",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -812,16 +781,13 @@
"visible": true,
"data": {
"title": "نیروی انسانی",
"visible_condition": "activeStepperIndex == 7",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
@@ -902,16 +868,13 @@
"visible": true,
"data": {
"title": "تسهیلات و حمایت‌ها",
"visible_condition": "activeStepperIndex == 8",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "dropdown",
@@ -954,8 +917,7 @@
"key": "payment_year",
"label": "سال دریافت",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
@@ -998,16 +960,13 @@
"visible": true,
"data": {
"title": "مستندات",
"visible_condition": "activeStepperIndex == 9",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "image_picker",
@@ -1042,16 +1001,13 @@
"visible": true,
"data": {
"title": "جمع‌بندی بازرس",
"visible_condition": "activeStepperIndex == 10",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"spacing": 10.0,
"children": [
{
"type": "chip_selection",

View File

@@ -2,38 +2,38 @@
"info": {
"type": "column",
"visible": true,
"data": {
"spacing": 30.0
},
"visible_condition": null,
"spacing": 30.0,
"children": [
{
"type": "stepper",
"visible": true,
"visible_condition": null,
"data": {
"key": "activeStepperIndex",
"total_steps": 7,
"total_steps": 11,
"active_step": 0
}
},
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 0",
"data": {
"title": "اطلاعات پایه واحد",
"padding_horizontal": 12.0,
"padding_vertical": 11.0,
"visible_condition": "activeStepperIndex == 0"
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "unit_name",
"label": "نام واحد مرغداری",
@@ -44,6 +44,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "breeding_unique_id",
"label": "کد یکتا / شناسه واحد",
@@ -54,6 +55,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "health_license",
"label": "پروانه بهداشتی",
@@ -63,6 +65,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "tenant_status",
"label": "وضعیت مستاجر",
@@ -72,36 +75,37 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": "tenant_status == 'دارد'",
"data": {
"key": "tenant_name",
"label": "نام مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": "tenant_status == 'دارد'",
"data": {
"key": "tenant_national_id",
"label": "کد ملی مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": "tenant_status == 'دارد'",
"data": {
"key": "tenant_phone_number",
"label": "شماره تماس مستاجر",
"keyboard_type": "text",
"visible_condition": "tenant_status == 'دارد'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "owner_national_code",
"label": "کد ملی بهره‌بردار",
@@ -112,6 +116,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "owner_phone_number",
"label": "شماره تماس بهره‌بردار",
@@ -122,6 +127,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "total_capacity",
"label": "ظرفیت اسمی سالن‌ها",
@@ -135,44 +141,44 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 1",
"data": {
"title": "اطلاعات جوجه ریزی",
"visible_condition": "activeStepperIndex == 1",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "hatching_date",
"label": "تاریخ جوجه ریزی",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "visit_date",
"label": "تاریخ بازدید",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "hatching_count",
"label": "تعداد جوجه‌ریزی اولیه",
@@ -184,6 +190,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "hatching_breed",
"label": "نوع نژاد",
@@ -193,6 +200,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "hatching_average_weight",
"label": "میانگین وزن جوجه",
@@ -206,22 +214,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 2",
"data": {
"title": "وضعیت عمومی سالن",
"visible_condition": "activeStepperIndex == 2",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "image_picker",
"visible": true,
"visible_condition": null,
"data": {
"key": "pultry_images",
"label": "تعداد موجود فعلی"
@@ -230,6 +238,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "sanitary_condition_of_the_hall",
"label": "وضعیت بهداشتی سالن",
@@ -261,6 +270,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "ventilation_status",
"label": "وضعیت تهویه",
@@ -292,6 +302,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "bedding_status",
"label": "وضعیت بستر",
@@ -318,6 +329,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "hatching_temperature",
"label": "دمای سالن",
@@ -327,6 +339,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "water_quality",
"label": "آب مصرفی",
@@ -358,6 +371,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "water_hardness",
"label": "درصد سختی آب (PPM)",
@@ -371,22 +385,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 3",
"data": {
"title": "تلفات",
"visible_condition": "activeStepperIndex == 3",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "normal_losses",
"label": "تعداد تلفات عادی دوره",
@@ -397,6 +411,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "abnormal_losses",
"label": "تلفات غیرعادی",
@@ -407,6 +422,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "cause_of_unusual_casualties",
"label": "علت تلفات غیرعادی",
@@ -426,16 +442,17 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": "cause_of_unusual_casualties == 'سایر (شرح…)'",
"data": {
"key": "other_cause_of_unusual_casualties",
"label": "علت تلفات غیرعادی",
"keyboard_type": "text",
"visible_condition": "cause_of_unusual_casualties == 'سایر (شرح…)'"
"keyboard_type": "text"
}
},
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "type_of_disease",
"label": "نوع بیماری تشخیص داده‌شده / مشکوک",
@@ -455,16 +472,17 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": "type_of_disease == 'سایر (شرح)'",
"data": {
"key": "other_type_of_disease",
"label": "نوع بیماری",
"keyboard_type": "text",
"visible_condition": "type_of_disease == 'سایر (شرح)'"
"keyboard_type": "text"
}
},
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "sampling_done",
"label": "نمونه‌برداری انجام‌شده",
@@ -480,11 +498,11 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": "sampling_done == 'انجام شد'",
"data": {
"key": "sample_type",
"label": "نوع نمونه",
"selectedIndex": -1,
"visible_condition": "sampling_done == 'انجام شد'",
"options": [
{
"index": 0,
@@ -510,22 +528,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 4",
"data": {
"title": "مسئول فنی",
"visible_condition": "activeStepperIndex == 4",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "technical_health_officer_name",
"label": "نام مسئول فنی بهداشتی",
@@ -535,6 +553,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "technical_engineering_officer_name",
"label": "نام مسئول فنی نظام مهندسی",
@@ -547,22 +566,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 5",
"data": {
"title": "نهاده و خوراک",
"visible_condition": "activeStepperIndex == 5",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "input_status",
"label": "وضعیت نهاده",
@@ -578,26 +597,27 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": "input_status == 'وابسته'",
"data": {
"key": "company_name",
"label": "نام کارخانه",
"keyboard_type": "text",
"visible_condition": "input_status == 'وابسته'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": "input_status == 'مستقل'",
"data": {
"key": "tracking_code",
"label": "شناسه خرید یا کد پیگیری",
"keyboard_type": "text",
"visible_condition": "input_status == 'مستقل'"
"keyboard_type": "text"
}
},
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "input_inventory_until_visit",
"label": "موجودی نهاده مصرفی تا روز بازدید (کیلوگرم)",
@@ -608,6 +628,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "type_of_grain",
"label": "نوع دان",
@@ -626,6 +647,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "input_inventory_in_warehouse",
"label": "موجودی نهاده موجود در انبار (کیلوگرم)",
@@ -636,6 +658,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "grain_quality",
"label": "کیفیت دانه",
@@ -665,22 +688,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 6",
"data": {
"title": "زیرساخت و انرژی",
"visible_condition": "activeStepperIndex == 6",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "generator_type",
"label": "نوع ژنراتور",
@@ -690,6 +713,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "generator_model",
"label": "مدل ژنراتور",
@@ -699,6 +723,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "generator_count",
"label": "تعداد ژنراتور",
@@ -709,6 +734,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "fuel_type",
"label": "نوع سوخت",
@@ -724,6 +750,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "generator_capacity",
"label": "ظرفیت (KVA)",
@@ -734,6 +761,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "generator_operating_status",
"label": "وضعیت عملکرد ژنراتور",
@@ -760,6 +788,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "emergency_fuel_inventory",
"label": "میزان موجودی سوخت اضطراری (لیتر)",
@@ -770,6 +799,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "power_cut_history",
"label": "سابقه قطعی برق دوره جاری",
@@ -785,6 +815,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "power_cut_duration",
"label": "مدت قطعی",
@@ -795,6 +826,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "power_cut_hour",
"label": "ساعت قطعی",
@@ -805,6 +837,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "additional_notes",
"label": "توضیحات تکمیلی",
@@ -819,22 +852,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 7",
"data": {
"title": "نیروی انسانی",
"visible_condition": "activeStepperIndex == 7",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "employed_workers_count",
"label": "تعداد افراد شاغل",
@@ -845,6 +878,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "native_workers_count",
"label": "تعداد افراد بومی",
@@ -855,6 +889,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "non_native_workers_count",
"label": "تعداد افراد غیر بومی",
@@ -865,6 +900,7 @@
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "worker_contract_status",
"label": "وضعیت قرارداد کارگران",
@@ -891,6 +927,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "training_status",
"label": "آموزش‌دیده در حوزه بهداشت و امنیت زیستی",
@@ -909,22 +946,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 8",
"data": {
"title": "تسهیلات و حمایت‌ها",
"visible_condition": "activeStepperIndex == 8",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "has_facilities",
"label": "تسهیلات دریافتی فعال",
@@ -940,6 +977,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "facility_type",
"label": "نوع تسهیلات",
@@ -949,6 +987,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "facility_amount",
"label": "مبلغ",
@@ -959,17 +998,18 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "payment_year",
"label": "سال دریافت",
"keyboard_type": "text",
"readonly": true,
"type": "date_picker"
"readonly": true
}
},
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "overdue_status",
"label": "وضعیت بازپرداخت",
@@ -985,6 +1025,7 @@
{
"type": "dropdown",
"visible": true,
"visible_condition": null,
"data": {
"key": "new_beneficiary_request",
"label": "درخواست جدید بهره بردار",
@@ -1005,22 +1046,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 9",
"data": {
"title": "مستندات",
"visible_condition": "activeStepperIndex == 9",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "image_picker",
"visible": true,
"visible_condition": null,
"data": {
"key": "hall_images",
"label": "ثبت عکس سالن (حداقل ۳ زاویه)",
@@ -1030,6 +1071,7 @@
{
"type": "image_picker",
"visible": true,
"visible_condition": null,
"data": {
"key": "input_warehouse_images",
"label": "ثبت عکس انبار نهاده‌ها"
@@ -1038,6 +1080,7 @@
{
"type": "image_picker",
"visible": true,
"visible_condition": null,
"data": {
"key": "losses_images",
"label": "ثبت عکس تلفات"
@@ -1049,22 +1092,22 @@
{
"type": "card_label_item",
"visible": true,
"visible_condition": "activeStepperIndex == 10",
"data": {
"title": "جمع‌بندی بازرس",
"visible_condition": "activeStepperIndex == 10",
"padding_horizontal": 12.0,
"padding_vertical": 11.0
},
"child": {
"type": "column",
"visible": true,
"data": {
"spacing": 10.0
},
"visible_condition": null,
"spacing": 10.0,
"children": [
{
"type": "chip_selection",
"visible": true,
"visible_condition": null,
"data": {
"key": "inspector_conclusion",
"label": "وضعیت کلی واحد",
@@ -1091,6 +1134,7 @@
{
"type": "text_form_field",
"visible": true,
"visible_condition": null,
"data": {
"key": "inspector_conclusion_description",
"label": "توصیه‌ها / اخطارها / اقدامات اصلاحی ...",