Ejemplo n.º 1
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'));
 }
Ejemplo n.º 2
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'));
 }
Ejemplo n.º 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)
     $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'));
 }
 /**
  * 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'));
 }
Ejemplo n.º 5
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'));
 }