add copntact number to business
This commit is contained in:
@@ -6,6 +6,7 @@ class Business {
|
|||||||
final String registration_no;
|
final String registration_no;
|
||||||
final String logo_name;
|
final String logo_name;
|
||||||
final String logo_path;
|
final String logo_path;
|
||||||
|
final String contact_no;
|
||||||
final String app_id;
|
final String app_id;
|
||||||
|
|
||||||
const Business(
|
const Business(
|
||||||
@@ -15,6 +16,7 @@ class Business {
|
|||||||
this.registration_no,
|
this.registration_no,
|
||||||
this.logo_name,
|
this.logo_name,
|
||||||
this.logo_path,
|
this.logo_path,
|
||||||
|
this.contact_no,
|
||||||
this.app_id,
|
this.app_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -26,6 +28,7 @@ class Business {
|
|||||||
json['registration_no'],
|
json['registration_no'],
|
||||||
json['logo_name'],
|
json['logo_name'],
|
||||||
json['logo_path'],
|
json['logo_path'],
|
||||||
|
json['contact_no'],
|
||||||
json['app_id'],
|
json['app_id'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
final titleController = TextEditingController();
|
final titleController = TextEditingController();
|
||||||
final signtureController = TextEditingController();
|
final signtureController = TextEditingController();
|
||||||
final accessController = TextEditingController();
|
final accessController = TextEditingController();
|
||||||
|
final contactController = TextEditingController();
|
||||||
|
|
||||||
late PlatformFile selectedLogo;
|
late PlatformFile selectedLogo;
|
||||||
late PlatformFile selectedSignature;
|
late PlatformFile selectedSignature;
|
||||||
@@ -113,6 +114,7 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
"logo_name": logonameController.text,
|
"logo_name": logonameController.text,
|
||||||
"logo_path":
|
"logo_path":
|
||||||
"${widget.signedInUser.app_id}/business_files/${logonameController.text}",
|
"${widget.signedInUser.app_id}/business_files/${logonameController.text}",
|
||||||
|
"contact_no": contactController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 201) {
|
if (response.statusCode == 201) {
|
||||||
@@ -206,6 +208,13 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
|
|||||||
editable: true,
|
editable: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
MIHTextField(
|
||||||
|
controller: contactController,
|
||||||
|
hintText: "Contact Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
MIHFileField(
|
MIHFileField(
|
||||||
controller: logonameController,
|
controller: logonameController,
|
||||||
hintText: "Logo",
|
hintText: "Logo",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
|
|||||||
final titleController = TextEditingController();
|
final titleController = TextEditingController();
|
||||||
final signtureController = TextEditingController();
|
final signtureController = TextEditingController();
|
||||||
final accessController = TextEditingController();
|
final accessController = TextEditingController();
|
||||||
|
final contactController = TextEditingController();
|
||||||
|
|
||||||
late PlatformFile? selectedLogo = null;
|
late PlatformFile? selectedLogo = null;
|
||||||
late PlatformFile? selectedSignature = null;
|
late PlatformFile? selectedSignature = null;
|
||||||
@@ -177,6 +178,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
|
|||||||
"logo_name": logonameController.text,
|
"logo_name": logonameController.text,
|
||||||
"logo_path":
|
"logo_path":
|
||||||
"${widget.arguments.signedInUser.app_id}/business_files/${logonameController.text}",
|
"${widget.arguments.signedInUser.app_id}/business_files/${logonameController.text}",
|
||||||
|
"contact_no": contactController.text,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
@@ -228,6 +230,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
|
|||||||
signtureController.text = widget.arguments.businessUser!.signature;
|
signtureController.text = widget.arguments.businessUser!.signature;
|
||||||
titleController.text = widget.arguments.businessUser!.title;
|
titleController.text = widget.arguments.businessUser!.title;
|
||||||
accessController.text = widget.arguments.businessUser!.access;
|
accessController.text = widget.arguments.businessUser!.access;
|
||||||
|
|
||||||
oldSigPath = widget.arguments.businessUser!.sig_path;
|
oldSigPath = widget.arguments.businessUser!.sig_path;
|
||||||
|
|
||||||
//business = results;
|
//business = results;
|
||||||
@@ -237,6 +240,7 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
|
|||||||
typeController.text = widget.arguments.business!.type;
|
typeController.text = widget.arguments.business!.type;
|
||||||
logonameController.text = widget.arguments.business!.logo_name;
|
logonameController.text = widget.arguments.business!.logo_name;
|
||||||
oldLogoPath = widget.arguments.business!.logo_path;
|
oldLogoPath = widget.arguments.business!.logo_path;
|
||||||
|
contactController.text = widget.arguments.business!.contact_no;
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -292,6 +296,13 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
|
|||||||
editable: true,
|
editable: true,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
MIHTextField(
|
||||||
|
controller: contactController,
|
||||||
|
hintText: "Contact Number",
|
||||||
|
editable: true,
|
||||||
|
required: true,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10.0),
|
||||||
MIHFileField(
|
MIHFileField(
|
||||||
controller: logonameController,
|
controller: logonameController,
|
||||||
hintText: "Logo",
|
hintText: "Logo",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class businessInsertRequest(BaseModel):
|
|||||||
registration_no: str
|
registration_no: str
|
||||||
logo_name: str
|
logo_name: str
|
||||||
logo_path: str
|
logo_path: str
|
||||||
|
contact_no: str
|
||||||
|
|
||||||
class businessUpdateRequest(BaseModel):
|
class businessUpdateRequest(BaseModel):
|
||||||
business_id: str
|
business_id: str
|
||||||
@@ -30,6 +31,7 @@ class businessUpdateRequest(BaseModel):
|
|||||||
registration_no: str
|
registration_no: str
|
||||||
logo_name: str
|
logo_name: str
|
||||||
logo_path: str
|
logo_path: str
|
||||||
|
contact_no: str
|
||||||
|
|
||||||
|
|
||||||
# Get List of all files
|
# Get List of all files
|
||||||
@@ -37,7 +39,7 @@ class businessUpdateRequest(BaseModel):
|
|||||||
async def read_business_by_business_id(business_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
async def read_business_by_business_id(business_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT business.business_id, business.Name, business.type, business.registration_no, business.logo_name, business.logo_path, business_users.app_id "
|
query = "SELECT business.business_id, business.Name, business.type, business.registration_no, business.logo_name, business.logo_path, business.contact_no, business_users.app_id "
|
||||||
query += "FROM business "
|
query += "FROM business "
|
||||||
query += "inner join business_users "
|
query += "inner join business_users "
|
||||||
query += "on business.business_id=business_users.business_id "
|
query += "on business.business_id=business_users.business_id "
|
||||||
@@ -54,7 +56,8 @@ async def read_business_by_business_id(business_id: str, session: SessionContain
|
|||||||
"registration_no": item[3],
|
"registration_no": item[3],
|
||||||
"logo_name": item[4],
|
"logo_name": item[4],
|
||||||
"logo_path": item[5],
|
"logo_path": item[5],
|
||||||
"app_id": item[6],
|
"contact_no": item[6],
|
||||||
|
"app_id": item[7],
|
||||||
}
|
}
|
||||||
for item in cursor.fetchall()
|
for item in cursor.fetchall()
|
||||||
]
|
]
|
||||||
@@ -72,7 +75,7 @@ async def read_business_by_business_id(business_id: str, session: SessionContain
|
|||||||
async def read_business_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
async def read_business_by_app_id(app_id: str, session: SessionContainer = Depends(verify_session())): #, session: SessionContainer = Depends(verify_session())
|
||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "SELECT business.business_id, business.Name, business.type, business.registration_no, business.logo_name, business.logo_path, business_users.app_id "
|
query = "SELECT business.business_id, business.Name, business.type, business.registration_no, business.logo_name, business.logo_path, business.contact_no, business_users.app_id "
|
||||||
query += "FROM business "
|
query += "FROM business "
|
||||||
query += "inner join business_users "
|
query += "inner join business_users "
|
||||||
query += "on business.business_id=business_users.business_id "
|
query += "on business.business_id=business_users.business_id "
|
||||||
@@ -89,7 +92,8 @@ async def read_business_by_app_id(app_id: str, session: SessionContainer = Depen
|
|||||||
"registration_no": item[3],
|
"registration_no": item[3],
|
||||||
"logo_name": item[4],
|
"logo_name": item[4],
|
||||||
"logo_path": item[5],
|
"logo_path": item[5],
|
||||||
"app_id": item[6],
|
"contact_no": item[6],
|
||||||
|
"app_id": item[7],
|
||||||
}
|
}
|
||||||
for item in cursor.fetchall()
|
for item in cursor.fetchall()
|
||||||
]
|
]
|
||||||
@@ -106,15 +110,16 @@ async def insert_business_details(itemRequest : businessInsertRequest, session:
|
|||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "insert into business "
|
query = "insert into business "
|
||||||
query += "(business_id, Name, type, registration_no, logo_name, logo_path) "
|
query += "(business_id, Name, type, registration_no, logo_name, logo_path, contact_no) "
|
||||||
query += "values (%s, %s, %s, %s, %s, %s)"
|
query += "values (%s, %s, %s, %s, %s, %s, %s)"
|
||||||
uuidString = str(uuid.uuid1())
|
uuidString = str(uuid.uuid1())
|
||||||
userData = (uuidString,
|
userData = (uuidString,
|
||||||
itemRequest.Name,
|
itemRequest.Name,
|
||||||
itemRequest.type,
|
itemRequest.type,
|
||||||
itemRequest.registration_no,
|
itemRequest.registration_no,
|
||||||
itemRequest.logo_name,
|
itemRequest.logo_name,
|
||||||
itemRequest.logo_path)
|
itemRequest.logo_path,
|
||||||
|
itemRequest.contact_no)
|
||||||
try:
|
try:
|
||||||
cursor.execute(query, userData)
|
cursor.execute(query, userData)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
@@ -130,13 +135,14 @@ async def Update_Business_details(itemRequest : businessUpdateRequest, session:
|
|||||||
db = database.dbConnection.dbAppDataConnect()
|
db = database.dbConnection.dbAppDataConnect()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
query = "update business "
|
query = "update business "
|
||||||
query += "set Name=%s, type=%s, registration_no=%s, logo_name=%s, logo_path=%s "
|
query += "set Name=%s, type=%s, registration_no=%s, logo_name=%s, logo_path=%s, contact_no=%s "
|
||||||
query += "where business_id=%s"
|
query += "where business_id=%s"
|
||||||
userData = (itemRequest.Name,
|
userData = (itemRequest.Name,
|
||||||
itemRequest.type,
|
itemRequest.type,
|
||||||
itemRequest.registration_no,
|
itemRequest.registration_no,
|
||||||
itemRequest.logo_name,
|
itemRequest.logo_name,
|
||||||
itemRequest.logo_path,
|
itemRequest.logo_path,
|
||||||
|
itemRequest.contact_no,
|
||||||
itemRequest.business_id)
|
itemRequest.business_id)
|
||||||
try:
|
try:
|
||||||
cursor.execute(query, userData)
|
cursor.execute(query, userData)
|
||||||
|
|||||||
Reference in New Issue
Block a user