Skip to content
Snippets Groups Projects
Commit 0e383d8d authored by Balaji M's avatar Balaji M
Browse files

Mobile web app issues

parent 938f6f3b
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@
<script type="text/javascript" src="../../{$TEMPLATE_WEBPATH}/Vtiger/js/Edit.js"></script>
{literal}
<form name="editForm" id="field-edit-form" ng-submit="saveThisRecord()" ng-controller="VtigerEditController">
<form name="editForm" id="field-edit-form" ng-submit="saveThisRecord(editForm)" ng-controller="VtigerEditController">
<header md-page-header fixed-top>
<md-toolbar>
<div class="md-toolbar-tools actionbar">
......@@ -58,7 +58,7 @@
<label ng-if="field.name == 'taskstatus'">Task Status</label>
<label ng-if="field.name == 'eventstatus'">Event Status</label>
<label ng-if="field.name != 'taskstatus' && field.name != 'eventstatus'">{{field.label}}</label>
<md-select ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory">
<md-select name="{{field.name}}" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory">
<md-option ng-value="opt.value" ng-repeat="opt in field.type.picklistValues">{{opt.label}}</md-option>
</md-select>
</div>
......@@ -72,7 +72,7 @@
<label ng-if="field.name == 'taskstatus'">Task Status</label>
<label ng-if="field.name == 'eventstatus'">Event Status</label>
<label ng-if="field.name != 'taskstatus' && field.name != 'eventstatus'">{{field.label}}</label>
<md-select ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory">
<md-select name="{{field.name}}" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory">
<md-option ng-value="opt.value" ng-repeat="opt in field.type.picklistValues">{{opt.label}}</md-option>
</md-select>
</div>
......@@ -84,7 +84,7 @@
<md-input-container ng-switch-when="owner">
<div class="input-group-addon">
<label>{{field.label}}</label>
<md-select ng-model="field.raw" aria-label="{{field.label}}">
<md-select name="{{field.name}}" ng-model="field.raw" aria-label="{{field.label}}">
<md-optgroup label="Users" aria-label="Users">
<md-option ng-value="user_id" ng-repeat="(user_id, user) in field.type.picklistValues.users">{{user}}</md-option>
</md-optgroup>
......@@ -101,7 +101,7 @@
<div ng-switch-when="reference" style="padding-bottom: 16px;">
<div class="input-group-addon">
<label>{{field.label}}</label>
<md-autocomplete flex
<md-autocomplete name="{{field.name}}" flex
ng-model="field.raw"
md-search-text="field.valueLabel"
md-items="item in getMatchedReferenceFields(field.valueLabel, field)"
......@@ -125,7 +125,7 @@
<md-input-container ng-switch-when="multipicklist">
<div class="input-group-addon">
<label>{{field.label}}</label>
<md-chips ng-model="field.valuelabel" md-autocomplete-snap md-require-match>
<md-chips name="{{field.name}}" ng-model="field.valuelabel" md-autocomplete-snap md-require-match>
<md-autocomplete aria-label="{{field.name}}"
md-input-name="field.name"
md-search-text="field.valuelabel"
......@@ -150,7 +150,7 @@
<div layout="row">
<span class="mdi mdi-calendar editIcon"></span>
<div flex="90">
<input type="date" ng-model="field.raw">
<input name="{{field.name}}" type="date" aria-label="Date Field UI" ng-model="field.raw">
</div>
</div>
</div>
......@@ -165,8 +165,8 @@
<div layout="row" class="input-group-addon" flex>
<span class="mdi mdi-clock editIcon"></span>
<div flex="90">
<input mdc-datetime-picker ng-if="userinfo.hour_format == '12'" date="false" time="true" type="text" format="hh:mm a" short-time="true" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory" placeholder="Time">
<input mdc-datetime-picker ng-if="userinfo.hour_format == '24'" date="false" time="true" type="text" format="HH:mm" short-time="false" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory" placeholder="Time">
<input name="{{field.name}}" mdc-datetime-picker ng-if="userinfo.hour_format == '12'" date="false" time="true" type="text" format="hh:mm a" short-time="true" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory" placeholder="Time">
<input name="{{field.name}}" mdc-datetime-picker ng-if="userinfo.hour_format == '24'" date="false" time="true" type="text" format="HH:mm" short-time="false" ng-model="field.raw" aria-label="{{field.label}}" ng-required="field.mandatory" placeholder="Time">
</div>
</div>
</div>
......@@ -176,7 +176,7 @@
</md-input-container>
<!--*************Checkbox /Boolean Box UI *********************-->
<md-input-container ng-switch-when="boolean">
<md-checkbox class="md-primary edit-checkbox" name="{{field.name}}" ng-model="field.raw" aria-label="{{field.name}}" ng-required="field.mandatory">
<md-checkbox name="{{field.name}}" class="md-primary edit-checkbox" name="{{field.name}}" ng-model="field.raw" aria-label="{{field.name}}" ng-required="field.mandatory">
{{field.label}}
</md-checkbox>
<div ng-messages="editForm.{{field.name}}.$error">
......@@ -186,7 +186,7 @@
<!--************* TEXT AREA *********************-->
<md-input-container ng-switch-when="text">
<label>{{field.label}}</label>
<textarea ng-model="field.raw" rows="4" md-select-on-focus></textarea>
<textarea name="{{field.name}}" ng-model="field.raw" rows="4" md-select-on-focus></textarea>
<div ng-messages="editForm.{{field.name}}.$error">
<div ng-show="field.mandatory" ng-message="required"> Mandatory Field.</div>
</div>
......
......@@ -62,7 +62,7 @@ mobileapp.controller('VtigerEditController', function ($scope, $api, $mdToast, $
}
return field;
};
var ignorefields = ['duration_hours','duration_minutes','notime','starred','tags','modifiedby','reminder_time','imagename','taxclass','isconvertedfromlead','donotcall'];
var ignorefields = ['notime','starred','tags','modifiedby','reminder_time','imagename','taxclass','isconvertedfromlead','donotcall'];
//Function to prepare create data.
var prepareCreateData = function(newRecord, record){
......@@ -147,22 +147,6 @@ mobileapp.controller('VtigerEditController', function ($scope, $api, $mdToast, $
value = field.raw;
value = moment.utc(value).format('HH:mm:ss');
break;
case 'reference' :
if(value && field.editable){
value = field.raw;
var webservice_value = value.split('x');
value = webservice_value[1];
}
break;
case 'owner' :
if(value && field.editable){
value = field.raw;
var webservice_value = value.split('x');
value = webservice_value[1];
}
break;
}
if(field.editable){
$scope.editdata[field.name] = value;
......@@ -170,13 +154,26 @@ mobileapp.controller('VtigerEditController', function ($scope, $api, $mdToast, $
}
};
$scope.saveThisRecord = function () {
$scope.isValid = function(form){
if(!form.$valid) {
return false;
}
return true;
};
$scope.saveThisRecord = function (editForm) {
if(!$scope.isValid(editForm)) {
var toast = $mdToast.simple().content('Mandatory Fields Missing').position($scope.getToastPosition()).hideDelay(1000);
$mdToast.show(toast);
return;
}
$scope.processEditData($scope.fieldsData);
$api('saveRecord', {module: $scope.module, record: $scope.record, values: $scope.editdata}, function (e, r) {
if (r) {
//split the ws id to get actual record id to fetch.
var id = r.record.id.split('x')[1];
var toast = $mdToast.simple().content('Record Saved Successfully!').position($scope.getToastPosition()).hideDelay(1000);
$mdToast.show(toast);
window.location.href = "index.php?module="+$scope.module+"&view=Detail&record="+r.id+"&app="+$scope.selectedApp;
window.location.href = "index.php?module="+$scope.module+"&view=Detail&record="+id+"&app="+$scope.selectedApp;
} else {
var toast = $mdToast.simple().content('Some thing went wrong ! \n Save is not Succesfull.').position($scope.getToastPosition()).hideDelay(1000);
$mdToast.show(toast);
......
......@@ -24,13 +24,12 @@ mobileapp.controller('VtigerListController', function ($scope, $api, $mdDialog)
// To fetch Module Filters
$api('fetchModuleFilters', {module: $scope.module}, function (e, r) {
$scope.filters = r.filters;
$scope.moduleLabel = r.moduleLabel;
$scope.loadRecords();
});
// To fetch data from service with the given params
$scope.loadRecords = function () {
$scope.pageTitle = $scope.moduleLabel;
$scope.pageTitle = $scope.module;
$api('listModuleRecords', {module: $scope.module, filterid: $scope.selectedFilter, page: $scope.page, orderBy: $scope.orderBy, sortOrder: $scope.sortOrder}, function (e, r) {
$scope.records = r.records;
$scope.selectedFilter = r.selectedFilter;
......
......@@ -21,6 +21,7 @@ class Mobile_APIV1_Controller {
'fetchRecord' => array('file' => '/api/ws/FetchRecord.php', 'class' => 'Mobile_WS_FetchRecord'),
'fetchRecordWithGrouping' => array('file' => '/api/ws/FetchRecordWithGrouping.php', 'class' => 'Mobile_WS_FetchRecordWithGrouping'),
'fetchRecordsWithGrouping' => array('file' => '/api/ws/FetchRecordsWithGrouping.php', 'class' => 'Mobile_WS_FetchRecordsWithGrouping'),
'fetchReferenceRecords' => array('file' => '/api/ws/FetchReferenceRecords.php', 'class' => 'Mobile_WS_FetchReferenceRecords'),
'describe' => array('file' => '/api/ws/Describe.php', 'class' => 'Mobile_WS_Describe'),
'saveRecord' => array('file' => '/api/ws/SaveRecord.php', 'class' => 'Mobile_WS_SaveRecord'),
'syncModuleRecords' => array('file' => '/api/ws/SyncModuleRecords.php', 'class' => 'Mobile_WS_SyncModuleRecords'),
......
......@@ -44,6 +44,14 @@ class Mobile_WS_Describe extends Mobile_WS_Controller {
$field['type']['picklistValues']['users'] = $users;
$field['type']['picklistValues']['groups'] = $groups;
}
if($fieldModel && $fieldModel->get('name') == 'salutationtype') {
$values = $fieldModel->getPicklistValues();
$picklistValues = array();
foreach($values as $value => $label) {
$picklistValues[] = array('value'=>$value, 'label'=>$label);
}
$field['type']['picklistValues'] = $picklistValues;
}
$newFields[] = $field;
}
$fields=null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment