diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index ad12b36..6a60234 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -32,8 +32,33 @@ - + + + + + + + + + + + + + + + + + + + diff --git a/lib/Utils/Common/MainController.dart b/lib/Utils/Common/MainController.dart index 8dfdb71..1e0f997 100644 --- a/lib/Utils/Common/MainController.dart +++ b/lib/Utils/Common/MainController.dart @@ -10,7 +10,7 @@ class MainController extends GetxController { var currentTab = [ const HomeScreen(), const ShortTrade(), - const Holdings(), + const Portfolio(), ].obs; void updateTab(int index) { diff --git a/lib/Utils/Common/custom_drop_down.dart b/lib/Utils/Common/custom_drop_down.dart index 11ecc49..1fd63cb 100644 --- a/lib/Utils/Common/custom_drop_down.dart +++ b/lib/Utils/Common/custom_drop_down.dart @@ -1,12 +1,19 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:traderscircuit/controller/risk_profile_controller.dart'; import '../text.dart'; class CustomDropDownWidget extends StatefulWidget { const CustomDropDownWidget( - {super.key, required this.header, required this.listData}); + {super.key, + required this.header, + required this.title, + required this.listData}); final String header; + final String title; final List listData; @override @@ -16,6 +23,27 @@ class CustomDropDownWidget extends StatefulWidget { class _CustomDropDownWidgetState extends State { RxBool onDropTap = false.obs; RxString selectedValue = "".obs; + RiskProfileController riskProfileController = + Get.put(RiskProfileController()); + + void updateOrAddData(String key, String value) { + bool keyExists = false; + for (int i = 0; i < riskProfileController.selectedData.length; i++) { + Map item = riskProfileController.selectedData[i]; + if (item.containsKey(key)) { + riskProfileController.selectedData[i][key] = + value; // Update existing value + keyExists = true; + break; + } + } + + if (!keyExists) { + // Add new key-value pair + riskProfileController.selectedData.add({key: value}); + } + } + @override Widget build(BuildContext context) { return Obx( @@ -146,6 +174,8 @@ class _CustomDropDownWidgetState extends State { onTap: () { selectedValue.value = widget.listData[index]; onDropTap.value = !onDropTap.value; + updateOrAddData( + widget.title, widget.listData[index]); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/Utils/api_urls.dart b/lib/Utils/api_urls.dart index 0525d82..588046b 100644 --- a/lib/Utils/api_urls.dart +++ b/lib/Utils/api_urls.dart @@ -1,4 +1,8 @@ class ApiUrls { +// PIE BASE URL FOR SMALL CASE --> NEED TO BE UPDATED + + static const String pieBase = "https://app.piadvisors.in/"; + //Base URL static const base = "http://192.168.50.112/Trader_circuit/api/"; @@ -25,4 +29,13 @@ class ApiUrls { //FAQ API static String faqApi = "${base}getFaq"; + + //RISK PROFILE API + static String getRiskProfileQuestionAnswerApi = "${base}riskProfileQueAns"; + static String addRiskProfileQuestionAnswerApi = "${base}addUserRiskProfile"; + + //CONTENT BYTES API + static String getContentBytesCategoriesApi = + "${base}getContentByteCategories"; + static String getContentBytesApi = "${base}getContentBytes"; } diff --git a/lib/controller/content_bytes_controller.dart b/lib/controller/content_bytes_controller.dart new file mode 100644 index 0000000..7fa544c --- /dev/null +++ b/lib/controller/content_bytes_controller.dart @@ -0,0 +1,11 @@ +import 'package:get/get.dart'; +import 'package:traderscircuit/model/ContentBytesModel/content_bytes_categories_model.dart'; +import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart'; + +class ContentBytesController extends GetxController { + ContentBytesCategoriesModel contentBytesCategoriesModel = + ContentBytesCategoriesModel(); + ContentBytesModel contentBytesModel = ContentBytesModel(); + int filterId = 0; + RxBool isApiCalling = true.obs; +} diff --git a/lib/controller/risk_profile_controller.dart b/lib/controller/risk_profile_controller.dart new file mode 100644 index 0000000..732e1cb --- /dev/null +++ b/lib/controller/risk_profile_controller.dart @@ -0,0 +1,9 @@ +import 'package:get/get.dart'; + +import '../model/RiskProfileModel/risk_profile_ques_answer_model.dart'; + +class RiskProfileController extends GetxController { + RiskProfileQuestionAnswerModel riskProfileQuestionAnswerModel = + RiskProfileQuestionAnswerModel(); + List> selectedData = []; +} diff --git a/lib/data/network/network_api_services.dart b/lib/data/network/network_api_services.dart index 785672e..513c5d0 100644 --- a/lib/data/network/network_api_services.dart +++ b/lib/data/network/network_api_services.dart @@ -16,7 +16,7 @@ class NetworkApiServices extends BaseApiServices { base64.encode( utf8.encode('traderCircuitUser:71%@L%es^bUX94`J9XT*@bh,._WWM{')); @override - Future getApi(String url) async { + Future getApi(String url, {bool isAuth = false}) async { if (kDebugMode) { print("api url is >>> $url"); } @@ -25,14 +25,17 @@ class NetworkApiServices extends BaseApiServices { String? token = prefs.getString('accessToken').toString(); log(token); try { - response = await dio.get( - url, - // options: Options(headers: { - // 'authorization': "Bearer $token", - - // // "device-id": deviceId - // }) - ); + response = await dio.get(url, + options: (token == null || token == "") + ? Options( + headers: { + "Authorization": basicAuth, + }, + ) + : Options(headers: { + "Authorization": basicAuth, + 'access-token': token, + })); if (response.statusCode == 200) { return ResponseData( @@ -61,7 +64,7 @@ class NetworkApiServices extends BaseApiServices { } @override - Future postApi(data, String url) async { + Future postApi(data, String url, {bool isAuth = false}) async { if (kDebugMode) { print("data >>> $data"); print("api url is >>> $url"); diff --git a/lib/main.dart b/lib/main.dart index f56d010..9624b71 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:traderscircuit/firebase_options.dart'; +import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart'; import 'package:traderscircuit/resources/routes/route_name.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:traderscircuit/resources/routes/routes.dart'; @@ -28,6 +29,14 @@ Future main() async { // GlobalVariables globalVariables = GlobalVariables(); //token = prefs.getString('token'); // OnBoard = prefs.getBool("OnBoard"); + + //smallcase + ScgatewayFlutterPlugin.setConfigEnvironment( + GatewayEnvironment.PRODUCTION, + 'pi-advisors', + false, + [], + ); SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]).then((value) => runApp(const MyApp())); diff --git a/lib/model/ContentBytesModel/content_bytes_categories_model.dart b/lib/model/ContentBytesModel/content_bytes_categories_model.dart new file mode 100644 index 0000000..885faef --- /dev/null +++ b/lib/model/ContentBytesModel/content_bytes_categories_model.dart @@ -0,0 +1,83 @@ +class ContentBytesCategoriesModel { + String? status; + int? statusCode; + String? message; + List? data; + + ContentBytesCategoriesModel( + {this.status, this.statusCode, this.message, this.data}); + + ContentBytesCategoriesModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + if (json['data'] != null) { + data = []; + json['data'].forEach((v) { + data!.add(Data.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class Data { + int? id; + String? contentType; + String? title; + String? description; + String? tags; + String? file; + int? categoryId; + String? image; + String? isActive; + + Data({ + this.id, + this.contentType, + this.title, + this.description, + this.tags, + this.file, + this.categoryId, + this.image, + this.isActive, + }); + + Data.fromJson(Map json) { + id = json['id']; + contentType = json['content_type']; + title = json['title']; + description = json['description']; + tags = json['tags']; + file = json['file']; + categoryId = json['category_id']; + image = json['image']; + isActive = json['is_active']; + } + + Map toJson() { + final Map data = {}; + data['id'] = id; + data['content_type'] = contentType; + data['title'] = title; + data['description'] = description; + data['tags'] = tags; + data['file'] = file; + data['category_id'] = categoryId; + data['image'] = image; + data['is_active'] = isActive; + + return data; + } +} diff --git a/lib/model/ContentBytesModel/content_bytes_model.dart b/lib/model/ContentBytesModel/content_bytes_model.dart new file mode 100644 index 0000000..22a9d20 --- /dev/null +++ b/lib/model/ContentBytesModel/content_bytes_model.dart @@ -0,0 +1,222 @@ +class ContentBytesModel { + String? status; + int? statusCode; + String? message; + Data? data; + + ContentBytesModel({this.status, this.statusCode, this.message, this.data}); + + ContentBytesModel.fromJson(Map json) { + status = json['status']; + statusCode = json['status_code']; + message = json['message']; + data = json['data'] != null ? Data.fromJson(json['data']) : null; + } + + Map toJson() { + final Map data = {}; + data['status'] = status; + data['status_code'] = statusCode; + data['message'] = message; + if (this.data != null) { + data['data'] = this.data!.toJson(); + } + return data; + } +} + +class Data { + List