-- carga de archivos

-- ALTER TABLE `student` ADD COLUMN `lock_grades` ENUM('LOCKED','UNLOCKED') NULL DEFAULT 'UNLOCKED'  AFTER `siblins_post_between`;
INSERT INTO process (`serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`)
VALUES (738, 'Registro de Documentos', '#', '999', 'LOCKABLE');

INSERT INTO process (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`)
VALUES ('739', '738', 'Cargar Documentos de Matrícula', 'laravel/public/uploadMatriculeFiles', '10', 'LOCKABLE');

insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@getIndex');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@postLoadStudents');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@postLoadMessages');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@postLoadInfoChild');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@postSaveDocuments');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@getDownloadFile');

ALTER TABLE school_year
ADD COLUMN photo_matricule ENUM('YES','NO') NULL DEFAULT NULL AFTER setup_skills;

ALTER TABLE list_student_year
ADD COLUMN file_name varchar(255) NULL DEFAULT NULL AFTER options_lsy;

ALTER TABLE list
MODIFY COLUMN options_lst set('SHOW_IN_REGISTER_PROCESS','DOWNLOADABLE') NULL DEFAULT NULL;


-- creo tabla para controlar documentos por nivel por año lectivo
CREATE TABLE IF NOT EXISTS list_year (
  serial_lty int NOT NULL AUTO_INCREMENT,
  serial_lst int NULL DEFAULT NULL,
  serial_lvl int NULL DEFAULT NULL,
  serial_scy int NULL DEFAULT NULL,
  serial_set int NULL DEFAULT NULL,
  options set('FOR_NEW','FOR_OLD','PHOTO_USER','POLITICS') DEFAULT NULL,
  defined_prf set('MEDICAL','DCE','EXTRACURRICULAR','COLLECTOR','TRANSPORT','NONE') DEFAULT 'NONE',
  file_name_lty varchar (250) NULL DEFAULT NULL,
  status_lty enum('ACTIVE','INACTIVE') DEFAULT 'ACTIVE',
  PRIMARY KEY (serial_lty)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------------------------------------------------------------------------------
-- Descarga de archivos
-- --------------------------------------------------------------------------------------------------------------------------------
-- extracurriculares
INSERT INTO process (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`) VALUES ('741', '441', 'Descargar Documentos', 'laravel/public/downloadExtracurricularFiles', '99.00', 'LOCKABLE');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (741,'DownloadExtracurricularFilesController@getIndex');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (741,'DownloadExtracurricularFilesController@postReport');
-- dece
insert into allowed_pages_by_process (serial_prc, url_dsc) values (75,'DownloadDeceFilesController@getIndex');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (634,'DownloadDeceFilesController@postReport');
INSERT INTO process (`serial_prc`, `prc_serial_prc`, `name_prc`, `link_prc`, `weight_prc`, `status_prc`)
VALUES (742, 634, 'Descarga de Documentos', 'laravel/public/downloadDeceFiles', '99', 'LOCKABLE');

-- ------------------------------------------------------------------------------------------------------------------------------------
-- Administrador
-- ------------------------------------------------------------------------------------------------------------------------------------
ALTER TABLE profile ADD COLUMN defined_prf enum('MEDICAL','DCE','EXTRACURRICULAR','COLLECTOR','TRANSPORT') NULL DEFAULT NULL AFTER owner_prf;
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'UploadFilesController@getDownloadFile');

insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@getDownload');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@postAceptPolitics');

insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'UploadFilesController@getDownloadguardian');
-- ------------------------------------------
-- si se usa otra ruta usar esto para hacer una carpeta compartida
--  mount -o bind /media/disco/letort/files/matricula  /var/www/html/local_develop/DEV/files/matricula
--
insert into allowed_pages_by_process (serial_prc, url_dsc) values (739,'UploadFilesController@getDownloadfiles');

-- observacion cuando rechaza
ALTER TABLE list_student_year ADD COLUMN observation_lsy text NULL DEFAULT NULL AFTER file_name;
-- guardar observacion
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postSaveObservation');


/*CAMBIOS EN PANTALLA*/

insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postLoadStudentContainer');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postLoadLevelContainer');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postLoadPendingContainer');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postLoadStudentInLevelContainer');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@getInfoModalInLevel');
insert into allowed_pages_by_process (serial_prc, url_dsc) values (696,'DocumentRegisterController@postStudentPending');

-- campos que no tienen otras bases
ALTER TABLE student_invoice_data ADD COLUMN mobil_phone_sid varchar(45) NULL DEFAULT NULL AFTER phone_sid;
ALTER TABLE student_year  ADD COLUMN options_sty set('PEDAGOGY_OUTPUTS','LEAVE_WITHOUT_AUTHORIZATION','TAKE_TRANSPORT','INSURANCE_EDUCATION','INSURANCE_ACCIDENTS') NULL DEFAULT NULL AFTER date_start_invoice_sty;
ALTER TABLE student_year  ADD COLUMN bank_sty enum('PICHINCHA','PACIFICO') NULL DEFAULT NULL AFTER options_sty;


--orden dce catalog
ALTER TABLE `dce_catalog` ADD COLUMN `orde_dca` int NULL DEFAULT NULL  AFTER type_page;
insert into allowed_pages_by_process (serial_prc, url_dsc) values (635,'DceController@postDcepdfreportwindowdocumentsguardian');



--medical file
alter table medical_file add column medicine_auth_mdf enum('YES','NO') after emergency_auth_mdf;
alter table medical_file add column medical_care_auth_mdf enum('YES','NO') after medicine_auth_mdf;
