//request
var LogistMobile_checkpoint = null;
var LogistMobile_checkpoint_WindowAddEdit = null;

var TOiR_app_WindowAddEdit = null;
var Uploads_Window_Add_Checkpoint = null;

var Cargo_Window_Checkpoint = null;

Ext.define('LogistMobile_checkpoint_Model', {
    extend: 'Ext.data.Model',
    //fields: ['Id', 'StartCheckTime', 'EndCheckTime', 'Description', 'Name', 'FactTripID', 'is_factTrip', 'CarID', 'imei', 'car_name', 'GeoX', 'GeoY', 'Date', 'OrderInTrip', 'Distance', 'Time', 'PointState', 'Address']
	fields: ['Order_ID','OriginalAddress','StartTime','EndTime','LoadUnloadTime','IsInTrip','GeoX','GeoY','Date','LinkAddress','Priority','Name','Code'/*, {name: 'indoor', type: 'bool'}*/]
});

Ext.define('Catalog_TP_Select', {
    extend: 'Ext.data.Model',
    fields: ['nameTP']
});

var LogistMobile_checkpoint_Store =  new Ext.data.Store({		        
			    pageSize: 50,
		        model: 'LogistMobile_checkpoint_Model',
		        proxy: 
		        {
		          type: 'ajax',
		          url: 'app/LogistMobile_checkpoint.php?showCheckpoint=true',
		          reader: 
		          {
		            type: 'json',
		            root: 'rows',
					totalProperty: 'total'
		          }
		        }
		});

var LogistMobile_checkpointImpexp_Store =  new Ext.data.Store({		        
			    pageSize: 50,
		        model: 'LogistMobile_checkpoint_Model',
		        proxy: 
		        {
		          type: 'ajax',
		          url: 'app/LogistMobile_checkpoint.php?showCheckpointImpexp=true',
		          reader: 
		          {
		            type: 'json',
		            root: 'rows',
					totalProperty: 'total'
		          }
		        }
		});		

var Catalog_TP_Select_Store = new Ext.data.Store(
  {     
  	// autoLoad: true,
		//autoDestroy: true,
        model: 'Catalog_TP_Select',
        proxy: 
        {
          type: 'ajax',
          url: 'app/LogistMobile_checkpoint.php?func=selectNameTP',
          reader: 
          {
            type: 'json',
            root: 'rows'
          }
        }
});

/*
var addressModel = Ext.define("Addresses", {
            extend: 'Ext.data.Model',
            proxy: {
                type: 'jsonp',
                url: 'https://jsonp.nodejitsu.com',
                reader: {
                    type: 'json',
                    root: 'predictions',
                    totalProperty: 'totalCount'
                }
            },

            fields: ['description']
        });

        var ds = Ext.create('Ext.data.Store', {
            model: 'Addresses'
        });
*/
		
function completedCheckCheckpointUpdate(){
	//Ext.MessageBox.alert(all_toir.skill, o.result.message);
	var project = Ext.getCmp('checkpointprojectcombopanel').getValue();
	
	if(Uploads_Window_Add_Checkpoint){
		Uploads_Window_Add_Checkpoint.destroy();
	}
	if(TOiR_app_WindowAddEdit){
		TOiR_app_WindowAddEdit.destroy();
	}
	LogistMobile_checkpoint_Store.load({
		params: {
			project: project,
		}		
	});
	LogistMobile_checkpointImpexp_Store.load({
		params: {
			project: project,
		}
	});
}

		
/* ----------------- new order for post --------------------------------- */

function show_TOiR_app_WindowAddEdit(project,id,records) {
    //TOiR_UsersRequestStoreMy.load();
    //TOiR_RolesStore.load();
	
	//alert(id);
	
	//Catalog_TP_Select_Store.load();
	
    //if (!id){
	if (!id){
        //var t = calendar.adding_tasks;
        //var title = "Добавить заявку";
        var title = request_toir.add_the_request;
        var isLock = false;
        var isTTLock = false;
        //var func = 'add';
    }else{
        //var t = calendar.editing_tasks;
        //var title = "Редактировать заявку";
        var title = request_toir.edit_the_request;
        //var isTTLock = isLock;
		var isTTLock = true;
        //var func = 'edit';
    }
    var date = new Date();
    console.log(date);
	console.log(records);

    if(!TOiR_app_WindowAddEdit){
		var place;
		var geo_x;
		var geo_у;
        TOiR_app_WindowAddEdit = new Ext.Window({
            width:750,
            height:260,
            title: title,
            closeAction : 'destroy',
            listeners : {
                destroy : function()
				{
                    TOiR_app_WindowAddEdit = null;
                },
				afterrender: function( eOpts )
				{
					var locationInput = document.getElementById('locationField-inputEl');
					//console.log(locationInput);
					//Create new autocomplete object
					locationComplete = new google.maps.places.Autocomplete(locationInput);
					//console.log(locationComplete);
					//Bias to users current location
					google.maps.event.addListener(locationComplete, 'place_changed', function() {
						place = locationComplete.getPlace();
						geo_y = place.geometry.location.lat();
						geo_x = place.geometry.location.lng();
						if(geo_x !="" && geo_y !="")
						{
							var Cmp_Geo_X = Ext.getCmp('Geo_X');
							var Cmp_Geo_Y = Ext.getCmp('Geo_Y');
							Cmp_Geo_X.setValue(geo_x);
							Cmp_Geo_Y.setValue(geo_y);
						}
						//console.log(place.formatted_address); //address
						//console.log(place.geometry.location.lat()); //latitude
						//console.log(place.geometry.location.lng()); //longitude
					});
				}
            },
            layout:'fit',
            resizable: true,
            constrainHeader: true,
            modal:true,
            items:[
                {
                    xtype: 'form',
                    autoScroll: true,
                    bodyPadding: '5 5 5 5',
                    id: "TOiR_RequestFormId",
                    border: false,
                    frame: true,
                    autoHeight: true,
					//html: '<div class="x-container x-field-text x-field x-label-align-top x-field-labeled x-form-label-nowrap x-empty" id=""><div class="x-form-label" id="" style="width: 100% !important;"><span id="ext-element-251">Address</span></div><div class="x-component-outer" id=""><div class="x-unsized x-field-input" id=""><input class="x-input-el x-form-field x-input-text" type="text" id="locationField" name="locationPoint" maxlength="50" placeholder=""><div class="x-field-mask" style="display: none !important;" id=""></div><div class="x-clear-icon" id=""></div></div></div></div>',
                    //fieldwidth:'width:150px',
                    layout: {
                        type: 'table',
                        columns: 2
                        //align: 'stretch'
                    },
                    defaults: {
                        //fileUpload: true,
                        //labelAlign: 'left',
                        labelWidth: 120,
                        msgTarget: 'side',
                        margin: '5 5 5 5',
                        width: 350,
                    },
                    items:[
						{
							xtype: 'combobox',
							//fieldLabel: 'Город',
                            //fieldLabel: 'Название',
							fieldLabel: request_toir.name,
							disabled: isTTLock,
							name : 'Name',
							//value: nameTP,
							store:Catalog_TP_Select_Store,
							minChars: 0,
							queryMode: 'remote',
							//queryParam: 'inpCity',
							// displayField: 'id',
							valueField: 'nameTP',
							// queryParam: 'name',
							displayField: 'nameTP',
							// valueField: 'varGLN',
							hideTrigger: true, 
							typeAhead: true,
							triggerAction: 'query',
							//forceSelect: true,
							lazyRender: true,
							editable: true,
							listeners: 
							{
								select: function( combo, record, eOpts ) 
								{
									console.log(111);
									var name_tp = combo.getValue();
									//console.log(name_tp);
									//var inpRegion = Ext.getCmp('request_region').getValue();
									Ext.Ajax.request({
										type: 'ajax',
										url: 'app/LogistMobile_checkpoint.php?func=selectNameTP',
										params: {
											name_tp: name_tp
										},
										success: function(response){
											var obj = JSON.parse(response.responseText);
											var Cmp_code = Ext.getCmp('code');
											var Cmp_locationField = Ext.getCmp('locationField');
											var Cmp_load_Unload_Time = Ext.getCmp('LoadUnloadTime');
											var Cmp_start_Time = Ext.getCmp('StartTime');
											var Cmp_end_Time = Ext.getCmp('EndTime');
											var Cmp_Geo_X = Ext.getCmp('Geo_X');
											var Cmp_Geo_Y = Ext.getCmp('Geo_Y');
											
											if(obj[0].code != null){Cmp_code.setValue(obj[0].code);}
											if(obj[0].Address != null){Cmp_locationField.setValue(obj[0].Address);}
											if(obj[0].StaticUnloadTime){Cmp_load_Unload_Time.setValue(obj[0].StaticUnloadTime);}
											if(obj[0].StartServeTime != null){Cmp_start_Time.setValue(obj[0].StartServeTime);}
											if(obj[0].EndServeTime != null){Cmp_end_Time.setValue(obj[0].EndServeTime);}
											if(obj[0].GeoX != null){Cmp_Geo_X.setValue(obj[0].GeoX);}
											if(obj[0].GeoY != null){Cmp_Geo_Y.setValue(obj[0].GeoY);}
											//console.log(obj[0].Address);
											//console.log(response);
											// process server response here
											
										}
									});
								},
      afterrender: function(combo) {
        //var thisCombo = this;
        //this.store.load({callback: function(){
         //thisCombo.setValue(thisCombo.store.getAt(0).get(thisCombo.valueField));
        //}});
       }

							},
							
						},
						/*
                        {
                            xtype: 'textfield',
                            fieldLabel: 'Название',
                            disabled: isTTLock,
                            name : 'Name',
                        //    id: '',
                            allowBlank: false,
                        },*/
                        {
                            xtype: 'textfield',
                            //fieldLabel: 'Код',
                            fieldLabel: request_toir.code,
                            disabled: isTTLock,
                            allowBlank: false,
                            name : 'Code',
                            id: 'code'
                        },
						{
                            xtype: 'textfield',
                            //fieldLabel: 'Адрес',
                            fieldLabel: request_toir.address,
                            //disabled: isTTLock,
                            allowBlank: false,
							id:'locationField',
                            name : 'OriginalAddress',
							emptyText: ' ',
                          //  id: ''
                        },
						/*
						{
							xtype: 'combo',
							//store: ds,
							displayField: 'description',
							typeAhead: false,
							fieldLabel: 'Адрес',
							hideTrigger: true,
							anchor: '100%',
							enableKeyEvents: true,
							allowBlank:false,
							listConfig: {
								loadingText: 'Searching...',
								emptyText: 'No matching posts found.',

								// Custom rendering template for each item
								getInnerTpl: function() {
									return '<div class="search-item">{description}</div>';
								}
							},
							listeners: {
							/*
								keyup: function(combo) {
									queryString = combo.getValue();
									//console.log(queryString);
									//console.log(addressModel);
									addressModel.getProxy().setExtraParam('url', 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=' + queryString + '&types=geocode&components=country:ua&language=ru&key=');

								},
								
							}
						},*/ 
						{
                            xtype: 'timefield',
                            name: 'LoadUnloadTime',
                            //fieldLabel: 'Врем погрузки/выгрузки',
                            fieldLabel: request_toir.time_loading_unloading,
                            format:'i',
                            minValue: '0',
                            maxValue: '60',
							value: '10',
                            increment: 5,
                            disabled: isTTLock,
                            anchor: '100%',
                            allowBlank:false,
							id:'LoadUnloadTime'
                        },
                        {
                            xtype: 'timefield',
                            name: 'StartTime',
                            //fieldLabel: 'Начало работ',
                            fieldLabel: request_toir.beginning_of_work,
                            format:'H:i',
                            minValue: '00:00',
                            maxValue: '23:45',
                            increment: 15,
                            disabled: isTTLock,
                            anchor: '100%',
                            allowBlank:false,
							editable: false,
							id: 'StartTime',
							value: '08:00',
							listeners:
							{
								select: function( combo, record, eOpts )
								{
									var val_StarTime = combo.getValue();
									var Cmp_EndTime = Ext.getCmp('EndTime');
									Cmp_EndTime.setValue(val_StarTime);
									Cmp_EndTime.setMinValue(val_StarTime);
								}
							}
                        },
                        {
                            xtype: 'timefield',
                            name: 'EndTime',
                            //fieldLabel: 'Конец работ',
                            fieldLabel: request_toir.end_of_works,
                            format:'H:i',
                            minValue: '00:00',
                            maxValue: '23:45',
                            increment: 15,
                            disabled: isTTLock,
                            anchor: '100%',
                            allowBlank:false,
							editable: false,
							id: 'EndTime',
							value: '15:00'
                        }, 
                        {
                            xtype: 'textfield',
                            fieldLabel: 'GeoX',
                            //disabled: isTTLock,
                            allowBlank: false,
                            name : 'GeoX',
							id: 'Geo_X',
                        },
                        {
                            xtype: 'textfield',
                            fieldLabel: 'GeoY',
                            //disabled: isTTLock,
                            allowBlank: false,
                            name : 'GeoY',
                            id: 'Geo_Y',
                        },
                        {
			        	 xtype: 'combo',
			        	 fieldLabel: plan_toir.warehouse,
			        	 store: Warehouse_store,
						 disabled: isTTLock,
			        	 allowBlank: false,
						 editable: false,
			        	 valueField: 'Code',
			        	 displayField: 'Name',
			        	 name: 'WAREHOUSE_CODE',
			        	 queryMode: 'local',
						 listeners: {
							afterrender: function(combo) {
								var thisCombo = this;
								this.store.load({callback: function(){
									thisCombo.setValue(thisCombo.store.getAt(0).get(thisCombo.valueField));
								}});
							}
							}
			         }

                    ],buttons:[
                    {
                        //text:'Cохранить',
                        text: all_toir.save,
                        disabled: isLock,
                        //id:'buttonUploadsLMcheckpoint',
                        iconCls:'save',
                        handler: function() {
                            console.log(id);
                            var form = this.up('form').getForm();
                           // var time = Ext.getCmp('date_execute_id').getRawValue();
                            if(form.isValid()){
                                
								if( id ){
									form.submit({
                                    waitMsg: all_toir.loading,
                                    url: 'app/LogistMobile_checkpoint.php',
                                    wait: true,
                                    scope: this,
                                    method: 'post',
                                    params: {func:'ImpexpEdit',id:id, project:project},
                                    success: function(fp, o){
                                    
									if(o.result.success == true){
										
									/*TOiR_app_WindowAddEdit.destroy();
									Ext.MessageBox.alert(all_toir.skill, o.result.message);

									LogistMobile_checkpoint_Store.load({
										params: {
										project: project,
										}
									});
								
									LogistMobile_checkpointImpexp_Store.load({
										params: {
										project: project,
										}
									});
									*/
									
									checkwebtaskprogress(o.result.message,false,completedCheckCheckpointUpdate.name);
									
									
									}else{
										Ext.MessageBox.alert(all_toir.error, o.result.message);
									}
									
									
                                    },
                                    failure: function(fp, o){
										Ext.MessageBox.alert(all_toir.error, o.result.message);
									}
                                });
								}else{
								
								form.submit({
                                   //waitMsg:'Идет отправка...',
                                    waitMsg: all_toir.loading,
                                    url: 'app/LogistMobile_checkpoint.php',
                                    //waitMsg: 'Збереження...',
                                    wait: true,
                                    scope: this,
                                    method: 'post',
                                    //timeout : 60000,
                                    params: {func:'addedit_app',id:id, project:project},
                                    success: function(fp, o){
                                        
							
							if(o.result.success == true){
							
                            /*TOiR_app_WindowAddEdit.destroy();
                            Ext.MessageBox.alert(all_toir.skill, o.result.message);

							LogistMobile_checkpoint_Store.load({
									params: {
									project: project,
									}
								});
								
							LogistMobile_checkpointImpexp_Store.load({
									params: {
									project: project,
									}
								});
							*/			
									checkwebtaskprogress(o.result.message,false,completedCheckCheckpointUpdate.name);

							}else{
										Ext.MessageBox.alert(all_toir.error, o.result.message);
							}
									

                                    },
                                    failure: function(fp, o){
										Ext.MessageBox.alert(all_toir.error, o.result.message);
									}
                                								
								});	
									
									
								
								
								}
								
								
								
					
                            }
                        }
                    },
                    {
                        //text: 'Отмена',
                        text: all_toir.cancel,
                        iconCls:'cancel',
                        handler: function(){
                            TOiR_app_WindowAddEdit.destroy();
                        }
                    }
                ]
                }
            ]
        });
    }
    TOiR_app_WindowAddEdit.show();
    var form = Ext.getCmp("TOiR_RequestFormId").getForm();
    if (id) {
        //Ext.getCmp('equipment_combo_id').enable(true);
        //Ext.getCmp('outlet_combo_id').enable(true);
        /*Ext.Ajax.request({
            url: 'app/TOiR_request_L.php',
            method: 'POST',
            params: {"func":"editshow","id":id},
            success: function(response) {
                var JSON = response.responseText;
                if (JSON) {
                    var decoded = Ext.decode(JSON);
                    var i = 0;
                    var arrOfItems = [];
                    for (k in decoded) {
                        arrOfItems.push(decoded[k]);
                    }
                    console.log(arrOfItems);
                    form.each(function(item) {
                        if (i == 1) {
                            TOiR_OutletStoreRequest.load({
                                params: {
                                    clientID: arrOfItems[i]
                                }
                            });
                        }
                        if (i == 2) {
                            TOiR_EquipmentStoreRequest.load({
                                params: {
                                    outletID: arrOfItems[i]
                                }
                            });
                        }


                        if (item.xtype == 'combo') {
                            //item.setRawValue(decoded[i]);
                            item.setValue(parseInt(arrOfItems[i]));
                        } else {
                            if (i == 18) {
                                var arr = arrOfItems[i].split(' ');
                                console.log(arr[0]);
                                item.setValue(arr[0]);
                            } else {
                                item.setValue(arrOfItems[i]);
                            }
                        }
                        i++;
                    });
                }
            },
            failure: function(response) {
                Ext.MessageBox.alert(all_toir.error, response.responseText);
            }
        });*/
		
		
		form.findField("OriginalAddress").setValue( records.get('OriginalAddress') );
		form.findField("GeoX").setValue( records.get('GeoX') );
		form.findField("GeoY").setValue( records.get('GeoY') );
		
    }
}
/* ----------------- new order for post --------------------------------- */	
		
		
		
		
		
		
		
function show_LogistMobile_checkpoint_Window(Xcoord,Ycoord,Wwidth,Wheight) {	
	hiddenAdd = true;
	if(globalClientID==92){
		hiddenAdd = false;
	}
	
	//LogistMobile_checkpoint_Store.load();
	//LogistMobile_checkpoint_Store.removeAll();
	Project_store.load();
	
	//closeRoute();	
    Xcoord = Xcoord ? Xcoord :40;
    Ycoord = Ycoord ? Ycoord :60;  
    Wwidth = Wwidth ? Wwidth :1100;  
    Wheight = Wheight ? Wheight :400;
        
    var PagingToolbarLogistMobile_checkpoint = Ext.create('Ext.PagingToolbar', {
        //height:30,
        border: false,
        frame: false,
        store: LogistMobile_checkpoint_Store,
        displayInfo: true
    });

	var PagingToolbarLogistMobile_checkpointImpexp = Ext.create('Ext.PagingToolbar', {
        //height:30,
        border: false,
        frame: false,
        store: LogistMobile_checkpointImpexp_Store,
        displayInfo: true
    });
	
	var columns = [
			/*{
				xtype: 'checkcolumn', dataIndex: 'indoor', width: 35, hideable: false, sortable: false
			},*/
			{
		        text:'№',
                width:40,
                xtype:'rownumberer'
			},
			{
                //text: 'Название', 
		        text: request_toir.name, 
                dataIndex: 'Name', 
                sortable: true
			},
			{
                //text: 'Код', 
		        text: request_toir.code, 
                dataIndex: 'Code', 
                sortable: true
			},
			{
                //text: 'Адрес', 
		        text: request_toir.address, 
                dataIndex: 'OriginalAddress', 
                sortable: true
			},
			{
                //text: 'Начало работ', 
		        text: request_toir.beginning_of_work, 
                dataIndex: 'StartTime', 
                sortable: true
			},
			{
                //text: 'Конец работ', 
		        text: request_toir.end_of_works, 
                dataIndex: 'EndTime', 
                sortable: true
			},
			{
                //text: 'Врем погрузки/выгрузки', 
		        text: request_toir.time_loading_unloading, 
                dataIndex: 'LoadUnloadTime', 
                sortable: true
			},
			{
                //text: 'В рейсе', 
		        text: request_toir.in_trip, 
                dataIndex: 'IsInTrip', 
                sortable: true
			},
			{
		        text: 'GeoX', 
                dataIndex: 'GeoX', 
                sortable: true
			},
			{
		        text: 'GeoY', 
                dataIndex: 'GeoY', 
                sortable: true
			},
			{
                //text: 'Дата', 
		        text: request_toir.date, 
                dataIndex: 'Date', 
                sortable: true
			},
			{
                //text: 'Приоритет', 
		        text: request_toir.priority, 
                dataIndex: 'Priority', 
                sortable: true
			}
			
			/*{
		    	  text: 'ID', 
		          dataIndex: 'Id',
		          sortable: true,
		          style: 'text-align:center',            
		          align: 'center',
		          width: 50
		      },  {
		        text: 'Начало работ',
		        dataIndex: 'StartCheckTime',
		        sortable: true
		      }, {
		        text: 'Конец работ',
		        dataIndex: 'EndCheckTime',        
		        sortable: true
		      }, {
		        text: 'Описание',
		        dataIndex: 'Description',
		        sortable: true
		      }, {
		        text: 'Название точки',
		        dataIndex: 'Name',
		        sortable: true
		      }, {
		        text: 'Маршрут',		 
		        dataIndex: 'is_factTrip',
		        sortable: true
		      }, {
		        text: 'Название авто',
		        dataIndex: 'car_name',
		        sortable: true
		      }, {
		        text: 'GeoX',
		        dataIndex: 'GeoX',
		        sortable: true
		      }, {
		        text: 'GeoY',
		        dataIndex: 'GeoY',
		        sortable: true
		      }, {
		    	  text: 'Адрес',		 
			      dataIndex: 'Address',
			      sortable: true
		      }, {
		        text: 'Дата создания',
		        dataIndex: 'Date',
		        sortable: true
		      }, {
		        text: 'Порядок в рейсе',
		        dataIndex: 'OrderInTrip',
		        sortable: true
		      }, {
		        text: 'Растояние',
		        dataIndex: 'Distance',
		        sortable: true
		      }, {
		        text: 'Статус',		 
		        dataIndex: 'PointState',
		        sortable: true
		      }*/
			  ];
	
if (!LogistMobile_checkpoint) {
    Ext.getBody().mask('Загрузка...');
    LogistMobile_checkpoint = new Ext.Window({
        layout : 'fit',
        //title : 'Заявки',
		title : request_toir.request,
        closeAction : 'destroy',
        width : parseInt(Wwidth),
        height : parseInt(Wheight),
        //minimizable: true,
		//constrainHeader: true,
        constrain : true,
		resizable: true,
		maximizable:true,
        x : 2,
        y : 29,
        //y : parseInt(Ycoord),
		listeners : {
        	destroy : function(){
        		LogistMobile_checkpoint = null;
				LogistMobile_checkpoint_Store.removeAll();
        	}
        },
		items : [					
		
		new Ext.create('Ext.tab.Panel', {
        resizeTabs: true,
        enableTabScroll: true,
		border:true,
		frame:false,
		activeTab: 1,
		layout: 'fit',
		collapsible: false,
		region: 'center',
		margins: '5 5 5 0',
        defaults: {
            //autoScroll: true,
            //bodyPadding: 10
        },
        items:[

		{
            closable: false,
			layout: 'fit',
			autoScroll: false,
			floatable: false,
			align: 'stretch',
			defaults: { flex : 1 },
			border:false,
            //title: 'Непривязанные заявки',
			title: routes_LogistMobile.ordersourceimpexp,
			items:[
		new Ext.create('Ext.grid.Panel',{
		    selType: 'rowmodel',
		    columnLines: true,
		    id: 'LogistMobile_checkpointImpexpGridId',
		    store: LogistMobile_checkpointImpexp_Store,
		    loadMask: true,
		    border: false,
		    autoScroll: true,
		    columns: columns,
		    bbar:[PagingToolbarLogistMobile_checkpointImpexp],
		    listeners: {
		    	itemdblclick: function(cmp, records) {
		    		show_TOiR_app_WindowAddEdit(Ext.getCmp('checkpointprojectcombopanel').getValue(),records.get('Order_ID'),records);
		    	}
		    }
		})
		]},{
            closable: false,
			layout: 'fit',
			autoScroll: false,
			floatable: false,
			align: 'stretch',
			defaults: { flex: 1 },
			border:false,
            //title: 'Привязанные заявки',
			title: routes_LogistMobile.ordersource,
			items:[
		
		new Ext.create('Ext.grid.Panel',{
		    selType: 'rowmodel',
		    columnLines: true,
		    id: 'LogistMobile_checkpointGridId',
		    store: LogistMobile_checkpoint_Store,
		    loadMask: true,
		    border: false,
		    autoScroll: true,
		    columns: columns,
		    bbar:[PagingToolbarLogistMobile_checkpoint],
		    listeners: {
		    	itemdblclick: function(cmp, records) {
		    		Show_Cargo_Window_Checkpoint( records.get('Order_ID') );
		    	}
		    }
		})
		
		]}
		
		]
		})
		
	],
	dockedItems: [{
		            xtype: 'toolbar',
		            items: [
						{
	    	    		xtype: 'datefield',
                        //fieldLabel: 'Дата проекта',
	    				fieldLabel: request_toir.date_project,
	    				format: 'Y-m-d',
						labelWidth: 75,
						width: 170,
						editable: false,
						//minValue: new Date(),
						allowBlank: false,
	    				altFormats: 'Y-m-d',
	    				startDay: 1,
	    				value: new Date(),
						id: 'checkpointdatecombopanel',
						listeners: {
	    					select: function( field, value, eOpts ) {
								LogistMobile_checkpoint_Store.removeAll();
								LogistMobile_checkpointImpexp_Store.removeAll();
								Project_store.removeAll();
								Ext.getCmp('checkpointprojectcombopanel').setValue('');
								Ext.getCmp('checkpointprojectcombopanel').setRawValue('');
								Project_store.load({
									params: {
									time: field.rawValue,
									}
								});
								
								
							}
						}
						},
						{
			        	 xtype: 'combo',
                         //fieldLabel: 'Проект',
			        	 fieldLabel: request_toir.project,
			        	 store: Project_store,
			        	 allowBlank: false,
			        	 margin: '5 5 5 5',
			        	 editable: false,
						 labelWidth: 40,
						 width: 180,
			        	 valueField: 'ID',
			        	 displayField: 'Name',
			        	 queryMode: 'local',
						 id: 'checkpointprojectcombopanel',
						 //typeAhead: true,
						 //triggerAction: 'query',
						 //forceSelect: true,
						 //lazyRender: true,
						 listeners:{
							change : function(combo, newValue, oldValue, eOpts){
								/*LogistMobile_checkpoint_Store.load({
									params: {
									project: newValue,
									}
								});*/
								LogistMobile_checkpoint_Store.setProxy({type: 'ajax',
									url: 'app/LogistMobile_checkpoint.php?showCheckpoint=true&project='+newValue,
									reader: {
									type: 'json',
									root: 'rows',
									totalProperty: 'total'
									}
								});
								LogistMobile_checkpoint_Store.load();
								
								LogistMobile_checkpointImpexp_Store.setProxy({type: 'ajax',
									url: 'app/LogistMobile_checkpoint.php?showCheckpointImpexp=true&project='+newValue,
									reader: {
									type: 'json',
									root: 'rows',
									totalProperty: 'total'
									}
								});
								LogistMobile_checkpointImpexp_Store.load();
							},
							afterrender: function(combo) {
								
								var thisCombo = this;
								var project;
								var time = Ext.getCmp('checkpointdatecombopanel').getRawValue();
								
								this.store.load({
									params: {
										time: time,
									},
									callback: function(){
										project = thisCombo.store.getAt(0).get(thisCombo.valueField);
										thisCombo.setValue(project);
									}
								});

								
							},
						 }
						},
						{
		                //text: 'Шаблоны импорта XML/EXCEL',
                        //text: 'Шаблоны импорта XML',
						text: request_toir.XML_import_templates,
		                //iconCls: 'add',
		                handler: function(){
							//window.open('app/name.zip', '_blank');
							window.location.href = 'app/name.zip';
						}
						},
						{
                        //text: 'Импорт заявок',
		                text: request_toir.import_applications,
		                handler: function(){
							if( Ext.getCmp('checkpointprojectcombopanel').getValue() ){
								Show_Uploads_Window_Add_Checkpoint(Ext.getCmp('checkpointprojectcombopanel').getValue());
							}else{
								Ext.MessageBox.alert(all_toir.error,request_toir.choose_project);
							}
							//Show_Uploads_Window_Add_Checkpoint(5);
						}
						},
						{
                        //text: 'Удалить проект',
		                text: request_toir.remove_project,
		                handler: function(){
							//Ext.MessageBox.alert('Ошибка','К сожалению, данный функционал для вас недоступен');
							
							if( Ext.getCmp('checkpointprojectcombopanel').getValue() ){
								
								Ext.MessageBox.confirm(all_toir.attention, request_toir.want_delete_project,  function(btn){
								if(btn=='yes'){
								
								var myMask = new Ext.LoadMask(LogistMobile_checkpoint, {msg: all.loading});
								myMask.show();
								$.post("app/LogistMobile_checkpoint.php",{'DeleteProject':true, 'arrayProjectId':Ext.getCmp('checkpointprojectcombopanel').getValue()}, function(data){
									
									if(data){
											var obj = Ext.decode(data);
											if(obj.success == true){
												myMask.hide();
												var result = checkwebtaskprogress(obj.message,false);
												//alert('result '+result);
												
												LogistMobile_checkpoint_Store.removeAll();
												LogistMobile_checkpointImpexp_Store.removeAll();
												Project_store.removeAll();
												
											}else{
												myMask.hide();
												Ext.MessageBox.alert(all_toir.error, obj.message);
											}

										}else{
											Ext.MessageBox.alert(all_toir.error, '');
											myMask.hide();
										}
									
									/*myMask.hide();
									LogistMobile_checkpoint_Store.removeAll();
									Project_store.removeAll();
									*/
									
								});
								
								}});
								
							}else{
								Ext.MessageBox.alert(all_toir.error, request_toir.choose_project);
							}
							
							/*
							var arrayOrdersId=[];									
							LogistMobile_checkpoint_Store.each(function(record)   
							{
								console.log(record.get('IsInTrip'));
								
								if(record.get('indoor') == true){
									if(record.get('IsInTrip') == 0){
									arrayOrdersId.push(record.get('Order_ID'));
									}else{ Ext.Msg.alert('Ошибка','Заявки в рейсе нельзя удалить'); }
								}
								
							});
							console.log(arrayOrdersId);
							if (arrayOrdersId.length==0){
								Ext.Msg.alert('Ошибка','Выберите заявку(и) для удаления');
							} else {
								var myMask = new Ext.LoadMask(LogistMobile_checkpoint, {msg: all.loading});
								myMask.show();
								$.post("app/LogistMobile_checkpoint.php",{'DeleteOrders':true, 'arrayOrdersId[]':arrayOrdersId}, function(data){
								myMask.hide();
								LogistMobile_checkpoint_Store.load();
								});
							}
							*/
						}
						},
						{
                            //text: 'Добавить заявку',
							text: request_toir.add_the_request,
							iconCls: 'add',
							//hidden: hiddenAdd,
							handler: function(){
								//var myMask = new Ext.LoadMask(LogistMobile_checkpoint, {msg: all.loading});
								//myMask.show();
								
								if( Ext.getCmp('checkpointprojectcombopanel').getValue() ){
									show_TOiR_app_WindowAddEdit(Ext.getCmp('checkpointprojectcombopanel').getValue());
								}else{
									Ext.MessageBox.alert(all_toir.error, request_toir.choose_project);
								}
							}
						}
						
		/*,{
		text: 'Progress',
		handler: function(){
        
			checkwebtaskprogress(8);
		
		}
		}*/
						
						
						/*{
		                text: 'Добавить',
						//text: all_toir.add,
		                iconCls: 'add',
						hidden: true,
		                handler: function(){
							//show_TOiR_users_WindowAddEdit(false);
		                	show_LogistMobile_checkpoint_WindowAddEdit(false);
						}
						},'-',{
		                //text: 'Удалить',
						text: all_toir.del,
		                iconCls: 'delete',
		                handler: function(){
									var select = Ext.getCmp('TOiR_RequestGridId').getView().getSelectionModel().getSelection()[0];
		                            if (select) {
		                                Ext.MessageBox.confirm(all_toir.attention, request_toir.are_you_sure_you_want_to_delete_the_record, function(btn) {
		                                    if (btn == 'yes') {
		                                        //alert(select.get('id'));
		                                        Ext.Ajax.request({
		                                            url: 'app/TOiR_request.php',
		                                            method: 'POST',
		                                            params: { 'func':'delete', "id": select.get('id')},
		                                            success: function(response) {
		                                                Ext.MessageBox.alert(all_toir.skill, all_toir.record_deleted_successfully);
		                                                Ext.getCmp('TOiR_RequestGridId').store.load();
														Ext.getCmp('TOiR_RequestGridId').getView().refresh();
		                                            }
		                                        });
		                                    }
		                                });
		                            } else {
		                                Ext.MessageBox.alert(all_toir.error, all_toir.select_row);
		                            }
						}
						},'-',{
		                //text: 'Редактировать',
						text: all_toir.edit,
		                iconCls: 'edit',
		                handler: function(){
		                	//if () {
		                		var select = Ext.getCmp('TOiR_RequestGridId').getView().getSelectionModel().getSelection()[0];
		                        if (select) {
		    						//show_TOiR_users_WindowAddEdit(select.get('id'));
		                        	console.log(select);
		                        	isLocked(select);
		    					} else {
		                            Ext.MessageBox.alert(all_toir.error, all_toir.select_row);
		                        }
		                	//}
							
						}
						},'->', {
		 					xtype: 'textfield',
		 					width: 150,
		 					id: 'request_filter_field_id'
		 				},'-',{
		 					//text: 'Фильтровать',
							text: all_toir.filter,
		 					handler: function () {
		 						var filter = Ext.getCmp('request_filter_field_id').getValue(); 					
		 						TOiR_requestStore.setProxy({
		 							type: 'ajax',
		 					          url: 'app/TOiR_request.php?func=show&filter='+filter,
		 					          reader: 
		 					          {
		 					            type: 'json',
		 					            root: 'rows'
		 					          }
		 						});
		 						TOiR_requestStore.load();
		 						TOiR_requestStore.loadPage(1); 						
		 					}
		 					
		 				},'-', {
		 					//text: 'Очистить',
							text: all_toir.filter_reset,
		 					margin: '0 20 0 0',
		 					handler: function () {
		 						Ext.getCmp('request_filter_field_id').setValue('');
		 						TOiR_requestStore.setProxy({
		 							type: 'ajax',
		 					          url: 'app/TOiR_request.php?func=show',
		 					          reader: 
		 					          {
		 					            type: 'json',
		 					            root: 'rows'
		 					          }
		 						});
		 						TOiR_requestStore.load();
		 						TOiR_requestStore.loadPage(1); 						
		 					}
		 				}
		 				*/]
			}]
  });
}  
    LogistMobile_checkpoint.show();
	//Ext.getCmp('LogistMobile_checkpointGridId').getView().refresh();
    Ext.getBody().unmask(request_toir.loading);
}

function show_LogistMobile_checkpoint_WindowAddEdit(id, isLock) {
	//TOiR_UsersRequestStoreMy.load();
	//TOiR_RolesStore.load();
	
	if (!id){        
        //var title = "Добавить заявку";      
		var title = request_toir.add_the_request;		
		var isLock = false;		
    } else {        
		//var title = "Редактировать заявку";
		var title = request_toir.edit_the_request;
    }
	var date = new Date();	
	
	if(!LogistMobile_checkpoint_WindowAddEdit){
		LogistMobile_checkpoint_WindowAddEdit = new Ext.Window({
                        width:800,
                        height:500,
                        title: title,
                        closeAction : 'destroy',
						listeners : {
							destroy : function(){
								LogistMobile_checkpoint_WindowAddEdit = null;	
							}
						},
                        layout:'fit',
                        resizable: true,
						constrainHeader: true,
                        modal:true,
                        items:[
						{
						xtype: 'form',
						autoScroll: true,
						bodyPadding: '5 5 5 5',
						id: "LogistMobile_checkpointFormId",
						border: false,
						frame: true,
						autoHeight: true,						
						layout: {
							type: 'table',
							columns: 2
							//align: 'stretch'
						},
						defaults: {
							//fileUpload: true,
							//labelAlign: 'left',
							labelWidth: 120,
							//msgTarget: 'side',
							margin: '5 5 5 5',
							width: 350							
						},
						items:[{
							xtype: 'datefield',						
							//disabled: isLock,
							//fieldLabel: 'Начало',
							fieldLabel: request_toir.starttime,
							format: 'Y-m-d H:i:s',
							altFormats: 'Y-m-d H:i:s',
							startDay: 1,
							name : 'StartCheckTime',
							id: 'StartCheckTime_id',
							allowBlank: false,
							//value: new Date(),
							listeners: {/* 
								change: function(newValue, oldValue, eOpts){ 
									Ext.getCmp('date_execute_id').setMinValue( this.getValue() )
									Ext.getCmp('date_execute_id').setValue( this.getValue() )
								}
							*/}	
						},	{
							xtype: 'datefield',						
							//disabled: isLock,
							//fieldLabel: 'Окончание',
							fieldLabel: request_toir.ending,
							format: 'Y-m-d H:i:s',
							altFormats: 'Y-m-d H:i:s',
							startDay: 1,
							name : 'EndCheckTime',
							id: 'EndCheckTime_id',
							allowBlank: false,
							//value: new Date(),
							listeners: {}	
						}, 	{
							xtype: 'textfield',
							//fieldLabel: 'Описание',
							fieldLabel: request_toir.description,
							//disabled: isTTLock,
							allowBlank: true,
							name : 'Description',
							id: 'Description_id'
						}, {
							xtype: 'textfield',
							//fieldLabel: 'Название точки',
							fieldLabel: request_toir.title_points,
							//disabled: isTTLock,
							name : 'Name',							
							allowBlank: true,
							id: 'Name_id'
						}, {
							xtype: 'textfield',
							//fieldLabel: 'Адрес',
							fieldLabel: request_toir.address,
							//disabled: isTTLock,
							name : 'Address',
							allowBlank: false,							
							id: 'Address_id'
						}, {
							xtype: 'textfield',
							fieldLabel: 'GeoX',
							//fieldLabel: client_toir.contact_person,
							//disabled: isTTLock,
							name : 'GeoX',
							allowBlank: false,
							id: 'GeoX_id'
						},
						{
							xtype: 'textfield',
							fieldLabel: 'GeoY',
							//disabled: isTTLock,
							allowBlank: false,
							name : 'GeoY',
							id: 'GeoY_id'
						},	/*{
							xtype: 'textfield',
							fieldLabel: 'Примечания',
							disabled: isTTLock,
							allowBlank: true,
							hidden: true,
							name : 'description',
							id: 'request_id_description',
						},
						{
							xtype: 'textfield',
							//fieldLabel: 'Тип ТТ',
							fieldLabel: request_toir.type_TT,
							disabled: isTTLock,
							allowBlank: false,
							name : 'outlet_type',
							id: 'request_id_outlet_type'
						},
						{
							xtype: 'textfield',
							//fieldLabel: 'Телефон торгового представителя',
							fieldLabel: client_toir.telephone_sales_representative,
							disabled: isTTLock,
							name : 'sales_man',
							allowBlank: false,
							id: 'request_id_sales_man'
						},
						{
							xtype: 'combo',
							//fieldLabel: 'Мастер',
							fieldLabel: request_toir.name_master,
							name : 'worker',
							disabled: isLock,
							store: TOiR_UsersRequestStoreMy,
							valueField: 'id',
							displayField: 'name',
							queryMode: 'local',
							value: 0
						},
						{
							xtype: 'checkbox',
							//fieldLabel: 'Мастерская',
							fieldLabel: request_toir.workshop,
							disabled: isLock,
							name : 'workshop',
							inputValue: 1
						},
						{
							xtype: 'checkbox',
							disabled: isLock,
							//fieldLabel: 'Заявка выполнена',
							fieldLabel: request_toir.request_executed,
							name : 'status',
							inputValue: 1
						},						
						{
							xtype: 'combo',
							//fieldLabel: 'Оборудование',
							fieldLabel: TOiR.Equipment,
							disabled: isLock,
							allowBlank: false,
							id: 'equipment_combo_id',
							name : 'equipment',
							store: TOiR_EquipmentStoreRequest,
							valueField: 'id',
							disabled: true,
							displayField: 'name',
							queryMode: 'local',
							listeners: {
								select: function(combo, record) {
									var clientID = record[0].get('id');
									TOiR_OutletStore.load({
										params: {
											clientID: clientID
										}
									});
								}
							}
						},						
						{
							xtype: 'datefield',
							disabled: isLock,
							//fieldLabel: 'Дата создания',
							fieldLabel: request_toir.date_of_creation,
							format: 'Y-m-d H:i:s',
							altFormats: 'Y-m-d H:i:s',
							startDay: 1,
							name : 'date_create',
							id: 'date_create_id',
							value: new Date(),
							listeners: { 
								change: function(newValue, oldValue, eOpts){ 
									Ext.getCmp('date_execute_id').setMinValue( this.getValue() )
									Ext.getCmp('date_execute_id').setValue( this.getValue() )
								}
							}							
						},
						{
							xtype: 'datefield',
							disabled: isLock,
							//fieldLabel: 'Дата визита',
							fieldLabel: request_toir.date_of_visit,
							allowBlank: false,
							//format: 'Y-m-d H:i:s',
							//altFormats: 'Y-m-d H:i:s',
							format: 'Y-m-d',
							altFormats: 'Y-m-d',
							startDay: 1,
							name : 'date_execut',
							id: 'date_execute_id',
							//value: new Date(date.setDate(date.getDate() + 1)),
							value: new Date(), 
							minValue: new Date(),						
						}, {
							xtype: 'textfield',
							name: 'work_duration',
							disabled: isLock,
							allowBlank: false,
							//fieldLabel: 'Время выполнения, мин',
							fieldLabel: request_toir.run_time_min,
						}, {
							xtype: 'textfield',
							name: 'external_id',
							//fieldLabel: 'Внешний ID'
							fieldLabel: request_toir.external_ID
						}*/], buttons:[
							{ 
							//text:'Cохранить',
							text: all_toir.save,
							//disabled: isLock,
							//id:'buttonUploadsLMcheckpoint',
							iconCls:'save',
							handler: function() {
								console.log(id);
								var form = this.up('form').getForm();
								//var time = Ext.getCmp('date_execute_id').getRawValue();
								if(form.isValid()){
								form.submit({
									//waitMsg:'Идет отправка...',
									waitMsg: all_toir.loading2,
                                    url: 'app/LogistMobile_checkpoint.php',
									//waitMsg: 'Збереження...',
									wait: true,
									scope: this,
									method: 'post',
									//timeout : 60000,
									params: {'addEditCheckpoint': true, id: id},
                                    success: function(fp, o){
                                    	//LogistMobile_checkpoint_WindowAddEdit.destroy();
                                    	
//                                    	Ext.getCmp('TOiR_RequestGridId').store.load();
//										Ext.getCmp('TOiR_RequestGridId').getView().refresh();
//										if (Ext.getCmp('TOiR_TripPlanningGridId')) {
//											Ext.getCmp('TOiR_TripPlanningGridId').store.load({
//									  			params: {
//									  				time: time
//									  			}
//									  		});
//											Ext.getCmp('TOiR_TripPlanningGridId').getView().refresh();
//											clearMap();
//										}
										
                                    	
                                    }
							});
							  }
						 }
							}, 	{
                            //text: 'Отмена',
							text: all_toir.cancel,
							iconCls:'cancel',
                            handler: function(){
                            	LogistMobile_checkpoint_WindowAddEdit.destroy();
                             }
							}
						]
						}
						]
		});
	}
	LogistMobile_checkpoint_WindowAddEdit.show();
	
	/*var form = Ext.getCmp("TOiR_RequestFormId").getForm().getFields();
    if (id) {
    	Ext.getCmp('equipment_combo_id').enable(true);
    	Ext.getCmp('outlet_combo_id').enable(true);
        Ext.Ajax.request({
            url: 'app/TOiR_request.php',
            method: 'POST',
            params: {"func":"editshow","id":id},
            success: function(response) {
                var JSON = response.responseText;
                if (JSON) {
                    var decoded = Ext.decode(JSON);
					var i = 0;					
					var arrOfItems = [];
					for (k in decoded) {
						arrOfItems.push(decoded[k]);
					}
					console.log(arrOfItems);
					form.each(function(item) {						
						if (i == 1) {
							TOiR_OutletStoreRequest.load({
								params: {
									clientID: arrOfItems[i]
								}
							});
						}	
						if (i == 2) {
						TOiR_EquipmentStoreRequest.load({
								params: {
									outletID: arrOfItems[i]
								}
							});
						}
						
						
					if (item.xtype == 'combo') {
                        //item.setRawValue(decoded[i]);
						item.setValue(parseInt(arrOfItems[i]));
                    } else {
						if (i == 18) {
							var arr = arrOfItems[i].split(' ');
							console.log(arr[0]);
							item.setValue(arr[0]);
						} else {
							item.setValue(arrOfItems[i]);
						}
					}
					i++;
                    });
                }
            },
            failure: function(response) {
                Ext.MessageBox.alert(all_toir.error, response.responseText);
            }
        });
    }*/
}





function Show_Uploads_Window_Add_Checkpoint(project)
{
    if(!Uploads_Window_Add_Checkpoint){
         Uploads_Window_Add_Checkpoint = new Ext.Window({
                        width: 390,
                        height: 110,
                        //title: 'Загрузка файлов',
                        title: all_toir.upload_files,
                        closeAction : 'destroy',
                        layout:'border',
						//iconCls: 'Load16',
                        resizable:false,
                        modal:true,
						constrainHeader: true,
						listeners: {
							destroy : function(){
								Uploads_Window_Add_Checkpoint = null;
							}
						},
                 items:[
		Ext.create('Ext.form.Panel', {
        width: '100%',
        bodyPadding: '5 5 5 5',
		border: false,
		frame: true,
        defaults: {
			fileUpload: true,
            msgTarget: 'side'
        },
		items: [
		{
            xtype: 'filefield',
            name: 'file',
            //emptyText: 'Выберите файл для загрузки',
            emptyText: all_toir.select_file_upload,
            //fieldLabel: 'Пользователи',
			width: 357,
            //buttonText: 'Открыть',
            buttonText: all_toir.open,
			allowBlank: false,
			//clearOnSubmit: true,
			listeners:{
						change: function(val, value, eOpts ){
							
							var form = this.up('form').getForm();
							if(form.isValid()){
							if(value){
							var extn = value.split('.').pop();
							console.log(extn);
							if((extn=='xlsx') || (extn=='xls') || (extn=='XLS') || (extn=='XLSX') || (extn=='xml') || (extn=='XML')){
								
							}else{
								//val.reset();
								form.reset();
								//val.setValue('');
								//val.setRawValue('');
								Ext.MessageBox.alert(all_toir.error, all_toir.incorrect_file_format);
							}
							}
							}
						}
			}
        }
		],
		buttons:[
								{ 
                                //text:'Загрузить',
                                text:all_toir.upload,
                                id:'buttonUploadsLMcheckpoint',
								//iconCls:'Load16',
								 handler: function() {
									
									
				var form = this.up('form').getForm();
                if(form.isValid()){
                    form.submit({
                        //url: 'scripts/UploadFiles.php',
						url: 'app/Logist/file-upload.php',
                        //waitMsg: 'Загрузка...',
                        waitMsg: all_toir.loading3,
						wait:true,
						scope: this,
						method: 'post',
						timeout : 60000,
						params: {project:project},
                        success: function(fp, o) {
							//alert(o.result.success);
							if(o.result.success == true){
								var result = checkwebtaskprogress(o.result.message,false,completedCheckCheckpointUpdate.name);
							}else{
								Ext.MessageBox.alert(all_toir.error, o.result.message);
							}
							
                        },
						failure: function(fp, o) {
							Ext.MessageBox.alert(all_toir.error, o.result.message);
						}
                    });
                }
									

								 }
                                },
								
								{ 
                                //text:'Отмена',
                                text:all_toir.cancel,
                                id:'buttonCancel',
                                handler:function(){
                                        Uploads_Window_Add_Checkpoint.destroy();        
                                           }

                                }
								]
		})	 
				 ]
                     

                })      
         
     }
    Uploads_Window_Add_Checkpoint.show(); 
	
}



function Show_Cargo_Window_Checkpoint()
{
    if(!Cargo_Window_Checkpoint){
         Cargo_Window_Checkpoint = new Ext.Window({
                        width: 600,
                        height: 400,
                        //title: 'Загрузка файлов',
                        //title: all_toir.upload_files,
                        closeAction : 'destroy',
                        layout:'border',
						//iconCls: 'Load16',
                        resizable:false,
                        modal:true,
						constrainHeader: true,
						listeners: {
							destroy : function(){
								Cargo_Window_Checkpoint = null;
							}
						},
                 items:[
		
				 ]
                     

                })      
         
     }
    Cargo_Window_Checkpoint.show(); 
	
}