コード例 #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $contact = \montserrat\Contact::with('addresses.location', 'emails.location', 'phones.location', 'websites')->findOrFail($id);
     //dd($contact);
     $parishes = \montserrat\Parish::select(\DB::raw('CONCAT(parishes.name," (",parishes.city,"-",dioceses.name,")") as parishname'), 'parishes.id')->join('dioceses', 'parishes.diocese_id', '=', 'dioceses.id')->orderBy('parishname')->pluck('parishname', 'parishes.id');
     $parishes->prepend('N/A', 0);
     $states = \montserrat\StateProvince::orderby('name')->whereCountryId(1228)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $countries = \montserrat\Country::orderby('iso_code')->pluck('iso_code', 'id');
     $countries->prepend('N/A', 0);
     $ethnicities = \montserrat\Ethnicity::orderby('ethnicity')->pluck('ethnicity', 'ethnicity');
     //create defaults array for easier pre-populating of default values on edit/update blade
     // initialize defaults to avoid undefined index errors
     $defaults = array();
     $defaults['Home']['street_address'] = '';
     $defaults['Home']['supplemental_address_1'] = '';
     $defaults['Home']['city'] = '';
     $defaults['Home']['state_province_id'] = '';
     $defaults['Home']['postal_code'] = '';
     $defaults['Home']['country_id'] = '';
     $defaults['Home']['Phone'] = '';
     $defaults['Home']['Mobile'] = '';
     $defaults['Home']['Fax'] = '';
     $defaults['Home']['email'] = '';
     $defaults['Work']['street_address'] = '';
     $defaults['Work']['supplemental_address_1'] = '';
     $defaults['Work']['city'] = '';
     $defaults['Work']['state_province_id'] = '';
     $defaults['Work']['postal_code'] = '';
     $defaults['Work']['country_id'] = '';
     $defaults['Work']['Phone'] = '';
     $defaults['Work']['Mobile'] = '';
     $defaults['Work']['Fax'] = '';
     $defaults['Work']['email'] = '';
     $defaults['Other']['street_address'] = '';
     $defaults['Other']['supplemental_address_1'] = '';
     $defaults['Other']['city'] = '';
     $defaults['Other']['state_province_id'] = '';
     $defaults['Other']['postal_code'] = '';
     $defaults['Other']['country_id'] = '';
     $defaults['Other']['Phone'] = '';
     $defaults['Other']['Mobile'] = '';
     $defaults['Other']['Fax'] = '';
     $defaults['Other']['email'] = '';
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($contact->addresses as $address) {
         $defaults[$address->location->name]['street_address'] = $address->street_address;
         $defaults[$address->location->name]['supplemental_address_1'] = $address->supplemental_address_1;
         $defaults[$address->location->name]['city'] = $address->city;
         $defaults[$address->location->name]['state_province_id'] = $address->state_province_id;
         $defaults[$address->location->name]['postal_code'] = $address->postal_code;
         $defaults[$address->location->name]['country_id'] = $address->country_id;
     }
     foreach ($contact->phones as $phone) {
         $defaults[$phone->location->name][$phone->phone_type] = $phone->phone;
     }
     foreach ($contact->emails as $email) {
         $defaults[$email->location->name]['email'] = $email->email;
     }
     foreach ($contact->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     //dd($defaults);
     //dd($parishes);
     return view('contacts.edit', compact('contact', 'parishes', 'ethnicities', 'states', 'countries', 'defaults'));
 }
コード例 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $states = \montserrat\StateProvince::orderby('name')->whereCountryId(COUNTRY_ID_USA)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $countries = \montserrat\Country::orderby('iso_code')->pluck('iso_code', 'id');
     $defaults['state_province_id'] = STATE_PROVINCE_ID_TX;
     $defaults['country_id'] = COUNTRY_ID_USA;
     $countries->prepend('N/A', 0);
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     $vendor = \montserrat\Contact::with('address_primary.state', 'address_primary.location', 'phone_primary.location', 'phone_main_fax', 'email_primary.location', 'website_main', 'notes')->findOrFail($id);
     foreach ($vendor->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     return view('vendors.edit', compact('vendor', 'states', 'countries', 'defaults'));
 }
コード例 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // TODO: make create and edit bishop id multi-select with all bishops defaulting to selected on edit
     // TODO: consider making one primary bishop with multi-select for seperate auxilary bishops (new relationship)
     $organization = \montserrat\Contact::with('address_primary.state', 'address_primary.location', 'phone_main_phone.location', 'phone_main_fax.location', 'email_primary.location', 'website_main', 'notes')->findOrFail($id);
     $states = \montserrat\StateProvince::orderby('name')->whereCountryId(COUNTRY_ID_USA)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $countries = \montserrat\Country::orderby('iso_code')->pluck('iso_code', 'id');
     $countries->prepend('N/A', 0);
     $defaults['state_province_id'] = STATE_PROVINCE_ID_TX;
     $defaults['country_id'] = COUNTRY_ID_USA;
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($organization->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     $subcontact_types = \montserrat\ContactType::whereIsReserved(FALSE)->whereIsActive(TRUE)->pluck('label', 'id');
     $subcontact_types->prepend('N/A', 0);
     //dd($organization);
     return view('organizations.edit', compact('organization', 'states', 'countries', 'defaults', 'subcontact_types'));
 }
コード例 #4
0
 public function search()
 {
     $person = new \montserrat\Contact();
     $parishes = \montserrat\Contact::whereSubcontactType(CONTACT_TYPE_PARISH)->orderBy('organization_name', 'asc')->with('address_primary.state', 'diocese.contact_a')->get();
     $parish_list[0] = 'N/A';
     $contact_types = \montserrat\ContactType::whereIsReserved(TRUE)->pluck('label', 'id');
     $contact_types->prepend('N/A', 0);
     $subcontact_types = \montserrat\ContactType::whereIsReserved(FALSE)->whereIsActive(TRUE)->pluck('label', 'id');
     $subcontact_types->prepend('N/A', 0);
     // while probably not the most efficient way of doing this it gets me the result
     foreach ($parishes as $parish) {
         $parish_list[$parish->id] = $parish->organization_name . ' (' . $parish->address_primary_city . ') - ' . $parish->diocese_name;
     }
     $countries = \montserrat\Country::orderBy('iso_code')->pluck('iso_code', 'id');
     $countries->prepend('N/A', 0);
     $ethnicities = \montserrat\Ethnicity::orderBy('ethnicity')->pluck('ethnicity', 'id');
     $ethnicities->prepend('N/A', 0);
     $genders = \montserrat\Gender::orderBy('name')->pluck('name', 'id');
     $genders->prepend('N/A', 0);
     $languages = \montserrat\Language::orderBy('label')->whereIsActive(1)->pluck('label', 'id');
     $languages->prepend('N/A', 0);
     $prefixes = \montserrat\Prefix::orderBy('name')->pluck('name', 'id');
     $prefixes->prepend('N/A', 0);
     $religions = \montserrat\Religion::orderBy('name')->whereIsActive(1)->pluck('name', 'id');
     $religions->prepend('N/A', 0);
     $states = \montserrat\StateProvince::orderBy('name')->whereCountryId(1228)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $suffixes = \montserrat\Suffix::orderBy('name')->pluck('name', 'id');
     $suffixes->prepend('N/A', 0);
     $occupations = \montserrat\Ppd_occupation::orderBy('name')->pluck('name', 'id');
     $occupations->prepend('N/A', 0);
     //create defaults array for easier pre-populating of default values on edit/update blade
     // initialize defaults to avoid undefined index errors
     $defaults = array();
     $defaults['Home']['street_address'] = '';
     $defaults['Home']['supplemental_address_1'] = '';
     $defaults['Home']['city'] = '';
     $defaults['Home']['state_province_id'] = '';
     $defaults['Home']['postal_code'] = '';
     $defaults['Home']['country_id'] = '';
     $defaults['Home']['Phone'] = '';
     $defaults['Home']['Mobile'] = '';
     $defaults['Home']['Fax'] = '';
     $defaults['Home']['email'] = '';
     $defaults['Work']['street_address'] = '';
     $defaults['Work']['supplemental_address_1'] = '';
     $defaults['Work']['city'] = '';
     $defaults['Work']['state_province_id'] = '';
     $defaults['Work']['postal_code'] = '';
     $defaults['Work']['country_id'] = '';
     $defaults['Work']['Phone'] = '';
     $defaults['Work']['Mobile'] = '';
     $defaults['Work']['Fax'] = '';
     $defaults['Work']['email'] = '';
     $defaults['Other']['street_address'] = '';
     $defaults['Other']['supplemental_address_1'] = '';
     $defaults['Other']['city'] = '';
     $defaults['Other']['state_province_id'] = '';
     $defaults['Other']['postal_code'] = '';
     $defaults['Other']['country_id'] = '';
     $defaults['Other']['Phone'] = '';
     $defaults['Other']['Mobile'] = '';
     $defaults['Other']['Fax'] = '';
     $defaults['Other']['email'] = '';
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($person->addresses as $address) {
         $defaults[$address->location->name]['street_address'] = $address->street_address;
         $defaults[$address->location->name]['supplemental_address_1'] = $address->supplemental_address_1;
         $defaults[$address->location->name]['city'] = $address->city;
         $defaults[$address->location->name]['state_province_id'] = $address->state_province_id;
         $defaults[$address->location->name]['postal_code'] = $address->postal_code;
         $defaults[$address->location->name]['country_id'] = $address->country_id;
     }
     foreach ($person->phones as $phone) {
         $defaults[$phone->location->name][$phone->phone_type] = $phone->phone;
     }
     foreach ($person->emails as $email) {
         $defaults[$email->location->name]['email'] = $email->email;
     }
     foreach ($person->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     //dd($person);
     return view('search.search', compact('prefixes', 'suffixes', 'person', 'parish_list', 'ethnicities', 'states', 'countries', 'genders', 'languages', 'defaults', 'religions', 'occupations', 'contact_types', 'subcontact_types'));
 }
コード例 #5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     // TODO: make create and edit bishop id multi-select with all bishops defaulting to selected on edit
     // TODO: consider making one primary bishop with multi-select for seperate auxilary bishops (new relationship)
     $diocese = \montserrat\Contact::with('bishops.contact_b', 'parishes.contact_b', 'address_primary.state', 'address_primary.location', 'phone_primary.location', 'phone_main_fax.location', 'email_primary.location', 'website_main', 'notes')->findOrFail($id);
     if (empty($diocese->bishop)) {
         $diocese->bishop_id = 0;
     } else {
         $diocese->bishop_id = $diocese->bishop->contact_id_b;
     }
     $states = \montserrat\StateProvince::orderby('name')->whereCountryId(COUNTRY_ID_USA)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $countries = \montserrat\Country::orderby('iso_code')->pluck('iso_code', 'id');
     $countries->prepend('N/A', 0);
     $defaults['state_province_id'] = STATE_PROVINCE_ID_TX;
     $defaults['country_id'] = COUNTRY_ID_USA;
     $bishops = \montserrat\Contact::with('groups.group')->orderby('sort_name')->whereHas('groups', function ($query) {
         $query->where('group_id', '=', GROUP_ID_BISHOP);
     })->pluck('display_name', 'id');
     $bishops->prepend('N/A', 0);
     //dd($diocese);
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($diocese->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     return view('dioceses.edit', compact('diocese', 'bishops', 'states', 'countries', 'defaults'));
 }
コード例 #6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $person = \montserrat\Contact::with('prefix', 'suffix', 'addresses.location', 'emails.location', 'phones.location', 'websites', 'parish', 'emergency_contact', 'notes')->findOrFail($id);
     //dd($person);
     $parishes = \montserrat\Contact::whereSubcontactType(CONTACT_TYPE_PARISH)->orderBy('organization_name', 'asc')->with('address_primary.state', 'diocese.contact_a')->get();
     $parish_list[0] = 'N/A';
     $contact_types = \montserrat\ContactType::whereIsReserved(TRUE)->pluck('label', 'id');
     $subcontact_types = \montserrat\ContactType::whereIsReserved(FALSE)->whereIsActive(TRUE)->pluck('label', 'id');
     $subcontact_types->prepend('N/A', 0);
     // while probably not the most efficient way of doing this it gets me the result
     foreach ($parishes as $parish) {
         $parish_list[$parish->id] = $parish->organization_name . ' (' . $parish->address_primary_city . ') - ' . $parish->diocese_name;
     }
     if (!empty($person->parish)) {
         $person->parish_id = $person->parish->contact_id_a;
     } else {
         $person->parish_id = 0;
     }
     $preferred_language = \montserrat\Language::whereName($person->preferred_language)->first();
     if (!empty($preferred_language)) {
         $person->preferred_language_id = $preferred_language->id;
     } else {
         $person->preferred_language_id = 0;
     }
     //again not at all elegant but this parses out the notes for easy display and use in the edit blade
     $person->note_health = '';
     $person->note_dietary = '';
     $person->note_contact = '';
     $person->note_room_preference = '';
     if (!empty($person->notes)) {
         foreach ($person->notes as $note) {
             if ($note->subject == "Health Note") {
                 $person->note_health = $note->note;
             }
             if ($note->subject == 'Dietary Note') {
                 $person->note_dietary = $note->note;
             }
             if ($note->subject == 'Contact Note') {
                 $person->note_contact = $note->note;
             }
             if ($note->subject == 'Room Preference') {
                 $person->note_room_preference = $note->note;
             }
         }
     }
     //dd($person);
     $countries = \montserrat\Country::orderBy('iso_code')->pluck('iso_code', 'id');
     $countries->prepend('N/A', 0);
     $ethnicities = \montserrat\Ethnicity::orderBy('ethnicity')->pluck('ethnicity', 'id');
     $ethnicities->prepend('N/A', 0);
     $genders = \montserrat\Gender::orderBy('name')->pluck('name', 'id');
     $genders->prepend('N/A', 0);
     $languages = \montserrat\Language::orderBy('label')->whereIsActive(1)->pluck('label', 'id');
     $languages->prepend('N/A', 0);
     $prefixes = \montserrat\Prefix::orderBy('name')->pluck('name', 'id');
     $prefixes->prepend('N/A', 0);
     $religions = \montserrat\Religion::orderBy('name')->whereIsActive(1)->pluck('name', 'id');
     $religions->prepend('N/A', 0);
     $states = \montserrat\StateProvince::orderBy('name')->whereCountryId(1228)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $suffixes = \montserrat\Suffix::orderBy('name')->pluck('name', 'id');
     $suffixes->prepend('N/A', 0);
     $occupations = \montserrat\Ppd_occupation::orderBy('name')->pluck('name', 'id');
     $occupations->prepend('N/A', 0);
     //create defaults array for easier pre-populating of default values on edit/update blade
     // initialize defaults to avoid undefined index errors
     $defaults = array();
     $defaults['Home']['street_address'] = '';
     $defaults['Home']['supplemental_address_1'] = '';
     $defaults['Home']['city'] = '';
     $defaults['Home']['state_province_id'] = '';
     $defaults['Home']['postal_code'] = '';
     $defaults['Home']['country_id'] = '';
     $defaults['Home']['Phone'] = '';
     $defaults['Home']['Mobile'] = '';
     $defaults['Home']['Fax'] = '';
     $defaults['Home']['email'] = '';
     $defaults['Work']['street_address'] = '';
     $defaults['Work']['supplemental_address_1'] = '';
     $defaults['Work']['city'] = '';
     $defaults['Work']['state_province_id'] = '';
     $defaults['Work']['postal_code'] = '';
     $defaults['Work']['country_id'] = '';
     $defaults['Work']['Phone'] = '';
     $defaults['Work']['Mobile'] = '';
     $defaults['Work']['Fax'] = '';
     $defaults['Work']['email'] = '';
     $defaults['Other']['street_address'] = '';
     $defaults['Other']['supplemental_address_1'] = '';
     $defaults['Other']['city'] = '';
     $defaults['Other']['state_province_id'] = '';
     $defaults['Other']['postal_code'] = '';
     $defaults['Other']['country_id'] = '';
     $defaults['Other']['Phone'] = '';
     $defaults['Other']['Mobile'] = '';
     $defaults['Other']['Fax'] = '';
     $defaults['Other']['email'] = '';
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($person->addresses as $address) {
         $defaults[$address->location->name]['street_address'] = $address->street_address;
         $defaults[$address->location->name]['supplemental_address_1'] = $address->supplemental_address_1;
         $defaults[$address->location->name]['city'] = $address->city;
         $defaults[$address->location->name]['state_province_id'] = $address->state_province_id;
         $defaults[$address->location->name]['postal_code'] = $address->postal_code;
         $defaults[$address->location->name]['country_id'] = $address->country_id;
     }
     foreach ($person->phones as $phone) {
         $defaults[$phone->location->name][$phone->phone_type] = $phone->phone;
     }
     foreach ($person->emails as $email) {
         $defaults[$email->location->name]['email'] = $email->email;
     }
     foreach ($person->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     //dd($person);
     return view('persons.edit', compact('prefixes', 'suffixes', 'person', 'parish_list', 'ethnicities', 'states', 'countries', 'genders', 'languages', 'defaults', 'religions', 'occupations', 'contact_types', 'subcontact_types'));
 }
コード例 #7
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //
     $dioceses = \montserrat\Contact::whereSubcontactType(CONTACT_TYPE_DIOCESE)->orderby('organization_name')->pluck('organization_name', 'id');
     //$pastors = \montserrat\Contact::whereHas('b_relationships', function($query) {
     //    $query->whereRelationshipTypeId(RELATIONSHIP_TYPE_PASTOR)->whereIsActive(1);})->orderby('sort_name')->pluck('sort_name','id');
     $pastors = \montserrat\Contact::whereHas('group_pastor', function ($query) {
         $query->whereGroupId(GROUP_ID_PASTOR)->whereStatus('Added');
     })->orderby('sort_name')->pluck('sort_name', 'id');
     $dioceses[0] = 'No Diocese assigned';
     $pastors[0] = 'No pastor assigned';
     //dd($pastors);
     $states = \montserrat\StateProvince::orderby('name')->whereCountryId(COUNTRY_ID_USA)->pluck('name', 'id');
     $states->prepend('N/A', 0);
     $countries = \montserrat\Country::orderby('iso_code')->pluck('iso_code', 'id');
     $defaults['state_province_id'] = STATE_PROVINCE_ID_TX;
     $defaults['country_id'] = COUNTRY_ID_USA;
     $countries->prepend('N/A', 0);
     $parish = \montserrat\Contact::with('pastor.contact_b', 'diocese.contact_a', 'address_primary.state', 'address_primary.location', 'phone_primary.location', 'phone_main_fax', 'email_primary.location', 'website_main', 'notes')->findOrFail($id);
     $defaults['Main']['url'] = '';
     $defaults['Work']['url'] = '';
     $defaults['Facebook']['url'] = '';
     $defaults['Google']['url'] = '';
     $defaults['Instagram']['url'] = '';
     $defaults['LinkedIn']['url'] = '';
     $defaults['Twitter']['url'] = '';
     foreach ($parish->websites as $website) {
         $defaults[$website->website_type]['url'] = $website->url;
     }
     return view('parishes.edit', compact('parish', 'dioceses', 'pastors', 'states', 'countries', 'defaults'));
 }