/**
  * Finds the Division model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Division the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Division::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function edit($id)
 {
     $fixture = Fixture::findOrFail($id);
     $divisions = Division::all();
     $teams = Team::all();
     $venues = Venue::all();
     return view('admin.data-management.fixtures.edit', compact('fixture', 'divisions', 'teams', 'venues'));
 }
Ejemplo n.º 3
0
 public function search($params)
 {
     $query = Division::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'active' => $this->active, 'order' => $this->order]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Ejemplo n.º 4
0
 public function create($id, $tech_number = 1)
 {
     if (Auth::user()->can('create-service')) {
         $data['title'] = $tech_number == 1 ? "Create Service ~ " . $tech_number . " technician" : "Create Service ~ " . $tech_number . " technicians";
         $data['companies'] = Company::all();
         $data['company_id'] = $id;
         $data['contacts'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . $id], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['technicians'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['divisions'] = Division::orderBy("name")->get();
         $data['hotels'] = Hotel::where('company_id', $id)->orderBy("name")->get();
         $tech_number = $tech_number < 1 ? 1 : $tech_number;
         $tech_number = $tech_number > 5 ? 5 : $tech_number;
         $data['technician_number'] = $tech_number;
         foreach ($data['hotels'] as &$hotel) {
             $hotel['name_address'] = $hotel['name'] . " @ " . $hotel['address'];
         }
         return view('services/create', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to service create page']);
     }
 }
Ejemplo n.º 5
0
 public static function getMap()
 {
     return ArrayHelper::map(Division::find()->where(['active' => 1])->orderBy('ord')->asArray()->all(), 'id', 'name');
 }
Ejemplo n.º 6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function destroy($id)
 {
     $canBeDeleted = empty(Division::find($id)->fixtures->toArray());
     if ($canBeDeleted) {
         Division::destroy($id);
         \Flash::success('Division deleted!');
     } else {
         \Flash::error('Cannot delete because they are existing fixtures in this division.');
     }
     return redirect('admin/data-management/divisions');
 }
Ejemplo n.º 7
0
use app\models\Division;
/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var app\models\search\StudentSearch $searchModel
 */
$dataProvider->pagination->pageSize = Yii::$app->user->rowsPerPage;
$this->registerJsFile('/js/student-index.js', ['\\app\\assets\\AppAsset']);
$this->registerCssFile('/css/student-index.css', ['\\app\\assets\\AppAsset']);
$this->title = 'Students';
$this->params['breadcrumbs'][] = $this->title;
$columns = [['class' => 'yii\\grid\\SerialColumn'], ['class' => ToggleColumn::className(), 'attribute' => 'active', 'filter' => ['1' => 'Y', '0' => 'N', '' => 'All'], 'headerOptions' => ['style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center']], ['attribute' => 'gender', 'class' => EditableColumn::className(), 'url' => 'editable', 'contentOptions' => ['class' => 'text-center', 'nowrap' => true], 'headerOptions' => ['class' => 'text-center', 'style' => 'width:20px'], 'type' => 'select', 'filter' => ['M' => 'M', 'F' => 'F', '' => 'All'], 'editableOptions' => ['showbuttons' => false, 'mode' => 'inline', 'source' => '[{"M": "M"}, {"F": "F"}]', 'value' => function ($model) {
    return $model->gender;
}]], ['attribute' => 'fname', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['attribute' => 'lname', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['value' => 'division.name', 'header' => 'Div', 'attribute' => 'division_id', 'headerOptions' => ['class' => 'text-center', 'style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center'], 'filter' => Division::getMap() + ['' => 'All'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['showbuttons' => false, 'value' => function ($model) {
    return $model->division_id;
}, 'source' => Json::encode(Division::getMap()), 'mode' => 'inline']], ['value' => 'handAnchor.name', 'attribute' => 'handAnchorId', 'header' => 'Anchor', 'headerOptions' => ['class' => 'text-center'], 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['showbuttons' => false, 'mode' => 'inline', 'value' => function ($model) {
    return $model->affiliation->hand_anchor_id;
}, 'source' => function ($model) {
    return Url::to(['/student/available-classes', 'id' => $model->id, 'type' => 'hand']);
}]], ['value' => 'dobAndAge', 'attribute' => 'dob', 'header' => 'DoB & Age', 'contentOptions' => ['nowrap' => true, 'style' => 'width:100px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'combodate', 'editableOptions' => ['value' => function ($model) {
    return $model->dob;
}, 'format' => 'YYYY-MM-DD', 'viewformat' => 'M/D', 'template' => 'M / D / YYYY']], ['attribute' => 'belt_size', 'headerOptions' => ['style' => 'width:20px'], 'contentOptions' => ['class' => 'text-center'], 'class' => EditableColumn::className(), 'filter' => Student::getGiSizeMap() + ['' => 'All'], 'url' => 'editable', 'type' => 'select', 'editableOptions' => ['mode' => 'inline', 'showbuttons' => false, 'value' => function ($model) {
    return $model->belt_size;
}, 'source' => Json::encode(Student::getGiSizeMap())]], ['attribute' => 'bestPhoneNumber', 'contentOptions' => ['nowrap' => true], 'class' => EditableColumn::className(), 'url' => 'editable', 'editableOptions' => ['mode' => 'inline']], ['attribute' => 'sparAuth', 'value' => 'sparAuthJson', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['style' => 'width:20px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'checklist', 'editableOptions' => ['value' => function ($model) {
    return $model->sparAuthJson;
}, 'display' => new JsExpression("function(value, sourceData)\n         {  \n            var icon = 'remove';\n            //console.log(value, sourceData);\n            if(value instanceof Array && value[0] !== '')\n            {\n               \$.each(value, function(i, v)\n               {\n                  if (v.toLowerCase() === 'a')\n                  {\n                     icon = 'ok';\n                     return false;\n                  }\n                  else\n                  {\n                     icon = 'tasks';\n                  }\n               });\n            }\n            \$(this).html('<span class=\"glyphicon glyphicon-' + icon + '\"></span>');\n        }"), 'mode' => 'pop', 'source' => Json::encode(Student::getSparAuthList())]], ['attribute' => 'rank.name', 'contentOptions' => ['nowrap' => true]], ['attribute' => 'grappleAuth', 'value' => 'grappleAuthJson', 'contentOptions' => ['class' => 'text-center'], 'headerOptions' => ['style' => 'width:20px'], 'class' => EditableColumn::className(), 'url' => 'editable', 'type' => 'checklist', 'editableOptions' => ['value' => function ($model) {
    return $model->grappleAuthJson;
}, 'display' => new JsExpression("function(value, sourceData)\n            {\n               var icon = 'remove';\n               //console.log(value, sourceData);\n               if(value instanceof Array && value[0] !== '')\n               {\n                  \$.each(value, function(i, v)\n                  {\n                     if (v.toLowerCase() === 'a')\n                     {\n                        icon = 'ok';\n                        return false;\n                     }\n                     else\n                     {\n                     console.log(v);\n                        icon = 'tasks';\n                     }\n                  });\n               }\n               \$(this).html('<span class=\"glyphicon glyphicon-' + icon + '\"></span>');\n            }"), 'mode' => 'pop', 'source' => Json::encode(Student::getGrappleAuthList())]], ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['nowrap' => true], 'template' => '{view} {update}' . (Yii::$app->user->can('deleteStudent') ? ' {delete}' : '')]];
?>
<div class="student-index">
Ejemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery relation
  */
 public function getDivision()
 {
     return $this->hasOne(Division::className(), ['id' => 'division_id']);
 }
Ejemplo n.º 9
0
 public static function workingTimeData($days, $type)
 {
     $result = null;
     if ($type == "division") {
         $grouping = Division::whereIn('id', [LGV_DIVISION_ID, PLC_DIVISION_ID, PC_DIVISION_ID, BEMA_DIVISION_ID, FIELD_DIVISION_ID, SPARE_PARTS_DIVISION_ID, RELIABILITY_DIVISION_ID, OTHERS_DIVISION_ID])->orderBy("name")->get();
     } elseif ($type == "priority") {
         $grouping = Priority::orderBy("name")->get();
     } elseif ($type == "level") {
         $grouping = Level::orderBy("name")->get();
     } elseif ($type == "company") {
         $grouping = Company::orderBy("name")->get();
     } elseif ($type == "assignee") {
         $grouping = CompanyPerson::select("company_person.*", "people.first_name", "people.last_name")->leftJoin('people', 'company_person.person_id', '=', 'people.id')->where('company_person.company_id', '=', ELETTRIC80_COMPANY_ID)->orderBy("last_name")->get();
         foreach ($grouping as $group) {
             $group->name = $group->last_name . " " . $group->first_name;
         }
     }
     if (isset($grouping)) {
         foreach ($grouping as $index => $group) {
             for ($i = 0; $i < 50; $i++) {
                 $query = "SELECT SUM(resolution_time) as sum, COUNT(*) as ticket_count, AVG(resolution_time) as average, DATE_SUB(NOW(), INTERVAL " . $days * ($i + 1) . " day) as date\n                            FROM (\n                            SELECT before.ticket_id, SUM(\n                                TIMESTAMPDIFF(SECOND, \n                                    GREATEST(DATE_SUB(NOW(), INTERVAL " . $days * ($i + 1) . " day), before.created_at), \n                                    LEAST(DATE_SUB(NOW(), INTERVAL " . $days * $i . " day), IFNULL(after.created_at,NOW()))\n                                )\n                            )/3600 as resolution_time\n                            FROM tickets_history as `before`\n                            LEFT JOIN tickets_history as `after` ON before.id = after.previous_id\n                            INNER JOIN tickets ON tickets.id = before.ticket_id \n                            WHERE (\n                                after.status_id IN (" . TICKET_NEW_STATUS_ID . "," . TICKET_IN_PROGRESS_STATUS_ID . ",\n                                " . TICKET_REQUESTING_STATUS_ID . "," . TICKET_SOLVED_STATUS_ID . "," . TICKET_CLOSED_STATUS_ID . ")\n                                OR \n                                (before.status_id IN (" . TICKET_NEW_STATUS_ID . "," . TICKET_IN_PROGRESS_STATUS_ID . ",\n                                " . TICKET_REQUESTING_STATUS_ID . ") AND after.id IS NULL)\n                            )\n                            AND tickets.deleted_at IS NULL\n                            AND tickets." . $type . "_id = {$group->id}\n                            AND TIMESTAMPDIFF(SECOND, \n                                GREATEST(before.created_at,DATE_SUB(NOW(), INTERVAL " . $days * ($i + 1) . " day)), \n                                LEAST(DATE_SUB(NOW(), INTERVAL " . $days * $i . " day), IFNULL(after.created_at,NOW()))) > 0\n                            GROUP BY before.ticket_id\n                            ) as " . $type[0] . "_{$index} ";
                 $temp = DB::select(DB::raw($query));
                 foreach ($temp[0] as $key => $value) {
                     if ($key != "date") {
                         $div_key = str_replace(" ", "_", $group->name);
                         if ($i == 0) {
                             $result[$div_key][$key]['current'] = round($temp[0]->{$key}, 2);
                         }
                         if ($i == 1) {
                             $result[$div_key][$key]['previous'] = round($temp[0]->{$key}, 2);
                         }
                         $result[$div_key][$key]['historical'][$temp[0]->date] = $temp[0]->{$key};
                     }
                 }
             }
         }
     }
     return $result;
 }
Ejemplo n.º 10
0
$options = [];
$options['checkNameUrl'] = Url::to(['/student/check-name']);
$options['getClassesUrl'] = Url::to(['/class/create-student-hand-anchors']);
$this->registerJs("var options = " . JSON::encode($options) . ";", $this::POS_HEAD, 'my-options');
$this->registerJsFile('/js/student-create.js', ['\\app\\assets\\AppAsset']);
$this->title = 'Create Student';
$this->params['breadcrumbs'][] = ['label' => 'Students', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="student-create">
   <h1><?php 
echo Html::encode($this->title);
?>
</h1>
   <?php 
$form = ActiveForm::begin();
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 3, 'attributes' => ['gender' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => [], 'items' => ['M' => 'Male', 'F' => 'Female']], 'fname' => ['type' => Form::INPUT_TEXT, 'options' => []], 'lname' => ['type' => Form::INPUT_TEXT, 'options' => []], 'dob' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\datecontrol\\DateControl', 'options' => ['widgetClass' => '\\yii\\widgets\\MaskedInput', 'options' => ['mask' => '99/99/9999']], 'hint' => 'Use mm/dd/yyyy format'], 'bestPhone' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\yii\\widgets\\MaskedInput', 'options' => ['mask' => '(999) 999 9999', 'value' => '', 'name' => 'StudentPhone[number]']], 'belt_size' => ['type' => Form::INPUT_DROPDOWN_LIST, 'items' => Student::getGiSizeMap()], 'division_id' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => [], 'items' => [null => ''] + Division::getMap()], 'handAnchor' => ['type' => Form::INPUT_DROPDOWN_LIST, 'options' => ['value' => 0, 'name' => 'Affiliation[hand_anchor_id]'], 'items' => [null => '']]]]);
?>
   <div class="form-group">
      <!--input type="hidden" name="action" id="action" value="" /-->
      <?php 
echo Html::submitButton('Save and Exit', ['class' => 'btn btn-success', 'icon' => 'floppy-disk']);
?>
      <?php 
echo Html::submitButton('Save and Add Another', ['name' => 'then-add', 'class' => 'btn btn-success', 'icon' => 'floppy-disk']);
?>
      <?php 
echo Html::a('Cancel', Url::to(['/student']), ['class' => 'btn btn-primary', 'icon' => 'remove']);
?>
   </div>
</div>
Ejemplo n.º 11
0
 /**
  * @return string
  */
 public static function divisionClassName()
 {
     return Division::className();
 }
Ejemplo n.º 12
0
 public function edit($id)
 {
     if (Auth::user()->can('update-ticket')) {
         $data['ticket'] = self::API()->find(['id' => $id]);
         $temp = DB::table("ticket_links")->where("ticket_id", "=", $id)->get();
         foreach ($temp as $elem) {
             $links[] = $elem->linked_ticket_id;
         }
         $data['ticket']['linked_tickets_id'] = isset($links) ? implode(",", $links) : '';
         $data['companies'] = Company::where('id', '!=', ELETTRIC80_COMPANY_ID)->orderBy('name')->get();
         $data['priorities'] = Priority::orderBy('id', 'desc')->get();
         $data['divisions'] = Division::orderBy('name')->get();
         $data['job_types'] = JobType::orderBy('name')->get();
         $data['levels'] = Level::orderBy('name')->get();
         $data['assignees'] = CompanyPersonController::API()->all(["where" => ["companies.id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['companies'] = CompaniesController::API()->all(['where' => ['companies.id|!=|' . ELETTRIC80_COMPANY_ID], 'order' => ['companies.name|ASC'], 'paginate' => 'false']);
         $data['tags'] = "";
         foreach ($data['ticket']->tags as $tag) {
             $data['tags'] .= $tag->name . ",";
         }
         $is_draft = $data['ticket']->status_id == TICKET_DRAFT_STATUS_ID ? true : false;
         $data['title'] = "Edit Ticket #" . $id;
         return view('tickets/edit', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to tickets edit page']);
     }
 }
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $folderpath = base_path() . '/database/seeds/seed_files/';
     $folders = File::directories($folderpath);
     $latest = '11232015';
     foreach ($folders as $value) {
         $_dir = explode("/", str_replace('\\', '/', $value));
         $cnt = count($_dir);
         $name = $_dir[$cnt - 1];
         $latest_date = DateTime::createFromFormat('mdY', $latest);
         $now = DateTime::createFromFormat('mdY', $name);
         if ($now > $latest_date) {
             $latest = $name;
         }
     }
     $filePath = $folderpath . $latest . '/Masterfile.xlsx';
     $reader = ReaderFactory::create(Type::XLSX);
     // for XLSX files
     $reader->open($filePath);
     // DB::table('divisions')->truncate();
     // DB::table('categories')->truncate();
     // DB::table('sub_categories')->truncate();
     // DB::table('brands')->truncate();
     // DB::table('items')->truncate();
     foreach ($reader->getSheetIterator() as $sheet) {
         if ($sheet->getName() == 'Items') {
             $cnt = 0;
             Item::where('active', 1)->update(['active' => 0, 'cleared' => 0]);
             foreach ($sheet->getRowIterator() as $row) {
                 if ($row[0] != '') {
                     if ($cnt > 0) {
                         $division = Division::firstOrCreate(['division' => strtoupper($row[9])]);
                         $category = Category::firstOrCreate(['category' => strtoupper($row[1]), 'category_long' => strtoupper($row[0])]);
                         $sub_category = SubCategory::firstOrCreate(['category_id' => $category->id, 'sub_category' => strtoupper($row[7])]);
                         $brand = Brand::firstOrCreate(['brand' => strtoupper($row[8])]);
                         $itemExist = Item::where('sku_code', strtoupper($row[2]))->first();
                         if (empty($itemExist)) {
                             $item = Item::firstOrCreate(['sku_code' => trim($row[2]), 'barcode' => $row[3], 'description' => strtoupper($row[4]), 'description_long' => strtoupper($row[5]), 'conversion' => trim($row[6]), 'lpbt' => trim($row[10]), 'division_id' => $division->id, 'category_id' => $category->id, 'sub_category_id' => $sub_category->id, 'brand_id' => $brand->id, 'active' => 1]);
                         } else {
                             $itemExist->sku_code = trim($row[2]);
                             $itemExist->barcode = $row[3];
                             $itemExist->description = strtoupper($row[4]);
                             $itemExist->description_long = strtoupper($row[5]);
                             $itemExist->conversion = trim($row[6]);
                             $itemExist->lpbt = trim($row[10]);
                             $itemExist->division_id = $division->id;
                             $itemExist->category_id = $category->id;
                             $itemExist->sub_category_id = $sub_category->id;
                             $itemExist->brand_id = $brand->id;
                             $itemExist->active = 1;
                             $itemExist->save();
                         }
                     }
                     $cnt++;
                 }
             }
         }
     }
     $reader->close();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::reguard();
 }
Ejemplo n.º 14
0
         <td><?php 
echo $form->field($model, 'fname')->textInput(['maxlength' => 45]);
?>
</td>
         <td><?php 
echo $form->field($model, 'lname')->textInput(['maxlength' => 45]);
?>
</td>
      </tr>
      <tr>
         <td colspan="2"><?php 
echo $form->field($model, 'belt_size')->dropDownList(Student::getGiSizeMap());
?>
</td>
         <td colspan="2"><?php 
echo $form->field($model, 'division_id')->dropDownList(Division::getMap());
?>
</td>
      </tr>
      <tr>
         <td colspan="2"><?php 
echo $form->field($model->affiliation, 'hand_anchor_id')->dropDownList(ArrayHelper::map($model->handAnchors, 'id', 'fullName'));
?>
</td>
         <td colspan="2"><?php 
echo $form->field($model->affiliation, 'weapon_anchor_id')->dropDownList(ArrayHelper::map([null] + $model->weaponAnchors, 'id', 'fullName'));
?>
</td>
      </tr>
      <tr>
         <td colspan="4"><?php 
Ejemplo n.º 15
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['sku_code' => 'required', 'description' => 'required', 'conversion' => 'required|numeric', 'lpbt' => 'required|numeric', 'division' => 'required', 'category' => 'required', 'sub_category' => 'required', 'brand_id' => 'required']);
     $item = Item::findOrFail($id);
     $divname = $request->division;
     $divid = Division::where('division', '=', $divname)->first();
     $divname = $divid->id;
     $catname = $request->category;
     $catid = Category::where('category', '=', $catname)->first();
     $catname = $catid->id;
     $scatname = $request->sub_category;
     $scatid = SubCategory::where('sub_category', '=', $scatname)->first();
     $scatname = $scatid->id;
     $item->sku_code = $request->sku_code;
     $item->description = $request->description;
     $item->conversion = $request->conversion;
     $item->lpbt = $request->lpbt;
     $item->division_id = $divname;
     $item->category_id = $catname;
     $item->sub_category_id = $scatname;
     $item->brand_id = $request->brand_id;
     $item->description_long = $request->description_long;
     $item->barcode = $request->barcode;
     $item->active = $request->status;
     $item->update();
     Session::flash('flash_class', 'alert-success');
     Session::flash('flash_message', 'Item successfully updated.');
     return redirect()->route("item.index");
 }
Ejemplo n.º 16
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDivisions()
 {
     return $this->hasMany(Division::className(), ['id' => 'division_id'])->viaTable('class_division', ['class_id' => 'id']);
 }
 public function edit($id)
 {
     $company_person = CompanyPerson::find($id);
     if (Auth::user()->can('update-contact') || Auth::user()->active_contact->id == $id && Auth::user()->can('update-own-contact') || !$company_person->isE80() && Auth::user()->can('update-customer-contact')) {
         $data['title'] = "Edit Contact";
         $data['titles'] = Title::orderBy("name")->get();
         $data['departments'] = Department::orderBy("name")->get();
         $data['companies'] = Company::orderBy("name")->get();
         $data['contact'] = CompanyPerson::find($id);
         $data['divisions'] = Division::orderBy("name")->get();
         $data['groups'] = Group::where("group_type_id", "=", $company_person->group_type_id)->orderBy("name")->get();
         return view('company_person/edit', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to contacts edit page']);
     }
 }