public function getEdit($id)
 {
     $data = Checklist::where('id', $id)->firstOrFail();
     $list = Checklist_relasion::with('checklist', 'actifity', 'sub_jenis_dok')->where('checklist_id', $id)->orderBy('actifity_id')->get();
     $name = '';
     $i = 1;
     foreach ($list as $val) {
         if ($name === $val['actifity']['nama_actifity']) {
             $i++;
         } else {
             $i = 1;
         }
         $act[$val['actifity']['nama_actifity']]['rowspan'] = $i;
         $name = $val['actifity']['nama_actifity'];
     }
     return view('checklist.edit', compact('data', 'list', 'act'));
 }
Exemple #2
0
<?php

use app\models\Checklist;
$this->registerJsFile('/web/js/editable-checklist.js', ['depends' => [\app\assets\AppAsset::className()]]);
?>
<div class="block">
    <!-- Checklist Title -->
   	<div class="block-title dropdown">
        <div class="block-options pull-right">
            <button class="btn btn-sm btn-alt btn-default dropdown-toggle" type="button" id="dropdownChecklist" data-toggle="dropdown" aria-expanded="true">
                Choose Checklist
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownChecklist" id="choose-checklists">
            <?php 
$checklists = Checklist::getChecklistBelong($belong_to);
if ($checklists) {
    foreach ($checklists as $key => $checklist) {
        if (!empty($checklist->cschedule)) {
            ?>
                <li role="presentation">
                    <a data-toggle="modal" href="#modal-checklist-add" class="btn-pop-add-checklist" data-checklist-id="<?php 
            echo $checklist->id;
            ?>
"><?php 
            echo $checklist->title;
            ?>
</a>
                </li>

            <?php 
 public function postList(Request $request)
 {
     try {
         $user = $request->session()->get('Auth');
         if ($user != null) {
             $checklist = Checklist::where("user_id", "=", $user->id)->first();
             if ($checklist == null) {
                 $checklist = new Checklist();
                 $checklist->user_id = $user->id;
             }
             $checklist->lists = $request->lists;
             $checklist->save();
         }
         return json_encode(true);
     } catch (Exception $e) {
         return json_encode(false);
     }
 }
 /**
  * Finds the Checklist model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Checklist the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Checklist::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function removeChecklist($cardID, $checklistID)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     $delChecklist = Checklist::where('id', '=', $checklistID);
     $delChecklist->delete();
     $card = Card::with(['checklists', 'memberCard.member', 'comments.memberComment', 'preCard'])->find($cardID);
     return $card;
 }
 /**
  * establish 1-n relationship between this model and checklist model
  * @return [type] [description]
  */
 public function getChecklist()
 {
     return $this->hasOne(Checklist::className(), ['id' => 'checklists_id']);
 }
 public function actionIndex()
 {
     $count = ['clients' => count(Client::find()->all()), 'websites' => count(Website::find()->all()), 'checklists' => count(Checklist::find()->all()), 'messages' => count(Message::find()->all())];
     return $this->render('index', ['count' => $count]);
 }
 public function hardDeleteBoard($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     if (Auth::user()->Level_id == 1) {
         return redirect('/managementAccount');
     }
     $data = Board::find($id);
     if (Auth::user()->id != $data->manager_id) {
         return redirect("/");
     }
     $cards = Card::where('Board_id', '=', $id)->get();
     $ids = [];
     foreach ($cards as $cards) {
         $ids[] = $cards['id'];
     }
     Checklist::whereIn('Card_id', $ids)->delete();
     Comment::whereIn('Card_id', $ids)->delete();
     Card::where('Board_id', '=', $id)->whereNotNull('child_id')->delete();
     Card::where('Board_id', '=', $id)->delete();
     Membermanagement::where('Board_id', '=', $id)->delete();
     $data->delete();
     return redirect('/home');
 }