package kz.cafe.admin;

import java.util.*;
import kz.cafe.admin.constants.AccessConstants.EditMode;
import kz.cafe.admin.panel_extensions.*;
import kz.cafe.admin.panels.*;
import kz.cafe.admin.panels.model.*;
import kz.cafe.db.model.*;


public class TabFaceControl extends AbstractTab{
   private static final long serialVersionUID = -5281394170937761954L;




   public TabFaceControl(AdminMain application, Set<EditMode> setMode){
      super(application, setMode);
   }
   
   
   

   @Override
   public DBListPanel<MFaceControl> build(){
		CustomDescriptor dscr = new CustomDescriptor();
		
		CustomField field = new CustomField();
		field.visible = true;
		field.search.mode = CustomField.Search.SEARCH_MODES.INTEGER;
		field.name = "ID";
      field.db = "ID";
      field.isEditable = false;
      field.style.width = 50;
		field.isSortable = true;
		field.search.row = 0;
      dscr.addField(field);

		
		
      field = new CustomField();
      field.visible = true;
      field.name = "Название";
      field.db = "name";
      field.isEditable = true;
      field.style.width = 150;
      field.isMust = true;
      field.search.mode = CustomField.Search.SEARCH_MODES.LOCALIZED_STRING;
      dscr.addField(field);
      
      
      
      

      
      
      
      field = new CustomField();
      field.visible = true;
      //field.searchable = CustomField.SEARCH_MODES.INTEGER;
      
      field.name = "Описание";
      field.db = "description";
      field.isEditable = true;
      field.style.width = 0;
      field.search.mode = CustomField.Search.SEARCH_MODES.LOCALIZED_STRING;
      dscr.addField(field);
      
      
      
      
      CustomImageField fieldImage = new CustomImageField();
      fieldImage.visible = true;
      fieldImage.name = "Изображение";
      fieldImage.db = "image";
      fieldImage.isEditable = true;
      fieldImage.style.width = 40;
      fieldImage.style.height = 40;
      fieldImage.isImageInTable = true;
      dscr.addField(fieldImage);
      
      
      
      
      
      
      
      CustomDateField dateField = new CustomDateField();
      dateField.visible = true;
      dateField.name = "Создан";
      dateField.db = "created";
      dateField.isEditable = false;
      dateField.style.width = 120;
      dateField.isSortable = true;
      dateField.search.mode = CustomField.Search.SEARCH_MODES.DATE_RANGE; 
      dateField.search.row = 1;
      dscr.addField(dateField);
      
      
      
      
      
      dateField = new CustomDateField();
      dateField.visible = true;
      dateField.name = "Обновлен";
      dateField.db = "updated";
      dateField.isEditable = false;
      dateField.style.width = 120;
      dateField.isSortable = true;
      dateField.search.mode = CustomField.Search.SEARCH_MODES.DATE_RANGE;
      dateField.search.row = 1;
      dscr.addField(dateField);

      
      
      field = new CustomField();
      field.visible = true;
      field.name = "Опубликовано";
      field.db = "published";
      field.isEditable = true;
      field.style.width = 40;
      field.isSortable = true;
      field.search.mode = CustomField.Search.SEARCH_MODES.BOOLEAN_ONLY_TRUE; 
      field.search.row = 1;
      dscr.addField(field);
      
      
      
      field = new CustomField();
      field.visible = true;
      field.search.mode = CustomField.Search.SEARCH_MODES.INTEGER;
      field.name = "Порядок";
      field.db = "order";
      field.isEditable = true;
      field.style.width = 50;
      field.isSortable = true;
      field.style.expandable = false;
      field.search.row = 0;
      dscr.addField(field);
      
      
      
      DBListPanel<MFaceControl> panel = new DBListPanel<MFaceControl>(application, MFaceControl.class, dscr, Dimension.getFull(application), setMode);
      panel.addPanel(new ExtraPanelImageUploader(panel, (CustomImageField) dscr.mapDBFields.get("image")), false);
      //panelCourse.addPanel(new ExtraPanelImageViewer(panelCourse, fieldImage, 50), true);
      
      return panel;
   }




   @Override
   public DBSingle build(int ID){
      // TODO Auto-generated method stub
      return null;
   }
}

