Best JavaScript code snippet using ng-mocks
oldInputs.js
Source:oldInputs.js
1//SPIEGAZIONE2/*3"fields" è un oggetto che contiene tutti i campi che compongono una tabella4ogni oggetto al suo interno contiente un array degli elementi essenziali e necessari al funzionamento del modulo5e all'invio dei dati al server6type: tipo di input7label: label del campo8varName: nome della variabile in cui verrà salvato il valore del campo, e coincide con il nome della colonna della tabella nel database9idUpdate: id del campo che viene usato per la modifica dei dati10idAdd: id del campo che viene usato per l'inserimento dei dati, aggiunta di un nuovo record11*/12const fields2 = {13 "acconto": [14 {15 "type": "number",16 "varName": "id_rata",17 "idUpdate": "RataField",18 "idAdd": "addRataField",19 "label": "ID Rata"20 },21 {22 "type": "number",23 "varName": "somma",24 "idUpdate": "SommaField",25 "idAdd": "addSommaField",26 "label": "Somma"27 },28 {29 "type": "date",30 "varName": "data_pagamento",31 "idUpdate": "DataPagamentoField",32 "idAdd": "addDataPagamentoField",33 "label": "Data Pagamento"34 },35 {36 "type": "number",37 "varName": "metodo_pagamento",38 "idUpdate": "MetodoPagamentoField",39 "idAdd": "addMetodoPagamentoField",40 "label": "Metodo Pagamento"41 },42 {43 "type": "text",44 "varName": "log_utente",45 "idUpdate": "LogUtenteField",46 "idAdd": "addLogUtenteField",47 "label": "Log Utente"48 },49 {50 "type": "text",51 "varName": "log_azione",52 "idUpdate": "LogAzioneField",53 "idAdd": "addLogAzioneField",54 "label": "Log Azione"55 },56 {57 "type": "date",58 "varName": "date_time_record_insert",59 "idUpdate": "DateTimeRecordInsertField",60 "idAdd": "addDateTimeRecordInsertField",61 "label": "Data Inserimento Record"62 },63 {64 "type": "date",65 "varName": "date_time_record_update",66 "idUpdate": "DateTimeRecordUpdateField",67 "idAdd": "addDateTimeRecordUpdateField",68 "label": "Data Aggiornamento Record"69 },70 {71 "type": "text",72 "varName": "note",73 "idUpdate": "NoteField",74 "idAdd": "addNoteField",75 "classes": "text-area-modal",76 "label": "Note"77 },78 ],79 "allegati": [80 {81 "type": "text",82 "varName": "nome_file",83 "idUpdate": "NomeFileField",84 "idAdd": "addNomeFileField",85 "label": "Nome File"86 },87 {88 "type": "text",89 "varName": "percorso",90 "idUpdate": "PercorsoField",91 "idAdd": "addPercorsoField",92 "label": "Percorso"93 },94 {95 "type": "text",96 "varName": "estensione_file",97 "idUpdate": "EstensioneFileField",98 "idAdd": "addEstensioneFileField",99 "label": "Estensione File"100 },101 {102 "type": "number",103 "varName": "codice_tipo_file",104 "idUpdate": "CodiceTipoFileField",105 "idAdd": "addCodiceTipoFileField",106 "label": "Codice Tipo File"107 },108 {109 "type": "number",110 "varName": "eliminato",111 "idUpdate": "EliminatoField",112 "idAdd": "addEliminatoField",113 "label": "Eliminato"114 },115 {116 "type": "date",117 "varName": "data_caricamento",118 "idUpdate": "DataCaricamentoField",119 "idAdd": "addDataCaricamentoField",120 "label": "Data Caricamento"121 },122 {123 "type": "number",124 "varName": "acconto",125 "idUpdate": "AccontoField",126 "idAdd": "addAccontoField",127 "label": "Acconto"128 },129 {130 "type": "number",131 "varName": "rata",132 "idUpdate": "RataField",133 "idAdd": "addRataField",134 "label": "Rata"135 },136 {137 "type": "number",138 "varName": "pagamento",139 "idUpdate": "PagamentoField",140 "idAdd": "addPagamentoField",141 "label": "Pagamento"142 },143 {144 "type": "number",145 "varName": "referente",146 "idUpdate": "ReferenteField",147 "idAdd": "addReferenteField",148 "label": "Referente"149 },150 {151 "type": "number",152 "varName": "fascicolo",153 "idUpdate": "FascicoloField",154 "idAdd": "addFascicoloField",155 "label": "Fascicolo"156 },157 {158 "type": "number",159 "varName": "gestito",160 "idUpdate": "GestitoField",161 "idAdd": "addGestitoField",162 "label": "Gestito"163 },164 ],165 "appuntamenti": [166 {167 "type": "number",168 "varName": "id_prospective",169 "idUpdate": "IdProspectiveField",170 "idAdd": "addIdProspectiveField",171 "label": "ID Prospective"172 },173 {174 "type": "number",175 "varName": "numero_telefono",176 "idUpdate": "NumeroTelefonoField",177 "idAdd": "addNumeroTelefonoField",178 "label": "Numero Telefono"179 },180 {181 "type": "date",182 "varName": "data_chiamata",183 "idUpdate": "DataChiamataField",184 "idAdd": "addDataChiamataField",185 "label": "Data Chiamata"186 },187 {188 "type": "number",189 "varName": "stato",190 "idUpdate": "StatoField",191 "idAdd": "addStatoField",192 "label": "Stato"193 },194 {195 "type": "text",196 "varName": "note",197 "idUpdate": "NoteField",198 "idAdd": "addNoteField",199 "classes": "text-area-modal",200 "label": "Note"201 },202 ],203 "caso": [204 {205 "type": "text",206 "varName": "nome",207 "idUpdate": "NomeField",208 "idAdd": "addNomeField",209 "label": "Nome"210 },211 {212 "type": "text",213 "varName": "log_utente",214 "idUpdate": "LogUtenteField",215 "idAdd": "addLogUtenteField",216 "label": "Log Utente"217 },218 {219 "type": "text",220 "varName": "log_azione",221 "idUpdate": "LogAzioneField",222 "idAdd": "addLogAzioneField",223 "label": "Log Azione"224 },225 {226 "type": "date",227 "varName": "date_time_record_insert",228 "idUpdate": "DateTimeRecordInsertField",229 "idAdd": "addDateTimeRecordInsertField",230 "label": "Data Inserimento Record"231 },232 {233 "type": "date",234 "varName": "date_time_record_update",235 "idUpdate": "DateTimeRecordUpdateField",236 "idAdd": "addDateTimeRecordUpdateField",237 "label": "Data Aggiornamento Record"238 },239 {240 "type": "text",241 "varName": "note",242 "idUpdate": "NoteField",243 "idAdd": "addNoteField",244 "classes": "text-area-modal",245 "label": "Note"246 },247 ],248 "chiamata": [249 {250 "type": "text",251 "varName": "nome",252 "idUpdate": "NomeField",253 "idAdd": "addNomeField",254 "label": "Nome"255 },256 ],257 "fascicolo": [258 {259 "type": "text",260 "varName": "nickname",261 "idUpdate": "NicknameField",262 "idAdd": "addNicknameField",263 "label": "Nickname"264 },265 {266 "type": "date",267 "varName": "data_apertura",268 "idUpdate": "DataAperturaField",269 "idAdd": "addDataAperturaField",270 "label": "Data Apertura"271 },272 {273 "type": "date",274 "varName": "data_chiusura",275 "idUpdate": "DataChiusuraField",276 "idAdd": "addDataChiusuraField",277 "label": "Data Chiusura"278 },279 {280 "type": "number",281 "varName": "stato",282 "idUpdate": "StatoField",283 "idAdd": "addStatoField",284 "label": "Stato"285 },286 {287 "type": "number",288 "varName": "id_ufficio",289 "idUpdate": "UfficioField",290 "idAdd": "addUfficioField",291 "label": "ID Ufficio"292 },293 {294 "type": "number",295 "varName": "persone_gestite",296 "idUpdate": "PersoneGestiteField",297 "idAdd": "addPersoneGestiteField",298 "label": "Persone Gestite"299 },300 {301 "type": "number",302 "varName": "referente",303 "idUpdate": "ReferenteField",304 "idAdd": "addReferenteField",305 "label": "Referente"306 },307 {308 "type": "number",309 "varName": "caso",310 "idUpdate": "CasoField",311 "idAdd": "addCasoField",312 "label": "Caso"313 },314 {315 "type": "text",316 "varName": "link",317 "idUpdate": "LinkField",318 "idAdd": "addLinkField",319 "label": "Link"320 },321 {322 "type": "text",323 "varName": "log_utente",324 "idUpdate": "LogUtenteField",325 "idAdd": "addLogUtenteField",326 "label": "Log Utente"327 },328 {329 "type": "text",330 "varName": "log_azione",331 "idUpdate": "LogAzioneField",332 "idAdd": "addLogAzioneField",333 "label": "Log Azione"334 },335 {336 "type": "date",337 "varName": "date_time_record_insert",338 "idUpdate": "DateTimeRecordInsertField",339 "idAdd": "addDateTimeRecordInsertField",340 "label": "Data Inserimento Record"341 },342 {343 "type": "date",344 "varName": "date_time_record_update",345 "idUpdate": "DateTimeRecordUpdateField",346 "idAdd": "addDateTimeRecordUpdateField",347 "label": "Data Aggiornamento Record"348 },349 {350 "type": "text",351 "varName": "note",352 "idUpdate": "NoteField",353 "idAdd": "addNoteField",354 "classes": "text-area-modal",355 "label": "Note"356 },357 ],358 "fascicolo_s": [359 {360 "type": "number",361 "varName": "id_fascicolo",362 "idUpdate": "FascicoloField",363 "idAdd": "addFascicoloField",364 "label": "ID Fascicolo"365 },366 {367 "type": "number",368 "varName": "id_specialista",369 "idUpdate": "SpecialistaField",370 "idAdd": "addSpecialistaField",371 "label": "ID Specialista"372 },373 {374 "type": "date",375 "varName": "data_assegnazione",376 "idUpdate": "DataAssegnazioneField",377 "idAdd": "addDataAssegnazioneField",378 "label": "Data Assegnazione"379 },380 {381 "type": "date",382 "varName": "data_conclusione",383 "idUpdate": "DataConclusioneField",384 "idAdd": "addDataConclusioneField",385 "label": "Data Conclusione"386 },387 {388 "type": "number",389 "varName": "numero_specialista",390 "idUpdate": "NumeroSpecialistaField",391 "idAdd": "addNumeroSpecialistaField",392 "label": "Numero Specialista"393 },394 {395 "type": "checkbox",396 "classes": "form-check-input",397 "varName": "accettato",398 "idUpdate": "AccettatoField",399 "idAdd": "addAccettatoField",400 "label": "Accettato"401 },402 {403 "type": "text",404 "varName": "log_utente",405 "idUpdate": "LogUtenteField",406 "idAdd": "addLogUtenteField",407 "label": "Log Utente"408 },409 {410 "type": "text",411 "varName": "log_azione",412 "idUpdate": "LogAzioneField",413 "idAdd": "addLogAzioneField",414 "label": "Log Azione"415 },416 {417 "type": "date",418 "varName": "date_time_record_insert",419 "idUpdate": "DateTimeRecordInsertField",420 "idAdd": "addDateTimeRecordInsertField",421 "label": "Data Inserimento Record"422 },423 {424 "type": "date",425 "varName": "date_time_record_update",426 "idUpdate": "DateTimeRecordUpdateField",427 "idAdd": "addDateTimeRecordUpdateField",428 "label": "Data Aggiornamento Record"429 },430 {431 "type": "text",432 "varName": "note",433 "idUpdate": "NoteField",434 "idAdd": "addNoteField",435 "classes": "text-area-modal",436 "label": "Note"437 },438 ],439 "gestito": [440 {441 "type": "text",442 "varName": "nome",443 "idUpdate": "NomeField",444 "idAdd": "addNomeField",445 "label": "Nome"446 },447 {448 "type": "text",449 "varName": "cognome",450 "idUpdate": "CognomeField",451 "idAdd": "addCognomeField",452 "label": "Cognome"453 },454 {455 "type": "text",456 "varName": "middle_name",457 "idUpdate": "MiddleNameField",458 "idAdd": "addMiddleNameField",459 "label": "Middle Name"460 },461 {462 "type": "date",463 "varName": "data_nascita",464 "idUpdate": "DataField",465 "idAdd": "addDataField",466 "label": "Data"467 },468 {469 "type": "text",470 "varName": "indirizzo",471 "idUpdate": "IndirizzoField",472 "idAdd": "addIndirizzoField",473 "label": "Indirizzo"474 },475 {476 "type": "text",477 "varName": "numero_telefono",478 "idUpdate": "TelefonoField",479 "idAdd": "addTelefonoField",480 "label": "Telefono"481 },482 {483 "type": "email",484 "varName": "mail",485 "idUpdate": "MailField",486 "idAdd": "addMailField",487 "label": "Email"488 },489 {490 "type": "number",491 "varName": "id_fascicolo",492 "idUpdate": "FascicoloField",493 "idAdd": "addFascicoloField",494 "label": "ID Fascicolo"495 },496 {497 "type": "text",498 "varName": "log_utente",499 "idUpdate": "LogUtenteField",500 "idAdd": "addLogUtenteField",501 "label": "Log Utente"502 },503 {504 "type": "text",505 "varName": "log_azione",506 "idUpdate": "LogAzioneField",507 "idAdd": "addLogAzioneField",508 "label": "Log Azione"509 },510 {511 "type": "date",512 "varName": "date_time_record_insert",513 "idUpdate": "DateTimeRecordInsertField",514 "idAdd": "addDateTimeRecordInsertField",515 "label": "Data Inserimento Record"516 },517 {518 "type": "date",519 "varName": "date_time_record_update",520 "idUpdate": "DateTimeRecordUpdateField",521 "idAdd": "addDateTimeRecordUpdateField",522 "label": "Data Aggiornamento Record"523 },524 {525 "type": "number",526 "varName": "obbligo_gdpr",527 "idUpdate": "ObbligoGdprField",528 "idAdd": "addObbligoGdprField",529 "label": "Obbligo GDPR"530 },531 {532 "type": "text",533 "varName": "note",534 "idUpdate": "NoteField",535 "idAdd": "addNoteField",536 "classes": "text-area-modal",537 "label": "Note"538 },539 ],540 "metodo_p": [541 {542 "type": "text",543 "varName": "nome",544 "idUpdate": "NomeField",545 "idAdd": "addNomeField",546 "label": "Nome"547 },548 {549 "type": "text",550 "varName": "log_utente",551 "idUpdate": "LogUtenteField",552 "idAdd": "addLogUtenteField",553 "label": "Log Utente"554 },555 {556 "type": "text",557 "varName": "log_azione",558 "idUpdate": "LogAzioneField",559 "idAdd": "addLogAzioneField",560 "label": "Log Azione"561 },562 {563 "type": "date",564 "varName": "date_time_record_insert",565 "idUpdate": "DateTimeRecordInsertField",566 "idAdd": "addDateTimeRecordInsertField",567 "label": "Data Inserimento Record"568 },569 {570 "type": "date",571 "varName": "date_time_record_update",572 "idUpdate": "DateTimeRecordUpdateField",573 "idAdd": "addDateTimeRecordUpdateField",574 "label": "Data Aggiornamento Record"575 },576 {577 "type": "text",578 "varName": "note",579 "idUpdate": "NoteField",580 "idAdd": "addNoteField",581 "classes": "text-area-modal",582 "label": "Note"583 },584 ],585 "pagamento": [586 {587 "type": "number",588 "varName": "id_fascicolo",589 "idUpdate": "FascicoloField",590 "idAdd": "addFascicoloField",591 "label": "ID Fascicolo"592 },593 {594 "type": "date",595 "varName": "creazione",596 "idUpdate": "CreazioneField",597 "idAdd": "addCreazioneField",598 "label": "Data Creazione"599 },600 {601 "type": "number",602 "varName": "totale",603 "idUpdate": "TotaleField",604 "idAdd": "addTotaleField",605 "label": "Totale"606 },607 {608 "type": "number",609 "varName": "totale_vero",610 "idUpdate": "TotaleVeroField",611 "idAdd": "addTotaleVeroField",612 "label": "Totale Vero"613 },614 {615 "type": "checkbox",616 "classes": "form-check-input",617 "varName": "accettato",618 "idUpdate": "AccettatoField",619 "idAdd": "addAccettatoField",620 "label": "Accettato"621 },622 {623 "type": "text",624 "varName": "log_utente",625 "idUpdate": "LogUtenteField",626 "idAdd": "addLogUtenteField",627 "label": "Log Utente"628 },629 {630 "type": "text",631 "varName": "log_azione",632 "idUpdate": "LogAzioneField",633 "idAdd": "addLogAzioneField",634 "label": "Log Azione"635 },636 {637 "type": "date",638 "varName": "date_time_record_insert",639 "idUpdate": "DateTimeRecordInsertField",640 "idAdd": "addDateTimeRecordInsertField",641 "label": "Data Inserimento Record"642 },643 {644 "type": "date",645 "varName": "date_time_record_update",646 "idUpdate": "DateTimeRecordUpdateField",647 "idAdd": "addDateTimeRecordUpdateField",648 "label": "Data Aggiornamento Record"649 },650 {651 "type": "text",652 "varName": "note",653 "idUpdate": "NoteField",654 "idAdd": "addNoteField",655 "classes": "text-area-modal",656 "label": "Note"657 },658 ],659 "prospective": [660 {661 "type": "text",662 "varName": "nome",663 "idUpdate": "NomeField",664 "idAdd": "addNomeField",665 "label": "Nome"666 },667 {668 "type": "text",669 "varName": "cognome",670 "idUpdate": "CognomeField",671 "idAdd": "addCognomeField",672 "label": "Cognome"673 },674 {675 "type": "text",676 "varName": "middle_name",677 "idUpdate": "MiddleNameField",678 "idAdd": "addMiddleNameField",679 "label": "Middle Name"680 },681 {682 "type": "number",683 "varName": "numero_telefono",684 "idUpdate": "NumeroTelefonoField",685 "idAdd": "addNumeroTelefonoField",686 "label": "Numero Telefono"687 },688 {689 "type": "text",690 "varName": "log_utente",691 "idUpdate": "LogUtenteField",692 "idAdd": "addLogUtenteField",693 "label": "Log Utente"694 },695 {696 "type": "text",697 "varName": "log_azione",698 "idUpdate": "LogAzioneField",699 "idAdd": "addLogAzioneField",700 "label": "Log Azione"701 },702 {703 "type": "date",704 "varName": "date_time_record_insert",705 "idUpdate": "DateTimeRecordInsertField",706 "idAdd": "addDateTimeRecordInsertField",707 "label": "Data Inserimento Record"708 },709 {710 "type": "date",711 "varName": "date_time_record_update",712 "idUpdate": "DateTimeRecordUpdateField",713 "idAdd": "addDateTimeRecordUpdateField",714 "label": "Data Aggiornamento Record"715 },716 {717 "type": "number",718 "varName": "obbligo_gdpr",719 "idUpdate": "ObbligoGdprField",720 "idAdd": "addObbligoGdprField",721 "label": "Obbligo GDPR"722 },723 {724 "type": "text",725 "varName": "note",726 "idUpdate": "NoteField",727 "idAdd": "addNoteField",728 "classes": "text-area-modal",729 "label": "Note"730 },731 ],732 "rata": [733 {734 "type": "number",735 "varName": "id_pagamento",736 "idUpdate": "PagamentoField",737 "idAdd": "addPagamentoField",738 "label": "ID Pagamento"739 },740 {741 "type": "number",742 "varName": "somma",743 "idUpdate": "SommaField",744 "idAdd": "addSommaField",745 "label": "Somma"746 },747 {748 "type": "checkbox",749 "classes": "form-check-input",750 "varName": "pagata",751 "idUpdate": "PagataField",752 "idAdd": "addPagataField",753 "label": "Pagata"754 },755 {756 "type": "text",757 "varName": "log_utente",758 "idUpdate": "LogUtenteField",759 "idAdd": "addLogUtenteField",760 "label": "Log Utente"761 },762 {763 "type": "text",764 "varName": "log_azione",765 "idUpdate": "LogAzioneField",766 "idAdd": "addLogAzioneField",767 "label": "Log Azione"768 },769 {770 "type": "date",771 "varName": "date_time_record_insert",772 "idUpdate": "DateTimeRecordInsertField",773 "idAdd": "addDateTimeRecordInsertField",774 "label": "Data Inserimento Record"775 },776 {777 "type": "date",778 "varName": "date_time_record_update",779 "idUpdate": "DateTimeRecordUpdateField",780 "idAdd": "addDateTimeRecordUpdateField",781 "label": "Data Aggiornamento Record"782 },783 {784 "type": "text",785 "varName": "note",786 "idUpdate": "NoteField",787 "idAdd": "addNoteField",788 "classes": "text-area-modal",789 "label": "Note"790 },791 ],792 "referente": [793 {794 "type": "text",795 "varName": "nome",796 "idUpdate": "NomeField",797 "idAdd": "addNomeField",798 "label": "Nome"799 },800 {801 "type": "text",802 "varName": "cognome",803 "idUpdate": "CognomeField",804 "idAdd": "addCognomeField",805 "label": "Cognome"806 },807 {808 "type": "text",809 "varName": "middle_name",810 "idUpdate": "MiddleNameField",811 "idAdd": "addMiddleNameField",812 "label": "Middle Name"813 },814 {815 "type": "date",816 "varName": "data_nascita",817 "idUpdate": "DataField",818 "idAdd": "addDataField",819 "label": "Data"820 },821 {822 "type": "text",823 "varName": "indirizzo",824 "idUpdate": "IndirizzoField",825 "idAdd": "addIndirizzoField",826 "label": "Indirizzo"827 },828 {829 "type": "text",830 "varName": "numero_telefono",831 "idUpdate": "TelefonoField",832 "idAdd": "addTelefonoField",833 "label": "Telefono"834 },835 {836 "type": "email",837 "varName": "mail",838 "idUpdate": "MailField",839 "idAdd": "addMailField",840 "label": "Email"841 },842 {843 "type": "number",844 "varName": "sponsor",845 "idUpdate": "SponsorField",846 "idAdd": "addSponsorField",847 "label": "Sponsor"848 },849 {850 "type": "number",851 "varName": "perc_sponsor",852 "idUpdate": "PercSponsorField",853 "idAdd": "addPercSponsorField",854 "label": "Perc Sponsor"855 },856 {857 "type": "text",858 "varName": "log_utente",859 "idUpdate": "LogUtenteField",860 "idAdd": "addLogUtenteField",861 "label": "Log Utente"862 },863 {864 "type": "text",865 "varName": "log_azione",866 "idUpdate": "LogAzioneField",867 "idAdd": "addLogAzioneField",868 "label": "Log Azione"869 },870 {871 "type": "date",872 "varName": "date_time_record_insert",873 "idUpdate": "DateTimeRecordInsertField",874 "idAdd": "addDateTimeRecordInsertField",875 "label": "Data Inserimento Record"876 },877 {878 "type": "date",879 "varName": "date_time_record_update",880 "idUpdate": "DateTimeRecordUpdateField",881 "idAdd": "addDateTimeRecordUpdateField",882 "label": "Data Aggiornamento Record"883 },884 {885 "type": "number",886 "varName": "obbligo_gdpr",887 "idUpdate": "ObbligoGdprField",888 "idAdd": "addObbligoGdprField",889 "label": "Obbligo GDPR"890 },891 {892 "type": "text",893 "varName": "note",894 "idUpdate": "NoteField",895 "idAdd": "addNoteField",896 "classes": "text-area-modal",897 "label": "Note"898 },899 ],900 "specialista": [901 {902 "type": "text",903 "varName": "nome",904 "idUpdate": "NomeField",905 "idAdd": "addNomeField",906 "label": "Nome"907 },908 {909 "type": "text",910 "varName": "cognome",911 "idUpdate": "CognomeField",912 "idAdd": "addCognomeField",913 "label": "Cognome"914 },915 {916 "type": "text",917 "varName": "middle_name",918 "idUpdate": "MiddleNameField",919 "idAdd": "addMiddleNameField",920 "label": "Middle Name"921 },922 {923 "type": "date",924 "varName": "data_nascita",925 "idUpdate": "DataNascitaField",926 "idAdd": "addDataNascitaField",927 "label": "Data Nascita"928 },929 {930 "type": "text",931 "varName": "codice_fiscale",932 "idUpdate": "CodiceFiscaleField",933 "idAdd": "addCodiceFiscaleField",934 "label": "Codice Fiscale"935 },936 {937 "type": "text",938 "varName": "numero_telefono",939 "idUpdate": "TelefonoField",940 "idAdd": "addTelefonoField",941 "label": "Telefono"942 },943 {944 "type": "email",945 "varName": "mail",946 "idUpdate": "MailField",947 "idAdd": "addMailField",948 "label": "Email"949 },950 {951 "type": "text",952 "varName": "log_utente",953 "idUpdate": "LogUtenteField",954 "idAdd": "addLogUtenteField",955 "label": "Log Utente"956 },957 {958 "type": "text",959 "varName": "log_azione",960 "idUpdate": "LogAzioneField",961 "idAdd": "addLogAzioneField",962 "label": "Log Azione"963 },964 {965 "type": "date",966 "varName": "date_time_record_insert",967 "idUpdate": "DateTimeRecordInsertField",968 "idAdd": "addDateTimeRecordInsertField",969 "label": "Data Inserimento Record"970 },971 {972 "type": "date",973 "varName": "date_time_record_update",974 "idUpdate": "DateTimeRecordUpdateField",975 "idAdd": "addDateTimeRecordUpdateField",976 "label": "Data Aggiornamento Record"977 },978 {979 "type": "number",980 "varName": "obbligo_gdpr",981 "idUpdate": "ObbligoGdprField",982 "idAdd": "addObbligoGdprField",983 "label": "Obbligo GDPR"984 },985 {986 "type": "text",987 "varName": "note",988 "idUpdate": "NoteField",989 "idAdd": "addNoteField",990 "classes": "text-area-modal",991 "label": "Note"992 },993 ],994 "spese": [995 {996 "type": "number",997 "varName": "id_fascicolo",998 "idUpdate": "FascicoloField",999 "idAdd": "addFascicoloField",1000 "label": "ID Fascicolo"1001 },1002 {1003 "type": "number",1004 "varName": "somma",1005 "idUpdate": "SommaField",1006 "idAdd": "addSommaField",1007 "label": "Somma"1008 },1009 {1010 "type": "checkbox",1011 "classes": "form-check-input",1012 "varName": "rimborso",1013 "idUpdate": "RimborsoField",1014 "idAdd": "addRimborsoField",1015 "label": "Rimborso"1016 },1017 {1018 "type": "text",1019 "varName": "note",1020 "idUpdate": "NoteField",1021 "idAdd": "addNoteField",1022 "classes": "text-area-modal",1023 "label": "Note"1024 },1025 {1026 "type": "text",1027 "varName": "log_utente",1028 "idUpdate": "LogUtenteField",1029 "idAdd": "addLogUtenteField",1030 "label": "Log Utente"1031 },1032 {1033 "type": "text",1034 "varName": "log_azione",1035 "idUpdate": "LogAzioneField",1036 "idAdd": "addLogAzioneField",1037 "label": "Log Azione"1038 },1039 {1040 "type": "date",1041 "varName": "date_time_record_insert",1042 "idUpdate": "DateTimeRecordInsertField",1043 "idAdd": "addDateTimeRecordInsertField",1044 "label": "Data Inserimento Record"1045 },1046 {1047 "type": "date",1048 "varName": "date_time_record_update",1049 "idUpdate": "DateTimeRecordUpdateField",1050 "idAdd": "addDateTimeRecordUpdateField",1051 "label": "Data Aggiornamento Record"1052 },1053 ],1054 "sponsor": [1055 {1056 "type": "text",1057 "varName": "nome",1058 "idUpdate": "NomeField",1059 "idAdd": "addNomeField",1060 "label": "Nome"1061 },1062 ],1063 "stato": [1064 {1065 "type": "text",1066 "varName": "nome",1067 "idUpdate": "NomeField",1068 "idAdd": "addNomeField",1069 "label": "Nome"1070 },1071 {1072 "type": "text",1073 "varName": "log_utente",1074 "idUpdate": "LogUtenteField",1075 "idAdd": "addLogUtenteField",1076 "label": "Log Utente"1077 },1078 {1079 "type": "text",1080 "varName": "log_azione",1081 "idUpdate": "LogAzioneField",1082 "idAdd": "addLogAzioneField",1083 "label": "Log Azione"1084 },1085 {1086 "type": "date",1087 "varName": "date_time_record_insert",1088 "idUpdate": "DateTimeRecordInsertField",1089 "idAdd": "addDateTimeRecordInsertField",1090 "label": "Data Inserimento Record"1091 },1092 {1093 "type": "date",1094 "varName": "date_time_record_update",1095 "idUpdate": "DateTimeRecordUpdateField",1096 "idAdd": "addDateTimeRecordUpdateField",1097 "label": "Data Aggiornamento Record"1098 },1099 {1100 "type": "text",1101 "varName": "note",1102 "idUpdate": "NoteField",1103 "idAdd": "addNoteField",1104 "classes": "text-area-modal",1105 "label": "Note"1106 },1107 ],1108 "ufficio": [1109 {1110 "type": "text",1111 "varName": "nome",1112 "idUpdate": "NomeField",1113 "idAdd": "addNomeField",1114 "label": "Nome"1115 },1116 {1117 "type": "text",1118 "varName": "log_utente",1119 "idUpdate": "LogUtenteField",1120 "idAdd": "addLogUtenteField",1121 "label": "Log Utente"1122 },1123 {1124 "type": "text",1125 "varName": "log_azione",1126 "idUpdate": "LogAzioneField",1127 "idAdd": "addLogAzioneField",1128 "label": "Log Azione"1129 },1130 {1131 "type": "date",1132 "varName": "date_time_record_insert",1133 "idUpdate": "DateTimeRecordInsertField",1134 "idAdd": "addDateTimeRecordInsertField",1135 "label": "Data Inserimento Record"1136 },1137 {1138 "type": "date",1139 "varName": "date_time_record_update",1140 "idUpdate": "DateTimeRecordUpdateField",1141 "idAdd": "addDateTimeRecordUpdateField",1142 "label": "Data Aggiornamento Record"1143 },1144 {1145 "type": "text",1146 "varName": "note",1147 "idUpdate": "NoteField",1148 "idAdd": "addNoteField",1149 "classes": "text-area-modal",1150 "label": "Note"1151 },1152 ],...
createInputModals.js
Source:createInputModals.js
1var $ = jQuery;2$(document).ready(function () {3 console.log("inizio creazione input div");4 let page = $('#title').val();5 createModal(fields[page], "updateUser");6 createModal(fields[page], "addUser");7});8//si occupa di creare gli input da inserire nei moduli che l'utente compilerà 9function createModal(_form, _formId) {10 console.log("creazione degli input di " + _formId);11 for (let i = 0; i < _form.length; i++) {12 let id;13 if (_formId == "updateUser")14 id = _form[i].idUpdate;15 else if (_formId == "addUser")16 id = _form[i].idAdd;17 addInputDiv(_form[i].label, _form[i].type, _form[i].varName, id, _formId, _form[i].classes);18 }19 addSubmitButton(submitButtonInfo.type, submitButtonInfo.divClass, submitButtonInfo.buttonClass, submitButtonInfo.buttonText, _formId);20}21function addInputDiv(_label, _type, _var, _id, _formId, _classes) {22 // create a new div element23 const div1 = document.createElement("div");24 div1.classList.add("mb-3");25 div1.classList.add("row");26 // create a new label element27 const label = document.createElement("label");28 label.classList.add("col-md-3");29 label.classList.add("form-label");30 label.setAttribute("for", _id);31 // and give it some content32 const labelText = document.createTextNode(_label);33 // add the text node to the newly created label34 label.appendChild(labelText);35 // create a new div36 const div2 = document.createElement("div");37 div2.classList.add("col-md-9");38 // create a new input element and add it to the div39 var input = "";40 if (_var != "note") {41 input = document.createElement("input");42 }43 else {44 input = document.createElement("textarea");45 input.setAttribute("rows", textAreaInfo.rows);46 }47 input.classList.add("form-control");48 if (_classes != undefined)49 input.classList.add(_classes);50 input.setAttribute("type", _type);51 if (_type == "number")//impedisce che un utente SBADATO inserisca un valore negativo52 input.setAttribute("min", 0);53 input.setAttribute("name", _var);54 input.setAttribute("id", _id);55 //get updateUser form56 const form = document.getElementById(_formId);57 div1.appendChild(label);58 div2.appendChild(input);59 div1.appendChild(div2);60 // add the newly created elements and its content into the form61 form.appendChild(div1);62 console.log("created correctly input div: " + _label);63}64//aggiunge il pulsante "submit" alla fine del form65function addSubmitButton(_type, _divClass, _buttonClass, _buttonText, _formId) {66 // create a new div element67 const div1 = document.createElement("div");68 div1.classList.add(_divClass);69 // create a new button element70 const button = document.createElement("button");71 for (let i = 0; i < _buttonClass.length; i++) {72 button.classList.add(_buttonClass[i]);73 }74 button.setAttribute("type", _type);75 // and give it some content76 const buttonText = document.createTextNode(_buttonText);77 // add the text node to the newly created button78 button.appendChild(buttonText);79 div1.appendChild(button);80 // add the newly created button and its content into the form81 document.getElementById(_formId).appendChild(div1);82 console.log("created correctly button: " + _buttonText);83}84//contiene le informazioni per la textarea presente nel campo "note"85const textAreaInfo = {86 "rows": 5,87}88//SPIEGAZIONE89/*90"fields" è un oggetto che contiene tutti i campi che compongono una tabella91ogni oggetto al suo interno contiente un array degli elementi essenziali e necessari al funzionamento del modulo92e all'invio dei dati al server93type: tipo di input94label: label del campo95varName: nome della variabile in cui verrà salvato il valore del campo, e coincide con il nome della colonna della tabella nel database96idUpdate: id del campo che viene usato per la modifica dei dati97idAdd: id del campo che viene usato per l'inserimento dei dati, aggiunta di un nuovo record98*/99const fields = {100 "acconto": [101 {102 "type": "number",103 "varName": "id_rata",104 "idUpdate": "RataField",105 "idAdd": "addRataField",106 "label": "ID Rata"107 },108 {109 "type": "text",110 "varName": "somma",111 "idUpdate": "SommaField",112 "idAdd": "addSommaField",113 "label": "Somma"114 },115 {116 "type": "date",117 "varName": "data_pagamento",118 "idUpdate": "DataPagamentoField",119 "idAdd": "addDataPagamentoField",120 "label": "Data Pagamento"121 },122 {123 "type": "number",124 "varName": "metodo_pagamento",125 "idUpdate": "MetodoPagamentoField",126 "idAdd": "addMetodoPagamentoField",127 "label": "Metodo Pagamento"128 },129 {130 "type": "text",131 "varName": "note",132 "idUpdate": "NoteField",133 "idAdd": "addNoteField",134 "classes": "text-area-modal",135 "label": "Note"136 },137 ],138 "allegati": [139 {140 "type": "text",141 "varName": "nome_file",142 "idUpdate": "NomeFileField",143 "idAdd": "addNomeFileField",144 "label": "Nome File"145 },146 {147 "type": "text",148 "varName": "percorso",149 "idUpdate": "PercorsoField",150 "idAdd": "addPercorsoField",151 "label": "Percorso"152 },153 {154 "type": "text",155 "varName": "estensione_file",156 "idUpdate": "EstensioneFileField",157 "idAdd": "addEstensioneFileField",158 "label": "Estensione File"159 },160 {161 "type": "number",162 "varName": "codice_tipo_file",163 "idUpdate": "CodiceTipoFileField",164 "idAdd": "addCodiceTipoFileField",165 "label": "Codice Tipo File"166 },167 {168 "type": "number",169 "varName": "eliminato",170 "idUpdate": "EliminatoField",171 "idAdd": "addEliminatoField",172 "label": "Eliminato"173 },174 {175 "type": "date",176 "varName": "data_caricamento",177 "idUpdate": "DataCaricamentoField",178 "idAdd": "addDataCaricamentoField",179 "label": "Data Caricamento"180 },181 {182 "type": "number",183 "varName": "acconto",184 "idUpdate": "AccontoField",185 "idAdd": "addAccontoField",186 "label": "Acconto"187 },188 {189 "type": "number",190 "varName": "rata",191 "idUpdate": "RataField",192 "idAdd": "addRataField",193 "label": "Rata"194 },195 {196 "type": "number",197 "varName": "pagamento",198 "idUpdate": "PagamentoField",199 "idAdd": "addPagamentoField",200 "label": "Pagamento"201 },202 {203 "type": "number",204 "varName": "referente",205 "idUpdate": "ReferenteField",206 "idAdd": "addReferenteField",207 "label": "Referente"208 },209 {210 "type": "number",211 "varName": "fascicolo",212 "idUpdate": "FascicoloField",213 "idAdd": "addFascicoloField",214 "label": "Fascicolo"215 },216 {217 "type": "number",218 "varName": "gestito",219 "idUpdate": "GestitoField",220 "idAdd": "addGestitoField",221 "label": "Gestito"222 },223 ],224 "appuntamenti": [225 {226 "type": "number",227 "varName": "id_prospective",228 "idUpdate": "IdProspectiveField",229 "idAdd": "addIdProspectiveField",230 "label": "ID Prospective"231 },232 {233 "type": "number",234 "varName": "numero_telefono",235 "idUpdate": "NumeroTelefonoField",236 "idAdd": "addNumeroTelefonoField",237 "label": "Numero Telefono"238 },239 {240 "type": "date",241 "varName": "data_chiamata",242 "idUpdate": "DataChiamataField",243 "idAdd": "addDataChiamataField",244 "label": "Data Chiamata"245 },246 {247 "type": "number",248 "varName": "stato",249 "idUpdate": "StatoField",250 "idAdd": "addStatoField",251 "label": "Stato"252 },253 {254 "type": "text",255 "varName": "note",256 "idUpdate": "NoteField",257 "idAdd": "addNoteField",258 "classes": "text-area-modal",259 "label": "Note"260 },261 ],262 "caso": [263 {264 "type": "text",265 "varName": "nome",266 "idUpdate": "NomeField",267 "idAdd": "addNomeField",268 "label": "Nome"269 },270 {271 "type": "text",272 "varName": "note",273 "idUpdate": "NoteField",274 "idAdd": "addNoteField",275 "classes": "text-area-modal",276 "label": "Note"277 },278 ],279 "chiamata": [280 {281 "type": "text",282 "varName": "nome",283 "idUpdate": "NomeField",284 "idAdd": "addNomeField",285 "label": "Nome"286 },287 ],288 "fascicolo": [289 {290 "type": "text",291 "varName": "nickname",292 "idUpdate": "NicknameField",293 "idAdd": "addNicknameField",294 "label": "Nickname"295 },296 {297 "type": "date",298 "varName": "data_apertura",299 "idUpdate": "DataAperturaField",300 "idAdd": "addDataAperturaField",301 "label": "Data Apertura"302 },303 {304 "type": "date",305 "varName": "data_chiusura",306 "idUpdate": "DataChiusuraField",307 "idAdd": "addDataChiusuraField",308 "label": "Data Chiusura"309 },310 {311 "type": "number",312 "varName": "stato",313 "idUpdate": "StatoField",314 "idAdd": "addStatoField",315 "label": "Stato"316 },317 {318 "type": "number",319 "varName": "id_ufficio",320 "idUpdate": "UfficioField",321 "idAdd": "addUfficioField",322 "label": "ID Ufficio"323 },324 {325 "type": "number",326 "varName": "persone_gestite",327 "idUpdate": "PersoneGestiteField",328 "idAdd": "addPersoneGestiteField",329 "label": "Persone Gestite"330 },331 {332 "type": "number",333 "varName": "referente",334 "idUpdate": "ReferenteField",335 "idAdd": "addReferenteField",336 "label": "Referente"337 },338 {339 "type": "number",340 "varName": "caso",341 "idUpdate": "CasoField",342 "idAdd": "addCasoField",343 "label": "Caso"344 },345 {346 "type": "text",347 "varName": "link",348 "idUpdate": "LinkField",349 "idAdd": "addLinkField",350 "label": "Link"351 },352 {353 "type": "text",354 "varName": "note",355 "idUpdate": "NoteField",356 "idAdd": "addNoteField",357 "classes": "text-area-modal",358 "label": "Note"359 },360 ],361 "fascicolo_s": [362 {363 "type": "number",364 "varName": "id_fascicolo",365 "idUpdate": "FascicoloField",366 "idAdd": "addFascicoloField",367 "label": "ID Fascicolo"368 },369 {370 "type": "number",371 "varName": "id_specialista",372 "idUpdate": "SpecialistaField",373 "idAdd": "addSpecialistaField",374 "label": "ID Specialista"375 },376 {377 "type": "date",378 "varName": "data_assegnazione",379 "idUpdate": "DataAssegnazioneField",380 "idAdd": "addDataAssegnazioneField",381 "label": "Data Assegnazione"382 },383 {384 "type": "date",385 "varName": "data_conclusione",386 "idUpdate": "DataConclusioneField",387 "idAdd": "addDataConclusioneField",388 "label": "Data Conclusione"389 },390 {391 "type": "number",392 "varName": "numero_specialista",393 "idUpdate": "NumeroSpecialistaField",394 "idAdd": "addNumeroSpecialistaField",395 "label": "Numero Specialista"396 },397 {398 "type": "checkbox",399 "classes": "form-check-input",400 "varName": "accettato",401 "idUpdate": "AccettatoField",402 "idAdd": "addAccettatoField",403 "label": "Accettato"404 },405 {406 "type": "text",407 "varName": "note",408 "idUpdate": "NoteField",409 "idAdd": "addNoteField",410 "classes": "text-area-modal",411 "label": "Note"412 },413 ],414 "gestito": [415 {416 "type": "text",417 "varName": "nome",418 "idUpdate": "NomeField",419 "idAdd": "addNomeField",420 "label": "Nome"421 },422 {423 "type": "text",424 "varName": "cognome",425 "idUpdate": "CognomeField",426 "idAdd": "addCognomeField",427 "label": "Cognome"428 },429 {430 "type": "text",431 "varName": "middle_name",432 "idUpdate": "MiddleNameField",433 "idAdd": "addMiddleNameField",434 "label": "Middle Name"435 },436 {437 "type": "date",438 "varName": "data_nascita",439 "idUpdate": "DataField",440 "idAdd": "addDataField",441 "label": "Data"442 },443 {444 "type": "text",445 "varName": "indirizzo",446 "idUpdate": "IndirizzoField",447 "idAdd": "addIndirizzoField",448 "label": "Indirizzo"449 },450 {451 "type": "text",452 "varName": "numero_telefono",453 "idUpdate": "TelefonoField",454 "idAdd": "addTelefonoField",455 "label": "Telefono"456 },457 {458 "type": "email",459 "varName": "mail",460 "idUpdate": "MailField",461 "idAdd": "addMailField",462 "label": "Email"463 },464 {465 "type": "number",466 "varName": "id_fascicolo",467 "idUpdate": "FascicoloField",468 "idAdd": "addFascicoloField",469 "label": "ID Fascicolo"470 },471 {472 "type": "text",473 "varName": "note",474 "idUpdate": "NoteField",475 "idAdd": "addNoteField",476 "classes": "text-area-modal",477 "label": "Note"478 },479 ],480 "metodo_p": [481 {482 "type": "text",483 "varName": "nome",484 "idUpdate": "NomeField",485 "idAdd": "addNomeField",486 "label": "Nome"487 },488 {489 "type": "text",490 "varName": "note",491 "idUpdate": "NoteField",492 "idAdd": "addNoteField",493 "classes": "text-area-modal",494 "label": "Note"495 },496 ],497 "pagamento": [498 {499 "type": "number",500 "varName": "id_fascicolo",501 "idUpdate": "FascicoloField",502 "idAdd": "addFascicoloField",503 "label": "ID Fascicolo"504 },505 {506 "type": "date",507 "varName": "creazione",508 "idUpdate": "CreazioneField",509 "idAdd": "addCreazioneField",510 "label": "Data Creazione"511 },512 {513 "type": "text",514 "varName": "totale",515 "idUpdate": "TotaleField",516 "idAdd": "addTotaleField",517 "label": "Totale"518 },519 {520 "type": "text",521 "varName": "totale_vero",522 "idUpdate": "TotaleVeroField",523 "idAdd": "addTotaleVeroField",524 "label": "Totale Vero"525 },526 {527 "type": "checkbox",528 "classes": "form-check-input",529 "varName": "accettato",530 "idUpdate": "AccettatoField",531 "idAdd": "addAccettatoField",532 "label": "Accettato"533 },534 {535 "type": "text",536 "varName": "note",537 "idUpdate": "NoteField",538 "idAdd": "addNoteField",539 "classes": "text-area-modal",540 "label": "Note"541 },542 ],543 "prospective": [544 {545 "type": "text",546 "varName": "nome",547 "idUpdate": "NomeField",548 "idAdd": "addNomeField",549 "label": "Nome"550 },551 {552 "type": "text",553 "varName": "cognome",554 "idUpdate": "CognomeField",555 "idAdd": "addCognomeField",556 "label": "Cognome"557 },558 {559 "type": "text",560 "varName": "middle_name",561 "idUpdate": "MiddleNameField",562 "idAdd": "addMiddleNameField",563 "label": "Middle Name"564 },565 {566 "type": "number",567 "varName": "numero_telefono",568 "idUpdate": "NumeroTelefonoField",569 "idAdd": "addNumeroTelefonoField",570 "label": "Numero Telefono"571 },572 {573 "type": "text",574 "varName": "note",575 "idUpdate": "NoteField",576 "idAdd": "addNoteField",577 "classes": "text-area-modal",578 "label": "Note"579 },580 ],581 "rata": [582 {583 "type": "number",584 "varName": "id_pagamento",585 "idUpdate": "PagamentoField",586 "idAdd": "addPagamentoField",587 "label": "ID Pagamento"588 },589 {590 "type": "text",591 "varName": "somma",592 "idUpdate": "SommaField",593 "idAdd": "addSommaField",594 "label": "Somma"595 },596 {597 "type": "checkbox",598 "classes": "form-check-input",599 "varName": "pagata",600 "idUpdate": "PagataField",601 "idAdd": "addPagataField",602 "label": "Pagata"603 },604 {605 "type": "text",606 "varName": "note",607 "idUpdate": "NoteField",608 "idAdd": "addNoteField",609 "classes": "text-area-modal",610 "label": "Note"611 },612 ],613 "referente": [614 {615 "type": "text",616 "varName": "nome",617 "idUpdate": "NomeField",618 "idAdd": "addNomeField",619 "label": "Nome"620 },621 {622 "type": "text",623 "varName": "cognome",624 "idUpdate": "CognomeField",625 "idAdd": "addCognomeField",626 "label": "Cognome"627 },628 {629 "type": "text",630 "varName": "middle_name",631 "idUpdate": "MiddleNameField",632 "idAdd": "addMiddleNameField",633 "label": "Middle Name"634 },635 {636 "type": "date",637 "varName": "data_nascita",638 "idUpdate": "DataField",639 "idAdd": "addDataField",640 "label": "Data"641 },642 {643 "type": "text",644 "varName": "indirizzo",645 "idUpdate": "IndirizzoField",646 "idAdd": "addIndirizzoField",647 "label": "Indirizzo"648 },649 {650 "type": "text",651 "varName": "numero_telefono",652 "idUpdate": "TelefonoField",653 "idAdd": "addTelefonoField",654 "label": "Telefono"655 },656 {657 "type": "email",658 "varName": "mail",659 "idUpdate": "MailField",660 "idAdd": "addMailField",661 "label": "Email"662 },663 {664 "type": "number",665 "varName": "sponsor",666 "idUpdate": "SponsorField",667 "idAdd": "addSponsorField",668 "label": "Sponsor"669 },670 {671 "type": "text",672 "varName": "perc_sponsor",673 "idUpdate": "PercSponsorField",674 "idAdd": "addPercSponsorField",675 "label": "Perc Sponsor"676 },677 {678 "type": "text",679 "varName": "note",680 "idUpdate": "NoteField",681 "idAdd": "addNoteField",682 "classes": "text-area-modal",683 "label": "Note"684 },685 ],686 "specialista": [687 {688 "type": "text",689 "varName": "nome",690 "idUpdate": "NomeField",691 "idAdd": "addNomeField",692 "label": "Nome"693 },694 {695 "type": "text",696 "varName": "cognome",697 "idUpdate": "CognomeField",698 "idAdd": "addCognomeField",699 "label": "Cognome"700 },701 {702 "type": "text",703 "varName": "middle_name",704 "idUpdate": "MiddleNameField",705 "idAdd": "addMiddleNameField",706 "label": "Middle Name"707 },708 {709 "type": "date",710 "varName": "data_nascita",711 "idUpdate": "DataNascitaField",712 "idAdd": "addDataNascitaField",713 "label": "Data Nascita"714 },715 {716 "type": "text",717 "varName": "codice_fiscale",718 "idUpdate": "CodiceFiscaleField",719 "idAdd": "addCodiceFiscaleField",720 "label": "Codice Fiscale"721 },722 {723 "type": "text",724 "varName": "numero_telefono",725 "idUpdate": "TelefonoField",726 "idAdd": "addTelefonoField",727 "label": "Telefono"728 },729 {730 "type": "email",731 "varName": "mail",732 "idUpdate": "MailField",733 "idAdd": "addMailField",734 "label": "Email"735 },736 {737 "type": "text",738 "varName": "note",739 "idUpdate": "NoteField",740 "idAdd": "addNoteField",741 "classes": "text-area-modal",742 "label": "Note"743 },744 ],745 "spese": [746 {747 "type": "number",748 "varName": "id_fascicolo",749 "idUpdate": "FascicoloField",750 "idAdd": "addFascicoloField",751 "label": "ID Fascicolo"752 },753 {754 "type": "text",755 "varName": "somma",756 "idUpdate": "SommaField",757 "idAdd": "addSommaField",758 "label": "Somma"759 },760 {761 "type": "checkbox",762 "classes": "form-check-input",763 "varName": "rimborso",764 "idUpdate": "RimborsoField",765 "idAdd": "addRimborsoField",766 "label": "Rimborso"767 },768 {769 "type": "text",770 "varName": "note",771 "idUpdate": "NoteField",772 "idAdd": "addNoteField",773 "classes": "text-area-modal",774 "label": "Note"775 },776 ],777 "sponsor": [778 {779 "type": "text",780 "varName": "nome",781 "idUpdate": "NomeField",782 "idAdd": "addNomeField",783 "label": "Nome"784 },785 ],786 "stato": [787 {788 "type": "text",789 "varName": "nome",790 "idUpdate": "NomeField",791 "idAdd": "addNomeField",792 "label": "Nome"793 },794 {795 "type": "text",796 "varName": "note",797 "idUpdate": "NoteField",798 "idAdd": "addNoteField",799 "classes": "text-area-modal",800 "label": "Note"801 },802 ],803 "ufficio": [804 {805 "type": "text",806 "varName": "nome",807 "idUpdate": "NomeField",808 "idAdd": "addNomeField",809 "label": "Nome"810 },811 {812 "type": "text",813 "varName": "note",814 "idUpdate": "NoteField",815 "idAdd": "addNoteField",816 "classes": "text-area-modal",817 "label": "Note"818 },819 ],820};821//oggetto che contiente le informazioni del pulsante del form822const submitButtonInfo = {823 "type": "submit",824 "divClass": "text-center",825 "buttonClass": ["btn", "btn-outline-primary"],826 "buttonText": "Invia"...
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2import { idRemove } from 'ng-mocks';3import { idReset } from 'ng-mocks';4import { idText } from 'ng-mocks';5import { idValue } from 'ng-mocks';6import { inputAdd } from 'ng-mocks';7import { inputRemove } from 'ng-mocks';8import { inputReset } from 'ng-mocks';9import { inputValue } from 'ng-mocks';10import { instance } from 'ng-mocks';11import { isMockOf } from 'ng-mocks';12import { keep } from 'ng-mocks';13import { keepComponent } from 'ng-mocks';14import { keepDirective } from 'ng-mocks';15import { keepPipe } from 'ng-mocks';16import { keepProvider } from 'ng-mocks';17import { keepService } from 'ng-mocks';18import { mock } from 'ng-mocks';19import { mockComponent } from 'ng-mocks';20import { mockDirective } from 'ng-mocks';21import { mockPipe } from 'ng-mocks';22import { mockProvider
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2import { AppComponent } from './app.component';3describe('AppComponent', () => {4 beforeEach(async(() => {5 TestBed.configureTestingModule({6 imports: [7 }).compileComponents();8 }));9 it('should create the app', () => {10 const fixture = TestBed.createComponent(AppComponent);11 const app = fixture.debugElement.componentInstance;12 expect(app).toBeTruthy();13 });14 it('should have as title \'ng-mocks\'', () => {15 const fixture = TestBed.createComponent(AppComponent);16 const app = fixture.debugElement.componentInstance;17 expect(app.title).toEqual('ng-mocks');18 });19 it('should render title in a h1 tag', () => {20 const fixture = TestBed.createComponent(AppComponent);21 fixture.detectChanges();22 const compiled = fixture.debugElement.nativeElement;23 expect(compiled.querySelector('h1').textContent).toContain('Welcome to ng-mocks!');24 });25 it('should render title in a h1 tag', () => {26 const fixture = TestBed.createComponent(AppComponent);27 fixture.detectChanges();28 const compiled = fixture.debugElement.nativeElement;29 idAdd(compiled.querySelector('h1'), 'myH1');30 expect(compiled.querySelector('h1').textContent).toContain('Welcome to ng-mocks!');31 });32});33import { idAdd } from 'ng-mocks';34import { AppComponent } from './app.component';35describe('AppComponent', () => {36 beforeEach(async(() => {37 TestBed.configureTestingModule({38 imports: [39 }).compileComponents();40 }));41 it('should render title in a h1 tag', () => {42 const fixture = TestBed.createComponent(AppComponent);43 fixture.detectChanges();44 const compiled = fixture.debugElement.nativeElement;45 idAdd(compiled.querySelector('h1'), '
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2idAdd('my-id', MyComponent);3import { idRemove } from 'ng-mocks';4idRemove('my-id');5import { idMock } from 'ng-mocks';6idMock('my-id', MyComponent);7idMock(id: string, component: Type<any>): void;8import { idMock } from 'ng-mocks';9idMock('my-id', MyComponent);10idRemove(id: string): void;11import { idRemove } from 'ng-mocks';12idRemove('my-id');13idReset(): void;14import { idReset } from 'ng-mocks';15idReset();16instance<T>(fixture: ComponentFixture<T>): T;
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2import { MyComponent } from './my.component';3describe('MyComponent', () => {4 it('should work', () => {5 const fixture = MockRender(MyComponent);6 const component = idAdd(fixture.debugElement, 'my-component');7 expect(component).toBeDefined();8 });9});
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2const element = idAdd('my-id');3expect(element).toBeTruthy();4expect(element.id).toEqual('my-id');5import { idRemove } from 'ng-mocks';6const element = idRemove('my-id');7expect(element).toBeFalsy();8import { idReset } from 'ng-mocks';9idReset();
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2idAdd('myId', myComponent);3import { idRemove } from 'ng-mocks';4idRemove('myId');5import { idValue } from 'ng-mocks';6let myComponent = idValue('myId');7import { idReset } from 'ng-mocks';8idReset();9import { idClear } from 'ng-mocks';10idClear();11import { idDebug } from 'ng-mocks';12idDebug(true);13import { idFlush } from 'ng-mocks';14idFlush();15import { idTick } from 'ng-mocks';16idTick(1000);17import { idFakeAsync } from 'ng-mocks';18idFakeAsync(() => {19});20import { idTestBed } from 'ng-mocks';21idTestBed.configureCompiler({22});23import { idSpyOn } from 'ng-mocks';24idSpyOn(myComponent, '
Using AI Code Generation
1import { idAdd } from 'ng-mocks';2import { MyComponent } from '...';3idAdd(MyComponent, 'my-id');4import { MyComponent } from '...';5import { id } from 'ng-mocks';6const fixture = TestBed.createComponent(id('my-id'));7import { MyComponent } from '...';8import { id } from 'ng-mocks';9const fixture = TestBed.createComponent(id('my-id'));10import { MyComponent } from '...';11import { id } from 'ng-mocks';12const fixture = TestBed.createComponent(id('my-id'));13import { MyComponent } from '...';14import { id } from 'ng-mocks';15const fixture = TestBed.createComponent(id('my-id'));16import { MyComponent } from '...';17import { id } from 'ng-mocks';18const fixture = TestBed.createComponent(id('my-id'));19import { MyComponent } from '...';20import { id } from 'ng-mocks';21const fixture = TestBed.createComponent(id('my-id'));22import { MyComponent } from '...';23import { id } from 'ng-mocks';24const fixture = TestBed.createComponent(id('my-id'));25import { MyComponent } from '...';26import { id } from 'ng-mocks';27const fixture = TestBed.createComponent(id('my-id'));
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!