using UnityEngine; using UnityEngine.UI; using TMPro; using System.Text; using System.Collections.Generic; //using System.Text; public class Form : MonoBehaviour { public TMP_InputField Client_Name; public TMP_InputField Client_Address; public TMP_InputField Client_Email; public TMP_InputField Client_Phone; public TMP_InputField JobNumber; public TMP_InputField Note; public TMP_InputField Store_Name; public TMP_InputField Store_Address; public TMP_InputField Store_Email; public TMP_InputField Store_Phone; public TMP_Dropdown Store_List; public TMP_Dropdown Store_List_On_Client; //==================================================CLIENTS INFOS===================================================== public void OpenClientPanel(){ print("-----from Form-----"); DOIT.CloseALLPNL(); GameObject.Find("HIDER").transform.Find("Form").gameObject.SetActive(true); Client_Name.text = _G.ClientInfo["Name"]; Client_Address.text = _G.ClientInfo["Address"]; Client_Email.text=_G.ClientInfo["Email"]; Client_Phone.text=_G.ClientInfo["Phone"]; JobNumber.text=_G.ClientInfo["JobNumber"]; Note.text=_G.ClientInfo["Note"]; List Storelist = new(); for(int i=1; i<_G.UIT_LibraryStores.Count; i++){ string Name=_G.UIT_LibraryStores[i].Split(',')[0]; if(!string.IsNullOrEmpty(Name))Storelist.Add(Name.Split(',')[0]); } Store_List_On_Client.ClearOptions(); Store_List_On_Client.AddOptions(Storelist); if(_G.StoreSelect!=""){ int index =Store_List_On_Client.options.FindIndex(option => option.text == _G.StoreSelect); Store_List_On_Client.value=index; } } public void ClosePanel(){ DOIT.CloseALLPNLONLY(); if(Get.o2("Canvas","Panel_SCENE").activeInHierarchy==false){ Get.o2("Canvas","Panel_main").SetActive(true);// } } public void SaveClientInfos(){ print("SaveClientInfos"); _G.ClientInfo["Name"]=Client_Name.text; _G.ClientInfo["Address"]=Client_Address.text; _G.ClientInfo["Email"] =Client_Email.text; _G.ClientInfo["Phone"]=Client_Phone.text; _G.ClientInfo["JobNumber"]=JobNumber.text; _G.ClientInfo["Note"]=Note.text; //Add new Stores to list List Storelist = new(); foreach(string Store in _G.UIT_LibraryStores){ string Name=Store.Split(',')[0]; if(!string.IsNullOrEmpty(Name) && Name!="Name")Storelist.Add(Store.Split(',')[0]); } Store_List.ClearOptions(); Store_List.AddOptions(Storelist); StoreSelect(); DOIT.CloseALLPNL(); } public void StoreSelect(){ int Index=Store_List_On_Client.value; string StoreName=Store_List_On_Client.options[Index].text; _G.StoreSelect=StoreName; print("_G.StoreSelect====="+_G.StoreSelect); } //==================================================STORES LIST===================================================== public void OpenStorePanel(){ print("-----from Form-----"); _G.PON = "STORESpnl"; DOIT.CloseALLPNL(); GameObject.Find("HIDER").transform.Find("AddStore").gameObject.SetActive(true); Store_Name.text = _G.StoreInfo["Name_ID"]; Store_Address.text = _G.StoreInfo["Address"]; Store_Email.text=_G.StoreInfo["Email"]; Store_Phone.text=_G.StoreInfo["Phone"]; SetStoresToList(); FillInputs(); } public void SetStoresToList(){ print("SetStoresToList"); List Storelist = new(); for(int i=1; i<_G.UIT_LibraryStores.Count; i++){ string Name=_G.UIT_LibraryStores[i].Split(',')[0]; if(!string.IsNullOrEmpty(Name))Storelist.Add(Name.Split(',')[0]); } Store_List.ClearOptions(); Store_List.AddOptions(Storelist); } public void FillInputs(){ int Index=Store_List.value; string StoreName=Store_List.options[Index].text; print("StoreName===="+StoreName); //Add info on inputs Store_Name.text = UIT.Value(Library.Store,StoreName,Header.Name_ID); Store_Address.text = UIT.Value(Library.Store,StoreName,Header.Address); Store_Email.text=UIT.Value(Library.Store,StoreName,Header.Email); Store_Phone.text=UIT.Value(Library.Store,StoreName,Header.Phone); } public void AddStoreToList(){ print("AddStoreToList"); AddToLibrary.Store(Store_Name.text,Store_Address.text,Store_Email.text,Store_Phone.text); SetStoresToList(); _G.StoreSelect = Store_Name.text; int index =Store_List_On_Client.options.FindIndex(option => option.text == _G.StoreSelect); Store_List_On_Client.value=index; } public void DeleteStoreFromList(){ print("DeleteStoreFromList"); //Message _M.PH(22, 0, "ffffff", 1, 1); GameObject MessOK = Get.o2("HIDER/MESSAGE","btnOK"); MessOK.SetActive(true); MessOK.GetComponent