Compare commits
2 Commits
44421e39d6
...
3273d5b328
| Author | SHA1 | Date |
|---|---|---|
|
|
3273d5b328 | |
|
|
457e43f5b9 |
|
|
@ -144,10 +144,8 @@ class AuthRepository {
|
||||||
final shamsiMounth = startDate.month;
|
final shamsiMounth = startDate.month;
|
||||||
|
|
||||||
startDate = Jalali(shamsiYear, shamsiMounth, 1);
|
startDate = Jalali(shamsiYear, shamsiMounth, 1);
|
||||||
Jalali endDate = Jalali(
|
Jalali endDate = Jalali(shamsiMounth == 12 ? shamsiYear + 1 : shamsiYear,
|
||||||
shamsiYear,
|
shamsiMounth == 12 ? 1 : shamsiMounth + 1, 1)
|
||||||
shamsiMounth + 1 > 12 ? 12 : shamsiMounth + 1,
|
|
||||||
shamsiMounth + 1 > 12 ? 30 : 1)
|
|
||||||
.addDays(-1);
|
.addDays(-1);
|
||||||
Gregorian sMiladiDate = startDate.toGregorian();
|
Gregorian sMiladiDate = startDate.toGregorian();
|
||||||
Gregorian eMiladiDate = endDate.toGregorian();
|
Gregorian eMiladiDate = endDate.toGregorian();
|
||||||
|
|
@ -173,10 +171,8 @@ class AuthRepository {
|
||||||
final shamsiMounth = startDate.month;
|
final shamsiMounth = startDate.month;
|
||||||
|
|
||||||
startDate = Jalali(shamsiYear, shamsiMounth, 1);
|
startDate = Jalali(shamsiYear, shamsiMounth, 1);
|
||||||
Jalali endDate = Jalali(
|
Jalali endDate = Jalali(shamsiMounth == 12 ? shamsiYear + 1 : shamsiYear,
|
||||||
shamsiYear,
|
shamsiMounth == 12 ? 1 : shamsiMounth + 1, 1)
|
||||||
shamsiMounth + 1 > 12 ? 12 : shamsiMounth + 1,
|
|
||||||
shamsiMounth + 1 > 12 ? 30 : 1)
|
|
||||||
.addDays(-1);
|
.addDays(-1);
|
||||||
|
|
||||||
Gregorian sMiladiDate = startDate.toGregorian();
|
Gregorian sMiladiDate = startDate.toGregorian();
|
||||||
|
|
@ -218,8 +214,8 @@ class AuthRepository {
|
||||||
|
|
||||||
static Future<bool> addSubUser(String mobileNumber, int level) async {
|
static Future<bool> addSubUser(String mobileNumber, int level) async {
|
||||||
try {
|
try {
|
||||||
final number = mobileNumber.convertToEnglishNumber();
|
final number = mobileNumber.convertToEnglishNumber();
|
||||||
|
|
||||||
Response response = await _dioService.sendRequest().post(
|
Response response = await _dioService.sendRequest().post(
|
||||||
DioService.addSubUser,
|
DioService.addSubUser,
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -246,12 +242,13 @@ class AuthRepository {
|
||||||
|
|
||||||
static Future<List<Map<String, dynamic>>> getSubUsers() async {
|
static Future<List<Map<String, dynamic>>> getSubUsers() async {
|
||||||
try {
|
try {
|
||||||
Response response = await _dioService.sendRequest().get(DioService.getSubUsers);
|
Response response =
|
||||||
|
await _dioService.sendRequest().get(DioService.getSubUsers);
|
||||||
|
|
||||||
// استخراج لیست کاربران از پاسخ جیسون
|
// استخراج لیست کاربران از پاسخ جیسون
|
||||||
// ساختار: { "sub_users": [...], "total_count": 1 }
|
// ساختار: { "sub_users": [...], "total_count": 1 }
|
||||||
List<dynamic> data = response.data['sub_users'];
|
List<dynamic> data = response.data['sub_users'];
|
||||||
|
|
||||||
// تبدیل به لیستی از Mapها
|
// تبدیل به لیستی از Mapها
|
||||||
return List<Map<String, dynamic>>.from(data);
|
return List<Map<String, dynamic>>.from(data);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
|
@ -259,5 +256,3 @@ class AuthRepository {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue