/**
 * @description       : 
 * @author            : ChangeMeIn@UserSettingsUnder.SFDoc
 * @group             : 
 * @last modified on  : 03-04-2022
 * @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
**/
global class NewAndEditQuotesController extends NewAndEditBaseController {
    
    public String PIPL_Input_Account_Error_Msg{set;get;}
    public String contactId{set;get;}//For Lookup field
    public String staticResourceContact {get; set;}

    public NewAndEditQuotesController(ApexPages.StandardController controller){
        
        List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Quotes__c').getDescribe().fields.getMap().keyset());  
        
        // Add fields to controller. This is to avoid the SOQL error in visualforce page
        //Get Account Id from url param
    
        // System.debug('accountType = ' + );
        if(!Test.isRunningTest()){
            controller.addFields(fieldList);
        }
        LookUpOverrideFields.add('CONTACT_NAME__c');
        Init(controller.getRecord());
        //添加项
        PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg;

        SObject obj = controller.getRecord();
        if(obj.Id == null){
             //初始化加载值
             obj.put('OwnerId',UserInfo.getUserId());
        }
        //contact信息（搜索查询query url用）
        staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
    }
    @RemoteAction
    global static Response saveQuotes(String QuotesJson, String transId, Boolean isNew){
        return save(new Quotes__c(), QuotesJson, transId, isNew);
    }
}