1+ @extends (' layouts.layout' )
2+
3+ @section (' title' )
4+ {{ __ (' Edit Process Category' )} }
5+ @endsection
6+
7+ @section (' sidebar' )
8+ @include (' layouts.sidebar' , [' sidebar' => Menu:: get (' sidebar_processes' )] )
9+ @endsection
10+
11+ @section (' content' )
12+ <div class =" container" id =" editProcessCategory" >
13+ <h1 >{{ __ (' Edit Process Category' )} } </h1 >
14+ <div class =" row" >
15+ <div class =" col-8" >
16+ <div class =" card card-body" >
17+ {!! Form:: open () ! !}
18+ <div class =" form-group" >
19+ {!! Form:: label (' name' , ' Category Name' ) ! !}
20+ {!! Form:: text (' name' , null , [' id' => ' name' ,' class' => ' form-control' , ' v-model' => ' formData.name' ,
21+ ' v-bind:class' => ' {"form-control":true, "is-invalid":errors.name}' ]) ! !}
22+ <small class =" form-text text-muted" >{{ __ (' Category Name must be distinct' ) } } </small >
23+ <div class =" invalid-feedback" v-if =" errors.name" >@ {{errors.name[0]}}</div >
24+ </div >
25+ <div class =" form-group" >
26+ {!! Form:: label (' status' , ' Status' ) ! !}
27+ {!! Form:: select (' status' , [' ACTIVE' => ' Active' , ' INACTIVE' => ' Inactive' ], null , [' id' => ' status' ,
28+ ' class' => ' form-control' , ' v-model' => ' formData.status' , ' v-bind:class' => ' {"form-control":true, "is-invalid":errors.status}' ]) ! !}
29+ <div class =" invalid-feedback" v-if =" errors.status" >@ {{errors.status[0]}}</div >
30+ </div >
31+ <br >
32+ <div class =" text-right" >
33+ {!! Form:: button (' Cancel' , [' class' => ' btn btn-outline-success' , ' @click ' => ' onClose' ]) ! !}
34+ {!! Form:: button (' Update' , [' class' => ' btn btn-success ml-2' , ' @click ' => ' onUpdate' ]) ! !}
35+ </div >
36+ {!! Form:: close () ! !}
37+ </div >
38+ </div >
39+ </div >
40+ </div >
41+ @endsection
42+
43+ @section (' js' )
44+ <script >
45+ new Vue ({
46+ el: ' #editProcessCategory' ,
47+ data () {
48+ return {
49+ formData: @json ($processCategory ),
50+ errors: {
51+ ' name' : null ,
52+ ' status' : null
53+ }
54+ }
55+ },
56+ methods: {
57+ resetErrors () {
58+ this .errors = Object .assign ({}, {
59+ name: null ,
60+ description: null ,
61+ status: null
62+ });
63+ },
64+ onClose () {
65+ window .location .href = ' /processes/categories' ;
66+ },
67+ onUpdate () {
68+ this .resetErrors ();
69+ ProcessMaker .apiClient .put (' process_categories/' + this .formData .id , this .formData )
70+ .then (response => {
71+ ProcessMaker .alert (' Update Process Category Successfully' , ' success' );
72+ this .onClose ();
73+ })
74+ .catch (error => {
75+ if (error .response .status && error .response .status === 422 ) {
76+ this .errors = error .response .data .errors ;
77+ }
78+ });
79+ }
80+ }
81+ });
82+ </script >
83+ @endsection
0 commit comments