Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…seva into ISTE-141
  • Loading branch information
Hari-egov committed May 27, 2024
2 parents d041413 + d6d043e commit 3c90662
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class ConsumerBillPaymentsState extends State<ConsumerBillPayments> {
.toString()) +
' only')),
getPrinterLabel(
(item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE,
(item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>=0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE,
('₹' +
((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)).abs()
.toString())),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ class _GenerateNewBillState extends State<GenerateNewBill> {
: widget.waterConnection?.additionalDetails!
.meterReading
.toString()
: demandList.demands?.first.meterReadings!.first
:demandList.demands!.first.meterReadings!.isNotEmpty? demandList.demands?.first.meterReadings!.first
.currentReading
.toString(),
.toString():widget.waterConnection?.additionalDetails!
.meterReading
.toString(),
context),
if (CommonProvider.getPenaltyOrAdvanceStatus(
widget.waterConnection?.mdmsData, false) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class BillGenerationProvider with ChangeNotifier {

setMeterReading(meterRes) {
if (meterRes.meterReadings!.length > 0 &&
meterRes.meterReadings!.first.currentReading.toString() != '0') {
meterRes.meterReadings!.first.currentReading != null) {
readingExist = false;
var previousMeterReading = meterRes.meterReadings!.first.currentReading
.toString()
Expand All @@ -134,8 +134,7 @@ class BillGenerationProvider with ChangeNotifier {
var reqDate = readDate.add(Duration(days: 1)).toLocal().toString();
prevReadingDate = DateFormats.dateToTimeStamp(
DateFormats.getFilteredDate(reqDate, dateFormat: 'dd/MM/yyyy'));
} else if (waterconnection.additionalDetails!.meterReading.toString() !=
'0') {
} else {
readingExist = false;
var previousMeterReading = waterconnection.additionalDetails!.meterReading
.toString()
Expand All @@ -146,8 +145,6 @@ class BillGenerationProvider with ChangeNotifier {
billGenerateDetails.om_4Ctrl.text = previousMeterReading.toString()[3];
billGenerateDetails.om_5Ctrl.text = previousMeterReading.toString()[4];
prevReadingDate = waterconnection.previousReadingDate;
} else {
readingExist = true;
}
notifyListeners();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ class CollectPaymentProvider with ChangeNotifier {
.toString()) +
' only')),
getPrinterLabel(
(item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE,
(item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)>=0?i18.consumerReciepts.CONSUMER_PENDING_AMOUNT:i18.common.CORE_ADVANCE,
('₹' +
((item.totalDue ?? 0) - (item.totalAmountPaid ?? 0)).abs()
.toString())),
Expand Down
22 changes: 12 additions & 10 deletions frontend/mgramseva/lib/providers/household_details_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:mgramseva/utils/error_logging.dart';
import 'package:mgramseva/utils/global_variables.dart';
import 'package:provider/provider.dart';

import '../model/bill/meter_demand_details.dart';
import '../utils/constants.dart';
import 'common_provider.dart';
import 'fetch_bill_provider.dart';
Expand All @@ -31,30 +32,28 @@ class HouseHoldProvider with ChangeNotifier {
var streamController = StreamController.broadcast();
var isVisible = false;

Future<void> checkMeterDemand(
BillList data, WaterConnection waterConnection) async {
if (data.bill!.isNotEmpty) {
Future<List<MeterReadings>> checkMeterDemand(
BillList? data, WaterConnection? waterConnection) async {
if (data!=null && data.bill!=null && data.bill!.isNotEmpty&& data.bill!.isNotEmpty) {
try {
var res = await BillGenerateRepository().searchMeteredDemand({
"tenantId": data.bill!.first.tenantId,
"connectionNos": data.bill!.first.consumerCode
});
if (res.meterReadings!.isNotEmpty) {
if (res.meterReadings!=null && res.meterReadings!.isNotEmpty) {
data.bill!.first.meterReadings = res.meterReadings;
}
if (data.bill!.first.billDetails != null) {
data.bill!.first.billDetails!
.sort((a, b) => b.toPeriod!.compareTo(a.toPeriod!));
}
data.bill!.first.waterConnection = waterConnection;
streamController.add(data);
return res.meterReadings!;
} catch (e, s) {
streamController.addError('error');
ErrorHandler().allExceptionsHandler(navigatorKey.currentContext!, e, s);
}
} else {
streamController.add(data);
}
return <MeterReadings>[];
}

//*** Body FOR CreatePDF ***//
Expand Down Expand Up @@ -157,13 +156,12 @@ class HouseHoldProvider with ChangeNotifier {
waterConnection?.demands = demandList;
updateDemandList?.demands = demandList;
} else {}

await BillingServiceRepository().fetchdDemand({
"tenantId": data.tenantId,
"consumerCode": data.connectionNo.toString(),
"businessService": "WS",
// "status": "ACTIVE"
}).then((value) {
}).then((value) async{
value.demands = value.demands
?.where((element) => element.status != 'CANCELLED')
.toList();
Expand Down Expand Up @@ -192,6 +190,10 @@ class HouseHoldProvider with ChangeNotifier {
} else {
isfirstdemand = true;
}
if(waterConnection?.connectionType == 'Metered' && waterConnection?.fetchBill?.bill?.isNotEmpty == true){
value.demands?.first.meterReadings = await checkMeterDemand(
waterConnection?.fetchBill, waterConnection);
}
streamController.add(value);
} else {
DemandList demandList = new DemandList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class BillGenerateRepository extends BaseService {
method: RequestType.POST);
if (res != null) {
meterDemand = MeterDemand.fromJson(res);
meterDemand.meterReadings!.sort((a, b) => b.currentReading!.compareTo(a.currentReading!));
if(meterDemand.meterReadings !=null &&meterDemand.meterReadings!.isNotEmpty){
meterDemand.meterReadings!
.sort((a, b) => b.currentReading!.compareTo(a.currentReading!));
}
}
return meterDemand;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class _ConsumerDetailsState extends State<ConsumerDetails> {
inputFormatter: [
FilteringTextInputFormatter
.allow(RegExp(
"[a-zA-Z0-9]"))
r"^(?!0+$)[a-zA-Z0-9]+$"))
],
key: Keys.createConsumer
.CONSUMER_METER_NUMBER_KEY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _GenerateBillState extends State<GenerateBill> {
Provider.of<BillGenerationProvider>(context, listen: false).clearBillYear();
Navigator.pop(context);
},),
WaterConnectionCountWidget(),
widget.id == null ?WaterConnectionCountWidget():Container(),
Container(
width: MediaQuery.of(context).size.width,
child: Card(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_focus_watcher/flutter_focus_watcher.dart';
import 'package:mgramseva/components/household_register/household_card.dart';
import 'package:mgramseva/providers/household_register_provider.dart';
Expand Down Expand Up @@ -44,6 +46,7 @@ class _HouseholdRegister extends State<HouseholdRegister>

@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
var householdRegisterProvider =
Provider.of<HouseholdRegisterProvider>(context, listen: false);

Expand Down Expand Up @@ -76,14 +79,25 @@ class _HouseholdRegister extends State<HouseholdRegister>
child: CustomScrollView(slivers: [
SliverList(
delegate: SliverChildListDelegate([
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
HomeBack(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [_buildDownload, _buildShare])
],
SizedBox(
width: size.width,
child: Row(
children: [
HomeBack(),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: _buildDownload)),
_buildShare
],
),
)
],
),
),
Container(key: key, child: HouseholdCard()),
])),
Expand Down Expand Up @@ -130,7 +144,11 @@ class _HouseholdRegister extends State<HouseholdRegister>
onPressed: () => showDownloadList(Constants.DOWNLOAD_OPTIONS, context),
icon: Icon(Icons.download_sharp),
label: Text(
ApplicationLocalizations.of(context).translate(i18.common.DOWNLOAD)));
ApplicationLocalizations.of(context).translate(i18.common.DOWNLOAD),
maxLines: 1,
softWrap: false,
overflow: TextOverflow.ellipsis,
));
}

showDownloadList(List<String> result, BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/mgramseva/lib/services/urls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Url {

static const String LOCALIZATION = 'localization/messages/v1/_search';

static const String MDMS = 'egov-mdms-service/v1/_search';
static const String MDMS = 'mdms-v2/v1/_search';
static const String FILE_UPLOAD = 'filestore/v1/files';
static const String FILE_FETCH = 'filestore/v1/files/url';
static const String URL_SHORTNER = 'eus/shortener';
Expand Down
2 changes: 1 addition & 1 deletion frontend/mgramseva/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mgramseva",
"version": "1.2.21",
"version": "1.2.22",
"license": "egov"
}
2 changes: 1 addition & 1 deletion frontend/mgramseva/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 1.2.21+37
version: 1.2.21+38

environment:
sdk: ">=2.12.0 <4.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as locale from "./locale";
import * as obps from "./obps";
import * as pt from "./pt";
import * as privacy from "./privacy";
import PDFUtil, { downloadReceipt ,downloadPDFFromLink,downloadBill ,getFileUrl} from "./pdf";
import PDFUtil, { downloadReceipt, downloadPDFFromLink, downloadBill, getFileUrl } from "./pdf";
import getFileTypeFromFileStoreURL from "./fileType";
import preProcessMDMSConfig from "./preProcessMDMSConfig";
import preProcessMDMSConfigInboxSearch from "./preProcessMDMSConfigInboxSearch";
Expand All @@ -26,7 +26,7 @@ const getPattern = (type) => {
case "SearchOwnerName":
return /^[^{0-9}^\$\"<>?\\\\~!@#$%^()+={}\[\]*,/_:;“”‘’]{3,50}$/i;
case "MobileNo":
return /^[6789][0-9]{9}$/i;
return /^[456789][0-9]{9}$/i;
case "Amount":
return /^[0-9]{0,8}$/i;
case "NonZeroAmount":
Expand Down Expand Up @@ -170,9 +170,7 @@ const NOCAccess = () => {
const userInfo = Digit.UserService.getUser();
const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code);

const NOC_ROLES = [
"FIRE_NOC_APPROVER"
]
const NOC_ROLES = ["FIRE_NOC_APPROVER"];

const NOC_ACCESS = userRoles?.filter((role) => NOC_ROLES?.includes(role));

Expand Down Expand Up @@ -266,7 +264,7 @@ const hrmsAccess = () => {
const wsAccess = () => {
const userInfo = Digit.UserService.getUser();
const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code);
const waterRoles = ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER","WS_CLERK"];
const waterRoles = ["WS_CEMP", "WS_APPROVER", "WS_FIELD_INSPECTOR", "WS_DOC_VERIFIER", "WS_CLERK"];

const WS_ACCESS = userRoles?.filter((role) => waterRoles?.includes(role));

Expand All @@ -276,7 +274,7 @@ const wsAccess = () => {
const swAccess = () => {
const userInfo = Digit.UserService.getUser();
const userRoles = userInfo?.info?.roles?.map((roleData) => roleData?.code);
const sewerageRoles = ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER","SW_CLERK"];
const sewerageRoles = ["SW_CEMP", "SW_APPROVER", "SW_FIELD_INSPECTOR", "SW_DOC_VERIFIER", "SW_CLERK"];

const SW_ACCESS = userRoles?.filter((role) => sewerageRoles?.includes(role));

Expand Down Expand Up @@ -325,5 +323,5 @@ export default {
getConfigModuleName,
preProcessMDMSConfig,
preProcessMDMSConfigInboxSearch,
...privacy
...privacy,
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
BackButton,
Loader,
SubmitBar,
Password
Password,
} from "@egovernments/digit-ui-react-components";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
Expand Down Expand Up @@ -136,7 +136,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
const setUserMobileNumber = (value) => {
setMobileNo(value);

if (userType === "employee" && !new RegExp(/^[6-9]{1}[0-9]{9}$/).test(value)) {
if (userType === "employee" && !new RegExp(/^[4-9]{1}[0-9]{9}$/).test(value)) {
setErrors({ ...errors, mobileNumber: { type: "pattern", message: "CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID" } });
} else {
setErrors({ ...errors, mobileNumber: null });
Expand Down Expand Up @@ -200,7 +200,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_NAME_INVALID") });
}

if (userType === "employee" && !new RegExp(/^[6-9]{1}[0-9]{9}$/).test(mobileNumber)) {
if (userType === "employee" && !new RegExp(/^[4-9]{1}[0-9]{9}$/).test(mobileNumber)) {
throw JSON.stringify({ type: "error", message: t("CORE_COMMON_PROFILE_MOBILE_NUMBER_INVALID") });
}

Expand Down Expand Up @@ -277,7 +277,6 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
} catch (error) {
if (error?.response?.data?.Errors[0].message) {
showToast("error", error?.response?.data?.Errors[0].message);

} else {
const errorObj = JSON.parse(error);
showToast(errorObj.type, t(errorObj.message), 5000);
Expand Down Expand Up @@ -605,7 +604,6 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
onChange={(value) => setUserCurrentPassword(value)}
disable={editScreen}
maxlength={10}

/>
{errors?.currentPassword && <CardLabelError>{t(errors?.currentPassword?.message)}</CardLabelError>}
</div>
Expand Down Expand Up @@ -643,7 +641,6 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
onChange={(value) => setUserConfirmPassword(value)}
disable={editScreen}
maxlength={10}

/>
{errors?.confirmPassword && <CardLabelError>{t(errors?.confirmPassword?.message)}</CardLabelError>}
</div>
Expand Down
Loading

0 comments on commit 3c90662

Please sign in to comment.