PHP Classes

File: public/_nuxt/ff38817.js

Recommend this page to a friend!
  Classes of Ahmad Mustapha   PHP Todo List   public/_nuxt/ff38817.js   Download  
File: public/_nuxt/ff38817.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Todo List
Application to manage a list of tasks to do
Author: By
Last change:
Date: 1 year ago
Size: 6,074 bytes
 

Contents

Class file image Download
(window.webpackJsonp=window.webpackJsonp||[]).push([[4,3],{362:function(t,e,n){"use strict";n.r(e);var o={name:"Header",props:["page"]},l=n(115),component=Object(l.a)(o,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("b-navbar",{attrs:{toggleable:"lg",type:"dark",variant:"info"}},[n("b-navbar-brand",{staticClass:"font-weight-bold",attrs:{href:"#"}},[t._v("FAKE TODO")]),t._v(" "),n("b-navbar-toggle",{attrs:{target:"nav-collapse"}}),t._v(" "),n("b-collapse",{attrs:{id:"nav-collapse","is-nav":""}},[n("b-navbar-nav",{staticClass:"ml-auto"},[n("b-nav-item",{staticClass:"font-weight-bold",attrs:{href:"#",id:"btn-sync-todo"}},[n("span",{staticClass:"fa fa-sync-alt"}),t._v(" Sync\n ")])],1)],1)],1)],1)}),[],!1,null,"5a3d4068",null);e.default=component.exports},382:function(t,e,n){"use strict";n.r(e);n(12),n(16),n(206);var o=n(363),l=n.n(o),d=n(27),r=n(160),c=n(381);d.default.use(r.a);var m=d.default.extend({name:"IndexPage",data:function(){return{page:{title:"Homepage"},todos:[],addItemModalVisibility:!1,nameInputState:!1,nameInputValue:"",nameInputError:""}},mounted:function(){document.title="Fake Todo";var t=this,e=function(){return t.fetchTodos((function(e){var n=e.data.data;n.forEach((function(t){t.isDisabled=1===t.status})),t.todos=n,t.$bvToast.toast("Todo contents have been synchronized",{title:"Todo Sync",variant:"success",solid:!0})}),(function(){}))};document.getElementById("btn-sync-todo").addEventListener("click",e),e()},methods:{validateInput:function(){return this.nameInputValue.length<3?(this.nameInputState=!1,this.nameInputError="Name must be at least 3 characters",!1):this.nameInputValue.length>100?(this.nameInputState=!0,this.nameInputError="Name must be less than 100 characters",!1):(this.nameInputState=!0,this.nameInputError="",!0)},fetchTodos:function(t,e){l()({method:"get",url:"http://localhost:8000/api/todos",responseType:"stream"}).then(t).catch(e)},addItem:function(){var t=this;this.validateInput()&&c.ajax({method:"POST",url:"http://localhost:8000/api/todos",data:{userId:1,title:t.nameInputValue},success:function(e){t.todos.push(e.data),t.addItemModalVisibility=!1,t.$bvToast.toast("Todo item added successfully",{title:"Add Todo Item",variant:"success",solid:!0})},error:function(t){if(422===t.status)for(var e in t.responseJSON)t.responseJSON.hasOwnProperty(e)&&(this.nameInputError=t.responseJSON[e][0])}})},removeItem:function(t){var e=this;c.ajax({method:"GET",url:"http://localhost:8000/api/todos/".concat(t.id,"/delete"),success:function(){e.todos.splice(e.todos.indexOf(t),1),e.$bvToast.toast("Todo item deleted successfully",{title:"Delete Todo Item",variant:"success",solid:!0})}})},updateTodoStatus:function(t){var e=this;c.ajax({method:"POST",url:"http://localhost:8000/api/todos/".concat(t.id,"/put"),data:{status:t.isDisabled?1:0},success:function(){e.$bvToast.toast("Todo item status updated successfully",{title:"Update Todo Item",variant:"success",solid:!0})}})}}}),v=n(115),component=Object(v.a)(m,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("Header",{attrs:{page:t.page}}),t._v(" "),n("div",{staticClass:"row d-flex justify-content-center mt-4"},[n("div",{staticClass:"col-md-7"},[n("div",{staticClass:"card"},[n("div",{staticClass:"card-header text-uppercase font-weight-bold d-flex justify-content-between"},[n("span",{staticClass:"mt-2"},[t._v("Todo Application")]),t._v(" "),n("b-button",{directives:[{name:"b-modal",rawName:"v-b-modal.modalPopover",modifiers:{modalPopover:!0}}],staticClass:"font-weight-bold z-depth-0",attrs:{variant:"primary",size:"sm"}},[n("i",{staticClass:"fa fa-plus"}),t._v(" Add\n ")])],1),t._v(" "),n("div",{staticClass:"card-body"},[n("div",{staticClass:"table-responsive table-responsive-md"},[n("table",{staticClass:"table table-bordered table-striped table-hover"},[t._m(0),t._v(" "),n("tbody",t._l(t.todos,(function(e){return n("tr",[n("td",[n("i",{staticClass:"fa fa-file-alt"}),t._v(" "+t._s(e.title)+"\n ")]),t._v(" "),n("td",[n("b-form-checkbox",{attrs:{name:"check-button",switch:""},on:{change:function(n){return t.updateTodoStatus(e)}},model:{value:e.isDisabled,callback:function(n){t.$set(e,"isDisabled",n)},expression:"todo.isDisabled"}},[t._v("\n "+t._s(e.isDisabled?"Completed":"Pending")+"\n ")])],1),t._v(" "),n("td",[n("a",{staticClass:"btn btn-sm text-danger font-weight-bold hover z-depth-0",attrs:{href:"#"},on:{click:function(n){return n.preventDefault(),t.removeItem(e)}}},[n("i",{staticClass:"fa fa-minus"}),t._v(" Remove\n ")])])])})),0)])])])])])]),t._v(" "),n("div",[n("b-modal",{attrs:{id:"modalPopover",title:"Add Item","ok-only":"","hide-footer":""},model:{value:t.addItemModalVisibility,callback:function(e){t.addItemModalVisibility=e},expression:"addItemModalVisibility"}},[n("form",{attrs:{method:"post"},on:{submit:function(e){return e.preventDefault(),t.addItem.apply(null,arguments)}}},[n("b-form-input",{attrs:{placeholder:"Enter your name",state:t.nameInputState,"aria-describedby":"input-live-help input-live-feedback",trim:""},on:{input:t.validateInput},model:{value:t.nameInputValue,callback:function(e){t.nameInputValue=e},expression:"nameInputValue"}}),t._v(" "),n("b-form-invalid-feedback",{attrs:{id:"input-live-feedback"}},[t._v(t._s(t.nameInputError))]),t._v(" "),n("div",{staticClass:"text-right"},[n("button",{staticClass:"btn btn-sm btn-primary font-weight-bold mx-0 z-depth-0",attrs:{type:"submit"}},[t._v("Save\n ")])])],1)])],1)],1)}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("thead",[n("tr",[n("th",{staticClass:"text-uppercase font-weight-bold"},[t._v("Title")]),t._v(" "),n("th",{staticClass:"text-uppercase font-weight-bold"},[t._v("State")]),t._v(" "),n("th",{staticClass:"text-uppercase font-weight-bold"},[t._v("Action")])])])}],!1,null,null,null);e.default=component.exports;installComponents(component,{Header:n(362).default})}}]);