Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
4
$roleName       = $currentUser->getUserTypeId();
5
 
6
$route   = $this->url('company/i-work-with');
7
 
8
$this->inlineScript()->appendFile($this->basePath('vendors/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
9
$this->inlineScript()->appendFile($this->basePath('vendors/jsrender/jsrender.min.js'));
10
 
11
 
12
$this->inlineScript()->captureStart();
13
echo <<<JS
14
 
15
 
16
jQuery( document ).ready(function( $ ) {
17
 
18
 
19
    $.fn.reload = function(search) {
20
        NProgress.start();
21
        $.ajax({
22
            'dataType'  : 'json',
23
            'accept'    : 'application/json',
24
            'method'    : 'get',
25
            'url'       :  '$route',
26
            'data'      : {
27
                'search'  : search
28
            }
29
        }).done(function(response) {
30
            if(response['success']) {
31
                $('#profiles-container').empty();
32
                if(response['data'].length > 0) {
33
                    $( "#profiles-container" ).html(
34
                		$( "#profileTemplate" ).render( response['data'] )
35
                	);
36
 
37
                } else {
38
                    var html = '<div class="company-title"><div class="widget widget-jobs"><div class="sd-title">ERROR_NO_RECORD_MATCHED_YOUR_QUERY</div></div></div>';
39
                    $( "#profiles-container" ).html(html);
40
                }
41
 
42
 
43
 
44
            } else {
45
                $.fn.showError(response['data']);
46
            }
47
        }).fail(function( jqXHR, textStatus, errorThrown) {
48
            $.fn.showError(textStatus);
49
        }).always(function() {
50
            NProgress.done();
51
        });
52
 
53
    }
54
 
55
    $('#form-company-search #search').keyup(function(e) {
56
        e.preventDefault();
57
 
58
        var search = $('#form-company-search #search').val()
59
        if(search.length > 0)  {
60
            var search = $('#form-company-search #search').val().trim()
61
            if(search.length > 0)  {
62
                $.fn.reload(search);
63
            } else {
64
                $('#form-company-search #search').val('');
65
            }
66
        } else {
67
            $.fn.reload('');
68
        }
69
 
70
    });
71
 
72
     $('body').on('click', 'a.btn-company-cancel', function(e) {
73
        e.preventDefault();
74
 
75
        var action = $(this).data('link')
76
        $(this).confirmation({
77
            rootSelector: 'a.btn-company-cancel',
78
            title : 'LABEL_ARE_YOU_SURE',
79
            singleton : true,
80
            btnOkLabel: 'LABEL_YES',
81
            btnCancelLabel: 'LABEL_NO',
82
            onConfirm: function(value) {
83
                NProgress.start();
84
                $.ajax({
85
                    'dataType'  : 'json',
86
                    'accept'    : 'application/json',
87
                    'method'    : 'post',
88
                    'url'       :  action,
89
                }).done(function(response) {
90
                    if(response['success']) {
91
                        $.fn.showSuccess(response['data']);
92
                        var search = $('#form-company-search #search').val().trim()
93
                        $.fn.reload(search);
94
                     } else {
95
                        $.fn.showError(response['data']);
96
                     }
97
                }).fail(function( jqXHR, textStatus, errorThrown) {
98
                    $.fn.showError(textStatus);
99
                }).always(function() {
100
                    NProgress.done();
101
                });
102
 
103
                return false;
104
 
105
            },
106
        });
107
        $(this).confirmation('show');
108
    });
109
 
110
 
111
    $.fn.reload('');
112
});
113
JS;
114
$this->inlineScript()->captureEnd();
115
?>
116
 
117
<section class="companies-info">
118
	<div class="container">
119
		<div class="company-title">
120
			<div class="section_admin_title_buttons">
121
				<div style="float:left;">
122
					<h1 class="title">LABEL_COMPANIES_I_WORK_WITH</h1>
123
				</div>
124
			</div>
125
		</div>
126
		<div class="company-title">
127
			<div class="section_admin_title_buttons">
128
				<form name="form-company-search" id="form-company-search">
129
					<div class="form-group">
130
						<input type="text" name="search" id="search" class="form-control" value="" placeholder="Buscar" />
131
					</div>
132
				</form>
133
			</div>
134
		</div>
135
 
136
 
137
		<div class="companies-list">
138
			<div class="row" id="profiles-container">
139
			</div><!--product-feed-tab end-->
140
		</div>
141
 
142
	</div>
143
</section>
144
 
145
 
146
<script id="profileTemplate" type="text/x-jsrender">
147
    <div class="col-lg-3 col-md-3 col-sm-6">
148
        <div class="company_profile_info">
149
            <div class="company-up-info">
150
                <img src="{{>image}}" alt="">
151
                <h3>{{>name}}</h3>
152
                {{if link_view}}
153
                <ul>
154
				    <li><a href="{{>link_view}}" title="" class="message-us">LABEL_VIEW_COMPANY</a></li>
155
 
156
		        </ul>
157
                {{/if}}
158
                {{if link_my_company}}
159
                <a href="{{>link_my_company}}" title="" class="view-more-pro">Administrar</a>
160
                {{/if}}
161
            </div>
162
        </div>
163
    </div>
164
</script>